From a63aec6c46141b65b7ea269ff00717c73d6cca5e Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 02:40:43 +0800 Subject: [PATCH] Sync with CPython 3.13 (#990) --- c-api/allocation.po | 30 +- c-api/arg.po | 2 +- c-api/init.po | 710 +++++------ c-api/init_config.po | 14 +- c-api/long.po | 4 +- c-api/monitoring.po | 8 +- c-api/typeobj.po | 892 +++++++------- deprecations/c-api-pending-removal-in-3.15.po | 18 +- deprecations/index.po | 223 ++-- deprecations/pending-removal-in-3.14.po | 103 +- deprecations/pending-removal-in-3.15.po | 26 +- deprecations/pending-removal-in-3.16.po | 70 +- glossary.po | 744 ++++++------ howto/enum.po | 4 +- howto/free-threading-python.po | 6 +- howto/functional.po | 6 +- howto/logging-cookbook.po | 609 +++++----- howto/regex.po | 4 +- howto/sockets.po | 2 +- howto/timerfd.po | 4 +- library/argparse.po | 1033 ++++++----------- library/builtins.po | 50 +- library/cmath.po | 85 +- library/codecs.po | 7 +- library/concurrent.futures.po | 4 +- library/configparser.po | 231 ++-- library/contextvars.po | 124 +- library/ctypes.po | 458 ++++---- library/dis.po | 8 +- library/email.message.po | 2 +- library/enum.po | 4 +- library/functions.po | 680 +++++------ library/getopt.po | 100 +- library/glob.po | 11 +- library/importlib.metadata.po | 15 +- library/ipaddress.po | 8 +- library/locale.po | 176 +-- library/math.po | 841 +++++++++++--- library/os.po | 376 +++--- library/pathlib.po | 138 +-- library/pydoc.po | 32 +- library/re.po | 2 +- library/selectors.po | 2 +- library/sqlite3.po | 110 +- library/stdtypes.po | 33 +- library/string.po | 321 ++--- library/time.po | 319 ++--- library/warnings.po | 168 +-- license.po | 88 +- reference/datamodel.po | 845 +++++++------- reference/expressions.po | 4 +- tutorial/controlflow.po | 385 +++--- tutorial/datastructures.po | 20 +- tutorial/errors.po | 18 +- tutorial/inputoutput.po | 208 ++-- using/configure.po | 4 +- using/ios.po | 9 +- using/mac.po | 2 +- using/unix.po | 18 +- using/windows.po | 8 +- whatsnew/2.2.po | 96 +- whatsnew/3.12.po | 329 ++---- whatsnew/3.13.po | 234 ++-- 63 files changed, 5868 insertions(+), 5217 deletions(-) diff --git a/c-api/allocation.po b/c-api/allocation.po index c4605012ef..2d4ce8e20a 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -10,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-08-09 00:03+0000\n" +"POT-Creation-Date: 2024-11-06 00:13+0000\n" "PO-Revision-Date: 2022-10-16 15:35+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,16 +28,13 @@ msgstr "在 heap 上分配物件" #: ../../c-api/allocation.rst:17 msgid "" "Initialize a newly allocated object *op* with its type and initial " -"reference. Returns the initialized object. If *type* indicates that the " -"object participates in the cyclic garbage detector, it is added to the " -"detector's set of observed objects. Other fields of the object are not " -"affected." +"reference. Returns the initialized object. Other fields of the object are " +"not affected." msgstr "" -"用它的型別和初始參照來初始化新分配物件 *op*。已初始化的物件會被回傳。如果 " -"*type* 表示了該物件參與迴圈垃圾檢查器,則將其新增到檢查器的觀察物件集合中。物" -"件的其他欄位不受影響。" +"用它的型別和初始參照來初始化新分配物件 *op*。已初始化的物件會被回傳。物件的其" +"他欄位不受影響。" -#: ../../c-api/allocation.rst:26 +#: ../../c-api/allocation.rst:24 msgid "" "This does everything :c:func:`PyObject_Init` does, and also initializes the " "length information for a variable-size object." @@ -46,7 +42,7 @@ msgstr "" "它會做到 :c:func:`PyObject_Init` 的所有功能,並且會初始化一個大小可變物件的長" "度資訊。" -#: ../../c-api/allocation.rst:32 +#: ../../c-api/allocation.rst:30 msgid "" "Allocate a new Python object using the C structure type *TYPE* and the " "Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the " @@ -60,7 +56,7 @@ msgstr "" "化;呼叫者會擁有那個對於物件的唯一參照(物件的參照計數為一)。記憶體分配大小" "由 type 物件的 :c:member:`~PyTypeObject.tp_basicsize` 欄位來指定。" -#: ../../c-api/allocation.rst:43 +#: ../../c-api/allocation.rst:41 msgid "" "Allocate a new Python object using the C structure type *TYPE* and the " "Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the " @@ -79,7 +75,7 @@ msgstr "" "於實現如 tuple 這種能夠在建立期間決定自己大小的物件是很實用的。將欄位的陣列嵌" "入到相同的記憶體分配中可以減少記憶體分配的次數,這提高了記憶體管理的效率。" -#: ../../c-api/allocation.rst:57 +#: ../../c-api/allocation.rst:55 msgid "" "Releases memory allocated to an object using :c:macro:`PyObject_New` or :c:" "macro:`PyObject_NewVar`. This is normally called from the :c:member:" @@ -92,7 +88,7 @@ msgstr "" "handler 中呼叫。呼叫這個函式以後,物件的各欄位都不可以被存取,因為原本分配的" "記憶體已不再是一個有效的 Python 物件。" -#: ../../c-api/allocation.rst:66 +#: ../../c-api/allocation.rst:64 msgid "" "Object which is visible in Python as ``None``. This should only be accessed " "using the :c:macro:`Py_None` macro, which evaluates to a pointer to this " @@ -101,10 +97,10 @@ msgstr "" "這個物件像是 Python 中的 ``None``。它只應該透過 :c:macro:`Py_None` 巨集來存" "取,該巨集的拿到指向該物件的指標。" -#: ../../c-api/allocation.rst:73 +#: ../../c-api/allocation.rst:71 msgid ":c:func:`PyModule_Create`" msgstr ":c:func:`PyModule_Create`" -#: ../../c-api/allocation.rst:74 +#: ../../c-api/allocation.rst:72 msgid "To allocate and create extension modules." msgstr "分配記憶體和建立擴充模組。" diff --git a/c-api/arg.po b/c-api/arg.po index f62175c411..6e8339452f 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -820,7 +820,7 @@ msgstr "" #: ../../c-api/arg.rst:465 msgid "Example::" -msgstr "" +msgstr "舉例來說: ::" #: ../../c-api/arg.rst:467 msgid "" diff --git a/c-api/init.po b/c-api/init.po index 4dbcd74843..1577394625 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -839,8 +839,8 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:587 ../../c-api/init.rst:826 ../../c-api/init.rst:862 -#: ../../c-api/init.rst:888 +#: ../../c-api/init.rst:587 ../../c-api/init.rst:829 ../../c-api/init.rst:865 +#: ../../c-api/init.rst:891 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" "`wchar_*` string." @@ -853,19 +853,19 @@ msgid "" "not modify its value." msgstr "" -#: ../../c-api/init.rst:599 ../../c-api/init.rst:621 ../../c-api/init.rst:665 -#: ../../c-api/init.rst:686 ../../c-api/init.rst:712 ../../c-api/init.rst:900 +#: ../../c-api/init.rst:599 ../../c-api/init.rst:621 ../../c-api/init.rst:667 +#: ../../c-api/init.rst:689 ../../c-api/init.rst:715 ../../c-api/init.rst:903 msgid "" "This function should not be called before :c:func:`Py_Initialize`, otherwise " "it returns ``NULL``." msgstr "此函式不應該在 :c:func:`Py_Initialize` 之前呼叫,否則會回傳 ``NULL``。" -#: ../../c-api/init.rst:602 ../../c-api/init.rst:624 ../../c-api/init.rst:668 -#: ../../c-api/init.rst:689 ../../c-api/init.rst:717 ../../c-api/init.rst:903 +#: ../../c-api/init.rst:602 ../../c-api/init.rst:624 ../../c-api/init.rst:670 +#: ../../c-api/init.rst:692 ../../c-api/init.rst:720 ../../c-api/init.rst:906 msgid "It now returns ``NULL`` if called before :c:func:`Py_Initialize`." msgstr "如果在 :c:func:`Py_Initialize` 之前呼叫,現在會回傳 ``NULL``。" -#: ../../c-api/init.rst:605 ../../c-api/init.rst:692 +#: ../../c-api/init.rst:605 ../../c-api/init.rst:695 msgid "Get :data:`sys.executable` instead." msgstr "" @@ -879,15 +879,17 @@ msgid "" "should not modify its value. This corresponds to the :makevar:`prefix` " "variable in the top-level :file:`Makefile` and the :option:`--prefix` " "argument to the :program:`configure` script at build time. The value is " -"available to Python code as ``sys.prefix``. It is only useful on Unix. See " -"also the next function." +"available to Python code as ``sys.base_prefix``. It is only useful on Unix. " +"See also the next function." msgstr "" #: ../../c-api/init.rst:627 -msgid "Get :data:`sys.prefix` instead." +msgid "" +"Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if :ref:`virtual " +"environments ` need to be handled." msgstr "" -#: ../../c-api/init.rst:633 +#: ../../c-api/init.rst:634 msgid "" "Return the *exec-prefix* for installed platform-*dependent* files. This is " "derived through a number of complicated rules from the program name set " @@ -897,11 +899,11 @@ msgid "" "caller should not modify its value. This corresponds to the :makevar:" "`exec_prefix` variable in the top-level :file:`Makefile` and the ``--exec-" "prefix`` argument to the :program:`configure` script at build time. The " -"value is available to Python code as ``sys.exec_prefix``. It is only useful " -"on Unix." +"value is available to Python code as ``sys.base_exec_prefix``. It is only " +"useful on Unix." msgstr "" -#: ../../c-api/init.rst:643 +#: ../../c-api/init.rst:645 msgid "" "Background: The exec-prefix differs from the prefix when platform dependent " "files (such as executables and shared libraries) are installed in a " @@ -910,7 +912,7 @@ msgid "" "independent may be installed in :file:`/usr/local`." msgstr "" -#: ../../c-api/init.rst:649 +#: ../../c-api/init.rst:651 msgid "" "Generally speaking, a platform is a combination of hardware and software " "families, e.g. Sparc machines running the Solaris 2.x operating system are " @@ -924,7 +926,7 @@ msgid "" "independent from the Python version by which they were compiled!)." msgstr "" -#: ../../c-api/init.rst:660 +#: ../../c-api/init.rst:662 msgid "" "System administrators will know how to configure the :program:`mount` or :" "program:`automount` programs to share :file:`/usr/local` between platforms " @@ -932,11 +934,13 @@ msgid "" "platform." msgstr "" -#: ../../c-api/init.rst:671 -msgid "Get :data:`sys.exec_prefix` instead." +#: ../../c-api/init.rst:673 +msgid "" +"Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if :ref:" +"`virtual environments ` need to be handled." msgstr "" -#: ../../c-api/init.rst:680 +#: ../../c-api/init.rst:683 msgid "" "Return the full program name of the Python executable; this is computed as " "a side-effect of deriving the default module search path from the program " @@ -945,7 +949,7 @@ msgid "" "available to Python code as ``sys.executable``." msgstr "" -#: ../../c-api/init.rst:702 +#: ../../c-api/init.rst:705 msgid "" "Return the default module search path; this is computed from the program " "name (set by :c:member:`PyConfig.program_name`) and some environment " @@ -958,21 +962,21 @@ msgid "" "for loading modules." msgstr "" -#: ../../c-api/init.rst:720 +#: ../../c-api/init.rst:723 msgid "Get :data:`sys.path` instead." msgstr "" -#: ../../c-api/init.rst:726 +#: ../../c-api/init.rst:729 msgid "" "Return the version of this Python interpreter. This is a string that looks " "something like ::" msgstr "" -#: ../../c-api/init.rst:729 +#: ../../c-api/init.rst:732 msgid "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" msgstr "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" -#: ../../c-api/init.rst:733 +#: ../../c-api/init.rst:736 msgid "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " @@ -981,11 +985,11 @@ msgid "" "version`." msgstr "" -#: ../../c-api/init.rst:738 +#: ../../c-api/init.rst:741 msgid "See also the :c:var:`Py_Version` constant." msgstr "" -#: ../../c-api/init.rst:745 +#: ../../c-api/init.rst:748 msgid "" "Return the platform identifier for the current platform. On Unix, this is " "formed from the \"official\" name of the operating system, converted to " @@ -996,50 +1000,50 @@ msgid "" "available to Python code as ``sys.platform``." msgstr "" -#: ../../c-api/init.rst:756 +#: ../../c-api/init.rst:759 msgid "" "Return the official copyright string for the current Python version, for " "example" msgstr "" -#: ../../c-api/init.rst:758 +#: ../../c-api/init.rst:761 msgid "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" msgstr "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" -#: ../../c-api/init.rst:762 +#: ../../c-api/init.rst:765 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as ``sys.copyright``." msgstr "" -#: ../../c-api/init.rst:768 +#: ../../c-api/init.rst:771 msgid "" "Return an indication of the compiler used to build the current Python " "version, in square brackets, for example::" msgstr "" -#: ../../c-api/init.rst:771 +#: ../../c-api/init.rst:774 msgid "\"[GCC 2.7.2.2]\"" msgstr "\"[GCC 2.7.2.2]\"" -#: ../../c-api/init.rst:775 ../../c-api/init.rst:789 +#: ../../c-api/init.rst:778 ../../c-api/init.rst:792 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as part of the variable " "``sys.version``." msgstr "" -#: ../../c-api/init.rst:782 +#: ../../c-api/init.rst:785 msgid "" "Return information about the sequence number and build date and time of the " "current Python interpreter instance, for example ::" msgstr "" -#: ../../c-api/init.rst:785 +#: ../../c-api/init.rst:788 msgid "\"#67, Aug 1 1997, 22:34:28\"" msgstr "\"#67, Aug 1 1997, 22:34:28\"" -#: ../../c-api/init.rst:801 +#: ../../c-api/init.rst:804 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " @@ -1047,7 +1051,7 @@ msgid "" "config>`." msgstr "" -#: ../../c-api/init.rst:806 +#: ../../c-api/init.rst:809 msgid "" "Set :data:`sys.argv` based on *argc* and *argv*. These parameters are " "similar to those passed to the program's :c:func:`main` function with the " @@ -1058,84 +1062,84 @@ msgid "" "fatal condition is signalled using :c:func:`Py_FatalError`." msgstr "" -#: ../../c-api/init.rst:814 +#: ../../c-api/init.rst:817 msgid "" "If *updatepath* is zero, this is all the function does. If *updatepath* is " "non-zero, the function also modifies :data:`sys.path` according to the " "following algorithm:" msgstr "" -#: ../../c-api/init.rst:818 +#: ../../c-api/init.rst:821 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " "path of the directory where the script is located is prepended to :data:`sys." "path`." msgstr "" -#: ../../c-api/init.rst:821 +#: ../../c-api/init.rst:824 msgid "" "Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point to an " "existing file name), an empty string is prepended to :data:`sys.path`, which " "is the same as prepending the current working directory (``\".\"``)." msgstr "" -#: ../../c-api/init.rst:829 ../../c-api/init.rst:865 +#: ../../c-api/init.rst:832 ../../c-api/init.rst:868 msgid "" "See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` " "members of the :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:833 +#: ../../c-api/init.rst:836 msgid "" "It is recommended that applications embedding the Python interpreter for " "purposes other than executing a single script pass ``0`` as *updatepath*, " "and update :data:`sys.path` themselves if desired. See :cve:`2008-5983`." msgstr "" -#: ../../c-api/init.rst:838 +#: ../../c-api/init.rst:841 msgid "" "On versions before 3.1.3, you can achieve the same effect by manually " "popping the first :data:`sys.path` element after having called :c:func:" "`PySys_SetArgv`, for example using::" msgstr "" -#: ../../c-api/init.rst:842 +#: ../../c-api/init.rst:845 msgid "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" msgstr "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" -#: ../../c-api/init.rst:854 +#: ../../c-api/init.rst:857 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" "`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:858 +#: ../../c-api/init.rst:861 msgid "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " "``1`` unless the :program:`python` interpreter was started with the :option:" "`-I`." msgstr "" -#: ../../c-api/init.rst:868 +#: ../../c-api/init.rst:871 msgid "The *updatepath* value depends on :option:`-I`." msgstr "" -#: ../../c-api/init.rst:875 +#: ../../c-api/init.rst:878 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "home` should be used instead, see :ref:`Python Initialization Configuration " "`." msgstr "" -#: ../../c-api/init.rst:879 +#: ../../c-api/init.rst:882 msgid "" "Set the default \"home\" directory, that is, the location of the standard " "Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument " "string." msgstr "" -#: ../../c-api/init.rst:883 +#: ../../c-api/init.rst:886 msgid "" "The argument should point to a zero-terminated character string in static " "storage whose contents will not change for the duration of the program's " @@ -1143,24 +1147,24 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:896 +#: ../../c-api/init.rst:899 msgid "" "Return the default \"home\", that is, the value set by :c:member:`PyConfig." "home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " "is set." msgstr "" -#: ../../c-api/init.rst:906 +#: ../../c-api/init.rst:909 msgid "" "Get :c:member:`PyConfig.home` or :envvar:`PYTHONHOME` environment variable " "instead." msgstr "改為取得 :c:member:`PyConfig.home` 或 :envvar:`PYTHONHOME` 環境變數。" -#: ../../c-api/init.rst:914 +#: ../../c-api/init.rst:917 msgid "Thread State and the Global Interpreter Lock" msgstr "" -#: ../../c-api/init.rst:921 +#: ../../c-api/init.rst:924 msgid "" "The Python interpreter is not fully thread-safe. In order to support multi-" "threaded Python programs, there's a global lock, called the :term:`global " @@ -1172,7 +1176,7 @@ msgid "" "once instead of twice." msgstr "" -#: ../../c-api/init.rst:931 +#: ../../c-api/init.rst:934 msgid "" "Therefore, the rule exists that only the thread that has acquired the :term:" "`GIL` may operate on Python objects or call Python/C API functions. In order " @@ -1182,7 +1186,7 @@ msgid "" "a file, so that other Python threads can run in the meantime." msgstr "" -#: ../../c-api/init.rst:941 +#: ../../c-api/init.rst:944 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " "inside a data structure called :c:type:`PyThreadState`. There's also one " @@ -1190,17 +1194,17 @@ msgid "" "retrieved using :c:func:`PyThreadState_Get`." msgstr "" -#: ../../c-api/init.rst:947 +#: ../../c-api/init.rst:950 msgid "Releasing the GIL from extension code" msgstr "" -#: ../../c-api/init.rst:949 +#: ../../c-api/init.rst:952 msgid "" "Most extension code manipulating the :term:`GIL` has the following simple " "structure::" msgstr "" -#: ../../c-api/init.rst:952 +#: ../../c-api/init.rst:955 msgid "" "Save the thread state in a local variable.\n" "Release the global interpreter lock.\n" @@ -1209,29 +1213,29 @@ msgid "" "Restore the thread state from the local variable." msgstr "" -#: ../../c-api/init.rst:958 +#: ../../c-api/init.rst:961 msgid "This is so common that a pair of macros exists to simplify it::" msgstr "" -#: ../../c-api/init.rst:960 +#: ../../c-api/init.rst:963 msgid "" "Py_BEGIN_ALLOW_THREADS\n" "... Do some blocking I/O operation ...\n" "Py_END_ALLOW_THREADS" msgstr "" -#: ../../c-api/init.rst:968 +#: ../../c-api/init.rst:971 msgid "" "The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a " "hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the " "block." msgstr "" -#: ../../c-api/init.rst:972 +#: ../../c-api/init.rst:975 msgid "The block above expands to the following code::" msgstr "" -#: ../../c-api/init.rst:974 +#: ../../c-api/init.rst:977 msgid "" "PyThreadState *_save;\n" "\n" @@ -1240,7 +1244,7 @@ msgid "" "PyEval_RestoreThread(_save);" msgstr "" -#: ../../c-api/init.rst:984 +#: ../../c-api/init.rst:987 msgid "" "Here is how these functions work: the global interpreter lock is used to " "protect the pointer to the current thread state. When releasing the lock " @@ -1251,7 +1255,7 @@ msgid "" "state, the lock must be acquired before storing the thread state pointer." msgstr "" -#: ../../c-api/init.rst:993 +#: ../../c-api/init.rst:996 msgid "" "Calling system I/O functions is the most common use case for releasing the " "GIL, but it can also be useful before calling long-running computations " @@ -1261,11 +1265,11 @@ msgid "" "compressing or hashing data." msgstr "" -#: ../../c-api/init.rst:1004 +#: ../../c-api/init.rst:1007 msgid "Non-Python created threads" msgstr "" -#: ../../c-api/init.rst:1006 +#: ../../c-api/init.rst:1009 msgid "" "When threads are created using the dedicated Python APIs (such as the :mod:" "`threading` module), a thread state is automatically associated to them and " @@ -1275,7 +1279,7 @@ msgid "" "for them." msgstr "" -#: ../../c-api/init.rst:1013 +#: ../../c-api/init.rst:1016 msgid "" "If you need to call Python code from these threads (often this will be part " "of a callback API provided by the aforementioned third-party library), you " @@ -1286,14 +1290,14 @@ msgid "" "finally free the thread state data structure." msgstr "" -#: ../../c-api/init.rst:1021 +#: ../../c-api/init.rst:1024 msgid "" "The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions " "do all of the above automatically. The typical idiom for calling into " "Python from a C thread is::" msgstr "" -#: ../../c-api/init.rst:1025 +#: ../../c-api/init.rst:1028 msgid "" "PyGILState_STATE gstate;\n" "gstate = PyGILState_Ensure();\n" @@ -1306,7 +1310,7 @@ msgid "" "PyGILState_Release(gstate);" msgstr "" -#: ../../c-api/init.rst:1035 +#: ../../c-api/init.rst:1038 msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " @@ -1315,11 +1319,11 @@ msgid "" "``PyGILState_*`` API is unsupported." msgstr "" -#: ../../c-api/init.rst:1045 +#: ../../c-api/init.rst:1048 msgid "Cautions about fork()" msgstr "" -#: ../../c-api/init.rst:1047 +#: ../../c-api/init.rst:1050 msgid "" "Another important thing to note about threads is their behaviour in the face " "of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a " @@ -1328,7 +1332,7 @@ msgid "" "CPython's runtime." msgstr "" -#: ../../c-api/init.rst:1053 +#: ../../c-api/init.rst:1056 msgid "" "The fact that only the \"current\" thread remains means any locks held by " "other threads will never be released. Python solves this for :func:`os.fork` " @@ -1345,7 +1349,7 @@ msgid "" "locks, but is not always able to." msgstr "" -#: ../../c-api/init.rst:1068 +#: ../../c-api/init.rst:1071 msgid "" "The fact that all other threads go away also means that CPython's runtime " "state there must be cleaned up properly, which :func:`os.fork` does. This " @@ -1358,17 +1362,17 @@ msgid "" "called immediately after." msgstr "" -#: ../../c-api/init.rst:1081 +#: ../../c-api/init.rst:1084 msgid "High-level API" msgstr "高階 API" -#: ../../c-api/init.rst:1083 +#: ../../c-api/init.rst:1086 msgid "" "These are the most commonly used types and functions when writing C " "extension code, or when embedding the Python interpreter:" msgstr "" -#: ../../c-api/init.rst:1088 +#: ../../c-api/init.rst:1091 msgid "" "This data structure represents the state shared by a number of cooperating " "threads. Threads belonging to the same interpreter share their module " @@ -1376,7 +1380,7 @@ msgid "" "in this structure." msgstr "" -#: ../../c-api/init.rst:1093 +#: ../../c-api/init.rst:1096 msgid "" "Threads belonging to different interpreters initially share nothing, except " "process state like available memory, open file descriptors and such. The " @@ -1384,41 +1388,41 @@ msgid "" "which interpreter they belong." msgstr "" -#: ../../c-api/init.rst:1101 +#: ../../c-api/init.rst:1104 msgid "" "This data structure represents the state of a single thread. The only " "public data member is:" msgstr "" -#: ../../c-api/init.rst:1106 +#: ../../c-api/init.rst:1109 msgid "This thread's interpreter state." msgstr "" -#: ../../c-api/init.rst:1117 +#: ../../c-api/init.rst:1120 msgid "Deprecated function which does nothing." msgstr "" -#: ../../c-api/init.rst:1119 +#: ../../c-api/init.rst:1122 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" -#: ../../c-api/init.rst:1121 +#: ../../c-api/init.rst:1124 msgid "The function now does nothing." msgstr "此函式現在不會做任何事情。" -#: ../../c-api/init.rst:1124 +#: ../../c-api/init.rst:1127 msgid "" "This function is now called by :c:func:`Py_Initialize()`, so you don't have " "to call it yourself anymore." msgstr "" -#: ../../c-api/init.rst:1128 +#: ../../c-api/init.rst:1131 msgid "" "This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -#: ../../c-api/init.rst:1138 +#: ../../c-api/init.rst:1141 msgid "" "Release the global interpreter lock (if it has been created) and reset the " "thread state to ``NULL``, returning the previous thread state (which is not " @@ -1426,7 +1430,7 @@ msgid "" "acquired it." msgstr "" -#: ../../c-api/init.rst:1146 +#: ../../c-api/init.rst:1149 msgid "" "Acquire the global interpreter lock (if it has been created) and set the " "thread state to *tstate*, which must not be ``NULL``. If the lock has been " @@ -1434,8 +1438,8 @@ msgid "" "ensues." msgstr "" -#: ../../c-api/init.rst:1152 ../../c-api/init.rst:1211 -#: ../../c-api/init.rst:1493 +#: ../../c-api/init.rst:1155 ../../c-api/init.rst:1214 +#: ../../c-api/init.rst:1496 msgid "" "Calling this function from a thread when the runtime is finalizing will " "terminate the thread, even if the thread was not created by Python. You can " @@ -1444,44 +1448,44 @@ msgid "" "avoid unwanted termination." msgstr "" -#: ../../c-api/init.rst:1160 +#: ../../c-api/init.rst:1163 msgid "" "Return the current thread state. The global interpreter lock must be held. " "When the current thread state is ``NULL``, this issues a fatal error (so " "that the caller needn't check for ``NULL``)." msgstr "" -#: ../../c-api/init.rst:1164 +#: ../../c-api/init.rst:1167 msgid "See also :c:func:`PyThreadState_GetUnchecked`." msgstr "也請見 :c:func:`PyThreadState_GetUnchecked`。" -#: ../../c-api/init.rst:1169 +#: ../../c-api/init.rst:1172 msgid "" "Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a " "fatal error if it is NULL. The caller is responsible to check if the result " "is NULL." msgstr "" -#: ../../c-api/init.rst:1173 +#: ../../c-api/init.rst:1176 msgid "" "In Python 3.5 to 3.12, the function was private and known as " "``_PyThreadState_UncheckedGet()``." msgstr "" -#: ../../c-api/init.rst:1180 +#: ../../c-api/init.rst:1183 msgid "" "Swap the current thread state with the thread state given by the argument " "*tstate*, which may be ``NULL``. The global interpreter lock must be held " "and is not released." msgstr "" -#: ../../c-api/init.rst:1185 +#: ../../c-api/init.rst:1188 msgid "" "The following functions use thread-local storage, and are not compatible " "with sub-interpreters:" msgstr "" -#: ../../c-api/init.rst:1190 +#: ../../c-api/init.rst:1193 msgid "" "Ensure that the current thread is ready to call the Python C API regardless " "of the current state of Python, or of the global interpreter lock. This may " @@ -1494,7 +1498,7 @@ msgid "" "is acceptable." msgstr "" -#: ../../c-api/init.rst:1200 +#: ../../c-api/init.rst:1203 msgid "" "The return value is an opaque \"handle\" to the thread state when :c:func:" "`PyGILState_Ensure` was called, and must be passed to :c:func:" @@ -1504,13 +1508,13 @@ msgid "" "func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1207 +#: ../../c-api/init.rst:1210 msgid "" "When the function returns, the current thread will hold the GIL and be able " "to call arbitrary Python code. Failure is a fatal error." msgstr "" -#: ../../c-api/init.rst:1219 +#: ../../c-api/init.rst:1222 msgid "" "Release any resources previously acquired. After this call, Python's state " "will be the same as it was prior to the corresponding :c:func:" @@ -1518,13 +1522,13 @@ msgid "" "caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:1224 +#: ../../c-api/init.rst:1227 msgid "" "Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" "func:`PyGILState_Release` on the same thread." msgstr "" -#: ../../c-api/init.rst:1230 +#: ../../c-api/init.rst:1233 msgid "" "Get the current thread state for this thread. May return ``NULL`` if no " "GILState API has been used on the current thread. Note that the main thread " @@ -1532,7 +1536,7 @@ msgid "" "made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1238 +#: ../../c-api/init.rst:1241 msgid "" "Return ``1`` if the current thread is holding the GIL and ``0`` otherwise. " "This function can be called from any thread at any time. Only if it has had " @@ -1543,13 +1547,13 @@ msgid "" "otherwise behave differently." msgstr "" -#: ../../c-api/init.rst:1250 +#: ../../c-api/init.rst:1253 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: ../../c-api/init.rst:1256 +#: ../../c-api/init.rst:1259 msgid "" "This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" "``. Note that it contains an opening brace; it must be matched with a " @@ -1557,7 +1561,7 @@ msgid "" "discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1264 +#: ../../c-api/init.rst:1267 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " "contains a closing brace; it must be matched with an earlier :c:macro:" @@ -1565,40 +1569,40 @@ msgid "" "macro." msgstr "" -#: ../../c-api/init.rst:1272 +#: ../../c-api/init.rst:1275 msgid "" "This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" "c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: ../../c-api/init.rst:1278 +#: ../../c-api/init.rst:1281 msgid "" "This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" "c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: ../../c-api/init.rst:1284 +#: ../../c-api/init.rst:1287 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1286 +#: ../../c-api/init.rst:1289 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1288 +#: ../../c-api/init.rst:1291 msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:1294 +#: ../../c-api/init.rst:1297 msgid "" "Create a new interpreter state object. The global interpreter lock need not " "be held, but may be held if it is necessary to serialize calls to this " "function." msgstr "" -#: ../../c-api/init.rst:1298 +#: ../../c-api/init.rst:1301 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_New`` with no arguments." @@ -1606,13 +1610,13 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_New``。" -#: ../../c-api/init.rst:1303 +#: ../../c-api/init.rst:1306 msgid "" "Reset all information in an interpreter state object. The global " "interpreter lock must be held." msgstr "" -#: ../../c-api/init.rst:1306 +#: ../../c-api/init.rst:1309 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_Clear`` with no arguments." @@ -1620,40 +1624,40 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1311 +#: ../../c-api/init.rst:1314 msgid "" "Destroy an interpreter state object. The global interpreter lock need not " "be held. The interpreter state must have been reset with a previous call " "to :c:func:`PyInterpreterState_Clear`." msgstr "" -#: ../../c-api/init.rst:1318 +#: ../../c-api/init.rst:1321 msgid "" "Create a new thread state object belonging to the given interpreter object. " "The global interpreter lock need not be held, but may be held if it is " "necessary to serialize calls to this function." msgstr "" -#: ../../c-api/init.rst:1325 +#: ../../c-api/init.rst:1328 msgid "" "Reset all information in a thread state object. The global interpreter lock " "must be held." msgstr "" -#: ../../c-api/init.rst:1328 +#: ../../c-api/init.rst:1331 msgid "" "This function now calls the :c:member:`PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1335 +#: ../../c-api/init.rst:1338 msgid "" "Destroy a thread state object. The global interpreter lock need not be " "held. The thread state must have been reset with a previous call to :c:func:" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1342 +#: ../../c-api/init.rst:1345 msgid "" "Destroy the current thread state and release the global interpreter lock. " "Like :c:func:`PyThreadState_Delete`, the global interpreter lock must be " @@ -1661,119 +1665,119 @@ msgid "" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1350 +#: ../../c-api/init.rst:1353 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1352 +#: ../../c-api/init.rst:1355 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1355 +#: ../../c-api/init.rst:1358 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1357 ../../c-api/init.rst:1366 -#: ../../c-api/init.rst:1375 +#: ../../c-api/init.rst:1360 ../../c-api/init.rst:1369 +#: ../../c-api/init.rst:1378 msgid "*tstate* must not be ``NULL``." msgstr "*tstate* 不可為 ``NULL``。" -#: ../../c-api/init.rst:1364 +#: ../../c-api/init.rst:1367 msgid "" "Get the unique thread state identifier of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1373 +#: ../../c-api/init.rst:1376 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1382 +#: ../../c-api/init.rst:1385 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1384 +#: ../../c-api/init.rst:1387 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1391 +#: ../../c-api/init.rst:1394 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1394 +#: ../../c-api/init.rst:1397 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1402 +#: ../../c-api/init.rst:1405 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1404 +#: ../../c-api/init.rst:1407 msgid "" "Issue a fatal error if there no current Python thread state or no current " "interpreter. It cannot return NULL." msgstr "" -#: ../../c-api/init.rst:1407 ../../c-api/init.rst:1417 +#: ../../c-api/init.rst:1410 ../../c-api/init.rst:1420 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/init.rst:1414 +#: ../../c-api/init.rst:1417 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1424 +#: ../../c-api/init.rst:1427 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1428 +#: ../../c-api/init.rst:1431 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1435 +#: ../../c-api/init.rst:1438 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1437 +#: ../../c-api/init.rst:1440 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1440 +#: ../../c-api/init.rst:1443 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1443 +#: ../../c-api/init.rst:1446 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1448 +#: ../../c-api/init.rst:1451 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1450 ../../c-api/init.rst:1458 +#: ../../c-api/init.rst:1453 ../../c-api/init.rst:1461 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1456 +#: ../../c-api/init.rst:1459 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1465 +#: ../../c-api/init.rst:1468 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1782,7 +1786,7 @@ msgid "" "raised and the caller should assume no current thread state is available." msgstr "" -#: ../../c-api/init.rst:1474 +#: ../../c-api/init.rst:1477 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1794,33 +1798,33 @@ msgid "" "raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1482 +#: ../../c-api/init.rst:1485 msgid "" "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" "`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1488 +#: ../../c-api/init.rst:1491 msgid "" "Acquire the global interpreter lock and set the current thread state to " "*tstate*, which must not be ``NULL``. The lock must have been created " "earlier. If this thread already has the lock, deadlock ensues." msgstr "" -#: ../../c-api/init.rst:1499 +#: ../../c-api/init.rst:1502 msgid "" "Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" "`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " "current thread if called while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1504 +#: ../../c-api/init.rst:1507 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1510 +#: ../../c-api/init.rst:1513 msgid "" "Reset the current thread state to ``NULL`` and release the global " "interpreter lock. The lock must have been created earlier and must be held " @@ -1829,17 +1833,17 @@ msgid "" "isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1516 +#: ../../c-api/init.rst:1519 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1523 +#: ../../c-api/init.rst:1526 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1525 +#: ../../c-api/init.rst:1528 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -1847,7 +1851,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1530 +#: ../../c-api/init.rst:1533 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1858,31 +1862,31 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1537 +#: ../../c-api/init.rst:1540 msgid "" "You can switch between sub-interpreters using the :c:func:" "`PyThreadState_Swap` function. You can create and destroy them using the " "following functions:" msgstr "" -#: ../../c-api/init.rst:1543 +#: ../../c-api/init.rst:1546 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1549 +#: ../../c-api/init.rst:1552 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1553 +#: ../../c-api/init.rst:1556 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1557 +#: ../../c-api/init.rst:1560 msgid "" "If this is ``0`` then :c:member:`~PyInterpreterConfig." "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " @@ -1890,44 +1894,44 @@ msgid "" "`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1565 +#: ../../c-api/init.rst:1568 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1569 +#: ../../c-api/init.rst:1572 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1574 +#: ../../c-api/init.rst:1577 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1579 +#: ../../c-api/init.rst:1582 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1584 +#: ../../c-api/init.rst:1587 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1590 +#: ../../c-api/init.rst:1593 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create daemon threads. Otherwise daemon threads are allowed (as long as :c:" "member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1597 +#: ../../c-api/init.rst:1600 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " @@ -1936,37 +1940,37 @@ msgid "" "`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1604 +#: ../../c-api/init.rst:1607 msgid "" "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." "use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1609 +#: ../../c-api/init.rst:1612 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1616 +#: ../../c-api/init.rst:1619 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1620 +#: ../../c-api/init.rst:1623 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1624 +#: ../../c-api/init.rst:1627 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1626 +#: ../../c-api/init.rst:1629 msgid "" "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" "`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1640 +#: ../../c-api/init.rst:1643 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " @@ -1979,13 +1983,13 @@ msgid "" "underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1650 +#: ../../c-api/init.rst:1653 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1653 +#: ../../c-api/init.rst:1656 msgid "" "Upon success, *tstate_p* will be set to the first thread state created in " "the new sub-interpreter. This thread state is made in the current thread " @@ -1996,7 +2000,7 @@ msgid "" "state." msgstr "" -#: ../../c-api/init.rst:1662 +#: ../../c-api/init.rst:1665 msgid "" "Like all other Python/C API functions, the global interpreter lock must be " "held before calling this function and is still held when it returns. " @@ -2008,13 +2012,13 @@ msgid "" "released here." msgstr "" -#: ../../c-api/init.rst:1673 +#: ../../c-api/init.rst:1676 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1676 +#: ../../c-api/init.rst:1679 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2038,7 +2042,7 @@ msgstr "" "};\n" "PyThreadState *tstate = Py_NewInterpreterFromConfig(&config);" -#: ../../c-api/init.rst:1687 +#: ../../c-api/init.rst:1690 msgid "" "Note that the config is used only briefly and does not get modified. During " "initialization the config's values are converted into various :c:type:" @@ -2046,11 +2050,11 @@ msgid "" "internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1696 +#: ../../c-api/init.rst:1699 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1698 +#: ../../c-api/init.rst:1701 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " @@ -2058,7 +2062,7 @@ msgid "" "are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1704 +#: ../../c-api/init.rst:1707 msgid "" "For modules using single-phase initialization, e.g. :c:func:" "`PyModule_Create`, the first time a particular extension is imported, it is " @@ -2070,7 +2074,7 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1715 +#: ../../c-api/init.rst:1718 msgid "" "Note that this is different from what happens when an extension is imported " "after the interpreter has been completely re-initialized by calling :c:func:" @@ -2080,7 +2084,7 @@ msgid "" "shared between these modules." msgstr "" -#: ../../c-api/init.rst:1735 +#: ../../c-api/init.rst:1738 msgid "" "Create a new sub-interpreter. This is essentially just a wrapper around :c:" "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " @@ -2089,7 +2093,7 @@ msgid "" "single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1747 +#: ../../c-api/init.rst:1750 msgid "" "Destroy the (sub-)interpreter represented by the given thread state. The " "given thread state must be the current thread state. See the discussion of " @@ -2099,17 +2103,17 @@ msgid "" "be held before calling this function. No GIL is held when it returns." msgstr "" -#: ../../c-api/init.rst:1755 +#: ../../c-api/init.rst:1758 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1760 +#: ../../c-api/init.rst:1763 msgid "A Per-Interpreter GIL" msgstr "" -#: ../../c-api/init.rst:1762 +#: ../../c-api/init.rst:1765 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2121,7 +2125,7 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1772 +#: ../../c-api/init.rst:1775 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2135,7 +2139,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1783 +#: ../../c-api/init.rst:1786 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2143,7 +2147,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1788 +#: ../../c-api/init.rst:1791 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2153,11 +2157,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1799 +#: ../../c-api/init.rst:1802 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1801 +#: ../../c-api/init.rst:1804 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2170,7 +2174,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1811 +#: ../../c-api/init.rst:1814 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2179,7 +2183,7 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1817 +#: ../../c-api/init.rst:1820 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " @@ -2191,25 +2195,25 @@ msgid "" "created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1828 +#: ../../c-api/init.rst:1831 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1830 +#: ../../c-api/init.rst:1833 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1837 +#: ../../c-api/init.rst:1840 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1841 +#: ../../c-api/init.rst:1844 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2217,17 +2221,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1846 +#: ../../c-api/init.rst:1849 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1847 +#: ../../c-api/init.rst:1850 msgid "" "with the main thread holding the :term:`global interpreter lock` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1850 +#: ../../c-api/init.rst:1853 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2235,20 +2239,20 @@ msgid "" "if the global interpreter lock is released." msgstr "" -#: ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:1858 msgid "" "This function doesn't need a current thread state to run, and it doesn't " "need the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:1858 +#: ../../c-api/init.rst:1861 msgid "" "To call this function in a subinterpreter, the caller must hold the GIL. " "Otherwise, the function *func* can be scheduled to be called from the wrong " "interpreter." msgstr "" -#: ../../c-api/init.rst:1863 +#: ../../c-api/init.rst:1866 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " @@ -2258,7 +2262,7 @@ msgid "" "`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1872 +#: ../../c-api/init.rst:1875 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2266,18 +2270,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1881 +#: ../../c-api/init.rst:1884 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1886 +#: ../../c-api/init.rst:1889 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:1890 +#: ../../c-api/init.rst:1893 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2287,7 +2291,7 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1900 +#: ../../c-api/init.rst:1903 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " @@ -2299,66 +2303,66 @@ msgid "" "value of *what*:" msgstr "" -#: ../../c-api/init.rst:1909 +#: ../../c-api/init.rst:1912 msgid "Value of *what*" msgstr "" -#: ../../c-api/init.rst:1909 +#: ../../c-api/init.rst:1912 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:1911 +#: ../../c-api/init.rst:1914 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:1911 ../../c-api/init.rst:1916 -#: ../../c-api/init.rst:1927 +#: ../../c-api/init.rst:1914 ../../c-api/init.rst:1919 +#: ../../c-api/init.rst:1930 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1913 +#: ../../c-api/init.rst:1916 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1913 +#: ../../c-api/init.rst:1916 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1916 +#: ../../c-api/init.rst:1919 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:1918 +#: ../../c-api/init.rst:1921 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1918 +#: ../../c-api/init.rst:1921 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1921 +#: ../../c-api/init.rst:1924 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1921 ../../c-api/init.rst:1923 -#: ../../c-api/init.rst:1925 +#: ../../c-api/init.rst:1924 ../../c-api/init.rst:1926 +#: ../../c-api/init.rst:1928 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:1923 +#: ../../c-api/init.rst:1926 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1925 +#: ../../c-api/init.rst:1928 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1927 +#: ../../c-api/init.rst:1930 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1932 +#: ../../c-api/init.rst:1935 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2367,7 +2371,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:1941 +#: ../../c-api/init.rst:1944 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2379,7 +2383,7 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:1952 +#: ../../c-api/init.rst:1955 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " @@ -2387,31 +2391,31 @@ msgid "" "f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:1960 +#: ../../c-api/init.rst:1963 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:1966 +#: ../../c-api/init.rst:1969 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:1972 +#: ../../c-api/init.rst:1975 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:1978 +#: ../../c-api/init.rst:1981 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:1984 +#: ../../c-api/init.rst:1987 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " @@ -2419,7 +2423,7 @@ msgid "" "attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:1992 +#: ../../c-api/init.rst:1995 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " @@ -2429,29 +2433,29 @@ msgid "" "`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:1999 +#: ../../c-api/init.rst:2002 msgid "See also the :func:`sys.setprofile` function." msgstr "" -#: ../../c-api/init.rst:2001 ../../c-api/init.rst:2008 -#: ../../c-api/init.rst:2027 ../../c-api/init.rst:2034 +#: ../../c-api/init.rst:2004 ../../c-api/init.rst:2011 +#: ../../c-api/init.rst:2030 ../../c-api/init.rst:2037 msgid "The caller must hold the :term:`GIL`." msgstr "呼叫者必須持有 :term:`GIL`。" -#: ../../c-api/init.rst:2005 +#: ../../c-api/init.rst:2008 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:2010 +#: ../../c-api/init.rst:2013 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:2018 +#: ../../c-api/init.rst:2021 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -2462,28 +2466,28 @@ msgid "" "*what* parameter." msgstr "" -#: ../../c-api/init.rst:2025 +#: ../../c-api/init.rst:2028 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:2031 +#: ../../c-api/init.rst:2034 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:2036 +#: ../../c-api/init.rst:2039 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:2042 +#: ../../c-api/init.rst:2045 msgid "Reference tracing" msgstr "" -#: ../../c-api/init.rst:2048 +#: ../../c-api/init.rst:2051 msgid "" "The type of the trace function registered using :c:func:" "`PyRefTracer_SetTracer`. The first parameter is a Python object that has " @@ -2493,19 +2497,19 @@ msgid "" "provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -#: ../../c-api/init.rst:2058 +#: ../../c-api/init.rst:2061 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" -#: ../../c-api/init.rst:2063 +#: ../../c-api/init.rst:2066 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been destroyed." msgstr "" -#: ../../c-api/init.rst:2068 +#: ../../c-api/init.rst:2071 msgid "" "Register a reference tracer function. The function will be called when a new " "Python has been created or when an object is going to be destroyed. If " @@ -2514,7 +2518,7 @@ msgid "" "return ``-1`` on error." msgstr "" -#: ../../c-api/init.rst:2074 +#: ../../c-api/init.rst:2077 msgid "" "Not that tracer functions **must not** create Python objects inside or " "otherwise the call will be re-entrant. The tracer also **must not** clear " @@ -2522,11 +2526,11 @@ msgid "" "the tracer function is called." msgstr "" -#: ../../c-api/init.rst:2079 ../../c-api/init.rst:2090 +#: ../../c-api/init.rst:2082 ../../c-api/init.rst:2093 msgid "The GIL must be held when calling this function." msgstr "" -#: ../../c-api/init.rst:2085 +#: ../../c-api/init.rst:2088 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " @@ -2534,48 +2538,48 @@ msgid "" "set the **data** pointer to NULL." msgstr "" -#: ../../c-api/init.rst:2097 +#: ../../c-api/init.rst:2100 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2102 +#: ../../c-api/init.rst:2105 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2107 +#: ../../c-api/init.rst:2110 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2112 +#: ../../c-api/init.rst:2115 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2117 +#: ../../c-api/init.rst:2120 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2123 +#: ../../c-api/init.rst:2126 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2129 +#: ../../c-api/init.rst:2132 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2136 +#: ../../c-api/init.rst:2139 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2140 +#: ../../c-api/init.rst:2143 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2585,19 +2589,19 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2147 +#: ../../c-api/init.rst:2150 msgid "" "The GIL does *not* need to be held when calling these functions; they supply " "their own locking." msgstr "" -#: ../../c-api/init.rst:2150 +#: ../../c-api/init.rst:2153 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2154 +#: ../../c-api/init.rst:2157 msgid "" "None of these API functions handle memory management on behalf of the :c:" "expr:`void*` values. You need to allocate and deallocate them yourself. If " @@ -2605,22 +2609,22 @@ msgid "" "don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2162 +#: ../../c-api/init.rst:2165 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2164 +#: ../../c-api/init.rst:2167 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2170 +#: ../../c-api/init.rst:2173 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2175 +#: ../../c-api/init.rst:2178 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2628,52 +2632,52 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2180 +#: ../../c-api/init.rst:2183 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2186 +#: ../../c-api/init.rst:2189 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: ../../c-api/init.rst:2191 +#: ../../c-api/init.rst:2194 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2193 +#: ../../c-api/init.rst:2196 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2200 +#: ../../c-api/init.rst:2203 msgid "" "Return a value which is the same state as a value initialized with :c:macro:" "`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" -#: ../../c-api/init.rst:2207 +#: ../../c-api/init.rst:2210 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2213 +#: ../../c-api/init.rst:2216 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2218 +#: ../../c-api/init.rst:2221 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2220 +#: ../../c-api/init.rst:2223 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " @@ -2681,13 +2685,13 @@ msgid "" "func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2228 +#: ../../c-api/init.rst:2231 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2234 +#: ../../c-api/init.rst:2237 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2696,7 +2700,7 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2243 +#: ../../c-api/init.rst:2246 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " @@ -2705,31 +2709,31 @@ msgid "" "key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2252 +#: ../../c-api/init.rst:2255 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2259 +#: ../../c-api/init.rst:2262 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2267 +#: ../../c-api/init.rst:2270 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2269 +#: ../../c-api/init.rst:2272 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2274 +#: ../../c-api/init.rst:2277 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2738,62 +2742,62 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2279 +#: ../../c-api/init.rst:2282 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:2290 +#: ../../c-api/init.rst:2293 msgid "Synchronization Primitives" msgstr "" -#: ../../c-api/init.rst:2292 +#: ../../c-api/init.rst:2295 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -#: ../../c-api/init.rst:2296 +#: ../../c-api/init.rst:2299 msgid "" "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " "zero to represent the unlocked state. For example::" msgstr "" -#: ../../c-api/init.rst:2299 +#: ../../c-api/init.rst:2302 msgid "PyMutex mutex = {0};" msgstr "" -#: ../../c-api/init.rst:2301 +#: ../../c-api/init.rst:2304 msgid "" "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " "contents and address of a :c:type:`!PyMutex` are meaningful, and it must " "remain at a fixed, writable location in memory." msgstr "" -#: ../../c-api/init.rst:2307 +#: ../../c-api/init.rst:2310 msgid "" "A :c:type:`!PyMutex` currently occupies one byte, but the size should be " "considered unstable. The size may change in future Python releases without " "a deprecation period." msgstr "" -#: ../../c-api/init.rst:2315 +#: ../../c-api/init.rst:2318 msgid "" "Lock mutex *m*. If another thread has already locked it, the calling thread " "will block until the mutex is unlocked. While blocked, the thread will " "temporarily release the :term:`GIL` if it is held." msgstr "" -#: ../../c-api/init.rst:2323 +#: ../../c-api/init.rst:2326 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" -#: ../../c-api/init.rst:2331 +#: ../../c-api/init.rst:2334 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2333 +#: ../../c-api/init.rst:2336 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded ` CPython. They are " @@ -2801,7 +2805,7 @@ msgid "" "no-ops in versions of Python with the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:2338 +#: ../../c-api/init.rst:2341 msgid "" "Critical sections avoid deadlocks by implicitly suspending active critical " "sections and releasing the locks during calls to :c:func:" @@ -2811,7 +2815,7 @@ msgid "" "-- they are useful because their behavior is similar to the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:2345 +#: ../../c-api/init.rst:2348 msgid "" "The functions and structs used by the macros are exposed for cases where C " "macros are not available. They should only be used as in the given macro " @@ -2819,7 +2823,7 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2352 +#: ../../c-api/init.rst:2355 msgid "" "Operations that need to lock two objects at once must use :c:macro:" "`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " @@ -2828,11 +2832,11 @@ msgid "" "lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2358 +#: ../../c-api/init.rst:2361 msgid "Example usage::" msgstr "" -#: ../../c-api/init.rst:2360 +#: ../../c-api/init.rst:2363 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -2844,71 +2848,71 @@ msgid "" "}" msgstr "" -#: ../../c-api/init.rst:2369 +#: ../../c-api/init.rst:2372 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " -"critical section API avoids potentital deadlocks due to reentrancy and lock " +"critical section API avoids potential deadlocks due to reentrancy and lock " "ordering by allowing the runtime to temporarily suspend the critical section " "if the code triggered by the finalizer blocks and calls :c:func:" "`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2377 +#: ../../c-api/init.rst:2380 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2380 ../../c-api/init.rst:2394 -#: ../../c-api/init.rst:2409 ../../c-api/init.rst:2423 +#: ../../c-api/init.rst:2383 ../../c-api/init.rst:2397 +#: ../../c-api/init.rst:2412 ../../c-api/init.rst:2426 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2382 +#: ../../c-api/init.rst:2385 msgid "" "{\n" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" msgstr "" -#: ../../c-api/init.rst:2386 ../../c-api/init.rst:2415 +#: ../../c-api/init.rst:2389 ../../c-api/init.rst:2418 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2392 +#: ../../c-api/init.rst:2395 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2396 +#: ../../c-api/init.rst:2399 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" msgstr "" -#: ../../c-api/init.rst:2399 ../../c-api/init.rst:2428 +#: ../../c-api/init.rst:2402 ../../c-api/init.rst:2431 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2405 +#: ../../c-api/init.rst:2408 msgid "" "Acquires the per-objects locks for the objects *a* and *b* and begins a " "critical section. The locks are acquired in a consistent order (lowest " "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2411 +#: ../../c-api/init.rst:2414 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection_Begin2(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" msgstr "" -#: ../../c-api/init.rst:2421 +#: ../../c-api/init.rst:2424 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2425 +#: ../../c-api/init.rst:2428 msgid "" " PyCriticalSection_End2(&_py_cs2);\n" "}" @@ -2922,36 +2926,36 @@ msgstr "PyEval_InitThreads()" msgid "modules (in module sys)" msgstr "modules(sys 模組中)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:698 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:698 ../../c-api/init.rst:1133 -#: ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 ../../c-api/init.rst:1136 +#: ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "sys" msgstr "sys" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:698 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 msgid "search" msgstr "search(搜尋)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:698 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1692 ../../c-api/init.rst:1745 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1695 ../../c-api/init.rst:1748 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" @@ -2959,7 +2963,7 @@ msgstr "Py_FinalizeEx(C 函式)" msgid "Py_Initialize()" msgstr "Py_Initialize()" -#: ../../c-api/init.rst:567 ../../c-api/init.rst:796 +#: ../../c-api/init.rst:567 ../../c-api/init.rst:799 msgid "main()" msgstr "main()" @@ -2967,102 +2971,102 @@ msgstr "main()" msgid "Py_GetPath()" msgstr "Py_GetPath()" -#: ../../c-api/init.rst:677 +#: ../../c-api/init.rst:680 msgid "executable (in module sys)" msgstr "executable(sys 模組中)" -#: ../../c-api/init.rst:731 ../../c-api/init.rst:773 ../../c-api/init.rst:787 +#: ../../c-api/init.rst:734 ../../c-api/init.rst:776 ../../c-api/init.rst:790 msgid "version (in module sys)" msgstr "version(sys 模組中)" -#: ../../c-api/init.rst:743 +#: ../../c-api/init.rst:746 msgid "platform (in module sys)" msgstr "platform(sys 模組中)" -#: ../../c-api/init.rst:760 +#: ../../c-api/init.rst:763 msgid "copyright (in module sys)" msgstr "copyright(sys 模組中)" -#: ../../c-api/init.rst:796 +#: ../../c-api/init.rst:799 msgid "Py_FatalError()" msgstr "Py_FatalError()" -#: ../../c-api/init.rst:796 +#: ../../c-api/init.rst:799 msgid "argv (in module sys)" msgstr "argv(sys 模組中)" -#: ../../c-api/init.rst:916 +#: ../../c-api/init.rst:919 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../c-api/init.rst:916 +#: ../../c-api/init.rst:919 msgid "interpreter lock" msgstr "interpreter lock(直譯器鎖)" -#: ../../c-api/init.rst:916 +#: ../../c-api/init.rst:919 msgid "lock, interpreter" msgstr "lock, interpreter(鎖、直譯器)" -#: ../../c-api/init.rst:929 +#: ../../c-api/init.rst:932 msgid "setswitchinterval (in module sys)" msgstr "setswitchinterval (sys 模組中)" -#: ../../c-api/init.rst:938 +#: ../../c-api/init.rst:941 msgid "PyThreadState (C type)" msgstr "PyThreadState(C 型別)" -#: ../../c-api/init.rst:964 +#: ../../c-api/init.rst:967 msgid "Py_BEGIN_ALLOW_THREADS (C macro)" msgstr "Py_BEGIN_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:964 +#: ../../c-api/init.rst:967 msgid "Py_END_ALLOW_THREADS (C macro)" msgstr "Py_END_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:980 +#: ../../c-api/init.rst:983 msgid "PyEval_RestoreThread (C function)" msgstr "PyEval_RestoreThread(C 函式)" -#: ../../c-api/init.rst:980 +#: ../../c-api/init.rst:983 msgid "PyEval_SaveThread (C function)" msgstr "PyEval_SaveThread(C 函式)" -#: ../../c-api/init.rst:1111 +#: ../../c-api/init.rst:1114 msgid "PyEval_AcquireThread()" msgstr "PyEval_AcquireThread()" -#: ../../c-api/init.rst:1111 +#: ../../c-api/init.rst:1114 msgid "PyEval_ReleaseThread()" msgstr "PyEval_ReleaseThread()" -#: ../../c-api/init.rst:1111 +#: ../../c-api/init.rst:1114 msgid "PyEval_SaveThread()" msgstr "PyEval_SaveThread()" -#: ../../c-api/init.rst:1111 +#: ../../c-api/init.rst:1114 msgid "PyEval_RestoreThread()" msgstr "PyEval_RestoreThread()" -#: ../../c-api/init.rst:1133 +#: ../../c-api/init.rst:1136 msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1692 +#: ../../c-api/init.rst:1695 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1722 +#: ../../c-api/init.rst:1725 msgid "close (in module os)" msgstr "close(os 模組中)" diff --git a/c-api/init_config.po b/c-api/init_config.po index 92b1a1a024..5293b616d7 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -2171,7 +2171,7 @@ msgstr "" #: ../../c-api/init_config.rst:1556 msgid "If :c:member:`~PyConfig.isolated` is zero:" -msgstr "" +msgstr "如果 :c:member:`~PyConfig.isolated` 為零:" #: ../../c-api/init_config.rst:1558 msgid "" @@ -2212,7 +2212,7 @@ msgstr "" #: ../../c-api/init_config.rst:1574 msgid "``pybuilddir.txt`` (Unix only)" -msgstr "" +msgstr "``pybuilddir.txt``\\ (僅限 Unix)" #: ../../c-api/init_config.rst:1576 msgid "If a ``._pth`` file is present:" @@ -2250,7 +2250,7 @@ msgstr "" #: ../../c-api/init_config.rst:1594 msgid "See also :c:member:`PyConfig.orig_argv` member." -msgstr "" +msgstr "也請參與 :c:member:`PyConfig.orig_argv` 成員。" #: ../../c-api/init_config.rst:1598 msgid "Multi-Phase Initialization Private Provisional API" @@ -2403,14 +2403,8 @@ msgstr "" #: ../../c-api/init_config.rst:558 msgid "main()" -msgstr "" +msgstr "main()" #: ../../c-api/init_config.rst:558 msgid "argv (in module sys)" msgstr "" - -#~ msgid "Py_RunMain()" -#~ msgstr "Py_RunMain()" - -#~ msgid "Command line arguments: :data:`sys.argv`." -#~ msgstr "命令列引數::data:`sys.argv`。" diff --git a/c-api/long.po b/c-api/long.po index 281c5ae8a4..db11da07a8 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-14 00:14+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -496,7 +496,7 @@ msgstr "" #: ../../c-api/long.rst:456 msgid "" "*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults " -"that behave most like a C cast, or a combintation of the other flags in the " +"that behave most like a C cast, or a combination of the other flags in the " "table below. Note that ``-1`` cannot be combined with other flags." msgstr "" diff --git a/c-api/monitoring.po b/c-api/monitoring.po index ef4d13984c..d4d8d09510 100644 --- a/c-api/monitoring.po +++ b/c-api/monitoring.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -184,9 +184,9 @@ msgstr "" msgid "" "The ``version`` argument is a pointer to a value which should be allocated " "by the user together with ``state_array`` and initialized to 0, and then set " -"only by :c:func:`!PyMonitoring_EnterScope` itelf. It allows this function to " -"determine whether event states have changed since the previous call, and to " -"return quickly if they have not." +"only by :c:func:`!PyMonitoring_EnterScope` itself. It allows this function " +"to determine whether event states have changed since the previous call, and " +"to return quickly if they have not." msgstr "" #: ../../c-api/monitoring.rst:154 diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 951587ed1f..2b7e6341f3 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+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-" @@ -1293,36 +1292,36 @@ msgstr "" #: ../../c-api/typeobj.rst:503 ../../c-api/typeobj.rst:526 #: ../../c-api/typeobj.rst:540 ../../c-api/typeobj.rst:584 -#: ../../c-api/typeobj.rst:627 ../../c-api/typeobj.rst:686 -#: ../../c-api/typeobj.rst:727 ../../c-api/typeobj.rst:744 -#: ../../c-api/typeobj.rst:761 ../../c-api/typeobj.rst:779 -#: ../../c-api/typeobj.rst:803 ../../c-api/typeobj.rst:820 -#: ../../c-api/typeobj.rst:832 ../../c-api/typeobj.rst:844 -#: ../../c-api/typeobj.rst:877 ../../c-api/typeobj.rst:899 -#: ../../c-api/typeobj.rst:919 ../../c-api/typeobj.rst:940 -#: ../../c-api/typeobj.rst:966 ../../c-api/typeobj.rst:985 -#: ../../c-api/typeobj.rst:1001 ../../c-api/typeobj.rst:1040 -#: ../../c-api/typeobj.rst:1051 ../../c-api/typeobj.rst:1061 -#: ../../c-api/typeobj.rst:1071 ../../c-api/typeobj.rst:1085 -#: ../../c-api/typeobj.rst:1103 ../../c-api/typeobj.rst:1126 -#: ../../c-api/typeobj.rst:1144 ../../c-api/typeobj.rst:1157 -#: ../../c-api/typeobj.rst:1179 ../../c-api/typeobj.rst:1223 -#: ../../c-api/typeobj.rst:1244 ../../c-api/typeobj.rst:1263 -#: ../../c-api/typeobj.rst:1293 ../../c-api/typeobj.rst:1315 -#: ../../c-api/typeobj.rst:1341 ../../c-api/typeobj.rst:1426 -#: ../../c-api/typeobj.rst:1500 ../../c-api/typeobj.rst:1561 -#: ../../c-api/typeobj.rst:1597 ../../c-api/typeobj.rst:1622 -#: ../../c-api/typeobj.rst:1645 ../../c-api/typeobj.rst:1658 -#: ../../c-api/typeobj.rst:1673 ../../c-api/typeobj.rst:1687 -#: ../../c-api/typeobj.rst:1717 ../../c-api/typeobj.rst:1749 -#: ../../c-api/typeobj.rst:1775 ../../c-api/typeobj.rst:1793 -#: ../../c-api/typeobj.rst:1822 ../../c-api/typeobj.rst:1866 -#: ../../c-api/typeobj.rst:1883 ../../c-api/typeobj.rst:1924 -#: ../../c-api/typeobj.rst:1946 ../../c-api/typeobj.rst:1978 -#: ../../c-api/typeobj.rst:2006 ../../c-api/typeobj.rst:2019 -#: ../../c-api/typeobj.rst:2029 ../../c-api/typeobj.rst:2046 -#: ../../c-api/typeobj.rst:2063 ../../c-api/typeobj.rst:2077 -#: ../../c-api/typeobj.rst:2123 ../../c-api/typeobj.rst:2146 +#: ../../c-api/typeobj.rst:627 ../../c-api/typeobj.rst:699 +#: ../../c-api/typeobj.rst:740 ../../c-api/typeobj.rst:757 +#: ../../c-api/typeobj.rst:774 ../../c-api/typeobj.rst:792 +#: ../../c-api/typeobj.rst:816 ../../c-api/typeobj.rst:833 +#: ../../c-api/typeobj.rst:845 ../../c-api/typeobj.rst:857 +#: ../../c-api/typeobj.rst:890 ../../c-api/typeobj.rst:912 +#: ../../c-api/typeobj.rst:932 ../../c-api/typeobj.rst:953 +#: ../../c-api/typeobj.rst:979 ../../c-api/typeobj.rst:998 +#: ../../c-api/typeobj.rst:1014 ../../c-api/typeobj.rst:1053 +#: ../../c-api/typeobj.rst:1064 ../../c-api/typeobj.rst:1074 +#: ../../c-api/typeobj.rst:1084 ../../c-api/typeobj.rst:1098 +#: ../../c-api/typeobj.rst:1116 ../../c-api/typeobj.rst:1139 +#: ../../c-api/typeobj.rst:1157 ../../c-api/typeobj.rst:1170 +#: ../../c-api/typeobj.rst:1192 ../../c-api/typeobj.rst:1236 +#: ../../c-api/typeobj.rst:1257 ../../c-api/typeobj.rst:1276 +#: ../../c-api/typeobj.rst:1306 ../../c-api/typeobj.rst:1328 +#: ../../c-api/typeobj.rst:1354 ../../c-api/typeobj.rst:1439 +#: ../../c-api/typeobj.rst:1513 ../../c-api/typeobj.rst:1574 +#: ../../c-api/typeobj.rst:1610 ../../c-api/typeobj.rst:1635 +#: ../../c-api/typeobj.rst:1658 ../../c-api/typeobj.rst:1671 +#: ../../c-api/typeobj.rst:1686 ../../c-api/typeobj.rst:1700 +#: ../../c-api/typeobj.rst:1730 ../../c-api/typeobj.rst:1762 +#: ../../c-api/typeobj.rst:1788 ../../c-api/typeobj.rst:1806 +#: ../../c-api/typeobj.rst:1835 ../../c-api/typeobj.rst:1879 +#: ../../c-api/typeobj.rst:1896 ../../c-api/typeobj.rst:1937 +#: ../../c-api/typeobj.rst:1959 ../../c-api/typeobj.rst:1991 +#: ../../c-api/typeobj.rst:2019 ../../c-api/typeobj.rst:2032 +#: ../../c-api/typeobj.rst:2042 ../../c-api/typeobj.rst:2059 +#: ../../c-api/typeobj.rst:2076 ../../c-api/typeobj.rst:2090 +#: ../../c-api/typeobj.rst:2125 ../../c-api/typeobj.rst:2148 msgid "**Inheritance:**" msgstr "" @@ -1355,12 +1354,12 @@ msgid "" "class. :c:func:`PyType_Ready` will not change this field if it is non-zero." msgstr "" -#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:688 -#: ../../c-api/typeobj.rst:805 ../../c-api/typeobj.rst:901 -#: ../../c-api/typeobj.rst:921 ../../c-api/typeobj.rst:1624 -#: ../../c-api/typeobj.rst:1647 ../../c-api/typeobj.rst:1777 -#: ../../c-api/typeobj.rst:1795 ../../c-api/typeobj.rst:1868 -#: ../../c-api/typeobj.rst:1980 ../../c-api/typeobj.rst:2125 +#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:701 +#: ../../c-api/typeobj.rst:818 ../../c-api/typeobj.rst:914 +#: ../../c-api/typeobj.rst:934 ../../c-api/typeobj.rst:1637 +#: ../../c-api/typeobj.rst:1660 ../../c-api/typeobj.rst:1790 +#: ../../c-api/typeobj.rst:1808 ../../c-api/typeobj.rst:1881 +#: ../../c-api/typeobj.rst:1993 ../../c-api/typeobj.rst:2127 msgid "This field is inherited by subtypes." msgstr "" @@ -1566,28 +1565,41 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:693 +#: ../../c-api/typeobj.rst:687 +msgid "" +"In a garbage collected Python, :c:member:`!tp_dealloc` may be called from " +"any Python thread, not just the thread which created the object (if the " +"object becomes part of a refcount cycle, that cycle might be collected by a " +"garbage collection on any thread). This is not a problem for Python API " +"calls, since the thread on which :c:member:`!tp_dealloc` is called will own " +"the Global Interpreter Lock (GIL). However, if the object being destroyed " +"in turn destroys objects from some other C or C++ library, care should be " +"taken to ensure that destroying those objects on the thread which called :c:" +"member:`!tp_dealloc` will not violate any assumptions of the library." +msgstr "" + +#: ../../c-api/typeobj.rst:706 msgid "" "An optional offset to a per-instance function that implements calling the " "object using the :ref:`vectorcall protocol `, a more efficient " "alternative of the simpler :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:698 +#: ../../c-api/typeobj.rst:711 msgid "" "This field is only used if the flag :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` is " "set. If so, this must be a positive integer containing the offset in the " "instance of a :c:type:`vectorcallfunc` pointer." msgstr "" -#: ../../c-api/typeobj.rst:702 +#: ../../c-api/typeobj.rst:715 msgid "" "The *vectorcallfunc* pointer may be ``NULL``, in which case the instance " "behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the " "instance falls back to :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:706 +#: ../../c-api/typeobj.rst:719 msgid "" "Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also set :c:member:" "`~PyTypeObject.tp_call` and make sure its behaviour is consistent with the " @@ -1595,13 +1607,13 @@ msgid "" "`PyVectorcall_Call`." msgstr "" -#: ../../c-api/typeobj.rst:713 +#: ../../c-api/typeobj.rst:726 msgid "" "Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was " "used for printing to a file. In Python 3.0 to 3.7, it was unused." msgstr "" -#: ../../c-api/typeobj.rst:719 +#: ../../c-api/typeobj.rst:732 msgid "" "Before version 3.12, it was not recommended for :ref:`mutable heap types " "` to implement the vectorcall protocol. When a user sets :attr:" @@ -1611,7 +1623,7 @@ msgid "" "`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" -#: ../../c-api/typeobj.rst:729 +#: ../../c-api/typeobj.rst:742 msgid "" "This field is always inherited. However, the :c:macro:" "`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, " @@ -1619,11 +1631,11 @@ msgid "" "func:`PyVectorcall_Call` is explicitly called." msgstr "" -#: ../../c-api/typeobj.rst:738 +#: ../../c-api/typeobj.rst:751 msgid "An optional pointer to the get-attribute-string function." msgstr "" -#: ../../c-api/typeobj.rst:740 +#: ../../c-api/typeobj.rst:753 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, " @@ -1631,7 +1643,7 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:746 ../../c-api/typeobj.rst:942 +#: ../../c-api/typeobj.rst:759 ../../c-api/typeobj.rst:955 msgid "" "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject." "tp_getattro`" @@ -1639,7 +1651,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject." "tp_getattro`" -#: ../../c-api/typeobj.rst:748 +#: ../../c-api/typeobj.rst:761 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1648,12 +1660,12 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:755 ../../c-api/typeobj.rst:955 +#: ../../c-api/typeobj.rst:768 ../../c-api/typeobj.rst:968 msgid "" "An optional pointer to the function for setting and deleting attributes." msgstr "" -#: ../../c-api/typeobj.rst:757 +#: ../../c-api/typeobj.rst:770 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, " @@ -1661,7 +1673,7 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:763 ../../c-api/typeobj.rst:968 +#: ../../c-api/typeobj.rst:776 ../../c-api/typeobj.rst:981 msgid "" "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject." "tp_setattro`" @@ -1669,7 +1681,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject." "tp_setattro`" -#: ../../c-api/typeobj.rst:765 +#: ../../c-api/typeobj.rst:778 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1678,38 +1690,38 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:772 +#: ../../c-api/typeobj.rst:785 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement :term:`awaitable` and :term:`asynchronous iterator` " "protocols at the C-level. See :ref:`async-structs` for details." msgstr "" -#: ../../c-api/typeobj.rst:776 +#: ../../c-api/typeobj.rst:789 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." msgstr "" -#: ../../c-api/typeobj.rst:781 +#: ../../c-api/typeobj.rst:794 msgid "" "The :c:member:`~PyTypeObject.tp_as_async` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:789 +#: ../../c-api/typeobj.rst:802 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`repr`." msgstr "" -#: ../../c-api/typeobj.rst:792 +#: ../../c-api/typeobj.rst:805 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" msgstr "" -#: ../../c-api/typeobj.rst:794 +#: ../../c-api/typeobj.rst:807 msgid "PyObject *tp_repr(PyObject *self);" msgstr "PyObject *tp_repr(PyObject *self);" -#: ../../c-api/typeobj.rst:796 +#: ../../c-api/typeobj.rst:809 msgid "" "The function must return a string or a Unicode object. Ideally, this " "function should return a string that, when passed to :func:`eval`, given a " @@ -1718,85 +1730,85 @@ msgid "" "``'>'`` from which both the type and the value of the object can be deduced." msgstr "" -#: ../../c-api/typeobj.rst:807 ../../c-api/typeobj.rst:886 -#: ../../c-api/typeobj.rst:923 ../../c-api/typeobj.rst:948 -#: ../../c-api/typeobj.rst:974 ../../c-api/typeobj.rst:1015 -#: ../../c-api/typeobj.rst:1570 ../../c-api/typeobj.rst:1604 -#: ../../c-api/typeobj.rst:1721 ../../c-api/typeobj.rst:1754 -#: ../../c-api/typeobj.rst:1829 ../../c-api/typeobj.rst:1870 -#: ../../c-api/typeobj.rst:1888 ../../c-api/typeobj.rst:1930 -#: ../../c-api/typeobj.rst:1951 ../../c-api/typeobj.rst:1982 +#: ../../c-api/typeobj.rst:820 ../../c-api/typeobj.rst:899 +#: ../../c-api/typeobj.rst:936 ../../c-api/typeobj.rst:961 +#: ../../c-api/typeobj.rst:987 ../../c-api/typeobj.rst:1028 +#: ../../c-api/typeobj.rst:1583 ../../c-api/typeobj.rst:1617 +#: ../../c-api/typeobj.rst:1734 ../../c-api/typeobj.rst:1767 +#: ../../c-api/typeobj.rst:1842 ../../c-api/typeobj.rst:1883 +#: ../../c-api/typeobj.rst:1901 ../../c-api/typeobj.rst:1943 +#: ../../c-api/typeobj.rst:1964 ../../c-api/typeobj.rst:1995 msgid "**Default:**" msgstr "**預設:**" -#: ../../c-api/typeobj.rst:809 +#: ../../c-api/typeobj.rst:822 msgid "" "When this field is not set, a string of the form ``<%s object at %p>`` is " "returned, where ``%s`` is replaced by the type name, and ``%p`` by the " "object's memory address." msgstr "" -#: ../../c-api/typeobj.rst:816 +#: ../../c-api/typeobj.rst:829 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the number protocol. These fields are documented " "in :ref:`number-structs`." msgstr "" -#: ../../c-api/typeobj.rst:822 +#: ../../c-api/typeobj.rst:835 msgid "" "The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:828 +#: ../../c-api/typeobj.rst:841 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the sequence protocol. These fields are documented " "in :ref:`sequence-structs`." msgstr "" -#: ../../c-api/typeobj.rst:834 +#: ../../c-api/typeobj.rst:847 msgid "" "The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:840 +#: ../../c-api/typeobj.rst:853 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the mapping protocol. These fields are documented " "in :ref:`mapping-structs`." msgstr "" -#: ../../c-api/typeobj.rst:846 +#: ../../c-api/typeobj.rst:859 msgid "" "The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:854 +#: ../../c-api/typeobj.rst:867 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`hash`." msgstr "" -#: ../../c-api/typeobj.rst:857 +#: ../../c-api/typeobj.rst:870 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" msgstr "" -#: ../../c-api/typeobj.rst:859 +#: ../../c-api/typeobj.rst:872 msgid "Py_hash_t tp_hash(PyObject *);" msgstr "Py_hash_t tp_hash(PyObject *);" -#: ../../c-api/typeobj.rst:861 +#: ../../c-api/typeobj.rst:874 msgid "" "The value ``-1`` should not be returned as a normal return value; when an " "error occurs during the computation of the hash value, the function should " "set an exception and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:865 +#: ../../c-api/typeobj.rst:878 msgid "" "When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` " "is not set), an attempt to take the hash of the object raises :exc:" @@ -1804,7 +1816,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:869 +#: ../../c-api/typeobj.rst:882 msgid "" "This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to " "block inheritance of the hash method from a parent type. This is interpreted " @@ -1815,7 +1827,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:879 ../../c-api/typeobj.rst:1563 +#: ../../c-api/typeobj.rst:892 ../../c-api/typeobj.rst:1576 msgid "" "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." "tp_richcompare`" @@ -1823,7 +1835,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject." "tp_richcompare`" -#: ../../c-api/typeobj.rst:881 +#: ../../c-api/typeobj.rst:894 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." @@ -1832,22 +1844,22 @@ msgid "" "are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:888 +#: ../../c-api/typeobj.rst:901 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." msgstr "" -#: ../../c-api/typeobj.rst:893 +#: ../../c-api/typeobj.rst:906 msgid "" "An optional pointer to a function that implements calling the object. This " "should be ``NULL`` if the object is not callable. The signature is the same " "as for :c:func:`PyObject_Call`::" msgstr "" -#: ../../c-api/typeobj.rst:897 +#: ../../c-api/typeobj.rst:910 msgid "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" msgstr "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" -#: ../../c-api/typeobj.rst:906 +#: ../../c-api/typeobj.rst:919 msgid "" "An optional pointer to a function that implements the built-in operation :" "func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls " @@ -1856,15 +1868,15 @@ msgid "" "this handler.)" msgstr "" -#: ../../c-api/typeobj.rst:911 +#: ../../c-api/typeobj.rst:924 msgid "The signature is the same as for :c:func:`PyObject_Str`::" msgstr "" -#: ../../c-api/typeobj.rst:913 +#: ../../c-api/typeobj.rst:926 msgid "PyObject *tp_str(PyObject *self);" msgstr "PyObject *tp_str(PyObject *self);" -#: ../../c-api/typeobj.rst:915 +#: ../../c-api/typeobj.rst:928 msgid "" "The function must return a string or a Unicode object. It should be a " "\"friendly\" string representation of the object, as this is the " @@ -1872,32 +1884,32 @@ msgid "" "function." msgstr "" -#: ../../c-api/typeobj.rst:925 +#: ../../c-api/typeobj.rst:938 msgid "" "When this field is not set, :c:func:`PyObject_Repr` is called to return a " "string representation." msgstr "" -#: ../../c-api/typeobj.rst:931 +#: ../../c-api/typeobj.rst:944 msgid "An optional pointer to the get-attribute function." msgstr "" -#: ../../c-api/typeobj.rst:933 +#: ../../c-api/typeobj.rst:946 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:935 +#: ../../c-api/typeobj.rst:948 msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" msgstr "PyObject *tp_getattro(PyObject *self, PyObject *attr);" -#: ../../c-api/typeobj.rst:937 +#: ../../c-api/typeobj.rst:950 msgid "" "It is usually convenient to set this field to :c:func:" "`PyObject_GenericGetAttr`, which implements the normal way of looking for " "object attributes." msgstr "" -#: ../../c-api/typeobj.rst:944 +#: ../../c-api/typeobj.rst:957 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1906,19 +1918,19 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:950 +#: ../../c-api/typeobj.rst:963 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:957 +#: ../../c-api/typeobj.rst:970 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:959 +#: ../../c-api/typeobj.rst:972 msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" msgstr "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" -#: ../../c-api/typeobj.rst:961 +#: ../../c-api/typeobj.rst:974 msgid "" "In addition, setting *value* to ``NULL`` to delete an attribute must be " "supported. It is usually convenient to set this field to :c:func:" @@ -1926,7 +1938,7 @@ msgid "" "attributes." msgstr "" -#: ../../c-api/typeobj.rst:970 +#: ../../c-api/typeobj.rst:983 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1935,24 +1947,24 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:976 +#: ../../c-api/typeobj.rst:989 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:981 +#: ../../c-api/typeobj.rst:994 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the buffer interface. These fields are documented " "in :ref:`buffer-structs`." msgstr "" -#: ../../c-api/typeobj.rst:987 +#: ../../c-api/typeobj.rst:1000 msgid "" "The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:993 +#: ../../c-api/typeobj.rst:1006 msgid "" "This field is a bit mask of various flags. Some flags indicate variant " "semantics for certain situations; others are used to indicate that certain " @@ -1964,7 +1976,7 @@ msgid "" "accessed and must be considered to have a zero or ``NULL`` value instead." msgstr "" -#: ../../c-api/typeobj.rst:1003 +#: ../../c-api/typeobj.rst:1016 msgid "" "Inheritance of this field is complicated. Most flag bits are inherited " "individually, i.e. if the base type has a flag bit set, the subtype inherits " @@ -1980,7 +1992,7 @@ msgid "" "*really* inherited individually?" msgstr "" -#: ../../c-api/typeobj.rst:1017 +#: ../../c-api/typeobj.rst:1030 msgid "" ":c:data:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``." @@ -1988,11 +2000,11 @@ msgstr "" ":c:data:`PyBaseObject_Type` 使用 ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``。" -#: ../../c-api/typeobj.rst:1020 +#: ../../c-api/typeobj.rst:1033 msgid "**Bit Masks:**" msgstr "" -#: ../../c-api/typeobj.rst:1024 +#: ../../c-api/typeobj.rst:1037 msgid "" "The following bit masks are currently defined; these can be ORed together " "using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." @@ -2001,7 +2013,7 @@ msgid "" "zero." msgstr "" -#: ../../c-api/typeobj.rst:1031 +#: ../../c-api/typeobj.rst:1044 msgid "" "This bit is set when the type object itself is allocated on the heap, for " "example, types created dynamically using :c:func:`PyType_FromSpec`. In this " @@ -2014,32 +2026,32 @@ msgid "" "reference cycle with their own module object." msgstr "" -#: ../../c-api/typeobj.rst:1042 ../../c-api/typeobj.rst:1053 -#: ../../c-api/typeobj.rst:1063 ../../c-api/typeobj.rst:1073 -#: ../../c-api/typeobj.rst:1105 +#: ../../c-api/typeobj.rst:1055 ../../c-api/typeobj.rst:1066 +#: ../../c-api/typeobj.rst:1076 ../../c-api/typeobj.rst:1086 +#: ../../c-api/typeobj.rst:1118 msgid "???" msgstr "???" -#: ../../c-api/typeobj.rst:1047 +#: ../../c-api/typeobj.rst:1060 msgid "" "This bit is set when the type can be used as the base type of another type. " "If this bit is clear, the type cannot be subtyped (similar to a \"final\" " "class in Java)." msgstr "" -#: ../../c-api/typeobj.rst:1058 +#: ../../c-api/typeobj.rst:1071 msgid "" "This bit is set when the type object has been fully initialized by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1068 +#: ../../c-api/typeobj.rst:1081 msgid "" "This bit is set while :c:func:`PyType_Ready` is in the process of " "initializing the type object." msgstr "" -#: ../../c-api/typeobj.rst:1078 +#: ../../c-api/typeobj.rst:1091 msgid "" "This bit is set when the object supports garbage collection. If this bit is " "set, instances must be created using :c:macro:`PyObject_GC_New` and " @@ -2049,14 +2061,14 @@ msgid "" "tp_clear` are present in the type object." msgstr "" -#: ../../c-api/typeobj.rst:1087 ../../c-api/typeobj.rst:1428 -#: ../../c-api/typeobj.rst:1502 +#: ../../c-api/typeobj.rst:1100 ../../c-api/typeobj.rst:1441 +#: ../../c-api/typeobj.rst:1515 msgid "" "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." "tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" -#: ../../c-api/typeobj.rst:1089 +#: ../../c-api/typeobj.rst:1102 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:" "member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` " @@ -2066,105 +2078,105 @@ msgid "" "values." msgstr "" -#: ../../c-api/typeobj.rst:1099 +#: ../../c-api/typeobj.rst:1112 msgid "" "This is a bitmask of all the bits that pertain to the existence of certain " "fields in the type object and its extension structures. Currently, it " "includes the following bits: :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." msgstr "" -#: ../../c-api/typeobj.rst:1110 +#: ../../c-api/typeobj.rst:1123 msgid "This bit indicates that objects behave like unbound methods." msgstr "" -#: ../../c-api/typeobj.rst:1112 +#: ../../c-api/typeobj.rst:1125 msgid "If this flag is set for ``type(meth)``, then:" msgstr "" -#: ../../c-api/typeobj.rst:1114 +#: ../../c-api/typeobj.rst:1127 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1117 +#: ../../c-api/typeobj.rst:1130 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1120 +#: ../../c-api/typeobj.rst:1133 msgid "" "This flag enables an optimization for typical method calls like ``obj." "meth()``: it avoids creating a temporary \"bound method\" object for ``obj." "meth``." msgstr "" -#: ../../c-api/typeobj.rst:1128 +#: ../../c-api/typeobj.rst:1141 msgid "" "This flag is never inherited by types without the :c:macro:" "`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited " "whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1134 +#: ../../c-api/typeobj.rst:1147 msgid "" "This bit indicates that instances of the class have a `~object.__dict__` " "attribute, and that the space for the dictionary is managed by the VM." msgstr "" -#: ../../c-api/typeobj.rst:1137 +#: ../../c-api/typeobj.rst:1150 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." msgstr "" -#: ../../c-api/typeobj.rst:1139 +#: ../../c-api/typeobj.rst:1152 msgid "" "The type traverse function must call :c:func:`PyObject_VisitManagedDict` and " "its clear function must call :c:func:`PyObject_ClearManagedDict`." msgstr "" -#: ../../c-api/typeobj.rst:1146 +#: ../../c-api/typeobj.rst:1159 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject.tp_dictoffset` " "field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1152 +#: ../../c-api/typeobj.rst:1165 msgid "" "This bit indicates that instances of the class should be weakly " "referenceable." msgstr "" -#: ../../c-api/typeobj.rst:1159 +#: ../../c-api/typeobj.rst:1172 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject." "tp_weaklistoffset` field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1165 +#: ../../c-api/typeobj.rst:1178 msgid "" "Only usable with variable-size types, i.e. ones with non-zero :c:member:" "`~PyTypeObject.tp_itemsize`." msgstr "" -#: ../../c-api/typeobj.rst:1168 +#: ../../c-api/typeobj.rst:1181 msgid "" "Indicates that the variable-sized portion of an instance of this type is at " "the end of the instance's memory area, at an offset of ``Py_TYPE(obj)-" ">tp_basicsize`` (which may be different in each subclass)." msgstr "" -#: ../../c-api/typeobj.rst:1173 +#: ../../c-api/typeobj.rst:1186 msgid "" "When setting this flag, be sure that all superclasses either use this memory " "layout, or are not variable-sized. Python does not check this." msgstr "" -#: ../../c-api/typeobj.rst:1181 +#: ../../c-api/typeobj.rst:1194 msgid "This flag is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1195 +#: ../../c-api/typeobj.rst:1208 msgid "" "These flags are used by functions such as :c:func:`PyLong_Check` to quickly " "determine if a type is a subclass of a built-in type; such specific checks " @@ -2174,90 +2186,90 @@ msgid "" "behave differently depending on what kind of check is used." msgstr "" -#: ../../c-api/typeobj.rst:1206 +#: ../../c-api/typeobj.rst:1219 msgid "" "This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is " "present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1211 +#: ../../c-api/typeobj.rst:1224 msgid "" "This flag isn't necessary anymore, as the interpreter assumes the :c:member:" "`~PyTypeObject.tp_finalize` slot is always present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1219 +#: ../../c-api/typeobj.rst:1232 msgid "" "This bit is set when the class implements the :ref:`vectorcall protocol " "`. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for " "details." msgstr "" -#: ../../c-api/typeobj.rst:1225 +#: ../../c-api/typeobj.rst:1238 msgid "" "This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also inherited." msgstr "" -#: ../../c-api/typeobj.rst:1232 +#: ../../c-api/typeobj.rst:1245 msgid "" "This flag is now removed from a class when the class's :py:meth:`~object." "__call__` method is reassigned." msgstr "" -#: ../../c-api/typeobj.rst:1235 +#: ../../c-api/typeobj.rst:1248 msgid "This flag can now be inherited by mutable classes." msgstr "" -#: ../../c-api/typeobj.rst:1239 +#: ../../c-api/typeobj.rst:1252 msgid "" "This bit is set for type objects that are immutable: type attributes cannot " "be set nor deleted." msgstr "" -#: ../../c-api/typeobj.rst:1241 +#: ../../c-api/typeobj.rst:1254 msgid "" ":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types " "`." msgstr "" -#: ../../c-api/typeobj.rst:1246 +#: ../../c-api/typeobj.rst:1259 msgid "This flag is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:1252 +#: ../../c-api/typeobj.rst:1265 msgid "" "Disallow creating instances of the type: set :c:member:`~PyTypeObject." "tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." msgstr "" -#: ../../c-api/typeobj.rst:1256 +#: ../../c-api/typeobj.rst:1269 msgid "" "The flag must be set before creating the type, not after. For example, it " "must be set before :c:func:`PyType_Ready` is called on the type." msgstr "" -#: ../../c-api/typeobj.rst:1259 +#: ../../c-api/typeobj.rst:1272 msgid "" "The flag is set automatically on :ref:`static types ` if :c:" "member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:" "member:`~PyTypeObject.tp_new` is NULL." msgstr "" -#: ../../c-api/typeobj.rst:1265 +#: ../../c-api/typeobj.rst:1278 msgid "" "This flag is not inherited. However, subclasses will not be instantiable " "unless they provide a non-NULL :c:member:`~PyTypeObject.tp_new` (which is " "only possible via the C API)." msgstr "" -#: ../../c-api/typeobj.rst:1272 +#: ../../c-api/typeobj.rst:1285 msgid "" "To disallow instantiating a class directly but allow instantiating its " "subclasses (e.g. for an :term:`abstract base class`), do not use this flag. " "Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1283 +#: ../../c-api/typeobj.rst:1296 msgid "" "This bit indicates that instances of the class may match mapping patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2265,23 +2277,23 @@ msgid "" "unset when registering :class:`collections.abc.Sequence`." msgstr "" -#: ../../c-api/typeobj.rst:1290 ../../c-api/typeobj.rst:1312 +#: ../../c-api/typeobj.rst:1303 ../../c-api/typeobj.rst:1325 msgid "" ":c:macro:`Py_TPFLAGS_MAPPING` and :c:macro:`Py_TPFLAGS_SEQUENCE` are " "mutually exclusive; it is an error to enable both flags simultaneously." msgstr "" -#: ../../c-api/typeobj.rst:1295 +#: ../../c-api/typeobj.rst:1308 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_SEQUENCE`." msgstr "" -#: ../../c-api/typeobj.rst:1298 ../../c-api/typeobj.rst:1320 +#: ../../c-api/typeobj.rst:1311 ../../c-api/typeobj.rst:1333 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../c-api/typeobj.rst:1305 +#: ../../c-api/typeobj.rst:1318 msgid "" "This bit indicates that instances of the class may match sequence patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2289,53 +2301,53 @@ msgid "" "unset when registering :class:`collections.abc.Mapping`." msgstr "" -#: ../../c-api/typeobj.rst:1317 +#: ../../c-api/typeobj.rst:1330 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_MAPPING`." msgstr "" -#: ../../c-api/typeobj.rst:1327 +#: ../../c-api/typeobj.rst:1340 msgid "" "Internal. Do not set or unset this flag. To indicate that a class has " "changed call :c:func:`PyType_Modified`" msgstr "" -#: ../../c-api/typeobj.rst:1331 +#: ../../c-api/typeobj.rst:1344 msgid "" "This flag is present in header files, but is not be used. It will be removed " "in a future version of CPython" msgstr "" -#: ../../c-api/typeobj.rst:1337 +#: ../../c-api/typeobj.rst:1350 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " "this type object. This is exposed as the :attr:`~type.__doc__` attribute on " "the type and instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:1343 +#: ../../c-api/typeobj.rst:1356 msgid "This field is *not* inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:1348 +#: ../../c-api/typeobj.rst:1361 msgid "" "An optional pointer to a traversal function for the garbage collector. This " "is only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1351 +#: ../../c-api/typeobj.rst:1364 msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" msgstr "int tp_traverse(PyObject *self, visitproc visit, void *arg);" -#: ../../c-api/typeobj.rst:1353 ../../c-api/typeobj.rst:1497 +#: ../../c-api/typeobj.rst:1366 ../../c-api/typeobj.rst:1510 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1356 +#: ../../c-api/typeobj.rst:1369 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " "collector to detect reference cycles. A typical implementation of a :c:" @@ -2345,7 +2357,7 @@ msgid "" "`!_thread` extension module::" msgstr "" -#: ../../c-api/typeobj.rst:1362 +#: ../../c-api/typeobj.rst:1375 msgid "" "static int\n" "local_traverse(localobject *self, visitproc visit, void *arg)\n" @@ -2365,7 +2377,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1371 +#: ../../c-api/typeobj.rst:1384 msgid "" "Note that :c:func:`Py_VISIT` is called only on those members that can " "participate in reference cycles. Although there is also a ``self->key`` " @@ -2373,48 +2385,50 @@ msgid "" "part of a reference cycle." msgstr "" -#: ../../c-api/typeobj.rst:1375 +#: ../../c-api/typeobj.rst:1388 msgid "" "On the other hand, even if you know a member can never be part of a cycle, " "as a debugging aid you may want to visit it anyway just so the :mod:`gc` " "module's :func:`~gc.get_referents` function will include it." msgstr "" -#: ../../c-api/typeobj.rst:1379 +#: ../../c-api/typeobj.rst:1392 msgid "" "Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" msgstr "" -#: ../../c-api/typeobj.rst:1381 +#: ../../c-api/typeobj.rst:1394 msgid "Py_VISIT(Py_TYPE(self));" -msgstr "" +msgstr "Py_VISIT(Py_TYPE(self));" -#: ../../c-api/typeobj.rst:1383 +#: ../../c-api/typeobj.rst:1396 msgid "" "It is only needed since Python 3.9. To support Python 3.8 and older, this " "line must be conditional::" msgstr "" -#: ../../c-api/typeobj.rst:1386 +#: ../../c-api/typeobj.rst:1399 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " Py_VISIT(Py_TYPE(self));\n" "#endif" msgstr "" +"#if PY_VERSION_HEX >= 0x03090000\n" +" Py_VISIT(Py_TYPE(self));\n" +"#endif" -#: ../../c-api/typeobj.rst:1390 +#: ../../c-api/typeobj.rst:1403 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" "`PyObject_VisitManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1394 -#, fuzzy +#: ../../c-api/typeobj.rst:1407 msgid "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" -msgstr "PyObject *tp_iternext(PyObject *self);" +msgstr "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" -#: ../../c-api/typeobj.rst:1397 +#: ../../c-api/typeobj.rst:1410 msgid "" "When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members " "that the instance *owns* (by having :term:`strong references ` hold a reference to " "their type. Their traversal function must therefore either visit :c:func:" @@ -2443,14 +2457,14 @@ msgid "" "superclass). If they do not, the type object may not be garbage-collected." msgstr "" -#: ../../c-api/typeobj.rst:1421 +#: ../../c-api/typeobj.rst:1434 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:1430 +#: ../../c-api/typeobj.rst:1443 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:" @@ -2458,18 +2472,18 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1438 +#: ../../c-api/typeobj.rst:1451 msgid "" "An optional pointer to a clear function for the garbage collector. This is " "only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1441 +#: ../../c-api/typeobj.rst:1454 msgid "int tp_clear(PyObject *);" msgstr "int tp_clear(PyObject *);" -#: ../../c-api/typeobj.rst:1443 +#: ../../c-api/typeobj.rst:1456 msgid "" "The :c:member:`~PyTypeObject.tp_clear` member function is used to break " "reference cycles in cyclic garbage detected by the garbage collector. Taken " @@ -2484,7 +2498,7 @@ msgid "" "good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1453 +#: ../../c-api/typeobj.rst:1466 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2492,7 +2506,7 @@ msgid "" "example::" msgstr "" -#: ../../c-api/typeobj.rst:1457 +#: ../../c-api/typeobj.rst:1470 msgid "" "static int\n" "local_clear(localobject *self)\n" @@ -2514,7 +2528,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1467 +#: ../../c-api/typeobj.rst:1480 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 :" @@ -2529,19 +2543,18 @@ msgid "" "performs the operations in a safe order." msgstr "" -#: ../../c-api/typeobj.rst:1479 +#: ../../c-api/typeobj.rst:1492 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" "`PyObject_ClearManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1483 -#, fuzzy +#: ../../c-api/typeobj.rst:1496 msgid "PyObject_ClearManagedDict((PyObject*)self);" -msgstr "PyObject *am_anext(PyObject *self);" +msgstr "PyObject_ClearManagedDict((PyObject*)self);" -#: ../../c-api/typeobj.rst:1485 +#: ../../c-api/typeobj.rst:1498 msgid "" "Note that :c:member:`~PyTypeObject.tp_clear` is not *always* called before " "an instance is deallocated. For example, when reference counting is enough " @@ -2549,7 +2562,7 @@ msgid "" "is not involved and :c:member:`~PyTypeObject.tp_dealloc` is called directly." msgstr "" -#: ../../c-api/typeobj.rst:1491 +#: ../../c-api/typeobj.rst:1504 msgid "" "Because the goal of :c:member:`~PyTypeObject.tp_clear` functions is to break " "reference cycles, it's not necessary to clear contained objects like Python " @@ -2559,7 +2572,7 @@ msgid "" "invoke :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1504 +#: ../../c-api/typeobj.rst:1517 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, :" @@ -2567,22 +2580,22 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1512 +#: ../../c-api/typeobj.rst:1525 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1514 +#: ../../c-api/typeobj.rst:1527 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" msgstr "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -#: ../../c-api/typeobj.rst:1516 +#: ../../c-api/typeobj.rst:1529 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:1519 +#: ../../c-api/typeobj.rst:1532 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2590,50 +2603,50 @@ msgid "" "set an exception condition." msgstr "" -#: ../../c-api/typeobj.rst:1524 +#: ../../c-api/typeobj.rst:1537 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:1530 +#: ../../c-api/typeobj.rst:1543 msgid "Constant" msgstr "常數" -#: ../../c-api/typeobj.rst:1530 +#: ../../c-api/typeobj.rst:1543 msgid "Comparison" msgstr "" -#: ../../c-api/typeobj.rst:1532 +#: ../../c-api/typeobj.rst:1545 msgid "``<``" msgstr "``<``" -#: ../../c-api/typeobj.rst:1534 +#: ../../c-api/typeobj.rst:1547 msgid "``<=``" msgstr "``<=``" -#: ../../c-api/typeobj.rst:1536 +#: ../../c-api/typeobj.rst:1549 msgid "``==``" msgstr "``==``" -#: ../../c-api/typeobj.rst:1538 +#: ../../c-api/typeobj.rst:1551 msgid "``!=``" msgstr "``!=``" -#: ../../c-api/typeobj.rst:1540 +#: ../../c-api/typeobj.rst:1553 msgid "``>``" msgstr "``>``" -#: ../../c-api/typeobj.rst:1542 +#: ../../c-api/typeobj.rst:1555 msgid "``>=``" msgstr "``>=``" -#: ../../c-api/typeobj.rst:1545 +#: ../../c-api/typeobj.rst:1558 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: ../../c-api/typeobj.rst:1549 +#: ../../c-api/typeobj.rst:1562 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 " @@ -2641,15 +2654,15 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: ../../c-api/typeobj.rst:1555 +#: ../../c-api/typeobj.rst:1568 msgid "The returned value is a new :term:`strong reference`." msgstr "" -#: ../../c-api/typeobj.rst:1557 +#: ../../c-api/typeobj.rst:1570 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: ../../c-api/typeobj.rst:1565 +#: ../../c-api/typeobj.rst:1578 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" @@ -2657,7 +2670,7 @@ msgid "" "tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1572 +#: ../../c-api/typeobj.rst:1585 msgid "" ":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." "tp_richcompare` implementation, which may be inherited. However, if only :c:" @@ -2666,13 +2679,13 @@ msgid "" "comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1581 +#: ../../c-api/typeobj.rst:1594 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:1584 +#: ../../c-api/typeobj.rst:1597 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 " @@ -2682,19 +2695,19 @@ msgid "" "`PyObject*` which is initialized to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1591 +#: ../../c-api/typeobj.rst:1604 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:1594 +#: ../../c-api/typeobj.rst:1607 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:1599 +#: ../../c-api/typeobj.rst:1612 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 " @@ -2703,7 +2716,7 @@ msgid "" "not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1606 +#: ../../c-api/typeobj.rst:1619 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." @@ -2711,32 +2724,32 @@ msgid "" "unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1614 +#: ../../c-api/typeobj.rst:1627 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:1618 +#: ../../c-api/typeobj.rst:1631 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: ../../c-api/typeobj.rst:1620 +#: ../../c-api/typeobj.rst:1633 msgid "PyObject *tp_iter(PyObject *self);" msgstr "PyObject *tp_iter(PyObject *self);" -#: ../../c-api/typeobj.rst:1629 +#: ../../c-api/typeobj.rst:1642 msgid "" "An optional pointer to a function that returns the next item in an :term:" "`iterator`. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1632 +#: ../../c-api/typeobj.rst:1645 msgid "PyObject *tp_iternext(PyObject *self);" msgstr "PyObject *tp_iternext(PyObject *self);" -#: ../../c-api/typeobj.rst:1634 +#: ../../c-api/typeobj.rst:1647 msgid "" "When the iterator is exhausted, it must return ``NULL``; a :exc:" "`StopIteration` exception may or may not be set. When another error occurs, " @@ -2744,74 +2757,74 @@ msgid "" "this type are iterators." msgstr "" -#: ../../c-api/typeobj.rst:1639 +#: ../../c-api/typeobj.rst:1652 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:1643 +#: ../../c-api/typeobj.rst:1656 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: ../../c-api/typeobj.rst:1652 +#: ../../c-api/typeobj.rst:1665 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:1655 +#: ../../c-api/typeobj.rst:1668 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:1660 +#: ../../c-api/typeobj.rst:1673 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1666 +#: ../../c-api/typeobj.rst:1679 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:1670 +#: ../../c-api/typeobj.rst:1683 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:1675 +#: ../../c-api/typeobj.rst:1688 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1681 +#: ../../c-api/typeobj.rst:1694 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:1684 +#: ../../c-api/typeobj.rst:1697 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:1689 +#: ../../c-api/typeobj.rst:1702 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1695 +#: ../../c-api/typeobj.rst:1708 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -2819,7 +2832,7 @@ msgid "" "metatype." msgstr "" -#: ../../c-api/typeobj.rst:1703 +#: ../../c-api/typeobj.rst:1716 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -2827,7 +2840,7 @@ msgid "" "valid C99 address constants." msgstr "" -#: ../../c-api/typeobj.rst:1708 +#: ../../c-api/typeobj.rst:1721 msgid "" "However, the unary '&' operator applied to a non-static variable like :c:" "data:`PyBaseObject_Type` is not required to produce an address constant. " @@ -2835,27 +2848,27 @@ msgid "" "strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1714 +#: ../../c-api/typeobj.rst:1727 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: ../../c-api/typeobj.rst:1719 +#: ../../c-api/typeobj.rst:1732 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: ../../c-api/typeobj.rst:1723 +#: ../../c-api/typeobj.rst:1736 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: ../../c-api/typeobj.rst:1729 +#: ../../c-api/typeobj.rst:1742 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1731 +#: ../../c-api/typeobj.rst:1744 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " @@ -2866,73 +2879,73 @@ msgid "" "be treated as read-only." msgstr "" -#: ../../c-api/typeobj.rst:1739 +#: ../../c-api/typeobj.rst:1752 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:1745 +#: ../../c-api/typeobj.rst:1758 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:1751 +#: ../../c-api/typeobj.rst:1764 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:1756 +#: ../../c-api/typeobj.rst:1769 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: ../../c-api/typeobj.rst:1761 +#: ../../c-api/typeobj.rst:1774 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:1767 +#: ../../c-api/typeobj.rst:1780 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: ../../c-api/typeobj.rst:1769 ../../c-api/typeobj.rst:1785 -#: ../../c-api/typeobj.rst:1849 ../../c-api/typeobj.rst:1879 -#: ../../c-api/typeobj.rst:1903 +#: ../../c-api/typeobj.rst:1782 ../../c-api/typeobj.rst:1798 +#: ../../c-api/typeobj.rst:1862 ../../c-api/typeobj.rst:1892 +#: ../../c-api/typeobj.rst:1916 msgid "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1771 +#: ../../c-api/typeobj.rst:1784 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:1782 +#: ../../c-api/typeobj.rst:1795 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: ../../c-api/typeobj.rst:1787 +#: ../../c-api/typeobj.rst:1800 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:1789 +#: ../../c-api/typeobj.rst:1802 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: ../../c-api/typeobj.rst:1800 +#: ../../c-api/typeobj.rst:1813 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:1803 +#: ../../c-api/typeobj.rst:1816 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 " @@ -2940,19 +2953,19 @@ msgid "" "func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1808 +#: ../../c-api/typeobj.rst:1821 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:1811 +#: ../../c-api/typeobj.rst:1824 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." msgstr "" -#: ../../c-api/typeobj.rst:1813 +#: ../../c-api/typeobj.rst:1826 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" "only. To get the pointer to the dictionary call :c:func:" @@ -2961,13 +2974,13 @@ msgid "" "to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: ../../c-api/typeobj.rst:1819 +#: ../../c-api/typeobj.rst:1832 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_dictoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1824 +#: ../../c-api/typeobj.rst:1837 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 " @@ -2975,25 +2988,25 @@ msgid "" "`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -#: ../../c-api/typeobj.rst:1831 +#: ../../c-api/typeobj.rst:1844 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:1834 +#: ../../c-api/typeobj.rst:1847 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:1842 +#: ../../c-api/typeobj.rst:1855 msgid "An optional pointer to an instance initialization function." msgstr "" -#: ../../c-api/typeobj.rst:1844 +#: ../../c-api/typeobj.rst:1857 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " @@ -3001,18 +3014,18 @@ msgid "" "instance by calling its :meth:`!__init__` method again." msgstr "" -#: ../../c-api/typeobj.rst:1851 +#: ../../c-api/typeobj.rst:1864 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1853 +#: ../../c-api/typeobj.rst:1866 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:1857 +#: ../../c-api/typeobj.rst:1870 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 :" @@ -3024,53 +3037,53 @@ msgid "" "subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: ../../c-api/typeobj.rst:1864 +#: ../../c-api/typeobj.rst:1877 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: ../../c-api/typeobj.rst:1872 +#: ../../c-api/typeobj.rst:1885 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" -#: ../../c-api/typeobj.rst:1877 +#: ../../c-api/typeobj.rst:1890 msgid "An optional pointer to an instance allocation function." msgstr "" -#: ../../c-api/typeobj.rst:1881 +#: ../../c-api/typeobj.rst:1894 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -#: ../../c-api/typeobj.rst:1885 +#: ../../c-api/typeobj.rst:1898 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)." msgstr "" -#: ../../c-api/typeobj.rst:1890 +#: ../../c-api/typeobj.rst:1903 msgid "" "For dynamic subtypes, this field is always set to :c:func:" "`PyType_GenericAlloc`, to force a standard heap allocation strategy." msgstr "" -#: ../../c-api/typeobj.rst:1894 +#: ../../c-api/typeobj.rst:1907 msgid "" "For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:" "`PyType_GenericAlloc`. That is the recommended value for all statically " "defined types." msgstr "" -#: ../../c-api/typeobj.rst:1901 +#: ../../c-api/typeobj.rst:1914 msgid "An optional pointer to an instance creation function." msgstr "" -#: ../../c-api/typeobj.rst:1905 +#: ../../c-api/typeobj.rst:1918 msgid "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1907 +#: ../../c-api/typeobj.rst:1920 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 " @@ -3079,7 +3092,7 @@ msgid "" "that type (but not an unrelated type)." msgstr "" -#: ../../c-api/typeobj.rst:1913 +#: ../../c-api/typeobj.rst:1926 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " @@ -3091,20 +3104,20 @@ msgid "" "be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: ../../c-api/typeobj.rst:1921 +#: ../../c-api/typeobj.rst:1934 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" -#: ../../c-api/typeobj.rst:1926 +#: ../../c-api/typeobj.rst:1939 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:1932 +#: ../../c-api/typeobj.rst:1945 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 " @@ -3112,44 +3125,44 @@ msgid "" "factory function." msgstr "" -#: ../../c-api/typeobj.rst:1940 +#: ../../c-api/typeobj.rst:1953 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1942 +#: ../../c-api/typeobj.rst:1955 msgid "void tp_free(void *self);" msgstr "void tp_free(void *self);" -#: ../../c-api/typeobj.rst:1944 +#: ../../c-api/typeobj.rst:1957 msgid "" "An initializer that is compatible with this signature is :c:func:" "`PyObject_Free`." msgstr "" -#: ../../c-api/typeobj.rst:1948 +#: ../../c-api/typeobj.rst:1961 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)" msgstr "" -#: ../../c-api/typeobj.rst:1953 +#: ../../c-api/typeobj.rst:1966 msgid "" "In dynamic subtypes, this field is set to a deallocator suitable to match :c:" "func:`PyType_GenericAlloc` and the value of the :c:macro:" "`Py_TPFLAGS_HAVE_GC` flag bit." msgstr "" -#: ../../c-api/typeobj.rst:1957 +#: ../../c-api/typeobj.rst:1970 msgid "" "For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_Del`." msgstr "" -#: ../../c-api/typeobj.rst:1962 +#: ../../c-api/typeobj.rst:1975 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: ../../c-api/typeobj.rst:1964 +#: ../../c-api/typeobj.rst:1977 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 " @@ -3161,93 +3174,93 @@ msgid "" "instance. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1972 +#: ../../c-api/typeobj.rst:1985 msgid "int tp_is_gc(PyObject *self);" msgstr "int tp_is_gc(PyObject *self);" -#: ../../c-api/typeobj.rst:1974 +#: ../../c-api/typeobj.rst:1987 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:1984 +#: ../../c-api/typeobj.rst:1997 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:1990 +#: ../../c-api/typeobj.rst:2003 msgid "Tuple of base types." msgstr "" -#: ../../c-api/typeobj.rst:1992 ../../c-api/typeobj.rst:2016 +#: ../../c-api/typeobj.rst:2005 ../../c-api/typeobj.rst:2029 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:1995 +#: ../../c-api/typeobj.rst:2008 msgid "" "For dynamically created classes, the ``Py_tp_bases`` :c:type:`slot " "` can be used instead of the *bases* argument of :c:func:" "`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: ../../c-api/typeobj.rst:2002 +#: ../../c-api/typeobj.rst:2015 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:2008 ../../c-api/typeobj.rst:2031 -#: ../../c-api/typeobj.rst:2048 ../../c-api/typeobj.rst:2065 -#: ../../c-api/typeobj.rst:2079 +#: ../../c-api/typeobj.rst:2021 ../../c-api/typeobj.rst:2044 +#: ../../c-api/typeobj.rst:2061 ../../c-api/typeobj.rst:2078 +#: ../../c-api/typeobj.rst:2092 msgid "This field is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:2013 +#: ../../c-api/typeobj.rst:2026 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:2021 +#: ../../c-api/typeobj.rst:2034 msgid "" "This field is not inherited; it is calculated fresh by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2027 +#: ../../c-api/typeobj.rst:2040 msgid "Unused. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2036 +#: ../../c-api/typeobj.rst:2049 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -#: ../../c-api/typeobj.rst:2038 +#: ../../c-api/typeobj.rst:2051 msgid "" "To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__`." msgstr "" -#: ../../c-api/typeobj.rst:2043 +#: ../../c-api/typeobj.rst:2056 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:2053 +#: ../../c-api/typeobj.rst:2066 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2058 +#: ../../c-api/typeobj.rst:2071 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 " @@ -3255,25 +3268,25 @@ msgid "" "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -#: ../../c-api/typeobj.rst:2070 +#: ../../c-api/typeobj.rst:2083 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "" -#: ../../c-api/typeobj.rst:2075 +#: ../../c-api/typeobj.rst:2088 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2084 +#: ../../c-api/typeobj.rst:2097 msgid "" "An optional pointer to an instance finalization function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2086 +#: ../../c-api/typeobj.rst:2099 msgid "void tp_finalize(PyObject *self);" msgstr "void tp_finalize(PyObject *self);" -#: ../../c-api/typeobj.rst:2088 +#: ../../c-api/typeobj.rst:2101 msgid "" "If :c:member:`~PyTypeObject.tp_finalize` is set, the interpreter calls it " "once when finalizing an instance. It is called either from the garbage " @@ -3283,14 +3296,14 @@ msgid "" "object in a sane state." msgstr "" -#: ../../c-api/typeobj.rst:2095 +#: ../../c-api/typeobj.rst:2108 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should not mutate the current " "exception status; therefore, a recommended way to write a non-trivial " "finalizer is::" msgstr "" -#: ../../c-api/typeobj.rst:2098 +#: ../../c-api/typeobj.rst:2111 msgid "" "static void\n" "local_finalize(PyObject *self)\n" @@ -3307,31 +3320,18 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:2112 -msgid "" -"Also, note that, in a garbage collected Python, :c:member:`~PyTypeObject." -"tp_dealloc` may be called from any Python thread, not just the thread which " -"created the object (if the object becomes part of a refcount cycle, that " -"cycle might be collected by a garbage collection on any thread). This is " -"not a problem for Python API calls, since the thread on which tp_dealloc is " -"called will own the Global Interpreter Lock (GIL). However, if the object " -"being destroyed in turn destroys objects from some other C or C++ library, " -"care should be taken to ensure that destroying those objects on the thread " -"which called tp_dealloc will not violate any assumptions of the library." -msgstr "" - -#: ../../c-api/typeobj.rst:2131 +#: ../../c-api/typeobj.rst:2133 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:2135 +#: ../../c-api/typeobj.rst:2137 msgid "\"Safe object finalization\" (:pep:`442`)" msgstr "" -#: ../../c-api/typeobj.rst:2140 +#: ../../c-api/typeobj.rst:2142 msgid "" "Vectorcall function to use for calls of this type object. In other words, it " "is used to implement :ref:`vectorcall ` for ``type.__call__``. " @@ -3339,65 +3339,65 @@ msgid "" "meth:`~object.__new__` and :meth:`~object.__init__` is used." msgstr "" -#: ../../c-api/typeobj.rst:2148 +#: ../../c-api/typeobj.rst:2150 msgid "This field is never inherited." msgstr "" -#: ../../c-api/typeobj.rst:2150 +#: ../../c-api/typeobj.rst:2152 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: ../../c-api/typeobj.rst:2155 +#: ../../c-api/typeobj.rst:2157 msgid "Internal. Do not use." msgstr "" -#: ../../c-api/typeobj.rst:2163 +#: ../../c-api/typeobj.rst:2165 msgid "Static Types" msgstr "" -#: ../../c-api/typeobj.rst:2165 +#: ../../c-api/typeobj.rst:2167 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:2169 +#: ../../c-api/typeobj.rst:2171 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: ../../c-api/typeobj.rst:2171 +#: ../../c-api/typeobj.rst:2173 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: ../../c-api/typeobj.rst:2173 +#: ../../c-api/typeobj.rst:2175 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:2175 +#: ../../c-api/typeobj.rst:2177 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" -#: ../../c-api/typeobj.rst:2179 +#: ../../c-api/typeobj.rst:2181 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:2187 +#: ../../c-api/typeobj.rst:2189 msgid "Heap Types" msgstr "" -#: ../../c-api/typeobj.rst:2189 +#: ../../c-api/typeobj.rst:2191 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " @@ -3405,29 +3405,29 @@ msgid "" "`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: ../../c-api/typeobj.rst:2194 +#: ../../c-api/typeobj.rst:2196 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:2202 +#: ../../c-api/typeobj.rst:2204 msgid "Number Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2209 +#: ../../c-api/typeobj.rst:2211 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:2215 ../../c-api/typeobj.rst:2539 +#: ../../c-api/typeobj.rst:2217 ../../c-api/typeobj.rst:2541 msgid "Here is the structure definition::" msgstr "" -#: ../../c-api/typeobj.rst:2217 +#: ../../c-api/typeobj.rst:2219 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -3515,7 +3515,7 @@ msgstr "" " binaryfunc nb_inplace_matrix_multiply;\n" "} PyNumberMethods;" -#: ../../c-api/typeobj.rst:2262 +#: ../../c-api/typeobj.rst:2264 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 " @@ -3525,31 +3525,31 @@ msgid "" "and set an exception." msgstr "" -#: ../../c-api/typeobj.rst:2271 +#: ../../c-api/typeobj.rst:2273 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:2316 +#: ../../c-api/typeobj.rst:2318 msgid "Mapping Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2323 +#: ../../c-api/typeobj.rst:2325 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:2328 +#: ../../c-api/typeobj.rst:2330 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:2334 +#: ../../c-api/typeobj.rst:2336 msgid "" "This function is used by :c:func:`PyObject_GetItem` and :c:func:" "`PySequence_GetSlice`, and has the same signature as :c:func:`!" @@ -3557,7 +3557,7 @@ msgid "" "`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2342 +#: ../../c-api/typeobj.rst:2344 msgid "" "This function is used by :c:func:`PyObject_SetItem`, :c:func:" "`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" @@ -3567,17 +3567,17 @@ msgid "" "deletion." msgstr "" -#: ../../c-api/typeobj.rst:2353 +#: ../../c-api/typeobj.rst:2355 msgid "Sequence Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2360 +#: ../../c-api/typeobj.rst:2362 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: ../../c-api/typeobj.rst:2365 +#: ../../c-api/typeobj.rst:2367 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 " @@ -3585,21 +3585,21 @@ msgid "" "member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: ../../c-api/typeobj.rst:2372 +#: ../../c-api/typeobj.rst:2374 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:2378 +#: ../../c-api/typeobj.rst:2380 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:2384 +#: ../../c-api/typeobj.rst:2386 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 " @@ -3608,7 +3608,7 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2390 +#: ../../c-api/typeobj.rst:2392 msgid "" "Negative indexes are handled as follows: if the :c:member:" "`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " @@ -3617,7 +3617,7 @@ msgid "" "index is passed as is to the function." msgstr "" -#: ../../c-api/typeobj.rst:2397 +#: ../../c-api/typeobj.rst:2399 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:" @@ -3626,14 +3626,14 @@ msgid "" "``NULL`` if the object does not support item assignment and deletion." msgstr "" -#: ../../c-api/typeobj.rst:2406 +#: ../../c-api/typeobj.rst:2408 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:2413 +#: ../../c-api/typeobj.rst:2415 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 " @@ -3643,7 +3643,7 @@ msgid "" "c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2422 +#: ../../c-api/typeobj.rst:2424 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 " @@ -3653,76 +3653,76 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2433 +#: ../../c-api/typeobj.rst:2435 msgid "Buffer Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2441 +#: ../../c-api/typeobj.rst:2443 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:2447 ../../c-api/typeobj.rst:2496 -#: ../../c-api/typeobj.rst:2550 ../../c-api/typeobj.rst:2561 -#: ../../c-api/typeobj.rst:2573 ../../c-api/typeobj.rst:2583 +#: ../../c-api/typeobj.rst:2449 ../../c-api/typeobj.rst:2498 +#: ../../c-api/typeobj.rst:2552 ../../c-api/typeobj.rst:2563 +#: ../../c-api/typeobj.rst:2575 ../../c-api/typeobj.rst:2585 msgid "The signature of this function is::" msgstr "" -#: ../../c-api/typeobj.rst:2449 +#: ../../c-api/typeobj.rst:2451 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" msgstr "int (PyObject *exporter, Py_buffer *view, int flags);" -#: ../../c-api/typeobj.rst:2451 +#: ../../c-api/typeobj.rst:2453 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:2455 +#: ../../c-api/typeobj.rst:2457 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:2458 +#: ../../c-api/typeobj.rst:2460 msgid "Fill in the requested fields." msgstr "" -#: ../../c-api/typeobj.rst:2460 +#: ../../c-api/typeobj.rst:2462 msgid "Increment an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2462 +#: ../../c-api/typeobj.rst:2464 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: ../../c-api/typeobj.rst:2464 +#: ../../c-api/typeobj.rst:2466 msgid "Return ``0``." msgstr "回傳 ``0``。" -#: ../../c-api/typeobj.rst:2466 +#: ../../c-api/typeobj.rst:2468 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: ../../c-api/typeobj.rst:2469 +#: ../../c-api/typeobj.rst:2471 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:2472 +#: ../../c-api/typeobj.rst:2474 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:2476 +#: ../../c-api/typeobj.rst:2478 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure `, the rules how an exporter must react to " @@ -3730,7 +3730,7 @@ msgid "" "types>`." msgstr "" -#: ../../c-api/typeobj.rst:2481 +#: ../../c-api/typeobj.rst:2483 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:" @@ -3739,23 +3739,23 @@ msgid "" "internal` are read-only for the consumer." msgstr "" -#: ../../c-api/typeobj.rst:2488 +#: ../../c-api/typeobj.rst:2490 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:2491 +#: ../../c-api/typeobj.rst:2493 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: ../../c-api/typeobj.rst:2498 +#: ../../c-api/typeobj.rst:2500 msgid "void (PyObject *exporter, Py_buffer *view);" msgstr "void (PyObject *exporter, Py_buffer *view);" -#: ../../c-api/typeobj.rst:2500 +#: ../../c-api/typeobj.rst:2502 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 " @@ -3763,15 +3763,15 @@ msgid "" "these optional steps:" msgstr "" -#: ../../c-api/typeobj.rst:2505 +#: ../../c-api/typeobj.rst:2507 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2507 +#: ../../c-api/typeobj.rst:2509 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: ../../c-api/typeobj.rst:2509 +#: ../../c-api/typeobj.rst:2511 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 " @@ -3779,30 +3779,30 @@ msgid "" "*view* argument." msgstr "" -#: ../../c-api/typeobj.rst:2515 +#: ../../c-api/typeobj.rst:2517 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:2520 +#: ../../c-api/typeobj.rst:2522 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: ../../c-api/typeobj.rst:2528 +#: ../../c-api/typeobj.rst:2530 msgid "Async Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2536 +#: ../../c-api/typeobj.rst:2538 msgid "" "This structure holds pointers to the functions required to implement :term:" "`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: ../../c-api/typeobj.rst:2541 +#: ../../c-api/typeobj.rst:2543 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -3818,62 +3818,62 @@ msgstr "" " sendfunc am_send;\n" "} PyAsyncMethods;" -#: ../../c-api/typeobj.rst:2552 +#: ../../c-api/typeobj.rst:2554 msgid "PyObject *am_await(PyObject *self);" msgstr "" -#: ../../c-api/typeobj.rst:2554 +#: ../../c-api/typeobj.rst:2556 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:2557 +#: ../../c-api/typeobj.rst:2559 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: ../../c-api/typeobj.rst:2563 +#: ../../c-api/typeobj.rst:2565 msgid "PyObject *am_aiter(PyObject *self);" msgstr "PyObject *am_aiter(PyObject *self);" -#: ../../c-api/typeobj.rst:2565 +#: ../../c-api/typeobj.rst:2567 msgid "" "Must return an :term:`asynchronous iterator` object. See :meth:`~object." "__anext__` for details." msgstr "" -#: ../../c-api/typeobj.rst:2568 +#: ../../c-api/typeobj.rst:2570 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: ../../c-api/typeobj.rst:2575 +#: ../../c-api/typeobj.rst:2577 msgid "PyObject *am_anext(PyObject *self);" msgstr "PyObject *am_anext(PyObject *self);" -#: ../../c-api/typeobj.rst:2577 +#: ../../c-api/typeobj.rst:2579 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:2585 +#: ../../c-api/typeobj.rst:2587 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" -#: ../../c-api/typeobj.rst:2587 +#: ../../c-api/typeobj.rst:2589 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2596 +#: ../../c-api/typeobj.rst:2598 msgid "Slot Type typedefs" msgstr "" -#: ../../c-api/typeobj.rst:2600 +#: ../../c-api/typeobj.rst:2602 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 " @@ -3887,80 +3887,80 @@ msgid "" "length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:2610 +#: ../../c-api/typeobj.rst:2612 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:2617 +#: ../../c-api/typeobj.rst:2619 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "請見 :c:member:`~PyTypeObject.tp_free`。" -#: ../../c-api/typeobj.rst:2621 +#: ../../c-api/typeobj.rst:2623 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "請見 :c:member:`~PyTypeObject.tp_new`。" -#: ../../c-api/typeobj.rst:2625 +#: ../../c-api/typeobj.rst:2627 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "請見 :c:member:`~PyTypeObject.tp_init`。" -#: ../../c-api/typeobj.rst:2629 +#: ../../c-api/typeobj.rst:2631 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "請見 :c:member:`~PyTypeObject.tp_repr`。" -#: ../../c-api/typeobj.rst:2633 ../../c-api/typeobj.rst:2642 +#: ../../c-api/typeobj.rst:2635 ../../c-api/typeobj.rst:2644 msgid "Return the value of the named attribute for the object." msgstr "" -#: ../../c-api/typeobj.rst:2637 ../../c-api/typeobj.rst:2648 +#: ../../c-api/typeobj.rst:2639 ../../c-api/typeobj.rst:2650 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:2644 +#: ../../c-api/typeobj.rst:2646 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_getattro`。" -#: ../../c-api/typeobj.rst:2651 +#: ../../c-api/typeobj.rst:2653 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_setattro`。" -#: ../../c-api/typeobj.rst:2655 +#: ../../c-api/typeobj.rst:2657 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_get`。" -#: ../../c-api/typeobj.rst:2659 +#: ../../c-api/typeobj.rst:2661 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_set`。" -#: ../../c-api/typeobj.rst:2663 +#: ../../c-api/typeobj.rst:2665 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "請見 :c:member:`~PyTypeObject.tp_hash`。" -#: ../../c-api/typeobj.rst:2667 +#: ../../c-api/typeobj.rst:2669 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" -#: ../../c-api/typeobj.rst:2671 +#: ../../c-api/typeobj.rst:2673 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "請見 :c:member:`~PyTypeObject.tp_iter`。" -#: ../../c-api/typeobj.rst:2675 +#: ../../c-api/typeobj.rst:2677 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "請見 :c:member:`~PyTypeObject.tp_iternext`。" -#: ../../c-api/typeobj.rst:2689 +#: ../../c-api/typeobj.rst:2691 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "請見 :c:member:`~PyAsyncMethods.am_send`。" -#: ../../c-api/typeobj.rst:2705 +#: ../../c-api/typeobj.rst:2707 msgid "Examples" msgstr "範例" -#: ../../c-api/typeobj.rst:2707 +#: ../../c-api/typeobj.rst:2709 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -3968,11 +3968,11 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: ../../c-api/typeobj.rst:2712 +#: ../../c-api/typeobj.rst:2714 msgid "A basic :ref:`static type `::" msgstr "" -#: ../../c-api/typeobj.rst:2714 +#: ../../c-api/typeobj.rst:2716 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -3990,13 +3990,13 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2729 +#: ../../c-api/typeobj.rst:2731 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: ../../c-api/typeobj.rst:2732 +#: ../../c-api/typeobj.rst:2734 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4080,11 +4080,11 @@ msgstr "" " myobj_new, /* tp_new */\n" "};" -#: ../../c-api/typeobj.rst:2773 +#: ../../c-api/typeobj.rst:2775 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: ../../c-api/typeobj.rst:2775 +#: ../../c-api/typeobj.rst:2777 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4110,14 +4110,14 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2798 +#: ../../c-api/typeobj.rst:2800 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:2802 +#: ../../c-api/typeobj.rst:2804 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -4135,12 +4135,12 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2817 +#: ../../c-api/typeobj.rst:2819 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" -#: ../../c-api/typeobj.rst:2819 +#: ../../c-api/typeobj.rst:2821 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4160,13 +4160,13 @@ msgstr "" " .tp_name = \"mymod.MyObject\",\n" "};" -#: ../../c-api/typeobj.rst:2828 +#: ../../c-api/typeobj.rst:2830 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" msgstr "" -#: ../../c-api/typeobj.rst:2830 +#: ../../c-api/typeobj.rst:2832 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n" @@ -4192,14 +4192,14 @@ msgstr "" " .tp_itemsize = sizeof(char *),\n" "};" -#: ../../c-api/typeobj.rst:787 ../../c-api/typeobj.rst:852 +#: ../../c-api/typeobj.rst:800 ../../c-api/typeobj.rst:865 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/typeobj.rst:787 +#: ../../c-api/typeobj.rst:800 msgid "repr" msgstr "repr" -#: ../../c-api/typeobj.rst:852 +#: ../../c-api/typeobj.rst:865 msgid "hash" msgstr "hash(雜湊)" diff --git a/deprecations/c-api-pending-removal-in-3.15.po b/deprecations/c-api-pending-removal-in-3.15.po index 1c765579a9..e8ab611316 100644 --- a/deprecations/c-api-pending-removal-in-3.15.po +++ b/deprecations/c-api-pending-removal-in-3.15.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -61,16 +61,24 @@ msgstr "" "data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 -msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." -msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" +msgid "" +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." +"exec_prefix` instead." +msgstr "" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" +"`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 -msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." -msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" +msgid "" +":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " +"instead." +msgstr "" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." +"prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." diff --git a/deprecations/index.po b/deprecations/index.po index 24c3129544..9d2c3b3c16 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2024-11-10 17:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,22 +25,6 @@ msgid "Pending Removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/pending-removal-in-3.14.rst:4 -#: ../../deprecations/pending-removal-in-3.15.rst:4 -msgid "The import system:" -msgstr "引入系統 (import system):" - -#: ../../deprecations/pending-removal-in-3.14.rst:6 -msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader ` is deprecated. In " -"Python 3.14, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." -msgstr "" -"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " -"` 的做法已被棄用。在 Python 3.14 中," -"引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__` 。" - -#: ../../deprecations/pending-removal-in-3.14.rst:11 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " @@ -50,7 +34,7 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:16 +#: ../../deprecations/pending-removal-in-3.14.rst:9 msgid "" ":mod:`ast`: The following features have been deprecated in documentation " "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " @@ -59,38 +43,39 @@ msgstr "" ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" "於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" -#: ../../deprecations/pending-removal-in-3.14.rst:20 +#: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../deprecations/pending-removal-in-3.14.rst:21 +#: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../deprecations/pending-removal-in-3.14.rst:23 +#: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../deprecations/pending-removal-in-3.14.rst:24 +#: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../deprecations/pending-removal-in-3.14.rst:26 +#: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:29 +#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../deprecations/pending-removal-in-3.14.rst:31 +#: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" "The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" "`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" @@ -102,7 +87,7 @@ msgstr "" "AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " "Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:37 +#: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" "`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." @@ -114,7 +99,7 @@ msgstr "" "AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:43 +#: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " "now emits a :exc:`DeprecationWarning` if there is no current event loop set " @@ -125,7 +110,7 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:48 +#: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -137,7 +122,7 @@ msgstr "" "改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " "Shantanu Jain 於 :gh:`91896` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -145,39 +130,39 @@ msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:50 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:60 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:65 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:68 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:70 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -188,7 +173,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:76 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -205,7 +190,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -213,7 +198,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -223,27 +208,27 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../deprecations/pending-removal-in-3.14.rst:100 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -253,27 +238,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:106 -msgid "" -"date and datetime adapter, date and timestamp converter: see the :mod:" -"`sqlite3` documentation for suggested replacement recipes." -msgstr "" -"date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" -"參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" - -#: ../../deprecations/pending-removal-in-3.14.rst:109 -msgid "" -":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " -"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " -"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " -"in 3.14. (Contributed by Nikita Sobolev in :gh:`101866`.)" -msgstr "" -":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:116 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -281,7 +246,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:119 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -295,6 +260,11 @@ msgstr "" msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" +#: ../../deprecations/pending-removal-in-3.15.rst:4 +#: ../../deprecations/pending-removal-in-3.16.rst:4 +msgid "The import system:" +msgstr "引入系統 (import system):" + #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" "Setting :attr:`~module.__cached__` on a module while failing to set :attr:" @@ -408,10 +378,26 @@ msgstr "" "任意數量的位置或關鍵字引數,並忽略每個引數。" #: ../../deprecations/pending-removal-in-3.15.rst:62 +msgid ":mod:`types`:" +msgstr ":mod:`types`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:64 +msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" +":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -422,7 +408,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:70 +#: ../../deprecations/pending-removal-in-3.15.rst:79 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -432,11 +418,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:75 +#: ../../deprecations/pending-removal-in-3.15.rst:84 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:77 +#: ../../deprecations/pending-removal-in-3.15.rst:86 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -447,32 +433,25 @@ msgstr "" "getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 -msgid "Pending Removal in Python 3.16" +msgid "Pending removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" -#: ../../deprecations/pending-removal-in-3.16.rst:4 -#: ../../deprecations/pending-removal-in-future.rst:12 -msgid ":mod:`builtins`:" -msgstr ":mod:`builtins`:" - #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " -"deprecated since Python 3.12, as it produces surprising and unintuitive " -"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " -"of a Boolean. In the rare case that you need the bitwise inversion of the " -"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" -"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" -"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" -"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " -"``~int(x)`` (``~int(x)``)。" +"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " +"` 的做法將於 Python 3.16 被棄用。在 " +"Python 3.16 中,引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__`。" -#: ../../deprecations/pending-removal-in-3.16.rst:13 +#: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../deprecations/pending-removal-in-3.16.rst:15 +#: ../../deprecations/pending-removal-in-3.16.rst:13 msgid "" "The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " "documentation since Python 3.3 and at runtime since Python 3.13. Use the " @@ -483,10 +462,35 @@ msgstr "" "來取代 Unicode 字元。" #: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:26 +#: ../../deprecations/pending-removal-in-future.rst:12 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:35 msgid ":mod:`shutil`:" msgstr ":mod:`shutil`:" -#: ../../deprecations/pending-removal-in-3.16.rst:23 +#: ../../deprecations/pending-removal-in-3.16.rst:37 msgid "" "The :class:`!ExecError` exception has been deprecated since Python 3.14. It " "has not been used by any function in :mod:`!shutil` since Python 3.4, and is " @@ -495,11 +499,11 @@ msgstr "" "自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" "未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" -#: ../../deprecations/pending-removal-in-3.16.rst:28 +#: ../../deprecations/pending-removal-in-3.16.rst:42 msgid ":mod:`symtable`:" msgstr ":mod:`symtable`:" -#: ../../deprecations/pending-removal-in-3.16.rst:30 +#: ../../deprecations/pending-removal-in-3.16.rst:44 msgid "" "The :meth:`Class.get_methods ` method has been " "deprecated since Python 3.14." @@ -507,11 +511,11 @@ msgstr "" "自 Python 3.14 起,:meth:`Class.get_methods ` 方" "法已被棄用。" -#: ../../deprecations/pending-removal-in-3.16.rst:33 +#: ../../deprecations/pending-removal-in-3.16.rst:47 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../deprecations/pending-removal-in-3.16.rst:35 +#: ../../deprecations/pending-removal-in-3.16.rst:49 msgid "" "The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " "since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " @@ -520,11 +524,11 @@ msgstr "" "自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" -#: ../../deprecations/pending-removal-in-3.16.rst:39 +#: ../../deprecations/pending-removal-in-3.16.rst:53 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../deprecations/pending-removal-in-3.16.rst:41 +#: ../../deprecations/pending-removal-in-3.16.rst:55 msgid "" "The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " "deprecated since Python 3.13." @@ -1182,16 +1186,24 @@ msgstr "" "data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 -msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." -msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" +msgid "" +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." +"exec_prefix` instead." +msgstr "" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" +"`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 -msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." -msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" +msgid "" +":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " +"instead." +msgstr "" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." +"prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." @@ -1339,3 +1351,10 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-future.rst:50 msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" + +#~ msgid "" +#~ "date and datetime adapter, date and timestamp converter: see the :mod:" +#~ "`sqlite3` documentation for suggested replacement recipes." +#~ msgstr "" +#~ "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 " +#~ "(converter):請參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index a552eb8e16..c471f0275a 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2024-11-10 17:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,21 +20,6 @@ msgid "Pending Removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/pending-removal-in-3.14.rst:4 -msgid "The import system:" -msgstr "引入系統 (import system):" - -#: ../../deprecations/pending-removal-in-3.14.rst:6 -msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader ` is deprecated. In " -"Python 3.14, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." -msgstr "" -"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " -"` 的做法已被棄用。在 Python 3.14 中," -"引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__` 。" - -#: ../../deprecations/pending-removal-in-3.14.rst:11 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " @@ -44,7 +29,7 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:16 +#: ../../deprecations/pending-removal-in-3.14.rst:9 msgid "" ":mod:`ast`: The following features have been deprecated in documentation " "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " @@ -53,38 +38,38 @@ msgstr "" ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" "於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" -#: ../../deprecations/pending-removal-in-3.14.rst:20 +#: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../deprecations/pending-removal-in-3.14.rst:21 +#: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../deprecations/pending-removal-in-3.14.rst:23 +#: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../deprecations/pending-removal-in-3.14.rst:24 +#: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../deprecations/pending-removal-in-3.14.rst:26 +#: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:29 +#: ../../deprecations/pending-removal-in-3.14.rst:22 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../deprecations/pending-removal-in-3.14.rst:31 +#: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" "The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" "`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" @@ -96,7 +81,7 @@ msgstr "" "AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " "Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:37 +#: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" "`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." @@ -108,7 +93,7 @@ msgstr "" "AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:43 +#: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " "now emits a :exc:`DeprecationWarning` if there is no current event loop set " @@ -119,7 +104,7 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:48 +#: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -131,7 +116,7 @@ msgstr "" "改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " "Shantanu Jain 於 :gh:`91896` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -139,39 +124,39 @@ msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:50 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:60 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:65 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:68 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:70 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -182,7 +167,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:76 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -199,7 +184,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -207,7 +192,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -217,27 +202,27 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../deprecations/pending-removal-in-3.14.rst:100 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -247,27 +232,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:106 -msgid "" -"date and datetime adapter, date and timestamp converter: see the :mod:" -"`sqlite3` documentation for suggested replacement recipes." -msgstr "" -"date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" -"參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" - -#: ../../deprecations/pending-removal-in-3.14.rst:109 -msgid "" -":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " -"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " -"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " -"in 3.14. (Contributed by Nikita Sobolev in :gh:`101866`.)" -msgstr "" -":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:116 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -275,7 +240,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:119 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index 1fc15168f5..0f21b19e13 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2024-11-05 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -136,10 +136,26 @@ msgstr "" "任意數量的位置或關鍵字引數,並忽略每個引數。" #: ../../deprecations/pending-removal-in-3.15.rst:62 +msgid ":mod:`types`:" +msgstr ":mod:`types`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:64 +msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" +":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -150,7 +166,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:70 +#: ../../deprecations/pending-removal-in-3.15.rst:79 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -160,11 +176,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:75 +#: ../../deprecations/pending-removal-in-3.15.rst:84 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:77 +#: ../../deprecations/pending-removal-in-3.15.rst:86 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" diff --git a/deprecations/pending-removal-in-3.16.po b/deprecations/pending-removal-in-3.16.po index 80e023abb0..eec8eb350d 100644 --- a/deprecations/pending-removal-in-3.16.po +++ b/deprecations/pending-removal-in-3.16.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-11-10 17:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,31 +16,29 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/pending-removal-in-3.16.rst:2 -msgid "Pending Removal in Python 3.16" +msgid "Pending removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:4 -msgid ":mod:`builtins`:" -msgstr ":mod:`builtins`:" +msgid "The import system:" +msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " -"deprecated since Python 3.12, as it produces surprising and unintuitive " -"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " -"of a Boolean. In the rare case that you need the bitwise inversion of the " -"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" -"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" -"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" -"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " -"``~int(x)`` (``~int(x)``)。" +"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " +"` 的做法將於 Python 3.16 被棄用。在 " +"Python 3.16 中,引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__`。" -#: ../../deprecations/pending-removal-in-3.16.rst:13 +#: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../deprecations/pending-removal-in-3.16.rst:15 +#: ../../deprecations/pending-removal-in-3.16.rst:13 msgid "" "The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " "documentation since Python 3.3 and at runtime since Python 3.13. Use the " @@ -50,11 +48,39 @@ msgstr "" "Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " "來取代 Unicode 字元。" +#: ../../deprecations/pending-removal-in-3.16.rst:19 +msgid ":mod:`asyncio`:" +msgstr ":mod:`asyncio`:" + #: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:26 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:35 msgid ":mod:`shutil`:" msgstr ":mod:`shutil`:" -#: ../../deprecations/pending-removal-in-3.16.rst:23 +#: ../../deprecations/pending-removal-in-3.16.rst:37 msgid "" "The :class:`!ExecError` exception has been deprecated since Python 3.14. It " "has not been used by any function in :mod:`!shutil` since Python 3.4, and is " @@ -63,11 +89,11 @@ msgstr "" "自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" "未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" -#: ../../deprecations/pending-removal-in-3.16.rst:28 +#: ../../deprecations/pending-removal-in-3.16.rst:42 msgid ":mod:`symtable`:" msgstr ":mod:`symtable`:" -#: ../../deprecations/pending-removal-in-3.16.rst:30 +#: ../../deprecations/pending-removal-in-3.16.rst:44 msgid "" "The :meth:`Class.get_methods ` method has been " "deprecated since Python 3.14." @@ -75,11 +101,11 @@ msgstr "" "自 Python 3.14 起,:meth:`Class.get_methods ` 方" "法已被棄用。" -#: ../../deprecations/pending-removal-in-3.16.rst:33 +#: ../../deprecations/pending-removal-in-3.16.rst:47 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../deprecations/pending-removal-in-3.16.rst:35 +#: ../../deprecations/pending-removal-in-3.16.rst:49 msgid "" "The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " "since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " @@ -88,11 +114,11 @@ msgstr "" "自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" -#: ../../deprecations/pending-removal-in-3.16.rst:39 +#: ../../deprecations/pending-removal-in-3.16.rst:53 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../deprecations/pending-removal-in-3.16.rst:41 +#: ../../deprecations/pending-removal-in-3.16.rst:55 msgid "" "The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " "deprecated since Python 3.13." diff --git a/glossary.po b/glossary.po index 92507365c3..428ab89521 100644 --- a/glossary.po +++ b/glossary.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-14 00:14+0000\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -614,43 +614,74 @@ msgstr "" "忽略它們。" #: ../../glossary.rst:262 -msgid "context manager" -msgstr "context manager(情境管理器)" +msgid "context" +msgstr "context(情境)" #: ../../glossary.rst:264 msgid "" -"An object which controls the environment seen in a :keyword:`with` statement " -"by defining :meth:`~object.__enter__` and :meth:`~object.__exit__` methods. " -"See :pep:`343`." +"This term has different meanings depending on where and how it is used. Some " +"common meanings:" msgstr "" -"一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定義 :meth:" -"`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。請參閱 :pep:" -"`343`。" #: ../../glossary.rst:267 +msgid "" +"The temporary state or environment established by a :term:`context manager` " +"via a :keyword:`with` statement." +msgstr "" + +#: ../../glossary.rst:269 +msgid "" +"The collection of key­value bindings associated with a particular :class:" +"`contextvars.Context` object and accessed via :class:`~contextvars." +"ContextVar` objects. Also see :term:`context variable`." +msgstr "" + +#: ../../glossary.rst:273 +msgid "" +"A :class:`contextvars.Context` object. Also see :term:`current context`." +msgstr "" +"一個 :class:`contextvars.Context` 物件。另請參閱 :term:`current context`。" + +#: ../../glossary.rst:275 +msgid "context management protocol" +msgstr "context management protocol(情境管理協定)" + +#: ../../glossary.rst:277 +msgid "" +"The :meth:`~object.__enter__` and :meth:`~object.__exit__` methods called by " +"the :keyword:`with` statement. See :pep:`343`." +msgstr "" +"由 :keyword:`with` 陳述式所呼叫的 :meth:`~object.__enter__` 和 :meth:" +"`~object.__exit__` 方法。另請參閱 :pep:`343`。" + +#: ../../glossary.rst:279 +msgid "context manager" +msgstr "context manager(情境管理器)" + +#: ../../glossary.rst:281 +msgid "" +"An object which implements the :term:`context management protocol` and " +"controls the environment seen in a :keyword:`with` statement. See :pep:" +"`343`." +msgstr "" + +#: ../../glossary.rst:284 msgid "context variable" msgstr "context variable(情境變數)" -#: ../../glossary.rst:269 +#: ../../glossary.rst:286 msgid "" -"A variable which can have different values depending on its context. This is " -"similar to Thread-Local Storage in which each execution thread may have a " -"different value for a variable. However, with context variables, there may " -"be several contexts in one execution thread and the main usage for context " -"variables is to keep track of variables in concurrent asynchronous tasks. " -"See :mod:`contextvars`." +"A variable whose value depends on which context is the :term:`current " +"context`. Values are accessed via :class:`contextvars.ContextVar` objects. " +"Context variables are primarily used to isolate state between concurrent " +"asynchronous tasks." msgstr "" -"一個變數,其值可以根據上下文的情境而有所不同。這類似執行緒區域儲存區 (Thread-" -"Local Storage),在其中,一個變數在每個執行緒可能具有不同的值。然而,關於情境" -"變數,在一個執行緒中可能會有多個情境,而情境變數的主要用途,是在並行的非同步" -"任務 (concurrent asynchronous task) 中,對於變數狀態的追蹤。請參閱 :mod:" -"`contextvars`。" -#: ../../glossary.rst:276 +#: ../../glossary.rst:290 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../glossary.rst:280 +#: ../../glossary.rst:294 msgid "" "A buffer is considered contiguous exactly if it is either *C-contiguous* or " "*Fortran contiguous*. Zero-dimensional buffers are C and Fortran " @@ -667,11 +698,11 @@ msgstr "" "的順序訪問各個項目時,最後一個索引的變化最快。然而,在 Fortran contiguous 陣" "列中,第一個索引的變化最快。" -#: ../../glossary.rst:288 +#: ../../glossary.rst:302 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../glossary.rst:290 +#: ../../glossary.rst:304 msgid "" "Coroutines are a more generalized form of subroutines. Subroutines are " "entered at one point and exited at another point. Coroutines can be " @@ -682,11 +713,11 @@ msgstr "" "在另一個時間點被退出。協程可以在許多不同的時間點被進入、退出和回復。它們能夠" "以 :keyword:`async def` 陳述式被實作。另請參閱 :pep:`492`。" -#: ../../glossary.rst:295 +#: ../../glossary.rst:309 msgid "coroutine function" msgstr "coroutine function(協程函式)" -#: ../../glossary.rst:297 +#: ../../glossary.rst:311 msgid "" "A function which returns a :term:`coroutine` object. A coroutine function " "may be defined with the :keyword:`async def` statement, and may contain :" @@ -697,11 +728,11 @@ msgstr "" "`async def` 陳述式被定義,並可能會包含 :keyword:`await`、:keyword:`async " "for` 和 :keyword:`async with` 關鍵字。這些關鍵字由 :pep:`492` 引入。" -#: ../../glossary.rst:302 +#: ../../glossary.rst:316 msgid "CPython" msgstr "CPython" -#: ../../glossary.rst:304 +#: ../../glossary.rst:318 msgid "" "The canonical implementation of the Python programming language, as " "distributed on `python.org `_. The term \"CPython\" " @@ -712,11 +743,25 @@ msgstr "" "`_ 上。「CPython」這個術語在必要時被使用,以區分此實" "作與其它語言的實作,例如 Jython 或 IronPython。" -#: ../../glossary.rst:308 +#: ../../glossary.rst:322 +msgid "current context" +msgstr "" + +#: ../../glossary.rst:324 +msgid "" +"The :term:`context` (:class:`contextvars.Context` object) that is currently " +"used by :class:`~contextvars.ContextVar` objects to access (get or set) the " +"values of :term:`context variables `. Each thread has its " +"own current context. Frameworks for executing asynchronous tasks (see :mod:" +"`asyncio`) associate each task with a context which becomes the current " +"context whenever the task starts or resumes execution." +msgstr "" + +#: ../../glossary.rst:330 msgid "decorator" msgstr "decorator(裝飾器)" -#: ../../glossary.rst:310 +#: ../../glossary.rst:332 msgid "" "A function returning another function, usually applied as a function " "transformation using the ``@wrapper`` syntax. Common examples for " @@ -726,13 +771,13 @@ msgstr "" "式的變換 (function transformation)。裝飾器的常見範例是 :func:`classmethod` " "和 :func:`staticmethod`。" -#: ../../glossary.rst:314 +#: ../../glossary.rst:336 msgid "" "The decorator syntax is merely syntactic sugar, the following two function " "definitions are semantically equivalent::" msgstr "裝飾器語法只是語法糖。以下兩個函式定義在語義上是等效的: ::" -#: ../../glossary.rst:317 +#: ../../glossary.rst:339 msgid "" "def f(arg):\n" " ...\n" @@ -750,7 +795,7 @@ msgstr "" "def f(arg):\n" " ..." -#: ../../glossary.rst:325 +#: ../../glossary.rst:347 msgid "" "The same concept exists for classes, but is less commonly used there. See " "the documentation for :ref:`function definitions ` and :ref:`class " @@ -759,11 +804,11 @@ msgstr "" "Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱\\ :" "ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" -#: ../../glossary.rst:328 +#: ../../glossary.rst:350 msgid "descriptor" msgstr "descriptor(描述器)" -#: ../../glossary.rst:330 +#: ../../glossary.rst:352 msgid "" "Any object which defines the methods :meth:`~object.__get__`, :meth:`~object." "__set__`, or :meth:`~object.__delete__`. When a class attribute is a " @@ -783,7 +828,7 @@ msgstr "" "們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、class method、" "靜態 method,以及對 super class(父類別)的參照。" -#: ../../glossary.rst:341 +#: ../../glossary.rst:363 msgid "" "For more information about descriptors' methods, see :ref:`descriptors` or " "the :ref:`Descriptor How To Guide `." @@ -791,11 +836,11 @@ msgstr "" "關於描述器 method 的更多資訊,請參閱\\ :ref:`descriptors`\\ 或\\ :ref:`描述器" "使用指南 `。" -#: ../../glossary.rst:343 +#: ../../glossary.rst:365 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../glossary.rst:345 +#: ../../glossary.rst:367 msgid "" "An associative array, where arbitrary keys are mapped to values. The keys " "can be any object with :meth:`~object.__hash__` and :meth:`~object.__eq__` " @@ -805,11 +850,11 @@ msgstr "" "有 :meth:`~object.__hash__` 和 :meth:`~object.__eq__` method 的物件。在 Perl " "中被稱為雜湊 (hash)。" -#: ../../glossary.rst:349 +#: ../../glossary.rst:371 msgid "dictionary comprehension" msgstr "dictionary comprehension(字典綜合運算)" -#: ../../glossary.rst:351 +#: ../../glossary.rst:373 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a dictionary with the results. ``results = {n: n ** 2 for n in " @@ -820,11 +865,11 @@ msgstr "" "字典回傳。``results = {n: n ** 2 for n in range(10)}`` 會產生一個字典,它包含" "了鍵 ``n`` 對映到值 ``n ** 2``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:355 +#: ../../glossary.rst:377 msgid "dictionary view" msgstr "dictionary view(字典檢視)" -#: ../../glossary.rst:357 +#: ../../glossary.rst:379 msgid "" "The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:" "`dict.items` are called dictionary views. They provide a dynamic view on the " @@ -837,11 +882,11 @@ msgstr "" "反映這些變動。若要強制將字典檢視轉為完整的 list(串列),須使用 " "``list(dictview)``。請參閱\\ :ref:`dict-views`。" -#: ../../glossary.rst:363 +#: ../../glossary.rst:385 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../glossary.rst:365 +#: ../../glossary.rst:387 msgid "" "A string literal which appears as the first expression in a class, function " "or module. While ignored when the suite is executed, it is recognized by " @@ -854,11 +899,11 @@ msgstr "" "`~definition.__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏" "覽,因此它是物件的說明文件存放的標準位置。" -#: ../../glossary.rst:371 +#: ../../glossary.rst:393 msgid "duck-typing" msgstr "duck-typing(鴨子型別)" -#: ../../glossary.rst:373 +#: ../../glossary.rst:395 msgid "" "A programming style which does not look at an object's type to determine if " "it has the right interface; instead, the method or attribute is simply " @@ -879,11 +924,11 @@ msgstr "" "來補充。)然而,它通常會採用 :func:`hasattr` 測試,或是 :term:`EAFP` 程式設計" "風格。" -#: ../../glossary.rst:382 +#: ../../glossary.rst:404 msgid "EAFP" msgstr "EAFP" -#: ../../glossary.rst:384 +#: ../../glossary.rst:406 msgid "" "Easier to ask for forgiveness than permission. This common Python coding " "style assumes the existence of valid keys or attributes and catches " @@ -898,11 +943,11 @@ msgstr "" "keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見的 :term:`LBYL` 風" "格形成了對比。" -#: ../../glossary.rst:390 +#: ../../glossary.rst:412 msgid "expression" msgstr "expression(運算式)" -#: ../../glossary.rst:392 +#: ../../glossary.rst:414 msgid "" "A piece of syntax which can be evaluated to some value. In other words, an " "expression is an accumulation of expression elements like literals, names, " @@ -918,11 +963,11 @@ msgstr "" "(陳述式)不能被用作運算式,例如 :keyword:`while`。賦值 (assignment) 也是陳述" "式,而不是運算式。" -#: ../../glossary.rst:399 +#: ../../glossary.rst:421 msgid "extension module" msgstr "extension module(擴充模組)" -#: ../../glossary.rst:401 +#: ../../glossary.rst:423 msgid "" "A module written in C or C++, using Python's C API to interact with the core " "and with user code." @@ -930,11 +975,11 @@ msgstr "" "一個以 C 或 C++ 編寫的模組,它使用 Python 的 C API 來與核心及使用者程式碼進行" "互動。" -#: ../../glossary.rst:403 +#: ../../glossary.rst:425 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../glossary.rst:405 +#: ../../glossary.rst:427 msgid "" "String literals prefixed with ``'f'`` or ``'F'`` are commonly called \"f-" "strings\" which is short for :ref:`formatted string literals `. " @@ -943,11 +988,11 @@ msgstr "" "以 ``'f'`` 或 ``'F'`` 為前綴的字串文本通常被稱為「f 字串」,它是\\ :ref:`格式" "化的字串文本 `\\ 的縮寫。另請參閱 :pep:`498`。" -#: ../../glossary.rst:408 +#: ../../glossary.rst:430 msgid "file object" msgstr "file object(檔案物件)" -#: ../../glossary.rst:410 +#: ../../glossary.rst:432 msgid "" "An object exposing a file-oriented API (with methods such as :meth:`!read` " "or :meth:`!write`) to an underlying resource. Depending on the way it was " @@ -962,7 +1007,7 @@ msgstr "" "衝區、socket(插座)、管線 (pipe) 等)的存取。檔案物件也被稱為\\ :dfn:`類檔案" "物件 (file-like object)` 或\\ :dfn:`串流 (stream)`。" -#: ../../glossary.rst:418 +#: ../../glossary.rst:440 msgid "" "There are actually three categories of file objects: raw :term:`binary files " "`, buffered :term:`binary files ` and :term:`text " @@ -974,19 +1019,19 @@ msgstr "" "term:`二進位檔案 `\\ 和\\ :term:`文字檔案 `。它們的介" "面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函式。" -#: ../../glossary.rst:423 +#: ../../glossary.rst:445 msgid "file-like object" msgstr "file-like object(類檔案物件)" -#: ../../glossary.rst:425 +#: ../../glossary.rst:447 msgid "A synonym for :term:`file object`." msgstr ":term:`file object`\\ (檔案物件)的同義字。" -#: ../../glossary.rst:426 +#: ../../glossary.rst:448 msgid "filesystem encoding and error handler" msgstr "filesystem encoding and error handler(檔案系統編碼和錯誤處理函式)" -#: ../../glossary.rst:428 +#: ../../glossary.rst:450 msgid "" "Encoding and error handler used by Python to decode bytes from the operating " "system and encode Unicode to the operating system." @@ -994,7 +1039,7 @@ msgstr "" "Python 所使用的一種編碼和錯誤處理函式,用來解碼來自作業系統的位元組,以及將 " "Unicode 編碼到作業系統。" -#: ../../glossary.rst:431 +#: ../../glossary.rst:453 msgid "" "The filesystem encoding must guarantee to successfully decode all bytes " "below 128. If the file system encoding fails to provide this guarantee, API " @@ -1003,7 +1048,7 @@ msgstr "" "檔案系統編碼必須保證能成功解碼所有小於 128 的位元組。如果檔案系統編碼無法提供" "此保證,則 API 函式會引發 :exc:`UnicodeError`。" -#: ../../glossary.rst:435 +#: ../../glossary.rst:457 msgid "" "The :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors` functions can be used to get the filesystem " @@ -1012,7 +1057,7 @@ msgstr "" ":func:`sys.getfilesystemencoding` 和 :func:`sys.getfilesystemencodeerrors` 函" "式可用於取得檔案系統編碼和錯誤處理函式。" -#: ../../glossary.rst:439 +#: ../../glossary.rst:461 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " "startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." @@ -1024,22 +1069,22 @@ msgstr "" "member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成員 :c:" "member:`~PyConfig.filesystem_errors`。" -#: ../../glossary.rst:444 +#: ../../glossary.rst:466 msgid "See also the :term:`locale encoding`." msgstr "另請參閱 :term:`locale encoding`\\ (區域編碼)。" -#: ../../glossary.rst:445 +#: ../../glossary.rst:467 msgid "finder" msgstr "finder(尋檢器)" -#: ../../glossary.rst:447 +#: ../../glossary.rst:469 msgid "" "An object that tries to find the :term:`loader` for a module that is being " "imported." msgstr "" "一個物件,它會嘗試為正在被 import 的模組尋找 :term:`loader`\\ (載入器)。" -#: ../../glossary.rst:450 +#: ../../glossary.rst:472 msgid "" "There are two types of finder: :term:`meta path finders ` " "for use with :data:`sys.meta_path`, and :term:`path entry finders ` 會使用 :data:`sys.meta_path`,而\\ :term:`路徑項目尋檢器 (path " "entry finder) ` 會使用 :data:`sys.path_hooks`。" -#: ../../glossary.rst:454 +#: ../../glossary.rst:476 msgid "" "See :ref:`finders-and-loaders` and :mod:`importlib` for much more detail." msgstr "請參閱 :ref:`finders-and-loaders` 和 :mod:`importlib` 以了解更多細節。" -#: ../../glossary.rst:455 +#: ../../glossary.rst:477 msgid "floor division" msgstr "floor division(向下取整除法)" -#: ../../glossary.rst:457 +#: ../../glossary.rst:479 msgid "" "Mathematical division that rounds down to nearest integer. The floor " "division operator is ``//``. For example, the expression ``11 // 4`` " @@ -1071,11 +1116,11 @@ msgstr "" "``2.75`` 不同。請注意,``(-11) // 4`` 的結果是 ``-3``,因為是 ``-2.75`` 被\\ " "*向下*\\ 無條件捨去。請參閱 :pep:`238`。" -#: ../../glossary.rst:462 +#: ../../glossary.rst:484 msgid "free threading" msgstr "free threading(自由執行緒)" -#: ../../glossary.rst:464 +#: ../../glossary.rst:486 msgid "" "A threading model where multiple threads can run Python bytecode " "simultaneously within the same interpreter. This is in contrast to the :" @@ -1086,11 +1131,11 @@ msgstr "" "\\ :term:`全域直譯器鎖 `\\ 形成對比,後者一次只允許" "一個執行緒執行 Python 位元組碼。請參閱 :pep:`703`。" -#: ../../glossary.rst:468 +#: ../../glossary.rst:490 msgid "free variable" msgstr "free variable(自由變數)" -#: ../../glossary.rst:470 +#: ../../glossary.rst:492 msgid "" "Formally, as defined in the :ref:`language execution model `, a " "free variable is any variable used in a namespace which is not a local " @@ -1100,11 +1145,11 @@ msgid "" "variable`." msgstr "" -#: ../../glossary.rst:475 +#: ../../glossary.rst:497 msgid "function" msgstr "function(函式)" -#: ../../glossary.rst:477 +#: ../../glossary.rst:499 msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments ` which may be used in the " @@ -1116,15 +1161,15 @@ msgstr "" "`parameter`\\ (參數)、:term:`method`\\ (方法),以及\\ :ref:`function`\\ " "章節。" -#: ../../glossary.rst:481 +#: ../../glossary.rst:503 msgid "function annotation" msgstr "function annotation(函式註釋)" -#: ../../glossary.rst:483 +#: ../../glossary.rst:505 msgid "An :term:`annotation` of a function parameter or return value." msgstr "函式參數或回傳值的一個 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:485 +#: ../../glossary.rst:507 msgid "" "Function annotations are usually used for :term:`type hints `: " "for example, this function is expected to take two :class:`int` arguments " @@ -1133,7 +1178,7 @@ msgstr "" "函式註釋通常被使用於\\ :term:`型別提示 `:例如,這個函式預期會得到" "兩個 :class:`int` 引數,並會有一個 :class:`int` 回傳值: ::" -#: ../../glossary.rst:490 +#: ../../glossary.rst:512 msgid "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" @@ -1141,11 +1186,11 @@ msgstr "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" -#: ../../glossary.rst:493 +#: ../../glossary.rst:515 msgid "Function annotation syntax is explained in section :ref:`function`." msgstr "函式註釋的語法在\\ :ref:`function`\\ 章節有詳細解釋。" -#: ../../glossary.rst:495 +#: ../../glossary.rst:517 msgid "" "See :term:`variable annotation` and :pep:`484`, which describe this " "functionality. Also see :ref:`annotations-howto` for best practices on " @@ -1154,11 +1199,11 @@ msgstr "" "請參閱 :term:`variable annotation` 和 :pep:`484`,皆有此功能的描述。關於註釋" "的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:499 +#: ../../glossary.rst:521 msgid "__future__" msgstr "__future__" -#: ../../glossary.rst:501 +#: ../../glossary.rst:523 msgid "" "A :ref:`future statement `, ``from __future__ import ``, " "directs the compiler to compile the current module using syntax or semantics " @@ -1174,7 +1219,7 @@ msgstr "" "import 此模組並對其變數求值,你可以看見一個新的功能是何時首次被新增到此語言" "中,以及它何時將會(或已經)成為預設的功能: ::" -#: ../../glossary.rst:509 +#: ../../glossary.rst:531 msgid "" ">>> import __future__\n" ">>> __future__.division\n" @@ -1184,11 +1229,11 @@ msgstr "" ">>> __future__.division\n" "_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)" -#: ../../glossary.rst:512 +#: ../../glossary.rst:534 msgid "garbage collection" msgstr "garbage collection(垃圾回收)" -#: ../../glossary.rst:514 +#: ../../glossary.rst:536 msgid "" "The process of freeing memory when it is not used anymore. Python performs " "garbage collection via reference counting and a cyclic garbage collector " @@ -1200,11 +1245,11 @@ msgstr "" "垃圾回收器 (cyclic garbage collector) 來完成。垃圾回收器可以使用 :mod:`gc` 模" "組對其進行控制。" -#: ../../glossary.rst:519 ../../glossary.rst:520 +#: ../../glossary.rst:541 ../../glossary.rst:542 msgid "generator" msgstr "generator(產生器)" -#: ../../glossary.rst:522 +#: ../../glossary.rst:544 msgid "" "A function which returns a :term:`generator iterator`. It looks like a " "normal function except that it contains :keyword:`yield` expressions for " @@ -1215,7 +1260,7 @@ msgstr "" "個正常的函式,但不同的是它包含了 :keyword:`yield` 運算式,能產生一系列的值," "這些值可用於 for 迴圈,或是以 :func:`next` 函式,每次檢索其中的一個值。" -#: ../../glossary.rst:527 +#: ../../glossary.rst:549 msgid "" "Usually refers to a generator function, but may refer to a *generator " "iterator* in some contexts. In cases where the intended meaning isn't " @@ -1224,15 +1269,15 @@ msgstr "" "這個術語通常用來表示一個產生器函式,但在某些情境中,也可能是表示\\ *產生器疊" "代器*。萬一想表達的意思不夠清楚,那就使用完整的術語,以避免歧義。" -#: ../../glossary.rst:530 +#: ../../glossary.rst:552 msgid "generator iterator" msgstr "generator iterator(產生器疊代器)" -#: ../../glossary.rst:532 +#: ../../glossary.rst:554 msgid "An object created by a :term:`generator` function." msgstr "一個由 :term:`generator`\\ (產生器)函式所建立的物件。" -#: ../../glossary.rst:534 +#: ../../glossary.rst:556 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "location execution state (including local variables and pending try-" @@ -1243,11 +1288,11 @@ msgstr "" "中的 try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與" "那些每次調用時都要重新開始的函式有所不同)。" -#: ../../glossary.rst:540 ../../glossary.rst:541 +#: ../../glossary.rst:562 ../../glossary.rst:563 msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../glossary.rst:543 +#: ../../glossary.rst:565 msgid "" "An :term:`expression` that returns an :term:`iterator`. It looks like a " "normal expression followed by a :keyword:`!for` clause defining a loop " @@ -1259,7 +1304,7 @@ msgstr "" "變數、範圍以及一個選擇性的 :keyword:`!if` 子句。該組合運算式會為外層函式產生" "多個值: ::" -#: ../../glossary.rst:548 +#: ../../glossary.rst:570 msgid "" ">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" "285" @@ -1267,11 +1312,11 @@ msgstr "" ">>> sum(i*i for i in range(10)) # 平方之和 0, 1, 4, ... 81\n" "285" -#: ../../glossary.rst:550 +#: ../../glossary.rst:572 msgid "generic function" msgstr "generic function(泛型函式)" -#: ../../glossary.rst:552 +#: ../../glossary.rst:574 msgid "" "A function composed of multiple functions implementing the same operation " "for different types. Which implementation should be used during a call is " @@ -1280,7 +1325,7 @@ msgstr "" "一個由多個函式組成的函式,該函式會對不同的型別實作相同的運算。呼叫期間應該使" "用哪種實作,是由調度演算法 (dispatch algorithm) 來決定。" -#: ../../glossary.rst:556 +#: ../../glossary.rst:578 msgid "" "See also the :term:`single dispatch` glossary entry, the :func:`functools." "singledispatch` decorator, and :pep:`443`." @@ -1288,11 +1333,11 @@ msgstr "" "另請參閱 :term:`single dispatch`\\ (單一調度)術語表條目、:func:`functools." "singledispatch` 裝飾器和 :pep:`443`。" -#: ../../glossary.rst:558 +#: ../../glossary.rst:580 msgid "generic type" msgstr "generic type(泛型型別)" -#: ../../glossary.rst:560 +#: ../../glossary.rst:582 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " "class` such as :class:`list` or :class:`dict`. Used for :" @@ -1302,7 +1347,7 @@ msgstr "" "`容器型別 `,像是 :class:`list` 和 :class:`dict`。它被用於" "\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" -#: ../../glossary.rst:565 +#: ../../glossary.rst:587 msgid "" "For more details, see :ref:`generic alias types`, :pep:" "`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." @@ -1310,19 +1355,19 @@ msgstr "" "詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:" "`484`、:pep:`585` 和 :mod:`typing` 模組。" -#: ../../glossary.rst:567 +#: ../../glossary.rst:589 msgid "GIL" msgstr "GIL" -#: ../../glossary.rst:569 +#: ../../glossary.rst:591 msgid "See :term:`global interpreter lock`." msgstr "請參閱 :term:`global interpreter lock`\\ (全域直譯器鎖)。" -#: ../../glossary.rst:570 +#: ../../glossary.rst:592 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../glossary.rst:572 +#: ../../glossary.rst:594 msgid "" "The mechanism used by the :term:`CPython` interpreter to assure that only " "one thread executes Python :term:`bytecode` at a time. This simplifies the " @@ -1339,7 +1384,7 @@ msgstr "" "(multi-threaded),但代價是會犧牲掉多處理器的機器能夠提供的一大部分平行性 " "(parallelism)。" -#: ../../glossary.rst:581 +#: ../../glossary.rst:603 msgid "" "However, some extension modules, either standard or third-party, are " "designed so as to release the GIL when doing computationally intensive tasks " @@ -1350,7 +1395,7 @@ msgstr "" "計算密集 (computationally intensive) 的任務時,可以解除 GIL。另外,在執行 I/" "O 時,GIL 總是會被解除。" -#: ../../glossary.rst:586 +#: ../../glossary.rst:608 msgid "" "As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil` " "build configuration. After building Python with this option, code must be " @@ -1365,11 +1410,11 @@ msgstr "" "多執行緒應用程式的效能,並使多核心 CPU 的高效使用變得更加容易。有關更多詳細資" "訊,請參閱 :pep:`703`。" -#: ../../glossary.rst:592 +#: ../../glossary.rst:614 msgid "hash-based pyc" msgstr "hash-based pyc(雜湊架構的 pyc)" -#: ../../glossary.rst:594 +#: ../../glossary.rst:616 msgid "" "A bytecode cache file that uses the hash rather than the last-modified time " "of the corresponding source file to determine its validity. See :ref:`pyc-" @@ -1378,11 +1423,11 @@ msgstr "" "一個位元組碼 (bytecode) 暫存檔,它使用雜湊值而不是對應原始檔案的最後修改時" "間,來確定其有效性。請參閱\\ :ref:`pyc-invalidation`。" -#: ../../glossary.rst:597 +#: ../../glossary.rst:619 msgid "hashable" msgstr "hashable(可雜湊的)" -#: ../../glossary.rst:599 +#: ../../glossary.rst:621 msgid "" "An object is *hashable* if it has a hash value which never changes during " "its lifetime (it needs a :meth:`~object.__hash__` method), and can be " @@ -1394,7 +1439,7 @@ msgstr "" "`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結果為相等的" "多個可雜湊物件,它們必須擁有相同的雜湊值。" -#: ../../glossary.rst:605 +#: ../../glossary.rst:627 msgid "" "Hashability makes an object usable as a dictionary key and a set member, " "because these data structures use the hash value internally." @@ -1402,7 +1447,7 @@ msgstr "" "可雜湊性 (hashability) 使一個物件可用作 dictionary(字典)的鍵和 set(集合)" "的成員,因為這些資料結構都在其內部使用了雜湊值。" -#: ../../glossary.rst:608 +#: ../../glossary.rst:630 msgid "" "Most of Python's immutable built-in objects are hashable; mutable containers " "(such as lists or dictionaries) are not; immutable containers (such as " @@ -1417,11 +1462,11 @@ msgstr "" "則這些物件會被預設為可雜湊的。它們在互相比較時都是不相等的(除非它們與自己比" "較),而它們的雜湊值則是衍生自它們的 :func:`id`。" -#: ../../glossary.rst:615 +#: ../../glossary.rst:637 msgid "IDLE" msgstr "IDLE" -#: ../../glossary.rst:617 +#: ../../glossary.rst:639 msgid "" "An Integrated Development and Learning Environment for Python. :ref:`idle` " "is a basic editor and interpreter environment which ships with the standard " @@ -1431,17 +1476,17 @@ msgstr "" "境)。:ref:`idle` 是一個基本的編輯器和直譯器環境,它和 Python 的標準發行版本" "一起被提供。" -#: ../../glossary.rst:620 +#: ../../glossary.rst:642 msgid "immortal" msgstr "immportal(不滅)" -#: ../../glossary.rst:622 +#: ../../glossary.rst:644 msgid "" "*Immortal objects* are a CPython implementation detail introduced in :pep:" "`683`." msgstr "*不滅物件 (Immortal objects)* 是 :pep:`683` 引入的 CPython 實作細節。" -#: ../../glossary.rst:625 +#: ../../glossary.rst:647 msgid "" "If an object is immortal, its :term:`reference count` is never modified, and " "therefore it is never deallocated while the interpreter is running. For " @@ -1451,11 +1496,11 @@ msgstr "" "修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` 和 :const:" "`None` 在 CPython 中是不滅的。" -#: ../../glossary.rst:628 +#: ../../glossary.rst:650 msgid "immutable" msgstr "immutable(不可變物件)" -#: ../../glossary.rst:630 +#: ../../glossary.rst:652 msgid "" "An object with a fixed value. Immutable objects include numbers, strings " "and tuples. Such an object cannot be altered. A new object has to be " @@ -1467,11 +1512,11 @@ msgstr "" "能被改變的。如果一個不同的值必須被儲存,則必須建立一個新的物件。它們在需要恆" "定雜湊值的地方,扮演重要的角色,例如 dictionary(字典)中的一個鍵。" -#: ../../glossary.rst:635 +#: ../../glossary.rst:657 msgid "import path" msgstr "import path(引入路徑)" -#: ../../glossary.rst:637 +#: ../../glossary.rst:659 msgid "" "A list of locations (or :term:`path entries `) that are searched " "by the :term:`path based finder` for modules to import. During import, this " @@ -1483,11 +1528,11 @@ msgstr "" "的位置。在 import 期間,此位置列表通常是來自 :data:`sys.path`,但對於子套件 " "(subpackage) 而言,它也可能是來自父套件的 ``__path__`` 屬性。" -#: ../../glossary.rst:642 +#: ../../glossary.rst:664 msgid "importing" msgstr "importing(引入)" -#: ../../glossary.rst:644 +#: ../../glossary.rst:666 msgid "" "The process by which Python code in one module is made available to Python " "code in another module." @@ -1495,11 +1540,11 @@ msgstr "" "一個過程。一個模組中的 Python 程式碼可以透過此過程,被另一個模組中的 Python " "程式碼使用。" -#: ../../glossary.rst:646 +#: ../../glossary.rst:668 msgid "importer" msgstr "importer(引入器)" -#: ../../glossary.rst:648 +#: ../../glossary.rst:670 msgid "" "An object that both finds and loads a module; both a :term:`finder` and :" "term:`loader` object." @@ -1507,11 +1552,11 @@ msgstr "" "一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也是 :term:" "`loader`\\ (載入器)物件。" -#: ../../glossary.rst:650 +#: ../../glossary.rst:672 msgid "interactive" msgstr "interactive(互動的)" -#: ../../glossary.rst:652 +#: ../../glossary.rst:674 msgid "" "Python has an interactive interpreter which means you can enter statements " "and expressions at the interpreter prompt, immediately execute them and see " @@ -1525,11 +1570,11 @@ msgstr "" "從你的電腦的主選單選擇它)。這是測試新想法或檢查模塊和包的非常強大的方法(請" "記住help(x))。更多互動式模式相關資訊請見 :ref:`tut-interac`。" -#: ../../glossary.rst:659 +#: ../../glossary.rst:681 msgid "interpreted" msgstr "interpreted(直譯的)" -#: ../../glossary.rst:661 +#: ../../glossary.rst:683 msgid "" "Python is an interpreted language, as opposed to a compiled one, though the " "distinction can be blurry because of the presence of the bytecode compiler. " @@ -1543,11 +1588,11 @@ msgstr "" "一個執行檔,然後再執行它。直譯語言通常比編譯語言有更短的開發/除錯週期,不過" "它們的程式通常也運行得較慢。另請參閱 :term:`interactive`\\ (互動的)。" -#: ../../glossary.rst:668 +#: ../../glossary.rst:690 msgid "interpreter shutdown" msgstr "interpreter shutdown(直譯器關閉)" -#: ../../glossary.rst:670 +#: ../../glossary.rst:692 msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " @@ -1565,18 +1610,18 @@ msgstr "" "段被執行的程式碼會遇到各種例外,因為它所依賴的資源可能不再有作用了(常見的例" "子是函式庫模組或是警告機制)。" -#: ../../glossary.rst:679 +#: ../../glossary.rst:701 msgid "" "The main reason for interpreter shutdown is that the ``__main__`` module or " "the script being run has finished executing." msgstr "" "直譯器關閉的主要原因,是 ``__main__`` 模組或正被運行的腳本已經執行完成。" -#: ../../glossary.rst:681 +#: ../../glossary.rst:703 msgid "iterable" msgstr "iterable(可疊代物件)" -#: ../../glossary.rst:683 +#: ../../glossary.rst:705 msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " @@ -1592,7 +1637,7 @@ msgstr "" "`sequence`\\ (序列)語意的 :meth:`~object.__getitem__` method,該物件就是可" "疊代物件。" -#: ../../glossary.rst:691 +#: ../../glossary.rst:713 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " @@ -1612,11 +1657,11 @@ msgstr "" "數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代器)、:" "term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" -#: ../../glossary.rst:701 +#: ../../glossary.rst:723 msgid "iterator" msgstr "iterator(疊代器)" -#: ../../glossary.rst:703 +#: ../../glossary.rst:725 msgid "" "An object representing a stream of data. Repeated calls to the iterator's :" "meth:`~iterator.__next__` method (or passing it to the built-in function :" @@ -1645,11 +1690,11 @@ msgstr "" "此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一個已被用盡的疊代器物" "件,使其看起來就像一個空的容器。" -#: ../../glossary.rst:718 +#: ../../glossary.rst:740 msgid "More information can be found in :ref:`typeiter`." msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" -#: ../../glossary.rst:722 +#: ../../glossary.rst:744 msgid "" "CPython does not consistently apply the requirement that an iterator define :" "meth:`~iterator.__iter__`. And also please note that the free-threading " @@ -1659,11 +1704,11 @@ msgstr "" "__iter__`\\ 」這個規定。另請注意,free-threading(自由執行緒)CPython 不保證" "疊代器操作的執行緒安全。" -#: ../../glossary.rst:727 +#: ../../glossary.rst:749 msgid "key function" msgstr "key function(鍵函式)" -#: ../../glossary.rst:729 +#: ../../glossary.rst:751 msgid "" "A key function or collation function is a callable that returns a value used " "for sorting or ordering. For example, :func:`locale.strxfrm` is used to " @@ -1673,7 +1718,7 @@ msgstr "" "一個用於排序 (sorting) 或定序 (ordering) 的值。例如,:func:`locale.strxfrm` " "被用來產生一個了解區域特定排序慣例的排序鍵。" -#: ../../glossary.rst:734 +#: ../../glossary.rst:756 msgid "" "A number of tools in Python accept key functions to control how elements are " "ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" @@ -1685,7 +1730,7 @@ msgstr "" "merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` 和 :func:`itertools." "groupby`。" -#: ../../glossary.rst:740 +#: ../../glossary.rst:762 msgid "" "There are several ways to create a key function. For example. the :meth:" "`str.lower` method can serve as a key function for case insensitive sorts. " @@ -1702,19 +1747,19 @@ msgstr "" "式 (constructor)。關於如何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 " "`。" -#: ../../glossary.rst:747 +#: ../../glossary.rst:769 msgid "keyword argument" msgstr "keyword argument(關鍵字引數)" -#: ../../glossary.rst:749 ../../glossary.rst:1053 +#: ../../glossary.rst:771 ../../glossary.rst:1075 msgid "See :term:`argument`." msgstr "請參閱 :term:`argument`\\ (引數)。" -#: ../../glossary.rst:750 +#: ../../glossary.rst:772 msgid "lambda" msgstr "lambda" -#: ../../glossary.rst:752 +#: ../../glossary.rst:774 msgid "" "An anonymous inline function consisting of a single :term:`expression` which " "is evaluated when the function is called. The syntax to create a lambda " @@ -1724,11 +1769,11 @@ msgstr "" "function),於該函式被呼叫時求值。建立 lambda 函式的語法是 ``lambda " "[parameters]: expression``" -#: ../../glossary.rst:755 +#: ../../glossary.rst:777 msgid "LBYL" msgstr "LBYL" -#: ../../glossary.rst:757 +#: ../../glossary.rst:779 msgid "" "Look before you leap. This coding style explicitly tests for pre-conditions " "before making calls or lookups. This style contrasts with the :term:`EAFP` " @@ -1739,7 +1784,7 @@ msgstr "" "地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許多 :" "keyword:`if` 陳述式的存在。" -#: ../../glossary.rst:762 +#: ../../glossary.rst:784 msgid "" "In a multi-threaded environment, the LBYL approach can risk introducing a " "race condition between \"the looking\" and \"the leaping\". For example, " @@ -1753,11 +1798,11 @@ msgstr "" "了 *key*,則該程式碼就會失效。這個問題可以用鎖 (lock) 或使用 EAFP 編碼方式來" "解決。" -#: ../../glossary.rst:767 +#: ../../glossary.rst:789 msgid "list" msgstr "list(串列)" -#: ../../glossary.rst:769 +#: ../../glossary.rst:791 msgid "" "A built-in Python :term:`sequence`. Despite its name it is more akin to an " "array in other languages than to a linked list since access to elements is " @@ -1767,11 +1812,11 @@ msgstr "" "似其他語言中的一個陣列 (array) 而較不像一個鏈結串列 (linked list),因為存取元" "素的時間複雜度是 *O*\\ (1)。" -#: ../../glossary.rst:772 +#: ../../glossary.rst:794 msgid "list comprehension" msgstr "list comprehension(串列綜合運算)" -#: ../../glossary.rst:774 +#: ../../glossary.rst:796 msgid "" "A compact way to process all or part of the elements in a sequence and " "return a list with the results. ``result = ['{:#04x}'.format(x) for x in " @@ -1785,11 +1830,11 @@ msgstr "" "keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有元素都會被" "處理。" -#: ../../glossary.rst:780 +#: ../../glossary.rst:802 msgid "loader" msgstr "loader(載入器)" -#: ../../glossary.rst:782 +#: ../../glossary.rst:804 msgid "" "An object that loads a module. It must define a method named :meth:" "`load_module`. A loader is typically returned by a :term:`finder`. See also:" @@ -1797,23 +1842,23 @@ msgstr "" "一個能夠載入模組的物件。它必須定義一個名為 :meth:`load_module` 的 method(方" "法)。載入器通常是被 :term:`finder`\\ (尋檢器)回傳。更多細節請參閱:" -#: ../../glossary.rst:786 +#: ../../glossary.rst:808 msgid ":ref:`finders-and-loaders`" msgstr ":ref:`finders-and-loaders`" -#: ../../glossary.rst:787 +#: ../../glossary.rst:809 msgid ":class:`importlib.abc.Loader`" msgstr ":class:`importlib.abc.Loader`" -#: ../../glossary.rst:788 +#: ../../glossary.rst:810 msgid ":pep:`302`" msgstr ":pep:`302`" -#: ../../glossary.rst:789 +#: ../../glossary.rst:811 msgid "locale encoding" msgstr "locale encoding(區域編碼)" -#: ../../glossary.rst:791 +#: ../../glossary.rst:813 msgid "" "On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" "`locale.setlocale(locale.LC_CTYPE, new_locale) `." @@ -1821,36 +1866,36 @@ msgstr "" "在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以用 :func:`locale." "setlocale(locale.LC_CTYPE, new_locale) ` 來設定。" -#: ../../glossary.rst:794 +#: ../../glossary.rst:816 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." msgstr "在 Windows 上,它是 ANSI 代碼頁(code page,例如 ``\"cp1252\"``\\ )。" -#: ../../glossary.rst:796 +#: ../../glossary.rst:818 msgid "" "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "在 Android 和 VxWorks 上,Python 使用 ``\"utf-8\"`` 作為區域編碼。" -#: ../../glossary.rst:798 +#: ../../glossary.rst:820 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr ":func:`locale.getencoding` 可以用來取得區域編碼。" -#: ../../glossary.rst:800 +#: ../../glossary.rst:822 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "也請參考 :term:`filesystem encoding and error handler`。" -#: ../../glossary.rst:801 +#: ../../glossary.rst:823 msgid "magic method" msgstr "magic method(魔術方法)" -#: ../../glossary.rst:805 +#: ../../glossary.rst:827 msgid "An informal synonym for :term:`special method`." msgstr ":term:`special method`\\ (特殊方法)的一個非正式同義詞。" -#: ../../glossary.rst:806 +#: ../../glossary.rst:828 msgid "mapping" msgstr "mapping(對映)" -#: ../../glossary.rst:808 +#: ../../glossary.rst:830 msgid "" "A container object that supports arbitrary key lookups and implements the " "methods specified in the :class:`collections.abc.Mapping` or :class:" @@ -1865,11 +1910,11 @@ msgstr "" "包括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections." "OrderedDict` 和 :class:`collections.Counter`。" -#: ../../glossary.rst:814 +#: ../../glossary.rst:836 msgid "meta path finder" msgstr "meta path finder(元路徑尋檢器)" -#: ../../glossary.rst:816 +#: ../../glossary.rst:838 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders ` " "相關但是不同。" -#: ../../glossary.rst:820 +#: ../../glossary.rst:842 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." msgstr "" "關於元路徑尋檢器實作的 method,請參閱 :class:`importlib.abc.MetaPathFinder`。" -#: ../../glossary.rst:822 +#: ../../glossary.rst:844 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../glossary.rst:824 +#: ../../glossary.rst:846 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -1910,15 +1955,15 @@ msgstr "" "性存取、增加執行緒安全性、追蹤物件建立、實作單例模式 (singleton),以及許多其" "他的任務。" -#: ../../glossary.rst:834 +#: ../../glossary.rst:856 msgid "More information can be found in :ref:`metaclasses`." msgstr "更多資訊可以在\\ :ref:`metaclasses`\\ 章節中找到。" -#: ../../glossary.rst:803 ../../glossary.rst:835 ../../glossary.rst:1198 +#: ../../glossary.rst:825 ../../glossary.rst:857 ../../glossary.rst:1220 msgid "method" msgstr "method(方法)" -#: ../../glossary.rst:837 +#: ../../glossary.rst:859 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " @@ -1930,11 +1975,11 @@ msgstr "" "通常被稱為 ``self``)。請參閱 :term:`function`\\ (函式)和 :term:`nested " "scope`\\ (巢狀作用域)。" -#: ../../glossary.rst:841 +#: ../../glossary.rst:863 msgid "method resolution order" msgstr "method resolution order(方法解析順序)" -#: ../../glossary.rst:843 +#: ../../glossary.rst:865 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See :ref:`python_2.3_mro` for details of the " @@ -1943,11 +1988,11 @@ msgstr "" "方法解析順序是在查找某個成員的過程中,base class(基底類別)被搜尋的順序。關" "於 Python 自 2.3 版直譯器所使用的演算法細節,請參閱 :ref:`python_2.3_mro`。" -#: ../../glossary.rst:846 +#: ../../glossary.rst:868 msgid "module" msgstr "module(模組)" -#: ../../glossary.rst:848 +#: ../../glossary.rst:870 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -1957,15 +2002,15 @@ msgstr "" "空間,它包含任意的 Python 物件。模組是藉由 :term:`importing` 的過程,被載入" "至 Python。" -#: ../../glossary.rst:852 +#: ../../glossary.rst:874 msgid "See also :term:`package`." msgstr "另請參閱 :term:`package`\\ (套件)。" -#: ../../glossary.rst:853 +#: ../../glossary.rst:875 msgid "module spec" msgstr "module spec(模組規格)" -#: ../../glossary.rst:855 +#: ../../glossary.rst:877 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." @@ -1973,23 +2018,23 @@ msgstr "" "一個命名空間,它包含用於載入模組的 import 相關資訊。它是 :class:`importlib." "machinery.ModuleSpec` 的一個實例。" -#: ../../glossary.rst:858 +#: ../../glossary.rst:880 msgid "See also :ref:`module-specs`." msgstr "另請參閱 :ref:`module-specs`。" -#: ../../glossary.rst:859 +#: ../../glossary.rst:881 msgid "MRO" msgstr "MRO" -#: ../../glossary.rst:861 +#: ../../glossary.rst:883 msgid "See :term:`method resolution order`." msgstr "請參閱 :term:`method resolution order`\\ (方法解析順序)。" -#: ../../glossary.rst:862 +#: ../../glossary.rst:884 msgid "mutable" msgstr "mutable(可變物件)" -#: ../../glossary.rst:864 +#: ../../glossary.rst:886 msgid "" "Mutable objects can change their value but keep their :func:`id`. See also :" "term:`immutable`." @@ -1997,11 +2042,11 @@ msgstr "" "可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參閱 :term:" "`immutable`\\ (不可變物件)。" -#: ../../glossary.rst:866 +#: ../../glossary.rst:888 msgid "named tuple" msgstr "named tuple(附名元組)" -#: ../../glossary.rst:868 +#: ../../glossary.rst:890 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -2011,7 +2056,7 @@ msgstr "" "索引 (indexable) 元素也可以用附名屬性來存取。這些型別或 class 也可以具有其他" "的特性。" -#: ../../glossary.rst:872 +#: ../../glossary.rst:894 msgid "" "Several built-in types are named tuples, including the values returned by :" "func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." @@ -2020,7 +2065,7 @@ msgstr "" "有些內建型別是 named tuple,包括由 :func:`time.localtime` 和 :func:`os.stat` " "回傳的值。另一個例子是 :data:`sys.float_info`: ::" -#: ../../glossary.rst:876 +#: ../../glossary.rst:898 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -2030,7 +2075,7 @@ msgid "" "True" msgstr "" -#: ../../glossary.rst:883 +#: ../../glossary.rst:905 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " @@ -2047,11 +2092,11 @@ msgstr "" "namedtuple` 來建立。後者技術也增加了一些額外的 method,這些 method 可能是在手" "寫或內建的 named tuple 中,無法找到的。" -#: ../../glossary.rst:891 +#: ../../glossary.rst:913 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../glossary.rst:893 +#: ../../glossary.rst:915 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " @@ -2071,11 +2116,11 @@ msgstr "" "func:`itertools.islice` 明確地表示,這些函式分別是由 :mod:`random` 和 :mod:" "`itertools` 模組在實作。" -#: ../../glossary.rst:903 +#: ../../glossary.rst:925 msgid "namespace package" msgstr "namespace package(命名空間套件)" -#: ../../glossary.rst:905 +#: ../../glossary.rst:927 msgid "" "A :pep:`420` :term:`package` which serves only as a container for " "subpackages. Namespace packages may have no physical representation, and " @@ -2086,15 +2131,15 @@ msgstr "" "一個容器。命名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:" "`regular package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" -#: ../../glossary.rst:910 +#: ../../glossary.rst:932 msgid "See also :term:`module`." msgstr "另請參閱 :term:`module`\\ (模組)。" -#: ../../glossary.rst:911 +#: ../../glossary.rst:933 msgid "nested scope" msgstr "nested scope(巢狀作用域)" -#: ../../glossary.rst:913 +#: ../../glossary.rst:935 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -2109,11 +2154,11 @@ msgstr "" "寫入。同樣地,全域變數是在全域命名空間中讀取及寫入。:keyword:`nonlocal` 容許" "對外層作用域進行寫入。" -#: ../../glossary.rst:920 +#: ../../glossary.rst:942 msgid "new-style class" msgstr "new-style class(新式類別)" -#: ../../glossary.rst:922 +#: ../../glossary.rst:944 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " @@ -2125,11 +2170,11 @@ msgstr "" "__slots__`、描述器 (descriptor)、屬性 (property)、:meth:`~object." "__getattribute__`、class method(類別方法)和 static method(靜態方法)。" -#: ../../glossary.rst:927 +#: ../../glossary.rst:949 msgid "object" msgstr "object(物件)" -#: ../../glossary.rst:929 +#: ../../glossary.rst:951 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." @@ -2137,11 +2182,11 @@ msgstr "" "具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任何 :term:" "`new-style class`\\ (新式類別)的最終 base class(基底類別)。" -#: ../../glossary.rst:932 +#: ../../glossary.rst:954 msgid "optimized scope" msgstr "optimized scope(最佳化作用域)" -#: ../../glossary.rst:934 +#: ../../glossary.rst:956 msgid "" "A scope where target local variable names are reliably known to the compiler " "when the code is compiled, allowing optimization of read and write access to " @@ -2152,11 +2197,11 @@ msgid "" "to optimized scopes." msgstr "" -#: ../../glossary.rst:941 +#: ../../glossary.rst:963 msgid "package" msgstr "package(套件)" -#: ../../glossary.rst:943 +#: ../../glossary.rst:965 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " @@ -2166,17 +2211,17 @@ msgstr "" "迴的子套件 (subpackage)。技術上而言,套件就是具有 ``__path__`` 屬性的一個 " "Python 模組。" -#: ../../glossary.rst:947 +#: ../../glossary.rst:969 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "" "另請參閱 :term:`regular package`\\ (正規套件)和 :term:`namespace " "package`\\ (命名空間套件)。" -#: ../../glossary.rst:948 +#: ../../glossary.rst:970 msgid "parameter" msgstr "parameter(參數)" -#: ../../glossary.rst:950 +#: ../../glossary.rst:972 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2186,7 +2231,7 @@ msgstr "" "它指明該函式能夠接受的一個 :term:`argument`\\ (引數),或在某些情況下指示多" "個引數。共有有五種不同的參數類型:" -#: ../../glossary.rst:954 +#: ../../glossary.rst:976 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally ` or as a :term:`keyword argument " @@ -2197,11 +2242,11 @@ msgstr "" "置 `\\ 或是作為\\ :term:`關鍵字引數 `\\ 被傳遞的引數。這" "是參數的預設類型,例如以下的 *foo* 和 *bar*: ::" -#: ../../glossary.rst:959 +#: ../../glossary.rst:981 msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." -#: ../../glossary.rst:963 +#: ../../glossary.rst:985 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2212,11 +2257,11 @@ msgstr "" "式定義的參數列表中包含一個 ``/`` 字元,就可以在該字元前面定義僅限位置參數,例" "如以下的 *posonly1* 和 *posonly2*: ::" -#: ../../glossary.rst:968 +#: ../../glossary.rst:990 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." -#: ../../glossary.rst:972 +#: ../../glossary.rst:994 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2229,11 +2274,11 @@ msgstr "" "單純的 ``*`` 字元,就可以在其後方定義僅限關鍵字參數,例如以下的 *kw_only1* " "和 *kw_only2*: ::" -#: ../../glossary.rst:978 +#: ../../glossary.rst:1000 msgid "def func(arg, *, kw_only1, kw_only2): ..." msgstr "def func(arg, *, kw_only1, kw_only2): ..." -#: ../../glossary.rst:980 +#: ../../glossary.rst:1002 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2245,11 +2290,11 @@ msgstr "" "數(在已被其他參數接受的任何位置引數之外)。這類參數是透過在其參數名稱字首加" "上 ``*`` 來定義的,例如以下的 *args*: ::" -#: ../../glossary.rst:986 +#: ../../glossary.rst:1008 msgid "def func(*args, **kwargs): ..." msgstr "def func(*args, **kwargs): ..." -#: ../../glossary.rst:988 +#: ../../glossary.rst:1010 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2260,14 +2305,14 @@ msgstr "" "已被其他參數接受的任何關鍵字引數之外)。這類參數是透過在其參數名稱字首加上 " "``**`` 來定義的,例如上面範例中的 *kwargs*。" -#: ../../glossary.rst:994 +#: ../../glossary.rst:1016 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." msgstr "" "參數可以指明引數是選擇性的或必需的,也可以為一些選擇性的引數指定預設值。" -#: ../../glossary.rst:997 +#: ../../glossary.rst:1019 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " @@ -2278,11 +2323,11 @@ msgstr "" "參數之間的差異 `、:class:`inspect.Parameter` " "class、:ref:`function`\\ 章節,以及 :pep:`362`。" -#: ../../glossary.rst:1001 +#: ../../glossary.rst:1023 msgid "path entry" msgstr "path entry(路徑項目)" -#: ../../glossary.rst:1003 +#: ../../glossary.rst:1025 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2290,11 +2335,11 @@ msgstr "" "在 :term:`import path`\\ (引入路徑)中的一個位置,而 :term:`path based " "finder` (基於路徑的尋檢器)會參考該位置來尋找要 import 的模組。" -#: ../../glossary.rst:1005 +#: ../../glossary.rst:1027 msgid "path entry finder" msgstr "path entry finder(路徑項目尋檢器)" -#: ../../glossary.rst:1007 +#: ../../glossary.rst:1029 msgid "" "A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" "term:`path entry hook`) which knows how to locate modules given a :term:" @@ -2304,7 +2349,7 @@ msgstr "" "`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一個 :term:" "`path entry`\\ 定位模組。" -#: ../../glossary.rst:1011 +#: ../../glossary.rst:1033 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." @@ -2312,11 +2357,11 @@ msgstr "" "關於路徑項目尋檢器實作的 method,請參閱 :class:`importlib.abc." "PathEntryFinder`。" -#: ../../glossary.rst:1013 +#: ../../glossary.rst:1035 msgid "path entry hook" msgstr "path entry hook(路徑項目鉤)" -#: ../../glossary.rst:1015 +#: ../../glossary.rst:1037 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2326,11 +2371,11 @@ msgstr "" "個特定的 :term:`path entry` 中尋找模組,則會回傳一個 :term:`path entry " "finder`\\ (路徑項目尋檢器)。" -#: ../../glossary.rst:1018 +#: ../../glossary.rst:1040 msgid "path based finder" msgstr "path based finder(基於路徑的尋檢器)" -#: ../../glossary.rst:1020 +#: ../../glossary.rst:1042 msgid "" "One of the default :term:`meta path finders ` which " "searches an :term:`import path` for modules." @@ -2338,11 +2383,11 @@ msgstr "" "預設的\\ :term:`元路徑尋檢器 (meta path finder) ` 之一,它" "會在一個 :term:`import path` 中搜尋模組。" -#: ../../glossary.rst:1022 +#: ../../glossary.rst:1044 msgid "path-like object" msgstr "path-like object(類路徑物件)" -#: ../../glossary.rst:1024 +#: ../../glossary.rst:1046 msgid "" "An object representing a file system path. A path-like object is either a :" "class:`str` or :class:`bytes` object representing a path, or an object " @@ -2360,11 +2405,11 @@ msgstr "" "`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結果。由 :" "pep:`519` 引入。" -#: ../../glossary.rst:1032 +#: ../../glossary.rst:1054 msgid "PEP" msgstr "PEP" -#: ../../glossary.rst:1034 +#: ../../glossary.rst:1056 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2375,7 +2420,7 @@ msgstr "" "為 Python 社群提供資訊,或是描述 Python 的一個新功能或該功能的程序和環境。" "PEP 應該要提供簡潔的技術規範以及被提案功能的運作原理。" -#: ../../glossary.rst:1040 +#: ../../glossary.rst:1062 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2387,15 +2432,15 @@ msgstr "" "已納入 Python 的設計決策的記錄,這些過程的主要機制。PEP 的作者要負責在社群內" "建立共識並記錄反對意見。" -#: ../../glossary.rst:1046 +#: ../../glossary.rst:1068 msgid "See :pep:`1`." msgstr "請參閱 :pep:`1`。" -#: ../../glossary.rst:1047 +#: ../../glossary.rst:1069 msgid "portion" msgstr "portion(部分)" -#: ../../glossary.rst:1049 +#: ../../glossary.rst:1071 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2403,15 +2448,15 @@ msgstr "" "在單一目錄中的一組檔案(也可能儲存在一個 zip 檔中),這些檔案能對一個命名空間" "套件 (namespace package) 有所貢獻,如同 :pep:`420` 中的定義。" -#: ../../glossary.rst:1051 +#: ../../glossary.rst:1073 msgid "positional argument" msgstr "positional argument(位置引數)" -#: ../../glossary.rst:1054 +#: ../../glossary.rst:1076 msgid "provisional API" msgstr "provisional API(暫行 API)" -#: ../../glossary.rst:1056 +#: ../../glossary.rst:1078 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2427,7 +2472,7 @@ msgstr "" "該介面)。這種變更並不會無端地產生——只有 API 被納入之前未察覺的嚴重基本缺陷被" "揭露時,它們才會發生。" -#: ../../glossary.rst:1065 +#: ../../glossary.rst:1087 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2436,7 +2481,7 @@ msgstr "" "即使對於暫行 API,向後不相容的變更也會被視為「最後的解決方案」——對於任何被發" "現的問題,仍然會盡可能找出一個向後相容的解決方案。" -#: ../../glossary.rst:1069 +#: ../../glossary.rst:1091 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2445,19 +2490,19 @@ msgstr "" "這個過程使得標準函式庫能隨著時間不斷進化,而避免耗費過長的時間去鎖定有問題的" "設計錯誤。請參閱 :pep:`411` 了解更多細節。" -#: ../../glossary.rst:1072 +#: ../../glossary.rst:1094 msgid "provisional package" msgstr "provisional package(暫行套件)" -#: ../../glossary.rst:1074 +#: ../../glossary.rst:1096 msgid "See :term:`provisional API`." msgstr "請參閱 :term:`provisional API`\\ (暫行 API)。" -#: ../../glossary.rst:1075 +#: ../../glossary.rst:1097 msgid "Python 3000" msgstr "Python 3000" -#: ../../glossary.rst:1077 +#: ../../glossary.rst:1099 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2466,11 +2511,11 @@ msgstr "" "Python 3.x 系列版本的暱稱(很久以前創造的,當時第 3 版的發布是在遙遠的未" "來。)也可以縮寫為「Py3k」。" -#: ../../glossary.rst:1080 +#: ../../glossary.rst:1102 msgid "Pythonic" msgstr "Pythonic(Python 風格的)" -#: ../../glossary.rst:1082 +#: ../../glossary.rst:1104 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2484,7 +2529,7 @@ msgstr "" "keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並沒有" "這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" -#: ../../glossary.rst:1089 +#: ../../glossary.rst:1111 msgid "" "for i in range(len(food)):\n" " print(food[i])" @@ -2492,11 +2537,11 @@ msgstr "" "for i in range(len(food)):\n" " print(food[i])" -#: ../../glossary.rst:1092 +#: ../../glossary.rst:1114 msgid "As opposed to the cleaner, Pythonic method::" msgstr "相較之下,以下方法更簡潔、更具有 Python 風格: ::" -#: ../../glossary.rst:1094 +#: ../../glossary.rst:1116 msgid "" "for piece in food:\n" " print(piece)" @@ -2504,11 +2549,11 @@ msgstr "" "for piece in food:\n" " print(piece)" -#: ../../glossary.rst:1096 +#: ../../glossary.rst:1118 msgid "qualified name" msgstr "qualified name(限定名稱)" -#: ../../glossary.rst:1098 +#: ../../glossary.rst:1120 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2519,7 +2564,7 @@ msgstr "" "或 method 的「路徑」,如 :pep:`3155` 中的定義。對於頂層的函式和 class 而言," "限定名稱與其物件名稱相同: ::" -#: ../../glossary.rst:1103 +#: ../../glossary.rst:1125 msgid "" ">>> class C:\n" "... class D:\n" @@ -2545,7 +2590,7 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../glossary.rst:1115 +#: ../../glossary.rst:1137 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " "dotted path to the module, including any parent packages, e.g. ``email.mime." @@ -2554,7 +2599,7 @@ msgstr "" "當用於引用模組時,*完全限定名稱 (fully qualified name)* 是表示該模組的完整點" "分隔路徑,包括任何的父套件,例如 ``email.mime.text``: ::" -#: ../../glossary.rst:1119 +#: ../../glossary.rst:1141 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" @@ -2564,11 +2609,11 @@ msgstr "" ">>> email.mime.text.__name__\n" "'email.mime.text'" -#: ../../glossary.rst:1122 +#: ../../glossary.rst:1144 msgid "reference count" msgstr "reference count(參照計數)" -#: ../../glossary.rst:1124 +#: ../../glossary.rst:1146 msgid "" "The number of references to an object. When the reference count of an " "object drops to zero, it is deallocated. Some objects are :term:`immortal` " @@ -2584,11 +2629,11 @@ msgstr "" "看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :" "func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" -#: ../../glossary.rst:1132 +#: ../../glossary.rst:1154 msgid "regular package" msgstr "regular package(正規套件)" -#: ../../glossary.rst:1134 +#: ../../glossary.rst:1156 msgid "" "A traditional :term:`package`, such as a directory containing an ``__init__." "py`` file." @@ -2596,15 +2641,15 @@ msgstr "" "一個傳統的 :term:`package`\\ (套件),例如一個包含 ``__init__.py`` 檔案的目" "錄。" -#: ../../glossary.rst:1137 +#: ../../glossary.rst:1159 msgid "See also :term:`namespace package`." msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" -#: ../../glossary.rst:1138 +#: ../../glossary.rst:1160 msgid "REPL" msgstr "REPL" -#: ../../glossary.rst:1140 +#: ../../glossary.rst:1162 msgid "" "An acronym for the \"read–eval–print loop\", another name for the :term:" "`interactive` interpreter shell." @@ -2612,11 +2657,11 @@ msgstr "" "「read-eval-print 迴圈 (read–eval–print loop)」的縮寫,是\\ :term:`互動式 " "`\\ 直譯器 shell 的另一個名稱。" -#: ../../glossary.rst:1142 +#: ../../glossary.rst:1164 msgid "__slots__" msgstr "__slots__" -#: ../../glossary.rst:1144 +#: ../../glossary.rst:1166 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -2629,11 +2674,11 @@ msgstr "" "最好保留給那種在一個記憶體關鍵 (memory-critical) 的應用程式中存在大量實例的罕" "見情況。" -#: ../../glossary.rst:1149 +#: ../../glossary.rst:1171 msgid "sequence" msgstr "sequence(序列)" -#: ../../glossary.rst:1151 +#: ../../glossary.rst:1173 msgid "" "An :term:`iterable` which supports efficient element access using integer " "indices via the :meth:`~object.__getitem__` special method and defines a :" @@ -2652,7 +2697,7 @@ msgstr "" "為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` 鍵," "而不是整數。" -#: ../../glossary.rst:1160 +#: ../../glossary.rst:1182 msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " "richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:" @@ -2669,11 +2714,11 @@ msgstr "" "用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於序列方法的文件,請見" "\\ :ref:`常見序列操作 `。" -#: ../../glossary.rst:1169 +#: ../../glossary.rst:1191 msgid "set comprehension" msgstr "set comprehension(集合綜合運算)" -#: ../../glossary.rst:1171 +#: ../../glossary.rst:1193 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " @@ -2684,11 +2729,11 @@ msgstr "" "set 回傳。``results = {c for c in 'abracadabra' if c not in 'abc'}`` 會產生一" "個字串 set:``{'r', 'd'}``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:1175 +#: ../../glossary.rst:1197 msgid "single dispatch" msgstr "single dispatch(單一調度)" -#: ../../glossary.rst:1177 +#: ../../glossary.rst:1199 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -2696,11 +2741,11 @@ msgstr "" ":term:`generic function`\\ (泛型函式)調度的一種形式,在此,實作的選擇是基於" "單一引數的型別。" -#: ../../glossary.rst:1179 +#: ../../glossary.rst:1201 msgid "slice" msgstr "slice(切片)" -#: ../../glossary.rst:1181 +#: ../../glossary.rst:1203 msgid "" "An object usually containing a portion of a :term:`sequence`. A slice is " "created using the subscript notation, ``[]`` with colons between numbers " @@ -2712,11 +2757,11 @@ msgstr "" "之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內部,會使" "用 :class:`slice` 物件。" -#: ../../glossary.rst:1185 +#: ../../glossary.rst:1207 msgid "soft deprecated" msgstr "soft deprecated(軟性棄用)" -#: ../../glossary.rst:1187 +#: ../../glossary.rst:1209 msgid "" "A soft deprecated API should not be used in new code, but it is safe for " "already existing code to use it. The API remains documented and tested, but " @@ -2725,13 +2770,13 @@ msgstr "" "被軟性棄用的 API 代表不應再用於新程式碼中,但在現有程式碼中繼續使用它仍會是安" "全的。API 仍會以文件記錄並會被測試,但不會被繼續改進。" -#: ../../glossary.rst:1191 +#: ../../glossary.rst:1213 msgid "" "Soft deprecation, unlike normal deprecation, does not plan on removing the " "API and will not emit warnings." msgstr "與正常棄用不同,軟性棄用沒有刪除 API 的規劃,也不會發出警告。" -#: ../../glossary.rst:1194 +#: ../../glossary.rst:1216 msgid "" "See `PEP 387: Soft Deprecation `_." @@ -2739,11 +2784,11 @@ msgstr "" "請參閱 `PEP 387:軟性棄用 `_。" -#: ../../glossary.rst:1196 +#: ../../glossary.rst:1218 msgid "special method" msgstr "special method(特殊方法)" -#: ../../glossary.rst:1200 +#: ../../glossary.rst:1222 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " @@ -2754,11 +2799,11 @@ msgstr "" "種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在\\ :ref:" "`specialnames`\\ 中有詳細說明。" -#: ../../glossary.rst:1204 +#: ../../glossary.rst:1226 msgid "statement" msgstr "statement(陳述式)" -#: ../../glossary.rst:1206 +#: ../../glossary.rst:1228 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " "an :term:`expression` or one of several constructs with a keyword, such as :" @@ -2768,11 +2813,11 @@ msgstr "" "term:`expression`\\ (運算式),或是含有關鍵字(例如 :keyword:`if`、:keyword:" "`while` 或 :keyword:`for`\\ )的多種結構之一。" -#: ../../glossary.rst:1209 +#: ../../glossary.rst:1231 msgid "static type checker" msgstr "static type checker(靜態型別檢查器)" -#: ../../glossary.rst:1211 +#: ../../glossary.rst:1233 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " "such as incorrect types. See also :term:`type hints ` and the :" @@ -2782,11 +2827,11 @@ msgstr "" "另請參閱\\ :term:`型別提示 (type hints) ` 以及 :mod:`typing` 模" "組。" -#: ../../glossary.rst:1214 +#: ../../glossary.rst:1236 msgid "strong reference" msgstr "strong reference(強參照)" -#: ../../glossary.rst:1216 +#: ../../glossary.rst:1238 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " @@ -2797,7 +2842,7 @@ msgstr "" "有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透過 :c:" "func:`Py_DECREF` 釋放強參照。" -#: ../../glossary.rst:1222 +#: ../../glossary.rst:1244 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -2807,15 +2852,15 @@ msgstr "" ":c:func:`Py_NewRef` 函式可用於建立一個對物件的強參照。通常,在退出強參照的作" "用域之前,必須在該強參照上呼叫 :c:func:`Py_DECREF` 函式,以避免洩漏一個參照。" -#: ../../glossary.rst:1227 +#: ../../glossary.rst:1249 msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" -#: ../../glossary.rst:1228 +#: ../../glossary.rst:1250 msgid "text encoding" msgstr "text encoding(文字編碼)" -#: ../../glossary.rst:1230 +#: ../../glossary.rst:1252 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " @@ -2824,7 +2869,7 @@ msgstr "" "Python 中的字串是一個 Unicode 碼點 (code point) 的序列(範圍在 ``U+0000`` -- " "``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一個位元組序列。" -#: ../../glossary.rst:1234 +#: ../../glossary.rst:1256 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -2832,7 +2877,7 @@ msgstr "" "將一個字串序列化為位元組序列,稱為「編碼」,而從位元組序列重新建立該字串則稱" "為「解碼 (decoding)」。" -#: ../../glossary.rst:1237 +#: ../../glossary.rst:1259 msgid "" "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." @@ -2840,11 +2885,11 @@ msgstr "" "有多種不同的文字序列化編解碼器 (:ref:`codecs `),它們被統" "稱為「文字編碼」。" -#: ../../glossary.rst:1240 +#: ../../glossary.rst:1262 msgid "text file" msgstr "text file(文字檔案)" -#: ../../glossary.rst:1242 +#: ../../glossary.rst:1264 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " "text file actually accesses a byte-oriented datastream and handles the :term:" @@ -2858,7 +2903,7 @@ msgstr "" "有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔案、:data:`sys.stdin`、:data:" "`sys.stdout` 以及 :class:`io.StringIO` 的實例。" -#: ../../glossary.rst:1249 +#: ../../glossary.rst:1271 msgid "" "See also :term:`binary file` for a file object able to read and write :term:" "`bytes-like objects `." @@ -2866,11 +2911,11 @@ msgstr "" "另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入\\ :" "term:`類位元組串物件 (bytes-like object) ` 的檔案物件。" -#: ../../glossary.rst:1251 +#: ../../glossary.rst:1273 msgid "triple-quoted string" msgstr "triple-quoted string(三引號內字串)" -#: ../../glossary.rst:1253 +#: ../../glossary.rst:1275 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -2885,11 +2930,11 @@ msgstr "" "中包含未跳脫 (unescaped) 的單引號和雙引號,而且它們不需使用連續字元 " "(continuation character) 就可以跨越多行,這使得它們在編寫說明字串時特別有用。" -#: ../../glossary.rst:1260 +#: ../../glossary.rst:1282 msgid "type" msgstr "type(型別)" -#: ../../glossary.rst:1262 +#: ../../glossary.rst:1284 msgid "" "The type of a Python object determines what kind of object it is; every " "object has a type. An object's type is accessible as its :attr:`~object." @@ -2899,22 +2944,22 @@ msgstr "" "件的型別可以用它的 :attr:`~object.__class__` 屬性來存取,或以 ``type(obj)`` " "來檢索。" -#: ../../glossary.rst:1266 +#: ../../glossary.rst:1288 msgid "type alias" msgstr "type alias(型別別名)" -#: ../../glossary.rst:1268 +#: ../../glossary.rst:1290 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "一個型別的同義詞,透過將型別指定給一個識別符 (identifier) 來建立。" -#: ../../glossary.rst:1270 +#: ../../glossary.rst:1292 msgid "" "Type aliases are useful for simplifying :term:`type hints `. For " "example::" msgstr "" "型別別名對於簡化\\ :term:`型別提示 (type hint) ` 很有用。例如: ::" -#: ../../glossary.rst:1273 +#: ../../glossary.rst:1295 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" @@ -2924,11 +2969,11 @@ msgstr "" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" -#: ../../glossary.rst:1277 +#: ../../glossary.rst:1299 msgid "could be made more readable like this::" msgstr "可以寫成這樣,更具有可讀性: ::" -#: ../../glossary.rst:1279 +#: ../../glossary.rst:1301 msgid "" "Color = tuple[int, int, int]\n" "\n" @@ -2940,15 +2985,15 @@ msgstr "" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" -#: ../../glossary.rst:1284 ../../glossary.rst:1298 +#: ../../glossary.rst:1306 ../../glossary.rst:1320 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "請參閱 :mod:`typing` 和 :pep:`484`,有此功能的描述。" -#: ../../glossary.rst:1285 +#: ../../glossary.rst:1307 msgid "type hint" msgstr "type hint(型別提示)" -#: ../../glossary.rst:1287 +#: ../../glossary.rst:1309 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -2956,7 +3001,7 @@ msgstr "" "一種 :term:`annotation`\\ (註釋),它指定一個變數、一個 class 屬性或一個函式" "的參數或回傳值的預期型別。" -#: ../../glossary.rst:1290 +#: ../../glossary.rst:1312 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers `. They can also aid " @@ -2966,7 +3011,7 @@ msgstr "" "(static type checkers) `\\ 很有用,並能協助 IDE 完成程式" "碼的補全 (completion) 和重構 (refactoring)。" -#: ../../glossary.rst:1294 +#: ../../glossary.rst:1316 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." @@ -2974,11 +3019,11 @@ msgstr "" "全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使用 :func:" "`typing.get_type_hints` 來存取。" -#: ../../glossary.rst:1299 +#: ../../glossary.rst:1321 msgid "universal newlines" msgstr "universal newlines(通用換行字元)" -#: ../../glossary.rst:1301 +#: ../../glossary.rst:1323 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " @@ -2991,20 +3036,20 @@ msgstr "" "``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用於 :func:`bytes." "splitlines` 的附加用途。" -#: ../../glossary.rst:1306 +#: ../../glossary.rst:1328 msgid "variable annotation" msgstr "variable annotation(變數註釋)" -#: ../../glossary.rst:1308 +#: ../../glossary.rst:1330 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "一個變數或 class 屬性的 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:1310 +#: ../../glossary.rst:1332 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "註釋變數或 class 屬性時,賦值是選擇性的: ::" -#: ../../glossary.rst:1312 +#: ../../glossary.rst:1334 msgid "" "class C:\n" " field: 'annotation'" @@ -3012,7 +3057,7 @@ msgstr "" "class C:\n" " field: 'annotation'" -#: ../../glossary.rst:1315 +#: ../../glossary.rst:1337 msgid "" "Variable annotations are usually used for :term:`type hints `: " "for example this variable is expected to take :class:`int` values::" @@ -3020,15 +3065,15 @@ msgstr "" "變數註釋通常用於\\ :term:`型別提示 (type hint) `:例如,這個變數預" "期會取得 :class:`int`\\ (整數)值: ::" -#: ../../glossary.rst:1319 +#: ../../glossary.rst:1341 msgid "count: int = 0" msgstr "count: int = 0" -#: ../../glossary.rst:1321 +#: ../../glossary.rst:1343 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "變數註釋的語法在\\ :ref:`annassign`\\ 章節有詳細的解釋。" -#: ../../glossary.rst:1323 +#: ../../glossary.rst:1345 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -3037,11 +3082,11 @@ msgstr "" "請參閱 :term:`function annotation`\\ (函式註釋)、:pep:`484` 和 :pep:`526`," "皆有此功能的描述。關於註釋的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:1327 +#: ../../glossary.rst:1349 msgid "virtual environment" msgstr "virtual environment(虛擬環境)" -#: ../../glossary.rst:1329 +#: ../../glossary.rst:1351 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -3052,15 +3097,15 @@ msgstr "" "程式得以安裝和升級 Python 發佈套件,而不會對同一個系統上運行的其他 Python 應" "用程式的行為產生干擾。" -#: ../../glossary.rst:1334 +#: ../../glossary.rst:1356 msgid "See also :mod:`venv`." msgstr "另請參閱 :mod:`venv`。" -#: ../../glossary.rst:1335 +#: ../../glossary.rst:1357 msgid "virtual machine" msgstr "virtual machine(虛擬機器)" -#: ../../glossary.rst:1337 +#: ../../glossary.rst:1359 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." @@ -3068,11 +3113,11 @@ msgstr "" "一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行由 :term:" "`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" -#: ../../glossary.rst:1339 +#: ../../glossary.rst:1361 msgid "Zen of Python" msgstr "Zen of Python(Python 之禪)" -#: ../../glossary.rst:1341 +#: ../../glossary.rst:1363 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -3081,22 +3126,45 @@ msgstr "" "Python 設計原則與哲學的列表,其內容有助於理解和使用此語言。此列表可以透過在互" "動式提式字元後輸入「``import this``」來找到它。" -#: ../../glossary.rst:278 +#: ../../glossary.rst:292 msgid "C-contiguous" msgstr "C-contiguous(C 連續的)" -#: ../../glossary.rst:278 +#: ../../glossary.rst:292 msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" -#: ../../glossary.rst:803 +#: ../../glossary.rst:825 msgid "magic" msgstr "magic" -#: ../../glossary.rst:1198 +#: ../../glossary.rst:1220 msgid "special" msgstr "special" +#~ msgid "" +#~ "An object which controls the environment seen in a :keyword:`with` " +#~ "statement by defining :meth:`~object.__enter__` and :meth:`~object." +#~ "__exit__` methods. See :pep:`343`." +#~ msgstr "" +#~ "一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定義 :meth:" +#~ "`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。請參閱 :" +#~ "pep:`343`。" + +#~ msgid "" +#~ "A variable which can have different values depending on its context. This " +#~ "is similar to Thread-Local Storage in which each execution thread may " +#~ "have a different value for a variable. However, with context variables, " +#~ "there may be several contexts in one execution thread and the main usage " +#~ "for context variables is to keep track of variables in concurrent " +#~ "asynchronous tasks. See :mod:`contextvars`." +#~ msgstr "" +#~ "一個變數,其值可以根據上下文的情境而有所不同。這類似執行緒區域儲存區 " +#~ "(Thread-Local Storage),在其中,一個變數在每個執行緒可能具有不同的值。然" +#~ "而,關於情境變數,在一個執行緒中可能會有多個情境,而情境變數的主要用途,是" +#~ "在並行的非同步任務 (concurrent asynchronous task) 中,對於變數狀態的追蹤。" +#~ "請參閱 :mod:`contextvars`。" + #~ msgid "" #~ "The main difference between a \"soft\" and a (regular) \"hard\" " #~ "deprecation is that the soft deprecation does not imply scheduling the " diff --git a/howto/enum.po b/howto/enum.po index 668b2723f2..c4f912e5cb 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -801,7 +801,7 @@ msgstr "" #: ../../howto/enum.rst:415 msgid "Then::" -msgstr "" +msgstr "然後: ::" #: ../../howto/enum.rst:417 msgid "" @@ -1238,7 +1238,7 @@ msgstr "" #: ../../howto/enum.rst:664 msgid "IntEnum" -msgstr "" +msgstr "IntEnum" #: ../../howto/enum.rst:666 msgid "" diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po index 5578166a5d..519f70b2e5 100644 --- a/howto/free-threading-python.po +++ b/howto/free-threading-python.po @@ -121,11 +121,11 @@ msgstr "" #: ../../howto/free-threading-python.rst:70 msgid "https://py-free-threading.github.io/tracking/" -msgstr "" +msgstr "https://py-free-threading.github.io/tracking/" #: ../../howto/free-threading-python.rst:71 msgid "https://hugovk.github.io/free-threaded-wheels/" -msgstr "" +msgstr "https://hugovk.github.io/free-threaded-wheels/" #: ../../howto/free-threading-python.rst:75 msgid "Thread safety" @@ -229,7 +229,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:135 msgid "Iterators" -msgstr "" +msgstr "疊代器" #: ../../howto/free-threading-python.rst:137 msgid "" diff --git a/howto/functional.po b/howto/functional.po index f55926dec9..a145631968 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -291,7 +291,7 @@ msgstr "" #: ../../howto/functional.rst:180 msgid "Iterators" -msgstr "" +msgstr "疊代器" #: ../../howto/functional.rst:182 msgid "" @@ -668,7 +668,7 @@ msgstr "" #: ../../howto/functional.rst:439 msgid "Generators" -msgstr "" +msgstr "產生器" #: ../../howto/functional.rst:441 msgid "" @@ -1982,7 +1982,7 @@ msgstr "https://en.wikipedia.org/wiki/Currying: currying 概念的條目。" #: ../../howto/functional.rst:1233 msgid "Python-specific" -msgstr "" +msgstr "Python 特有的" #: ../../howto/functional.rst:1235 msgid "" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index abe416bd57..340d2075f3 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-11-08 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1653,14 +1653,11 @@ msgstr "" msgid "" "You could also write your own handler which uses the :class:" "`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to " -"serialize access to the file from your processes. The existing :class:" -"`FileHandler` and subclasses do not make use of :mod:`multiprocessing` at " -"present, though they may do so in the future. Note that at present, the :mod:" -"`multiprocessing` module does not provide working lock functionality on all " -"platforms (see https://bugs.python.org/issue3770)." +"serialize access to the file from your processes. The stdlib :class:" +"`FileHandler` and subclasses do not make use of :mod:`multiprocessing`." msgstr "" -#: ../../howto/logging-cookbook.rst:1278 +#: ../../howto/logging-cookbook.rst:1275 msgid "" "Alternatively, you can use a ``Queue`` and a :class:`QueueHandler` to send " "all logging events to one of the processes in your multi-process " @@ -1675,7 +1672,7 @@ msgid "" "requirements::" msgstr "" -#: ../../howto/logging-cookbook.rst:1289 +#: ../../howto/logging-cookbook.rst:1286 msgid "" "# You'll need these imports in your own code\n" "import logging\n" @@ -1795,13 +1792,13 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1394 +#: ../../howto/logging-cookbook.rst:1391 msgid "" "A variant of the above script keeps the logging in the main process, in a " "separate thread::" msgstr "" -#: ../../howto/logging-cookbook.rst:1397 +#: ../../howto/logging-cookbook.rst:1394 msgid "" "import logging\n" "import logging.config\n" @@ -1898,7 +1895,7 @@ msgid "" " lp.join()" msgstr "" -#: ../../howto/logging-cookbook.rst:1489 +#: ../../howto/logging-cookbook.rst:1486 msgid "" "This variant shows how you can e.g. apply configuration for particular " "loggers - e.g. the ``foo`` logger has a special handler which stores all " @@ -1908,36 +1905,36 @@ msgid "" "appropriate destinations." msgstr "" -#: ../../howto/logging-cookbook.rst:1496 +#: ../../howto/logging-cookbook.rst:1493 msgid "Using concurrent.futures.ProcessPoolExecutor" -msgstr "" +msgstr "使用 concurrent.futures.ProcessPoolExecutor" -#: ../../howto/logging-cookbook.rst:1498 +#: ../../howto/logging-cookbook.rst:1495 msgid "" "If you want to use :class:`concurrent.futures.ProcessPoolExecutor` to start " "your worker processes, you need to create the queue slightly differently. " "Instead of" msgstr "" -#: ../../howto/logging-cookbook.rst:1502 +#: ../../howto/logging-cookbook.rst:1499 msgid "queue = multiprocessing.Queue(-1)" -msgstr "" +msgstr "queue = multiprocessing.Queue(-1)" -#: ../../howto/logging-cookbook.rst:1506 +#: ../../howto/logging-cookbook.rst:1503 msgid "you should use" msgstr "" -#: ../../howto/logging-cookbook.rst:1508 +#: ../../howto/logging-cookbook.rst:1505 msgid "" "queue = multiprocessing.Manager().Queue(-1) # also works with the examples " "above" msgstr "" -#: ../../howto/logging-cookbook.rst:1512 +#: ../../howto/logging-cookbook.rst:1509 msgid "and you can then replace the worker creation from this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1514 +#: ../../howto/logging-cookbook.rst:1511 msgid "" "workers = []\n" "for i in range(10):\n" @@ -1949,22 +1946,22 @@ msgid "" " w.join()" msgstr "" -#: ../../howto/logging-cookbook.rst:1523 +#: ../../howto/logging-cookbook.rst:1520 msgid "to this (remembering to first import :mod:`concurrent.futures`)::" msgstr "" -#: ../../howto/logging-cookbook.rst:1525 +#: ../../howto/logging-cookbook.rst:1522 msgid "" "with concurrent.futures.ProcessPoolExecutor(max_workers=10) as executor:\n" " for i in range(10):\n" " executor.submit(worker_process, queue, worker_configurer)" msgstr "" -#: ../../howto/logging-cookbook.rst:1530 +#: ../../howto/logging-cookbook.rst:1527 msgid "Deploying Web applications using Gunicorn and uWSGI" msgstr "" -#: ../../howto/logging-cookbook.rst:1532 +#: ../../howto/logging-cookbook.rst:1529 msgid "" "When deploying Web applications using `Gunicorn `_ or " "`uWSGI `_ (or similar), " @@ -1976,11 +1973,11 @@ msgid "" "listener in production`_ for more details." msgstr "" -#: ../../howto/logging-cookbook.rst:1542 +#: ../../howto/logging-cookbook.rst:1539 msgid "Using file rotation" msgstr "" -#: ../../howto/logging-cookbook.rst:1547 +#: ../../howto/logging-cookbook.rst:1544 msgid "" "Sometimes you want to let a log file grow to a certain size, then open a new " "file and log to that. You may want to keep a certain number of these files, " @@ -1989,7 +1986,7 @@ msgid "" "usage pattern, the logging package provides a :class:`RotatingFileHandler`::" msgstr "" -#: ../../howto/logging-cookbook.rst:1553 +#: ../../howto/logging-cookbook.rst:1550 msgid "" "import glob\n" "import logging\n" @@ -2018,13 +2015,13 @@ msgid "" " print(filename)" msgstr "" -#: ../../howto/logging-cookbook.rst:1579 +#: ../../howto/logging-cookbook.rst:1576 msgid "" "The result should be 6 separate files, each with part of the log history for " "the application:" msgstr "" -#: ../../howto/logging-cookbook.rst:1582 +#: ../../howto/logging-cookbook.rst:1579 msgid "" "logging_rotatingfile_example.out\n" "logging_rotatingfile_example.out.1\n" @@ -2034,7 +2031,7 @@ msgid "" "logging_rotatingfile_example.out.5" msgstr "" -#: ../../howto/logging-cookbook.rst:1591 +#: ../../howto/logging-cookbook.rst:1588 msgid "" "The most current file is always :file:`logging_rotatingfile_example.out`, " "and each time it reaches the size limit it is renamed with the suffix " @@ -2042,17 +2039,17 @@ msgid "" "(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased." msgstr "" -#: ../../howto/logging-cookbook.rst:1596 +#: ../../howto/logging-cookbook.rst:1593 msgid "" "Obviously this example sets the log length much too small as an extreme " "example. You would want to set *maxBytes* to an appropriate value." msgstr "" -#: ../../howto/logging-cookbook.rst:1604 +#: ../../howto/logging-cookbook.rst:1601 msgid "Use of alternative formatting styles" msgstr "" -#: ../../howto/logging-cookbook.rst:1606 +#: ../../howto/logging-cookbook.rst:1603 msgid "" "When logging was added to the Python standard library, the only way of " "formatting messages with variable content was to use the %-formatting " @@ -2061,7 +2058,7 @@ msgid "" "Python 2.6)." msgstr "" -#: ../../howto/logging-cookbook.rst:1612 +#: ../../howto/logging-cookbook.rst:1609 msgid "" "Logging (as of 3.2) provides improved support for these two additional " "formatting styles. The :class:`Formatter` class been enhanced to take an " @@ -2074,7 +2071,7 @@ msgid "" "session to show the possibilities:" msgstr "" -#: ../../howto/logging-cookbook.rst:1622 +#: ../../howto/logging-cookbook.rst:1619 msgid "" ">>> import logging\n" ">>> root = logging.getLogger()\n" @@ -2099,21 +2096,21 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1646 +#: ../../howto/logging-cookbook.rst:1643 msgid "" "Note that the formatting of logging messages for final output to logs is " "completely independent of how an individual logging message is constructed. " "That can still use %-formatting, as shown here::" msgstr "" -#: ../../howto/logging-cookbook.rst:1650 +#: ../../howto/logging-cookbook.rst:1647 msgid "" ">>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message')\n" "2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1654 +#: ../../howto/logging-cookbook.rst:1651 msgid "" "Logging calls (``logger.debug()``, ``logger.info()`` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -2129,7 +2126,7 @@ msgid "" "strings." msgstr "" -#: ../../howto/logging-cookbook.rst:1667 +#: ../../howto/logging-cookbook.rst:1664 msgid "" "There is, however, a way that you can use {}- and $- formatting to construct " "your individual log messages. Recall that for a message you can use an " @@ -2138,7 +2135,7 @@ msgid "" "the following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:1673 ../../howto/logging-cookbook.rst:2761 +#: ../../howto/logging-cookbook.rst:1670 ../../howto/logging-cookbook.rst:2758 msgid "" "class BraceMessage:\n" " def __init__(self, fmt, /, *args, **kwargs):\n" @@ -2176,7 +2173,7 @@ msgstr "" " from string import Template\n" " return Template(self.fmt).substitute(**self.kwargs)" -#: ../../howto/logging-cookbook.rst:1691 +#: ../../howto/logging-cookbook.rst:1688 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -2187,14 +2184,14 @@ msgid "" "used as a synonym/alias for :func:`gettext.gettext` or its brethren)." msgstr "" -#: ../../howto/logging-cookbook.rst:1699 +#: ../../howto/logging-cookbook.rst:1696 msgid "" "The above classes are not included in Python, though they're easy enough to " "copy and paste into your own code. They can be used as follows (assuming " "that they're declared in a module called ``wherever``):" msgstr "" -#: ../../howto/logging-cookbook.rst:1703 +#: ../../howto/logging-cookbook.rst:1700 msgid "" ">>> from wherever import BraceMessage as __\n" ">>> print(__('Message with {0} {name}', 2, name='placeholders'))\n" @@ -2213,14 +2210,14 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1721 +#: ../../howto/logging-cookbook.rst:1718 msgid "" "While the above examples use ``print()`` to show how the formatting works, " "you would of course use ``logger.debug()`` or similar to actually log using " "this approach." msgstr "" -#: ../../howto/logging-cookbook.rst:1725 +#: ../../howto/logging-cookbook.rst:1722 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -2231,13 +2228,13 @@ msgid "" "sugar for a constructor call to one of the :samp:`{XXX}Message` classes." msgstr "" -#: ../../howto/logging-cookbook.rst:1733 +#: ../../howto/logging-cookbook.rst:1730 msgid "" "If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar " "effect to the above, as in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1736 +#: ../../howto/logging-cookbook.rst:1733 msgid "" "import logging\n" "\n" @@ -2266,17 +2263,17 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1762 +#: ../../howto/logging-cookbook.rst:1759 msgid "" "The above script should log the message ``Hello, world!`` when run with " "Python 3.8 or later." msgstr "" -#: ../../howto/logging-cookbook.rst:1771 +#: ../../howto/logging-cookbook.rst:1768 msgid "Customizing ``LogRecord``" msgstr "" -#: ../../howto/logging-cookbook.rst:1773 +#: ../../howto/logging-cookbook.rst:1770 msgid "" "Every logging event is represented by a :class:`LogRecord` instance. When an " "event is logged and not filtered out by a logger's level, a :class:" @@ -2287,13 +2284,13 @@ msgid "" "was done:" msgstr "" -#: ../../howto/logging-cookbook.rst:1780 +#: ../../howto/logging-cookbook.rst:1777 msgid "" ":meth:`Logger.makeRecord`, which is called in the normal process of logging " "an event. This invoked :class:`LogRecord` directly to create an instance." msgstr "" -#: ../../howto/logging-cookbook.rst:1783 +#: ../../howto/logging-cookbook.rst:1780 msgid "" ":func:`makeLogRecord`, which is called with a dictionary containing " "attributes to be added to the LogRecord. This is typically invoked when a " @@ -2302,27 +2299,27 @@ msgid "" "`~handlers.HTTPHandler`)." msgstr "" -#: ../../howto/logging-cookbook.rst:1789 +#: ../../howto/logging-cookbook.rst:1786 msgid "" "This has usually meant that if you need to do anything special with a :class:" "`LogRecord`, you've had to do one of the following." msgstr "" -#: ../../howto/logging-cookbook.rst:1792 +#: ../../howto/logging-cookbook.rst:1789 msgid "" "Create your own :class:`Logger` subclass, which overrides :meth:`Logger." "makeRecord`, and set it using :func:`~logging.setLoggerClass` before any " "loggers that you care about are instantiated." msgstr "" -#: ../../howto/logging-cookbook.rst:1795 +#: ../../howto/logging-cookbook.rst:1792 msgid "" "Add a :class:`Filter` to a logger or handler, which does the necessary " "special manipulation you need when its :meth:`~Filter.filter` method is " "called." msgstr "" -#: ../../howto/logging-cookbook.rst:1799 +#: ../../howto/logging-cookbook.rst:1796 msgid "" "The first approach would be a little unwieldy in the scenario where (say) " "several different libraries wanted to do different things. Each would " @@ -2330,7 +2327,7 @@ msgid "" "last would win." msgstr "" -#: ../../howto/logging-cookbook.rst:1804 +#: ../../howto/logging-cookbook.rst:1801 msgid "" "The second approach works reasonably well for many cases, but does not allow " "you to e.g. use a specialized subclass of :class:`LogRecord`. Library " @@ -2339,11 +2336,11 @@ msgid "" "would do simply by adding new packages or modules and doing ::" msgstr "" -#: ../../howto/logging-cookbook.rst:1810 +#: ../../howto/logging-cookbook.rst:1807 msgid "logger = logging.getLogger(__name__)" msgstr "logger = logging.getLogger(__name__)" -#: ../../howto/logging-cookbook.rst:1812 +#: ../../howto/logging-cookbook.rst:1809 msgid "" "at module level). It's probably one too many things to think about. " "Developers could also add the filter to a :class:`~logging.NullHandler` " @@ -2353,7 +2350,7 @@ msgid "" "developer." msgstr "" -#: ../../howto/logging-cookbook.rst:1818 +#: ../../howto/logging-cookbook.rst:1815 msgid "" "In Python 3.2 and later, :class:`~logging.LogRecord` creation is done " "through a factory, which you can specify. The factory is just a callable you " @@ -2363,7 +2360,7 @@ msgid "" "`LogRecord` is the default setting for the factory." msgstr "" -#: ../../howto/logging-cookbook.rst:1825 +#: ../../howto/logging-cookbook.rst:1822 msgid "" "This approach allows a custom factory to control all aspects of LogRecord " "creation. For example, you could return a subclass, or just add some " @@ -2371,7 +2368,7 @@ msgid "" "this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1829 +#: ../../howto/logging-cookbook.rst:1826 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -2383,7 +2380,7 @@ msgid "" "logging.setLogRecordFactory(record_factory)" msgstr "" -#: ../../howto/logging-cookbook.rst:1838 +#: ../../howto/logging-cookbook.rst:1835 msgid "" "This pattern allows different libraries to chain factories together, and as " "long as they don't overwrite each other's attributes or unintentionally " @@ -2393,22 +2390,22 @@ msgid "" "used when the use of a :class:`Filter` does not provide the desired result." msgstr "" -#: ../../howto/logging-cookbook.rst:1850 +#: ../../howto/logging-cookbook.rst:1847 msgid "Subclassing QueueHandler and QueueListener- a ZeroMQ example" msgstr "" -#: ../../howto/logging-cookbook.rst:1853 ../../howto/logging-cookbook.rst:1986 +#: ../../howto/logging-cookbook.rst:1850 ../../howto/logging-cookbook.rst:1983 msgid "Subclass ``QueueHandler``" msgstr "" -#: ../../howto/logging-cookbook.rst:1855 +#: ../../howto/logging-cookbook.rst:1852 msgid "" "You can use a :class:`QueueHandler` subclass to send messages to other kinds " "of queues, for example a ZeroMQ 'publish' socket. In the example below,the " "socket is created separately and passed to the handler (as its 'queue')::" msgstr "" -#: ../../howto/logging-cookbook.rst:1859 +#: ../../howto/logging-cookbook.rst:1856 msgid "" "import zmq # using pyzmq, the Python binding for ZeroMQ\n" "import json # for serializing records portably\n" @@ -2425,13 +2422,13 @@ msgid "" "handler = ZeroMQSocketHandler(sock)" msgstr "" -#: ../../howto/logging-cookbook.rst:1874 +#: ../../howto/logging-cookbook.rst:1871 msgid "" "Of course there are other ways of organizing this, for example passing in " "the data needed by the handler to create the socket::" msgstr "" -#: ../../howto/logging-cookbook.rst:1877 +#: ../../howto/logging-cookbook.rst:1874 msgid "" "class ZeroMQSocketHandler(QueueHandler):\n" " def __init__(self, uri, socktype=zmq.PUB, ctx=None):\n" @@ -2447,17 +2444,17 @@ msgid "" " self.queue.close()" msgstr "" -#: ../../howto/logging-cookbook.rst:1892 ../../howto/logging-cookbook.rst:1922 +#: ../../howto/logging-cookbook.rst:1889 ../../howto/logging-cookbook.rst:1919 msgid "Subclass ``QueueListener``" msgstr "" -#: ../../howto/logging-cookbook.rst:1894 +#: ../../howto/logging-cookbook.rst:1891 msgid "" "You can also subclass :class:`QueueListener` to get messages from other " "kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1897 +#: ../../howto/logging-cookbook.rst:1894 msgid "" "class ZeroMQSocketListener(QueueListener):\n" " def __init__(self, uri, /, *handlers, **kwargs):\n" @@ -2473,11 +2470,11 @@ msgid "" " return logging.makeLogRecord(msg)" msgstr "" -#: ../../howto/logging-cookbook.rst:1912 +#: ../../howto/logging-cookbook.rst:1909 msgid "Subclassing QueueHandler and QueueListener- a ``pynng`` example" msgstr "" -#: ../../howto/logging-cookbook.rst:1914 +#: ../../howto/logging-cookbook.rst:1911 msgid "" "In a similar way to the above section, we can implement a listener and " "handler using :pypi:`pynng`, which is a Python binding to `NNG `_ of the Django documentation." msgstr "" -#: ../../howto/logging-cookbook.rst:2160 +#: ../../howto/logging-cookbook.rst:2157 msgid "Using a rotator and namer to customize log rotation processing" msgstr "" -#: ../../howto/logging-cookbook.rst:2162 +#: ../../howto/logging-cookbook.rst:2159 msgid "" "An example of how you can define a namer and rotator is given in the " "following runnable script, which shows gzip compression of the log file::" msgstr "" -#: ../../howto/logging-cookbook.rst:2165 +#: ../../howto/logging-cookbook.rst:2162 msgid "" "import gzip\n" "import logging\n" @@ -2860,12 +2857,12 @@ msgstr "" "for i in range(1000):\n" " root.info(f'Message no. {i + 1}')" -#: ../../howto/logging-cookbook.rst:2193 +#: ../../howto/logging-cookbook.rst:2190 msgid "" "After running this, you will see six new files, five of which are compressed:" msgstr "" -#: ../../howto/logging-cookbook.rst:2195 +#: ../../howto/logging-cookbook.rst:2192 msgid "" "$ ls rotated.log*\n" "rotated.log rotated.log.2.gz rotated.log.4.gz\n" @@ -2883,11 +2880,11 @@ msgstr "" "2023-01-20 02:28:17,767 Message no. 997\n" "2023-01-20 02:28:17,767 Message no. 998" -#: ../../howto/logging-cookbook.rst:2206 +#: ../../howto/logging-cookbook.rst:2203 msgid "A more elaborate multiprocessing example" msgstr "" -#: ../../howto/logging-cookbook.rst:2208 +#: ../../howto/logging-cookbook.rst:2205 msgid "" "The following working example shows how logging can be used with " "multiprocessing using configuration files. The configurations are fairly " @@ -2895,7 +2892,7 @@ msgid "" "in a real multiprocessing scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:2213 +#: ../../howto/logging-cookbook.rst:2210 msgid "" "In the example, the main process spawns a listener process and some worker " "processes. Each of the main process, the listener and the workers have three " @@ -2908,13 +2905,13 @@ msgid "" "own scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:2223 +#: ../../howto/logging-cookbook.rst:2220 msgid "" "Here's the script - the docstrings and the comments hopefully explain how it " "works::" msgstr "" -#: ../../howto/logging-cookbook.rst:2226 +#: ../../howto/logging-cookbook.rst:2223 msgid "" "import logging\n" "import logging.config\n" @@ -3137,11 +3134,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2435 +#: ../../howto/logging-cookbook.rst:2432 msgid "Inserting a BOM into messages sent to a SysLogHandler" msgstr "" -#: ../../howto/logging-cookbook.rst:2437 +#: ../../howto/logging-cookbook.rst:2434 msgid "" ":rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a " "set of bytes which have the following structure: an optional pure-ASCII " @@ -3150,7 +3147,7 @@ msgid "" "<5424#section-6>`.)" msgstr "" -#: ../../howto/logging-cookbook.rst:2443 +#: ../../howto/logging-cookbook.rst:2440 msgid "" "In Python 3.1, code was added to :class:`~logging.handlers.SysLogHandler` to " "insert a BOM into the message, but unfortunately, it was implemented " @@ -3158,7 +3155,7 @@ msgid "" "hence not allowing any pure-ASCII component to appear before it." msgstr "" -#: ../../howto/logging-cookbook.rst:2449 +#: ../../howto/logging-cookbook.rst:2446 msgid "" "As this behaviour is broken, the incorrect BOM insertion code is being " "removed from Python 3.2.4 and later. However, it is not being replaced, and " @@ -3167,37 +3164,37 @@ msgid "" "encoded using UTF-8, then you need to do the following:" msgstr "" -#: ../../howto/logging-cookbook.rst:2455 +#: ../../howto/logging-cookbook.rst:2452 msgid "" "Attach a :class:`~logging.Formatter` instance to your :class:`~logging." "handlers.SysLogHandler` instance, with a format string such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2459 +#: ../../howto/logging-cookbook.rst:2456 msgid "'ASCII section\\ufeffUnicode section'" msgstr "" -#: ../../howto/logging-cookbook.rst:2461 +#: ../../howto/logging-cookbook.rst:2458 msgid "" "The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as " "a UTF-8 BOM -- the byte-string ``b'\\xef\\xbb\\xbf'``." msgstr "" -#: ../../howto/logging-cookbook.rst:2464 +#: ../../howto/logging-cookbook.rst:2461 msgid "" "Replace the ASCII section with whatever placeholders you like, but make sure " "that the data that appears in there after substitution is always ASCII (that " "way, it will remain unchanged after UTF-8 encoding)." msgstr "" -#: ../../howto/logging-cookbook.rst:2468 +#: ../../howto/logging-cookbook.rst:2465 msgid "" "Replace the Unicode section with whatever placeholders you like; if the data " "which appears there after substitution contains characters outside the ASCII " "range, that's fine -- it will be encoded using UTF-8." msgstr "" -#: ../../howto/logging-cookbook.rst:2472 +#: ../../howto/logging-cookbook.rst:2469 msgid "" "The formatted message *will* be encoded using UTF-8 encoding by " "``SysLogHandler``. If you follow the above rules, you should be able to " @@ -3206,11 +3203,11 @@ msgid "" "daemon may complain." msgstr "" -#: ../../howto/logging-cookbook.rst:2479 +#: ../../howto/logging-cookbook.rst:2476 msgid "Implementing structured logging" msgstr "" -#: ../../howto/logging-cookbook.rst:2481 +#: ../../howto/logging-cookbook.rst:2478 msgid "" "Although most logging messages are intended for reading by humans, and thus " "not readily machine-parseable, there might be circumstances where you want " @@ -3222,7 +3219,7 @@ msgid "" "machine-parseable manner::" msgstr "" -#: ../../howto/logging-cookbook.rst:2489 +#: ../../howto/logging-cookbook.rst:2486 msgid "" "import json\n" "import logging\n" @@ -3241,11 +3238,11 @@ msgid "" "logging.info(_('message 1', foo='bar', bar='baz', num=123, fnum=123.456))" msgstr "" -#: ../../howto/logging-cookbook.rst:2505 +#: ../../howto/logging-cookbook.rst:2502 msgid "If the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2507 +#: ../../howto/logging-cookbook.rst:2504 msgid "" "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " "\"bar\"}" @@ -3253,19 +3250,19 @@ msgstr "" "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " "\"bar\"}" -#: ../../howto/logging-cookbook.rst:2511 ../../howto/logging-cookbook.rst:2553 +#: ../../howto/logging-cookbook.rst:2508 ../../howto/logging-cookbook.rst:2550 msgid "" "Note that the order of items might be different according to the version of " "Python used." msgstr "" -#: ../../howto/logging-cookbook.rst:2514 +#: ../../howto/logging-cookbook.rst:2511 msgid "" "If you need more specialised processing, you can use a custom JSON encoder, " "as in the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2517 +#: ../../howto/logging-cookbook.rst:2514 msgid "" "import json\n" "import logging\n" @@ -3298,19 +3295,19 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2547 +#: ../../howto/logging-cookbook.rst:2544 msgid "When the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2549 +#: ../../howto/logging-cookbook.rst:2546 msgid "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" msgstr "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" -#: ../../howto/logging-cookbook.rst:2562 +#: ../../howto/logging-cookbook.rst:2559 msgid "Customizing handlers with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2564 +#: ../../howto/logging-cookbook.rst:2561 msgid "" "There are times when you want to customize logging handlers in particular " "ways, and if you use :func:`dictConfig` you may be able to do this without " @@ -3320,7 +3317,7 @@ msgid "" "customize handler creation using a plain function such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2571 +#: ../../howto/logging-cookbook.rst:2568 msgid "" "def owned_file_handler(filename, mode='a', encoding=None, owner=None):\n" " if owner:\n" @@ -3336,13 +3333,13 @@ msgstr "" " shutil.chown(filename, *owner)\n" " return logging.FileHandler(filename, mode, encoding)" -#: ../../howto/logging-cookbook.rst:2578 +#: ../../howto/logging-cookbook.rst:2575 msgid "" "You can then specify, in a logging configuration passed to :func:" "`dictConfig`, that a logging handler be created by calling this function::" msgstr "" -#: ../../howto/logging-cookbook.rst:2581 +#: ../../howto/logging-cookbook.rst:2578 msgid "" "LOGGING = {\n" " 'version': 1,\n" @@ -3375,14 +3372,14 @@ msgid "" "}" msgstr "" -#: ../../howto/logging-cookbook.rst:2611 +#: ../../howto/logging-cookbook.rst:2608 msgid "" "In this example I am setting the ownership using the ``pulse`` user and " "group, just for the purposes of illustration. Putting it together into a " "working script, ``chowntest.py``::" msgstr "" -#: ../../howto/logging-cookbook.rst:2615 +#: ../../howto/logging-cookbook.rst:2612 msgid "" "import logging, logging.config, os, shutil\n" "\n" @@ -3428,11 +3425,11 @@ msgid "" "logger.debug('A debug message')" msgstr "" -#: ../../howto/logging-cookbook.rst:2658 +#: ../../howto/logging-cookbook.rst:2655 msgid "To run this, you will probably need to run as ``root``:" msgstr "" -#: ../../howto/logging-cookbook.rst:2660 +#: ../../howto/logging-cookbook.rst:2657 msgid "" "$ sudo python3.3 chowntest.py\n" "$ cat chowntest.log\n" @@ -3441,7 +3438,7 @@ msgid "" "-rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log" msgstr "" -#: ../../howto/logging-cookbook.rst:2668 +#: ../../howto/logging-cookbook.rst:2665 msgid "" "Note that this example uses Python 3.3 because that's where :func:`shutil." "chown` makes an appearance. This approach should work with any Python " @@ -3450,25 +3447,25 @@ msgid "" "change using e.g. :func:`os.chown`." msgstr "" -#: ../../howto/logging-cookbook.rst:2674 +#: ../../howto/logging-cookbook.rst:2671 msgid "" "In practice, the handler-creating function may be in a utility module " "somewhere in your project. Instead of the line in the configuration::" msgstr "" -#: ../../howto/logging-cookbook.rst:2677 +#: ../../howto/logging-cookbook.rst:2674 msgid "'()': owned_file_handler," msgstr "'()': owned_file_handler," -#: ../../howto/logging-cookbook.rst:2679 +#: ../../howto/logging-cookbook.rst:2676 msgid "you could use e.g.::" msgstr "" -#: ../../howto/logging-cookbook.rst:2681 +#: ../../howto/logging-cookbook.rst:2678 msgid "'()': 'ext://project.util.owned_file_handler'," msgstr "'()': 'ext://project.util.owned_file_handler'," -#: ../../howto/logging-cookbook.rst:2683 +#: ../../howto/logging-cookbook.rst:2680 msgid "" "where ``project.util`` can be replaced with the actual name of the package " "where the function resides. In the above working script, using ``'ext://" @@ -3476,25 +3473,25 @@ msgid "" "resolved by :func:`dictConfig` from the ``ext://`` specification." msgstr "" -#: ../../howto/logging-cookbook.rst:2688 +#: ../../howto/logging-cookbook.rst:2685 msgid "" "This example hopefully also points the way to how you could implement other " "types of file change - e.g. setting specific POSIX permission bits - in the " "same way, using :func:`os.chmod`." msgstr "" -#: ../../howto/logging-cookbook.rst:2692 +#: ../../howto/logging-cookbook.rst:2689 msgid "" "Of course, the approach could also be extended to types of handler other " "than a :class:`~logging.FileHandler` - for example, one of the rotating file " "handlers, or a different type of handler altogether." msgstr "" -#: ../../howto/logging-cookbook.rst:2702 +#: ../../howto/logging-cookbook.rst:2699 msgid "Using particular formatting styles throughout your application" msgstr "" -#: ../../howto/logging-cookbook.rst:2704 +#: ../../howto/logging-cookbook.rst:2701 msgid "" "In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword " "parameter which, while defaulting to ``%`` for backward compatibility, " @@ -3505,7 +3502,7 @@ msgid "" "is constructed." msgstr "" -#: ../../howto/logging-cookbook.rst:2711 +#: ../../howto/logging-cookbook.rst:2708 msgid "" "Logging calls (:meth:`~Logger.debug`, :meth:`~Logger.info` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -3520,7 +3517,7 @@ msgid "" "calls which are out there in existing code will be using %-format strings." msgstr "" -#: ../../howto/logging-cookbook.rst:2723 +#: ../../howto/logging-cookbook.rst:2720 msgid "" "There have been suggestions to associate format styles with specific " "loggers, but that approach also runs into backward compatibility problems " @@ -3528,7 +3525,7 @@ msgid "" "formatting." msgstr "" -#: ../../howto/logging-cookbook.rst:2727 +#: ../../howto/logging-cookbook.rst:2724 msgid "" "For logging to work interoperably between any third-party libraries and your " "code, decisions about formatting need to be made at the level of the " @@ -3536,11 +3533,11 @@ msgid "" "formatting styles can be accommodated." msgstr "" -#: ../../howto/logging-cookbook.rst:2734 +#: ../../howto/logging-cookbook.rst:2731 msgid "Using LogRecord factories" msgstr "" -#: ../../howto/logging-cookbook.rst:2736 +#: ../../howto/logging-cookbook.rst:2733 msgid "" "In Python 3.2, along with the :class:`~logging.Formatter` changes mentioned " "above, the logging package gained the ability to allow users to set their " @@ -3555,17 +3552,17 @@ msgid "" "implementation does." msgstr "" -#: ../../howto/logging-cookbook.rst:2747 +#: ../../howto/logging-cookbook.rst:2744 msgid "" "Refer to the reference documentation on :func:`setLogRecordFactory` and :" "class:`LogRecord` for more information." msgstr "" -#: ../../howto/logging-cookbook.rst:2752 +#: ../../howto/logging-cookbook.rst:2749 msgid "Using custom message objects" msgstr "" -#: ../../howto/logging-cookbook.rst:2754 +#: ../../howto/logging-cookbook.rst:2751 msgid "" "There is another, perhaps simpler way that you can use {}- and $- formatting " "to construct your individual log messages. You may recall (from :ref:" @@ -3575,7 +3572,7 @@ msgid "" "following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:2779 +#: ../../howto/logging-cookbook.rst:2776 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -3586,13 +3583,13 @@ msgid "" "using ``_`` for localization)." msgstr "" -#: ../../howto/logging-cookbook.rst:2787 +#: ../../howto/logging-cookbook.rst:2784 msgid "" "Examples of this approach are given below. Firstly, formatting with :meth:" "`str.format`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2790 +#: ../../howto/logging-cookbook.rst:2787 msgid "" ">>> __ = BraceMessage\n" ">>> print(__('Message with {0} {1}', 2, 'placeholders'))\n" @@ -3607,11 +3604,11 @@ msgid "" "Message with coordinates: (0.50, 0.50)" msgstr "" -#: ../../howto/logging-cookbook.rst:2801 +#: ../../howto/logging-cookbook.rst:2798 msgid "Secondly, formatting with :class:`string.Template`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2803 +#: ../../howto/logging-cookbook.rst:2800 msgid "" ">>> __ = DollarMessage\n" ">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" @@ -3619,7 +3616,7 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:2808 +#: ../../howto/logging-cookbook.rst:2805 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -3631,11 +3628,11 @@ msgid "" "shown above." msgstr "" -#: ../../howto/logging-cookbook.rst:2822 +#: ../../howto/logging-cookbook.rst:2819 msgid "Configuring filters with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2824 +#: ../../howto/logging-cookbook.rst:2821 msgid "" "You *can* configure filters using :func:`~logging.config.dictConfig`, though " "it might not be obvious at first glance how to do it (hence this recipe). " @@ -3650,7 +3647,7 @@ msgid "" "complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2835 +#: ../../howto/logging-cookbook.rst:2832 msgid "" "import logging\n" "import logging.config\n" @@ -3736,26 +3733,26 @@ msgstr "" " logging.debug('hello')\n" " logging.debug('hello - noshow')" -#: ../../howto/logging-cookbook.rst:2877 +#: ../../howto/logging-cookbook.rst:2874 msgid "" "This example shows how you can pass configuration data to the callable which " "constructs the instance, in the form of keyword parameters. When run, the " "above script will print:" msgstr "" -#: ../../howto/logging-cookbook.rst:2881 +#: ../../howto/logging-cookbook.rst:2878 msgid "changed: hello" msgstr "changed: hello" -#: ../../howto/logging-cookbook.rst:2885 +#: ../../howto/logging-cookbook.rst:2882 msgid "which shows that the filter is working as configured." msgstr "" -#: ../../howto/logging-cookbook.rst:2887 +#: ../../howto/logging-cookbook.rst:2884 msgid "A couple of extra points to note:" msgstr "" -#: ../../howto/logging-cookbook.rst:2889 +#: ../../howto/logging-cookbook.rst:2886 msgid "" "If you can't refer to the callable directly in the configuration (e.g. if it " "lives in a different module, and you can't import it directly where the " @@ -3765,7 +3762,7 @@ msgid "" "the above example." msgstr "" -#: ../../howto/logging-cookbook.rst:2896 +#: ../../howto/logging-cookbook.rst:2893 msgid "" "As well as for filters, this technique can also be used to configure custom " "handlers and formatters. See :ref:`logging-config-dict-userdef` for more " @@ -3774,11 +3771,11 @@ msgid "" "above." msgstr "" -#: ../../howto/logging-cookbook.rst:2905 +#: ../../howto/logging-cookbook.rst:2902 msgid "Customized exception formatting" msgstr "" -#: ../../howto/logging-cookbook.rst:2907 +#: ../../howto/logging-cookbook.rst:2904 msgid "" "There might be times when you want to do customized exception formatting - " "for argument's sake, let's say you want exactly one line per logged event, " @@ -3786,7 +3783,7 @@ msgid "" "formatter class, as shown in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2912 +#: ../../howto/logging-cookbook.rst:2909 msgid "" "import logging\n" "\n" @@ -3825,11 +3822,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2948 +#: ../../howto/logging-cookbook.rst:2945 msgid "When run, this produces a file with exactly two lines:" msgstr "" -#: ../../howto/logging-cookbook.rst:2950 +#: ../../howto/logging-cookbook.rst:2947 msgid "" "28/01/2015 07:21:23|INFO|Sample message|\n" "28/01/2015 07:21:23|ERROR|ZeroDivisionError: integer division or modulo by " @@ -3843,18 +3840,18 @@ msgstr "" "in main\\n x = 1 / 0\\nZeroDivisionError: integer division or modulo by " "zero'|" -#: ../../howto/logging-cookbook.rst:2955 +#: ../../howto/logging-cookbook.rst:2952 msgid "" "While the above treatment is simplistic, it points the way to how exception " "information can be formatted to your liking. The :mod:`traceback` module may " "be helpful for more specialized needs." msgstr "" -#: ../../howto/logging-cookbook.rst:2962 +#: ../../howto/logging-cookbook.rst:2959 msgid "Speaking logging messages" msgstr "" -#: ../../howto/logging-cookbook.rst:2964 +#: ../../howto/logging-cookbook.rst:2961 msgid "" "There might be situations when it is desirable to have logging messages " "rendered in an audible rather than a visible format. This is easy to do if " @@ -3871,7 +3868,7 @@ msgid "" "approach, which assumes that the ``espeak`` TTS package is available::" msgstr "" -#: ../../howto/logging-cookbook.rst:2977 +#: ../../howto/logging-cookbook.rst:2974 msgid "" "import logging\n" "import subprocess\n" @@ -3903,24 +3900,24 @@ msgid "" " sys.exit(main())" msgstr "" -#: ../../howto/logging-cookbook.rst:3006 +#: ../../howto/logging-cookbook.rst:3003 msgid "" "When run, this script should say \"Hello\" and then \"Goodbye\" in a female " "voice." msgstr "" -#: ../../howto/logging-cookbook.rst:3008 +#: ../../howto/logging-cookbook.rst:3005 msgid "" "The above approach can, of course, be adapted to other TTS systems and even " "other systems altogether which can process messages via external programs " "run from a command line." msgstr "" -#: ../../howto/logging-cookbook.rst:3016 +#: ../../howto/logging-cookbook.rst:3013 msgid "Buffering logging messages and outputting them conditionally" msgstr "" -#: ../../howto/logging-cookbook.rst:3018 +#: ../../howto/logging-cookbook.rst:3015 msgid "" "There might be situations where you want to log messages in a temporary area " "and only output them if a certain condition occurs. For example, you may " @@ -3930,7 +3927,7 @@ msgid "" "debug information to be output as well as the error." msgstr "" -#: ../../howto/logging-cookbook.rst:3025 +#: ../../howto/logging-cookbook.rst:3022 msgid "" "Here is an example which shows how you could do this using a decorator for " "your functions where you want logging to behave this way. It makes use of " @@ -3943,7 +3940,7 @@ msgid "" "subclass of ``MemoryHandler`` if you want custom flushing behavior." msgstr "" -#: ../../howto/logging-cookbook.rst:3035 +#: ../../howto/logging-cookbook.rst:3032 msgid "" "The example script has a simple function, ``foo``, which just cycles through " "all the logging levels, writing to ``sys.stderr`` to say what level it's " @@ -3952,7 +3949,7 @@ msgid "" "levels - otherwise, it only logs at DEBUG, INFO and WARNING levels." msgstr "" -#: ../../howto/logging-cookbook.rst:3041 +#: ../../howto/logging-cookbook.rst:3038 msgid "" "The script just arranges to decorate ``foo`` with a decorator which will do " "the conditional logging that's required. The decorator takes a logger as a " @@ -3964,11 +3961,11 @@ msgid "" "respectively." msgstr "" -#: ../../howto/logging-cookbook.rst:3049 +#: ../../howto/logging-cookbook.rst:3046 msgid "Here's the script::" msgstr "" -#: ../../howto/logging-cookbook.rst:3051 +#: ../../howto/logging-cookbook.rst:3048 msgid "" "import logging\n" "from logging.handlers import MemoryHandler\n" @@ -4034,11 +4031,11 @@ msgid "" " assert decorated_foo(True)" msgstr "" -#: ../../howto/logging-cookbook.rst:3112 +#: ../../howto/logging-cookbook.rst:3109 msgid "When this script is run, the following output should be observed:" msgstr "" -#: ../../howto/logging-cookbook.rst:3114 +#: ../../howto/logging-cookbook.rst:3111 msgid "" "Calling undecorated foo with False\n" "about to log at DEBUG ...\n" @@ -4067,29 +4064,29 @@ msgid "" "Actually logged at CRITICAL" msgstr "" -#: ../../howto/logging-cookbook.rst:3142 +#: ../../howto/logging-cookbook.rst:3139 msgid "" "As you can see, actual logging output only occurs when an event is logged " "whose severity is ERROR or greater, but in that case, any previous events at " "lower severities are also logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3146 +#: ../../howto/logging-cookbook.rst:3143 msgid "You can of course use the conventional means of decoration::" msgstr "" -#: ../../howto/logging-cookbook.rst:3148 +#: ../../howto/logging-cookbook.rst:3145 msgid "" "@log_if_errors(logger)\n" "def foo(fail=False):\n" " ..." msgstr "" -#: ../../howto/logging-cookbook.rst:3156 +#: ../../howto/logging-cookbook.rst:3153 msgid "Sending logging messages to email, with buffering" msgstr "" -#: ../../howto/logging-cookbook.rst:3158 +#: ../../howto/logging-cookbook.rst:3155 msgid "" "To illustrate how you can send log messages via email, so that a set number " "of messages are sent per email, you can subclass :class:`~logging.handlers." @@ -4100,7 +4097,7 @@ msgid "" "argument to see the required and optional arguments.)" msgstr "" -#: ../../howto/logging-cookbook.rst:3166 +#: ../../howto/logging-cookbook.rst:3163 msgid "" "import logging\n" "import logging.handlers\n" @@ -4168,7 +4165,7 @@ msgid "" " h.close()" msgstr "" -#: ../../howto/logging-cookbook.rst:3230 +#: ../../howto/logging-cookbook.rst:3227 msgid "" "If you run this script and your SMTP server is correctly set up, you should " "find that it sends eleven emails to the addressee you specify. The first ten " @@ -4176,17 +4173,17 @@ msgid "" "messages. That makes up 102 messages as specified in the script." msgstr "" -#: ../../howto/logging-cookbook.rst:3238 +#: ../../howto/logging-cookbook.rst:3235 msgid "Formatting times using UTC (GMT) via configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:3240 +#: ../../howto/logging-cookbook.rst:3237 msgid "" "Sometimes you want to format times using UTC, which can be done using a " "class such as ``UTCFormatter``, shown below::" msgstr "" -#: ../../howto/logging-cookbook.rst:3243 +#: ../../howto/logging-cookbook.rst:3240 msgid "" "import logging\n" "import time\n" @@ -4195,7 +4192,7 @@ msgid "" " converter = time.gmtime" msgstr "" -#: ../../howto/logging-cookbook.rst:3249 +#: ../../howto/logging-cookbook.rst:3246 msgid "" "and you can then use the ``UTCFormatter`` in your code instead of :class:" "`~logging.Formatter`. If you want to do that via configuration, you can use " @@ -4203,7 +4200,7 @@ msgid "" "the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:3254 +#: ../../howto/logging-cookbook.rst:3251 msgid "" "import logging\n" "import logging.config\n" @@ -4244,27 +4241,29 @@ msgid "" " logging.warning('The local time is %s', time.asctime())" msgstr "" -#: ../../howto/logging-cookbook.rst:3292 +#: ../../howto/logging-cookbook.rst:3289 msgid "When this script is run, it should print something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:3294 +#: ../../howto/logging-cookbook.rst:3291 msgid "" "2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" "2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" msgstr "" +"2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" +"2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" -#: ../../howto/logging-cookbook.rst:3299 +#: ../../howto/logging-cookbook.rst:3296 msgid "" "showing how the time is formatted both as local time and UTC, one for each " "handler." msgstr "" -#: ../../howto/logging-cookbook.rst:3306 +#: ../../howto/logging-cookbook.rst:3303 msgid "Using a context manager for selective logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3308 +#: ../../howto/logging-cookbook.rst:3305 msgid "" "There are times when it would be useful to temporarily change the logging " "configuration and revert it back after doing something. For this, a context " @@ -4274,7 +4273,7 @@ msgid "" "scope of the context manager::" msgstr "" -#: ../../howto/logging-cookbook.rst:3315 +#: ../../howto/logging-cookbook.rst:3312 msgid "" "import logging\n" "import sys\n" @@ -4303,7 +4302,7 @@ msgid "" " # implicit return of None => don't swallow exceptions" msgstr "" -#: ../../howto/logging-cookbook.rst:3341 +#: ../../howto/logging-cookbook.rst:3338 msgid "" "If you specify a level value, the logger's level is set to that value in the " "scope of the with block covered by the context manager. If you specify a " @@ -4312,13 +4311,13 @@ msgid "" "block exit - you could do this if you don't need the handler any more." msgstr "" -#: ../../howto/logging-cookbook.rst:3347 +#: ../../howto/logging-cookbook.rst:3344 msgid "" "To illustrate how it works, we can add the following block of code to the " "above::" msgstr "" -#: ../../howto/logging-cookbook.rst:3350 +#: ../../howto/logging-cookbook.rst:3347 msgid "" "if __name__ == '__main__':\n" " logger = logging.getLogger('foo')\n" @@ -4338,7 +4337,7 @@ msgid "" " logger.debug('7. This should not appear.')" msgstr "" -#: ../../howto/logging-cookbook.rst:3365 +#: ../../howto/logging-cookbook.rst:3362 msgid "" "We initially set the logger's level to ``INFO``, so message #1 appears and " "message #2 doesn't. We then change the level to ``DEBUG`` temporarily in the " @@ -4351,11 +4350,11 @@ msgid "" "(like message #1) whereas message #7 doesn't (just like message #2)." msgstr "" -#: ../../howto/logging-cookbook.rst:3375 +#: ../../howto/logging-cookbook.rst:3372 msgid "If we run the resulting script, the result is as follows:" msgstr "" -#: ../../howto/logging-cookbook.rst:3377 +#: ../../howto/logging-cookbook.rst:3374 msgid "" "$ python logctx.py\n" "1. This should appear just once on stderr.\n" @@ -4365,23 +4364,23 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -#: ../../howto/logging-cookbook.rst:3386 +#: ../../howto/logging-cookbook.rst:3383 msgid "" "If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the " "following, which is the only message written to ``stdout``:" msgstr "" -#: ../../howto/logging-cookbook.rst:3389 +#: ../../howto/logging-cookbook.rst:3386 msgid "" "$ python logctx.py 2>/dev/null\n" "5. This should appear twice - once on stderr and once on stdout." msgstr "" -#: ../../howto/logging-cookbook.rst:3394 +#: ../../howto/logging-cookbook.rst:3391 msgid "Once again, but piping ``stdout`` to ``/dev/null``, we get:" msgstr "" -#: ../../howto/logging-cookbook.rst:3396 +#: ../../howto/logging-cookbook.rst:3393 msgid "" "$ python logctx.py >/dev/null\n" "1. This should appear just once on stderr.\n" @@ -4390,42 +4389,42 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -#: ../../howto/logging-cookbook.rst:3404 +#: ../../howto/logging-cookbook.rst:3401 msgid "" "In this case, the message #5 printed to ``stdout`` doesn't appear, as " "expected." msgstr "" -#: ../../howto/logging-cookbook.rst:3406 +#: ../../howto/logging-cookbook.rst:3403 msgid "" "Of course, the approach described here can be generalised, for example to " "attach logging filters temporarily. Note that the above code works in Python " "2 as well as Python 3." msgstr "" -#: ../../howto/logging-cookbook.rst:3414 +#: ../../howto/logging-cookbook.rst:3411 msgid "A CLI application starter template" msgstr "" -#: ../../howto/logging-cookbook.rst:3416 +#: ../../howto/logging-cookbook.rst:3413 msgid "Here's an example which shows how you can:" msgstr "" -#: ../../howto/logging-cookbook.rst:3418 +#: ../../howto/logging-cookbook.rst:3415 msgid "Use a logging level based on command-line arguments" msgstr "" -#: ../../howto/logging-cookbook.rst:3419 +#: ../../howto/logging-cookbook.rst:3416 msgid "" "Dispatch to multiple subcommands in separate files, all logging at the same " "level in a consistent way" msgstr "" -#: ../../howto/logging-cookbook.rst:3421 +#: ../../howto/logging-cookbook.rst:3418 msgid "Make use of simple, minimal configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:3423 +#: ../../howto/logging-cookbook.rst:3420 msgid "" "Suppose we have a command-line application whose job is to stop, start or " "restart some services. This could be organised for the purposes of " @@ -4436,7 +4435,7 @@ msgid "" "``logging.INFO``. Here's one way that ``app.py`` could be written::" msgstr "" -#: ../../howto/logging-cookbook.rst:3431 +#: ../../howto/logging-cookbook.rst:3428 msgid "" "import argparse\n" "import importlib\n" @@ -4483,13 +4482,13 @@ msgid "" " sys.exit(main())" msgstr "" -#: ../../howto/logging-cookbook.rst:3472 +#: ../../howto/logging-cookbook.rst:3469 msgid "" "And the ``start``, ``stop`` and ``restart`` commands can be implemented in " "separate modules, like so for starting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3475 +#: ../../howto/logging-cookbook.rst:3472 msgid "" "# start.py\n" "import logging\n" @@ -4502,11 +4501,11 @@ msgid "" " logger.info('Started the \\'%s\\' service.', options.name)" msgstr "" -#: ../../howto/logging-cookbook.rst:3485 +#: ../../howto/logging-cookbook.rst:3482 msgid "and thus for stopping::" msgstr "" -#: ../../howto/logging-cookbook.rst:3487 +#: ../../howto/logging-cookbook.rst:3484 msgid "" "# stop.py\n" "import logging\n" @@ -4528,11 +4527,11 @@ msgid "" " logger.info('Stopped the %s service%s.', services, plural)" msgstr "" -#: ../../howto/logging-cookbook.rst:3506 +#: ../../howto/logging-cookbook.rst:3503 msgid "and similarly for restarting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3508 +#: ../../howto/logging-cookbook.rst:3505 msgid "" "# restart.py\n" "import logging\n" @@ -4554,13 +4553,13 @@ msgid "" " logger.info('Restarted the %s service%s.', services, plural)" msgstr "" -#: ../../howto/logging-cookbook.rst:3527 +#: ../../howto/logging-cookbook.rst:3524 msgid "" "If we run this application with the default log level, we get output like " "this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3529 +#: ../../howto/logging-cookbook.rst:3526 msgid "" "$ python app.py start foo\n" "INFO start Started the 'foo' service.\n" @@ -4572,19 +4571,19 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" -#: ../../howto/logging-cookbook.rst:3540 +#: ../../howto/logging-cookbook.rst:3537 msgid "" "The first word is the logging level, and the second word is the module or " "package name of the place where the event was logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3543 +#: ../../howto/logging-cookbook.rst:3540 msgid "" "If we change the logging level, then we can change the information sent to " "the log. For example, if we want more information:" msgstr "" -#: ../../howto/logging-cookbook.rst:3546 +#: ../../howto/logging-cookbook.rst:3543 msgid "" "$ python app.py --log-level DEBUG start foo\n" "DEBUG start About to start foo\n" @@ -4599,28 +4598,28 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" -#: ../../howto/logging-cookbook.rst:3560 +#: ../../howto/logging-cookbook.rst:3557 msgid "And if we want less:" msgstr "" -#: ../../howto/logging-cookbook.rst:3562 +#: ../../howto/logging-cookbook.rst:3559 msgid "" "$ python app.py --log-level WARNING start foo\n" "$ python app.py --log-level WARNING stop foo bar\n" "$ python app.py --log-level WARNING restart foo bar baz" msgstr "" -#: ../../howto/logging-cookbook.rst:3568 +#: ../../howto/logging-cookbook.rst:3565 msgid "" "In this case, the commands don't print anything to the console, since " "nothing at ``WARNING`` level or above is logged by them." msgstr "" -#: ../../howto/logging-cookbook.rst:3574 +#: ../../howto/logging-cookbook.rst:3571 msgid "A Qt GUI for logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3576 +#: ../../howto/logging-cookbook.rst:3573 msgid "" "A question that comes up from time to time is about how to log to a GUI " "application. The `Qt `_ framework is a popular cross-" @@ -4628,7 +4627,7 @@ msgid "" "`PyQt5` libraries." msgstr "" -#: ../../howto/logging-cookbook.rst:3581 +#: ../../howto/logging-cookbook.rst:3578 msgid "" "The following example shows how to log to a Qt GUI. This introduces a simple " "``QtHandler`` class which takes a callable, which should be a slot in the " @@ -4638,14 +4637,14 @@ msgid "" "logging messages at random levels with random short delays in between)." msgstr "" -#: ../../howto/logging-cookbook.rst:3588 +#: ../../howto/logging-cookbook.rst:3585 msgid "" "The worker thread is implemented using Qt's ``QThread`` class rather than " "the :mod:`threading` module, as there are circumstances where one has to use " "``QThread``, which offers better integration with other ``Qt`` components." msgstr "" -#: ../../howto/logging-cookbook.rst:3592 +#: ../../howto/logging-cookbook.rst:3589 msgid "" "The code should work with recent releases of any of ``PySide6``, ``PyQt6``, " "``PySide2`` or ``PyQt5``. You should be able to adapt the approach to " @@ -4653,7 +4652,7 @@ msgid "" "more detailed information." msgstr "" -#: ../../howto/logging-cookbook.rst:3597 +#: ../../howto/logging-cookbook.rst:3594 msgid "" "import datetime\n" "import logging\n" @@ -4904,11 +4903,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:3829 +#: ../../howto/logging-cookbook.rst:3826 msgid "Logging to syslog with RFC5424 support" msgstr "" -#: ../../howto/logging-cookbook.rst:3831 +#: ../../howto/logging-cookbook.rst:3828 msgid "" "Although :rfc:`5424` dates from 2009, most syslog servers are configured by " "default to use the older :rfc:`3164`, which hails from 2001. When " @@ -4918,14 +4917,14 @@ msgid "" "handlers.SysLogHandler` functionality has not been updated." msgstr "" -#: ../../howto/logging-cookbook.rst:3838 +#: ../../howto/logging-cookbook.rst:3835 msgid "" "RFC 5424 contains some useful features such as support for structured data, " "and if you need to be able to log to a syslog server with support for it, " "you can do so with a subclassed handler which looks something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3842 +#: ../../howto/logging-cookbook.rst:3839 msgid "" "import datetime\n" "import logging.handlers\n" @@ -4995,7 +4994,7 @@ msgid "" "{sdata} {msg}'" msgstr "" -#: ../../howto/logging-cookbook.rst:3904 +#: ../../howto/logging-cookbook.rst:3901 msgid "" "You'll need to be familiar with RFC 5424 to fully understand the above code, " "and it may be that you have slightly different needs (e.g. for how you pass " @@ -5004,7 +5003,7 @@ msgid "" "using something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3909 +#: ../../howto/logging-cookbook.rst:3906 msgid "" "sd = {\n" " 'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n" @@ -5014,12 +5013,19 @@ msgid "" "i = 1\n" "logger.debug('Message %d', i, extra=extra)" msgstr "" +"sd = {\n" +" 'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n" +" 'foo@54321': {'rab': 'baz', 'zab': 'bozz', 'zzif': r'buzz'}\n" +"}\n" +"extra = {'structured_data': sd}\n" +"i = 1\n" +"logger.debug('Message %d', i, extra=extra)" -#: ../../howto/logging-cookbook.rst:3918 +#: ../../howto/logging-cookbook.rst:3915 msgid "How to treat a logger like an output stream" msgstr "" -#: ../../howto/logging-cookbook.rst:3920 +#: ../../howto/logging-cookbook.rst:3917 msgid "" "Sometimes, you need to interface to a third-party API which expects a file-" "like object to write to, but you want to direct the API's output to a " @@ -5027,7 +5033,7 @@ msgid "" "API. Here's a short script illustrating such a class:" msgstr "" -#: ../../howto/logging-cookbook.rst:3925 +#: ../../howto/logging-cookbook.rst:3922 msgid "" "import logging\n" "\n" @@ -5065,23 +5071,23 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:3960 +#: ../../howto/logging-cookbook.rst:3957 msgid "When this script is run, it prints" msgstr "" -#: ../../howto/logging-cookbook.rst:3962 +#: ../../howto/logging-cookbook.rst:3959 msgid "" "INFO:demo:An INFO message\n" "DEBUG:demo:A DEBUG message" msgstr "" -#: ../../howto/logging-cookbook.rst:3967 +#: ../../howto/logging-cookbook.rst:3964 msgid "" "You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and ``sys." "stderr`` by doing something like this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3970 +#: ../../howto/logging-cookbook.rst:3967 msgid "" "import sys\n" "\n" @@ -5089,7 +5095,7 @@ msgid "" "sys.stderr = LoggerWriter(logger, logging.WARNING)" msgstr "" -#: ../../howto/logging-cookbook.rst:3977 +#: ../../howto/logging-cookbook.rst:3974 msgid "" "You should do this *after* configuring logging for your needs. In the above " "example, the :func:`~logging.basicConfig` call does this (using the ``sys." @@ -5097,7 +5103,7 @@ msgid "" "Then, you'd get this kind of result:" msgstr "" -#: ../../howto/logging-cookbook.rst:3982 +#: ../../howto/logging-cookbook.rst:3979 msgid "" ">>> print('Foo')\n" "INFO:demo:Foo\n" @@ -5105,32 +5111,37 @@ msgid "" "WARNING:demo:Bar\n" ">>>" msgstr "" +">>> print('Foo')\n" +"INFO:demo:Foo\n" +">>> print('Bar', file=sys.stderr)\n" +"WARNING:demo:Bar\n" +">>>" -#: ../../howto/logging-cookbook.rst:3990 +#: ../../howto/logging-cookbook.rst:3987 msgid "" "Of course, the examples above show output according to the format used by :" "func:`~logging.basicConfig`, but you can use a different formatter when you " "configure logging." msgstr "" -#: ../../howto/logging-cookbook.rst:3994 +#: ../../howto/logging-cookbook.rst:3991 msgid "" "Note that with the above scheme, you are somewhat at the mercy of buffering " "and the sequence of write calls which you are intercepting. For example, " "with the definition of ``LoggerWriter`` above, if you have the snippet" msgstr "" -#: ../../howto/logging-cookbook.rst:3998 +#: ../../howto/logging-cookbook.rst:3995 msgid "" "sys.stderr = LoggerWriter(logger, logging.WARNING)\n" "1 / 0" msgstr "" -#: ../../howto/logging-cookbook.rst:4003 +#: ../../howto/logging-cookbook.rst:4000 msgid "then running the script results in" msgstr "" -#: ../../howto/logging-cookbook.rst:4005 +#: ../../howto/logging-cookbook.rst:4002 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "\n" @@ -5149,7 +5160,7 @@ msgid "" "WARNING:demo:division by zero" msgstr "" -#: ../../howto/logging-cookbook.rst:4021 +#: ../../howto/logging-cookbook.rst:4018 msgid "" "As you can see, this output isn't ideal. That's because the underlying code " "which writes to ``sys.stderr`` makes multiple writes, each of which results " @@ -5159,7 +5170,7 @@ msgid "" "``LoggerWriter``:" msgstr "" -#: ../../howto/logging-cookbook.rst:4027 +#: ../../howto/logging-cookbook.rst:4024 msgid "" "class BufferingLoggerWriter(LoggerWriter):\n" " def __init__(self, logger, level):\n" @@ -5178,14 +5189,30 @@ msgid "" " for part in parts:\n" " self.logger.log(self.level, part)" msgstr "" +"class BufferingLoggerWriter(LoggerWriter):\n" +" def __init__(self, logger, level):\n" +" super().__init__(logger, level)\n" +" self.buffer = ''\n" +"\n" +" def write(self, message):\n" +" if '\\n' not in message:\n" +" self.buffer += message\n" +" else:\n" +" parts = message.split('\\n')\n" +" if self.buffer:\n" +" s = self.buffer + parts.pop(0)\n" +" self.logger.log(self.level, s)\n" +" self.buffer = parts.pop()\n" +" for part in parts:\n" +" self.logger.log(self.level, part)" -#: ../../howto/logging-cookbook.rst:4046 +#: ../../howto/logging-cookbook.rst:4043 msgid "" "This just buffers up stuff until a newline is seen, and then logs complete " "lines. With this approach, you get better output:" msgstr "" -#: ../../howto/logging-cookbook.rst:4049 +#: ../../howto/logging-cookbook.rst:4046 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, " @@ -5196,12 +5223,20 @@ msgid "" "WARNING:demo: 1/0\n" "WARNING:demo:ZeroDivisionError: division by zero" msgstr "" +"WARNING:demo:Traceback (most recent call last):\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, " +"in \n" +"WARNING:demo: main()\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 52, " +"in main\n" +"WARNING:demo: 1/0\n" +"WARNING:demo:ZeroDivisionError: division by zero" -#: ../../howto/logging-cookbook.rst:4062 +#: ../../howto/logging-cookbook.rst:4059 msgid "Patterns to avoid" msgstr "" -#: ../../howto/logging-cookbook.rst:4064 +#: ../../howto/logging-cookbook.rst:4061 msgid "" "Although the preceding sections have described ways of doing things you " "might need to do or deal with, it is worth mentioning some usage patterns " @@ -5209,11 +5244,11 @@ msgid "" "The following sections are in no particular order." msgstr "" -#: ../../howto/logging-cookbook.rst:4070 +#: ../../howto/logging-cookbook.rst:4067 msgid "Opening the same log file multiple times" msgstr "" -#: ../../howto/logging-cookbook.rst:4072 +#: ../../howto/logging-cookbook.rst:4069 msgid "" "On Windows, you will generally not be able to open the same file multiple " "times as this will lead to a \"file is in use by another process\" error. " @@ -5221,32 +5256,32 @@ msgid "" "file multiple times. This could be done accidentally, for example by:" msgstr "" -#: ../../howto/logging-cookbook.rst:4077 +#: ../../howto/logging-cookbook.rst:4074 msgid "" "Adding a file handler more than once which references the same file (e.g. by " "a copy/paste/forget-to-change error)." msgstr "" -#: ../../howto/logging-cookbook.rst:4080 +#: ../../howto/logging-cookbook.rst:4077 msgid "" "Opening two files that look different, as they have different names, but are " "the same because one is a symbolic link to the other." msgstr "" -#: ../../howto/logging-cookbook.rst:4083 +#: ../../howto/logging-cookbook.rst:4080 msgid "" "Forking a process, following which both parent and child have a reference to " "the same file. This might be through use of the :mod:`multiprocessing` " "module, for example." msgstr "" -#: ../../howto/logging-cookbook.rst:4087 +#: ../../howto/logging-cookbook.rst:4084 msgid "" "Opening a file multiple times might *appear* to work most of the time, but " "can lead to a number of problems in practice:" msgstr "" -#: ../../howto/logging-cookbook.rst:4090 +#: ../../howto/logging-cookbook.rst:4087 msgid "" "Logging output can be garbled because multiple threads or processes try to " "write to the same file. Although logging guards against concurrent use of " @@ -5255,7 +5290,7 @@ msgid "" "different handler instances which happen to point to the same file." msgstr "" -#: ../../howto/logging-cookbook.rst:4096 +#: ../../howto/logging-cookbook.rst:4093 msgid "" "An attempt to delete a file (e.g. during file rotation) silently fails, " "because there is another reference pointing to it. This can lead to " @@ -5265,17 +5300,17 @@ msgid "" "being supposedly in place." msgstr "" -#: ../../howto/logging-cookbook.rst:4103 +#: ../../howto/logging-cookbook.rst:4100 msgid "" "Use the techniques outlined in :ref:`multiple-processes` to circumvent such " "issues." msgstr "" -#: ../../howto/logging-cookbook.rst:4107 +#: ../../howto/logging-cookbook.rst:4104 msgid "Using loggers as attributes in a class or passing them as parameters" msgstr "" -#: ../../howto/logging-cookbook.rst:4109 +#: ../../howto/logging-cookbook.rst:4106 msgid "" "While there might be unusual cases where you'll need to do this, in general " "there is no point because loggers are singletons. Code can always access a " @@ -5286,13 +5321,13 @@ msgid "" "module (and not the class) is the unit of software decomposition." msgstr "" -#: ../../howto/logging-cookbook.rst:4118 +#: ../../howto/logging-cookbook.rst:4115 msgid "" "Adding handlers other than :class:`~logging.NullHandler` to a logger in a " "library" msgstr "" -#: ../../howto/logging-cookbook.rst:4120 +#: ../../howto/logging-cookbook.rst:4117 msgid "" "Configuring logging by adding handlers, formatters and filters is the " "responsibility of the application developer, not the library developer. If " @@ -5300,11 +5335,11 @@ msgid "" "your loggers other than a :class:`~logging.NullHandler` instance." msgstr "" -#: ../../howto/logging-cookbook.rst:4126 +#: ../../howto/logging-cookbook.rst:4123 msgid "Creating a lot of loggers" msgstr "" -#: ../../howto/logging-cookbook.rst:4128 +#: ../../howto/logging-cookbook.rst:4125 msgid "" "Loggers are singletons that are never freed during a script execution, and " "so creating lots of loggers will use up memory which can't then be freed. " @@ -5315,38 +5350,38 @@ msgid "" "occasionally slightly more fine-grained than that)." msgstr "" -#: ../../howto/logging-cookbook.rst:4139 +#: ../../howto/logging-cookbook.rst:4136 msgid "Other resources" -msgstr "" +msgstr "其他資源" -#: ../../howto/logging-cookbook.rst:4143 +#: ../../howto/logging-cookbook.rst:4140 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../howto/logging-cookbook.rst:4144 +#: ../../howto/logging-cookbook.rst:4141 msgid "API reference for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4146 +#: ../../howto/logging-cookbook.rst:4143 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../howto/logging-cookbook.rst:4147 +#: ../../howto/logging-cookbook.rst:4144 msgid "Configuration API for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4149 +#: ../../howto/logging-cookbook.rst:4146 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../howto/logging-cookbook.rst:4150 +#: ../../howto/logging-cookbook.rst:4147 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4152 +#: ../../howto/logging-cookbook.rst:4149 msgid ":ref:`Basic Tutorial `" msgstr ":ref:`基礎教學 `" -#: ../../howto/logging-cookbook.rst:4154 +#: ../../howto/logging-cookbook.rst:4151 msgid ":ref:`Advanced Tutorial `" msgstr ":ref:`進階教學 `" diff --git a/howto/regex.po b/howto/regex.po index 825d7f2aff..42467d34b9 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -661,7 +661,7 @@ msgstr "" #: ../../howto/regex.rst:363 ../../howto/regex.rst:417 #: ../../howto/regex.rst:1065 msgid "Method/Attribute" -msgstr "" +msgstr "方法/屬性" #: ../../howto/regex.rst:363 ../../howto/regex.rst:417 #: ../../howto/regex.rst:1065 @@ -1005,7 +1005,7 @@ msgstr "" #: ../../howto/regex.rst:538 msgid "Flag" -msgstr "" +msgstr "旗標" #: ../../howto/regex.rst:538 msgid "Meaning" diff --git a/howto/sockets.po b/howto/sockets.po index 982fa34fd1..168504a99e 100644 --- a/howto/sockets.po +++ b/howto/sockets.po @@ -50,7 +50,7 @@ msgstr "" #: ../../howto/sockets.rst:20 msgid "Sockets" -msgstr "" +msgstr "Sockets" #: ../../howto/sockets.rst:22 msgid "" diff --git a/howto/timerfd.po b/howto/timerfd.po index 27b4768a58..dd737358de 100644 --- a/howto/timerfd.po +++ b/howto/timerfd.po @@ -27,7 +27,7 @@ msgstr "" #: ../../howto/timerfd.rst:7 msgid "1.13" -msgstr "" +msgstr "1.13" #: ../../howto/timerfd.rst:9 msgid "" @@ -36,7 +36,7 @@ msgstr "" #: ../../howto/timerfd.rst:13 msgid "Examples" -msgstr "" +msgstr "範例" #: ../../howto/timerfd.rst:15 msgid "" diff --git a/library/argparse.po b/library/argparse.po index 9c267fb807..8898a13b96 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-16 00:13+0000\n" +"POT-Creation-Date: 2024-10-31 00:13+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-" @@ -94,8 +94,9 @@ msgstr "" #: ../../library/argparse.rst:53 msgid "" -"If you're looking a guide about how to upgrade optparse code to argparse, " -"see :ref:`Upgrading Optparse Code `." +"If you're looking for a guide about how to upgrade :mod:`optparse` code to :" +"mod:`!argparse`, see :ref:`Upgrading Optparse Code `." msgstr "" #: ../../library/argparse.rst:57 @@ -176,8 +177,8 @@ msgstr "" #: ../../library/argparse.rst:103 msgid "" -"exit_on_error_ - Determines whether or not ArgumentParser exits with error " -"info when an error occurs. (default: ``True``)" +"exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits " +"with error info when an error occurs. (default: ``True``)" msgstr "" #: ../../library/argparse.rst:106 @@ -615,7 +616,7 @@ msgid "" "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " "Parsers that need to support different or additional prefix characters, e.g. " "for options like ``+f`` or ``/foo``, may specify them using the " -"``prefix_chars=`` argument to the ArgumentParser constructor::" +"``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::" msgstr "" #: ../../library/argparse.rst:377 @@ -843,9 +844,9 @@ msgstr "add_help" #: ../../library/argparse.rst:506 msgid "" -"By default, ArgumentParser objects add an option which simply displays the " -"parser's help message. If ``-h`` or ``--help`` is supplied at the command " -"line, the ArgumentParser help will be printed." +"By default, :class:`ArgumentParser` objects add an option which simply " +"displays the parser's help message. If ``-h`` or ``--help`` is supplied at " +"the command line, the :class:`!ArgumentParser` help will be printed." msgstr "" #: ../../library/argparse.rst:510 @@ -952,8 +953,8 @@ msgstr "" #: ../../library/argparse.rst:569 msgid "" -"`name or flags`_ - Either a name or a list of option strings, e.g. ``foo`` " -"or ``-f, --foo``." +"`name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` " +"or ``'-f', '--foo'``." msgstr "" #: ../../library/argparse.rst:572 @@ -1184,11 +1185,36 @@ msgstr "" #: ../../library/argparse.rst:695 msgid "" +"``'extend'`` - This stores a list and appends each item from the multi-value " +"argument list to it. The ``'extend'`` action is typically used with the " +"nargs_ keyword argument value ``'+'`` or ``'*'``. Note that when nargs_ is " +"``None`` (the default) or ``'?'``, each character of the argument string " +"will be appended to the list. Example usage::" +msgstr "" + +#: ../../library/argparse.rst:703 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " +"type=str)\n" +">>> parser.parse_args([\"--foo\", \"f1\", \"--foo\", \"f2\", \"f3\", " +"\"f4\"])\n" +"Namespace(foo=['f1', 'f2', 'f3', 'f4'])" +msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " +"type=str)\n" +">>> parser.parse_args([\"--foo\", \"f1\", \"--foo\", \"f2\", \"f3\", " +"\"f4\"])\n" +"Namespace(foo=['f1', 'f2', 'f3', 'f4'])" + +#: ../../library/argparse.rst:710 +msgid "" "``'count'`` - This counts the number of times a keyword argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" -#: ../../library/argparse.rst:698 +#: ../../library/argparse.rst:713 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='count', default=0)\n" @@ -1196,11 +1222,11 @@ msgid "" "Namespace(verbose=3)" msgstr "" -#: ../../library/argparse.rst:703 +#: ../../library/argparse.rst:718 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -#: ../../library/argparse.rst:705 +#: ../../library/argparse.rst:720 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 " @@ -1208,14 +1234,14 @@ msgid "" "output is created." msgstr "" -#: ../../library/argparse.rst:710 +#: ../../library/argparse.rst:725 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:714 +#: ../../library/argparse.rst:729 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1231,43 +1257,21 @@ msgstr "" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" -#: ../../library/argparse.rst:720 -msgid "" -"``'extend'`` - This stores a list, and extends each argument value to the " -"list. Example usage::" -msgstr "" - -#: ../../library/argparse.rst:724 -msgid "" -">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " -"type=str)\n" -">>> parser.parse_args([\"--foo\", \"f1\", \"--foo\", \"f2\", \"f3\", " -"\"f4\"])\n" -"Namespace(foo=['f1', 'f2', 'f3', 'f4'])" -msgstr "" -">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " -"type=str)\n" -">>> parser.parse_args([\"--foo\", \"f1\", \"--foo\", \"f2\", \"f3\", " -"\"f4\"])\n" -"Namespace(foo=['f1', 'f2', 'f3', 'f4'])" - -#: ../../library/argparse.rst:731 +#: ../../library/argparse.rst:735 msgid "" "Only actions that consume command-line arguments (e.g. ``'store'``, " "``'append'`` or ``'extend'``) can be used with positional arguments." msgstr "" -#: ../../library/argparse.rst:734 +#: ../../library/argparse.rst:740 msgid "" -"You may also specify an arbitrary action by passing an Action subclass or " -"other object that implements the same interface. The " -"``BooleanOptionalAction`` is available in ``argparse`` and adds support for " +"You may also specify an arbitrary action by passing an :class:`Action` " +"subclass or other object that implements the same interface. The :class:`!" +"BooleanOptionalAction` is available in :mod:`!argparse` and adds support for " "boolean actions such as ``--foo`` and ``--no-foo``::" msgstr "" -#: ../../library/argparse.rst:739 +#: ../../library/argparse.rst:745 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -1281,18 +1285,18 @@ msgstr "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" -#: ../../library/argparse.rst:747 +#: ../../library/argparse.rst:753 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " -"overriding the ``__call__`` method and optionally the ``__init__`` and " -"``format_usage`` methods." +"overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` " +"and :meth:`!format_usage` methods." msgstr "" -#: ../../library/argparse.rst:751 +#: ../../library/argparse.rst:757 msgid "An example of a custom action::" msgstr "" -#: ../../library/argparse.rst:753 +#: ../../library/argparse.rst:759 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1313,29 +1317,30 @@ msgid "" "Namespace(bar='1', foo='2')" msgstr "" -#: ../../library/argparse.rst:771 +#: ../../library/argparse.rst:777 msgid "For more details, see :class:`Action`." -msgstr "" +msgstr "更多詳情請見 :class:`Action`。" -#: ../../library/argparse.rst:777 +#: ../../library/argparse.rst:783 msgid "nargs" -msgstr "" +msgstr "nargs" -#: ../../library/argparse.rst:779 +#: ../../library/argparse.rst:785 msgid "" -"ArgumentParser objects usually associate a single command-line argument with " -"a single action to be taken. The ``nargs`` keyword argument associates a " -"different number of command-line arguments with a single action. See also :" -"ref:`specifying-ambiguous-arguments`. The supported values are:" +":class:`ArgumentParser` objects usually associate a single command-line " +"argument with a single action to be taken. The ``nargs`` keyword argument " +"associates a different number of command-line arguments with a single " +"action. See also :ref:`specifying-ambiguous-arguments`. The supported values " +"are:" msgstr "" -#: ../../library/argparse.rst:784 +#: ../../library/argparse.rst:790 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: ../../library/argparse.rst:787 +#: ../../library/argparse.rst:793 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1349,13 +1354,13 @@ msgstr "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" -#: ../../library/argparse.rst:793 +#: ../../library/argparse.rst:799 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:798 +#: ../../library/argparse.rst:804 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 " @@ -1365,7 +1370,7 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: ../../library/argparse.rst:805 +#: ../../library/argparse.rst:811 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1387,13 +1392,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:815 +#: ../../library/argparse.rst:821 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: ../../library/argparse.rst:818 +#: ../../library/argparse.rst:824 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?', type=argparse.FileType('r'),\n" @@ -1419,7 +1424,7 @@ msgstr "" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>,\n" " outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:832 +#: ../../library/argparse.rst:838 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 " @@ -1427,7 +1432,7 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: ../../library/argparse.rst:837 +#: ../../library/argparse.rst:843 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1443,14 +1448,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:846 +#: ../../library/argparse.rst:852 msgid "" "``'+'``. Just like ``'*'``, all command-line args 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:850 +#: ../../library/argparse.rst:856 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1468,7 +1473,7 @@ msgstr "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:858 +#: ../../library/argparse.rst:864 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -1477,11 +1482,11 @@ msgid "" "``'store_const'``) set ``nargs=0``." msgstr "" -#: ../../library/argparse.rst:868 +#: ../../library/argparse.rst:874 msgid "const" msgstr "" -#: ../../library/argparse.rst:870 +#: ../../library/argparse.rst:876 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 " @@ -1489,7 +1494,7 @@ msgid "" "common uses of it are:" msgstr "" -#: ../../library/argparse.rst:874 +#: ../../library/argparse.rst:880 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='store_const'`` or ``action='append_const'``. These actions add " @@ -1499,7 +1504,7 @@ msgid "" "receive a default value of ``None``." msgstr "" -#: ../../library/argparse.rst:882 +#: ../../library/argparse.rst:888 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " @@ -1509,17 +1514,17 @@ msgid "" "to be ``None`` instead. See the nargs_ description for examples." msgstr "" -#: ../../library/argparse.rst:889 +#: ../../library/argparse.rst:895 msgid "" "``const=None`` by default, including when ``action='append_const'`` or " "``action='store_const'``." msgstr "" -#: ../../library/argparse.rst:896 +#: ../../library/argparse.rst:902 msgid "default" msgstr "" -#: ../../library/argparse.rst:898 +#: ../../library/argparse.rst:904 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." @@ -1529,7 +1534,7 @@ msgid "" "command line::" msgstr "" -#: ../../library/argparse.rst:905 +#: ../../library/argparse.rst:911 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1545,13 +1550,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:912 +#: ../../library/argparse.rst:918 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not overwrite it::" msgstr "" -#: ../../library/argparse.rst:915 +#: ../../library/argparse.rst:921 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1563,7 +1568,7 @@ msgstr "" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" -#: ../../library/argparse.rst:920 +#: ../../library/argparse.rst:926 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_ " @@ -1571,7 +1576,7 @@ msgid "" "`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" -#: ../../library/argparse.rst:925 +#: ../../library/argparse.rst:931 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -1585,13 +1590,13 @@ msgstr "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" -#: ../../library/argparse.rst:931 +#: ../../library/argparse.rst:937 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:934 +#: ../../library/argparse.rst:940 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -1607,20 +1612,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:941 +#: ../../library/argparse.rst:947 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:945 +#: ../../library/argparse.rst:951 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: ../../library/argparse.rst:948 +#: ../../library/argparse.rst:954 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -1636,11 +1641,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:959 +#: ../../library/argparse.rst:965 msgid "type" msgstr "" -#: ../../library/argparse.rst:961 +#: ../../library/argparse.rst:967 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -1649,13 +1654,13 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: ../../library/argparse.rst:967 +#: ../../library/argparse.rst:973 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:970 +#: ../../library/argparse.rst:976 msgid "" "The argument to ``type`` can be any callable that accepts a single string. " "If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" @@ -1663,11 +1668,11 @@ msgid "" "is displayed. No other exception types are handled." msgstr "" -#: ../../library/argparse.rst:975 +#: ../../library/argparse.rst:981 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: ../../library/argparse.rst:977 +#: ../../library/argparse.rst:983 msgid "" "import argparse\n" "import pathlib\n" @@ -1693,11 +1698,11 @@ msgstr "" "encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" -#: ../../library/argparse.rst:990 +#: ../../library/argparse.rst:996 msgid "User defined functions can be used as well:" msgstr "" -#: ../../library/argparse.rst:992 +#: ../../library/argparse.rst:998 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -1715,14 +1720,14 @@ msgstr "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" -#: ../../library/argparse.rst:1002 +#: ../../library/argparse.rst:1008 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:1006 +#: ../../library/argparse.rst:1012 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 " @@ -1730,7 +1735,7 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: ../../library/argparse.rst:1011 +#: ../../library/argparse.rst:1017 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." @@ -1738,7 +1743,7 @@ msgid "" "exception would not be handled at all." msgstr "" -#: ../../library/argparse.rst:1016 +#: ../../library/argparse.rst:1022 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses :class:`~argparse.FileType` and then " @@ -1748,17 +1753,17 @@ msgid "" "files." msgstr "" -#: ../../library/argparse.rst:1023 +#: ../../library/argparse.rst:1029 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: ../../library/argparse.rst:1030 +#: ../../library/argparse.rst:1036 msgid "choices" msgstr "" -#: ../../library/argparse.rst:1032 +#: ../../library/argparse.rst:1038 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* " @@ -1767,7 +1772,7 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: ../../library/argparse.rst:1038 +#: ../../library/argparse.rst:1044 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -1787,26 +1792,26 @@ msgstr "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" -#: ../../library/argparse.rst:1047 +#: ../../library/argparse.rst:1053 msgid "" "Note that inclusion in the *choices* sequence is checked after any type_ " "conversions have been performed, so the type of the objects in the *choices* " "sequence should match the type_ specified." msgstr "" -#: ../../library/argparse.rst:1051 +#: ../../library/argparse.rst:1057 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:1054 +#: ../../library/argparse.rst:1060 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:1057 +#: ../../library/argparse.rst:1063 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 " @@ -1814,19 +1819,19 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1066 +#: ../../library/argparse.rst:1072 msgid "required" msgstr "" -#: ../../library/argparse.rst:1068 +#: ../../library/argparse.rst:1074 msgid "" -"In general, the :mod:`argparse` module assumes that flags like ``-f`` and " +"In general, the :mod:`!argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " "command line. To make an option *required*, ``True`` can be specified for " "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1073 +#: ../../library/argparse.rst:1079 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -1844,24 +1849,24 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1081 +#: ../../library/argparse.rst:1087 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:1087 +#: ../../library/argparse.rst:1093 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:1094 +#: ../../library/argparse.rst:1100 msgid "help" msgstr "幫助" -#: ../../library/argparse.rst:1096 +#: ../../library/argparse.rst:1102 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`` " @@ -1869,7 +1874,7 @@ msgid "" "each argument." msgstr "" -#: ../../library/argparse.rst:1101 +#: ../../library/argparse.rst:1107 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " @@ -1878,7 +1883,7 @@ msgid "" "``%(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1106 +#: ../../library/argparse.rst:1112 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -1904,19 +1909,19 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1118 +#: ../../library/argparse.rst:1124 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:1121 +#: ../../library/argparse.rst:1127 msgid "" -":mod:`argparse` supports silencing the help entry for certain options, by " +":mod:`!argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1124 +#: ../../library/argparse.rst:1130 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -1934,23 +1939,23 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1136 +#: ../../library/argparse.rst:1142 msgid "metavar" -msgstr "" +msgstr "metavar" -#: ../../library/argparse.rst:1138 +#: ../../library/argparse.rst:1144 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " -"refer to each expected argument. By default, ArgumentParser objects use the " -"dest_ value as the \"name\" of each object. By default, for positional " -"argument actions, the dest_ value is used directly, and for optional " -"argument actions, the dest_ value is uppercased. So, a single positional " -"argument with ``dest='bar'`` will be referred to as ``bar``. A single " -"optional argument ``--foo`` that should be followed by a single command-line " -"argument will be referred to as ``FOO``. An example::" +"refer to each expected argument. By default, :class:`!ArgumentParser` " +"objects use the dest_ value as the \"name\" of each object. By default, for " +"positional argument actions, the dest_ value is used directly, and for " +"optional argument actions, the dest_ value is uppercased. So, a single " +"positional argument with ``dest='bar'`` will be referred to as ``bar``. A " +"single optional argument ``--foo`` that should be followed by a single " +"command-line argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1147 +#: ../../library/argparse.rst:1153 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -1982,11 +1987,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1162 +#: ../../library/argparse.rst:1168 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1164 +#: ../../library/argparse.rst:1170 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2018,21 +2023,21 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1179 +#: ../../library/argparse.rst:1185 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:1183 +#: ../../library/argparse.rst:1189 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:1187 +#: ../../library/argparse.rst:1193 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2056,11 +2061,11 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1202 +#: ../../library/argparse.rst:1208 msgid "dest" -msgstr "" +msgstr "dest" -#: ../../library/argparse.rst:1204 +#: ../../library/argparse.rst:1210 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " @@ -2070,7 +2075,7 @@ msgid "" "add_argument`::" msgstr "" -#: ../../library/argparse.rst:1211 +#: ../../library/argparse.rst:1217 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2082,7 +2087,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1216 +#: ../../library/argparse.rst:1222 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2094,7 +2099,7 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1225 +#: ../../library/argparse.rst:1231 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2112,11 +2117,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1233 +#: ../../library/argparse.rst:1239 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1235 +#: ../../library/argparse.rst:1241 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2128,11 +2133,11 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1244 +#: ../../library/argparse.rst:1250 msgid "deprecated" msgstr "" -#: ../../library/argparse.rst:1246 +#: ../../library/argparse.rst:1252 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 " @@ -2143,7 +2148,7 @@ msgid "" "will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" -#: ../../library/argparse.rst:1256 +#: ../../library/argparse.rst:1262 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='snake.py')\n" @@ -2163,131 +2168,124 @@ msgstr "" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" -#: ../../library/argparse.rst:1269 +#: ../../library/argparse.rst:1275 msgid "Action classes" msgstr "" -#: ../../library/argparse.rst:1271 +#: ../../library/argparse.rst:1277 msgid "" -"Action classes implement the Action API, a callable which returns a callable " -"which processes arguments from the command-line. Any object which follows " -"this API may be passed as the ``action`` parameter to :meth:`~ArgumentParser." -"add_argument`." -msgstr "" - -#: ../../library/argparse.rst:1280 -msgid "" -"Action objects are used by an ArgumentParser to represent the information " -"needed to parse a single argument from one or more strings from the command " -"line. The Action class must accept the two positional arguments plus any " -"keyword arguments passed to :meth:`ArgumentParser.add_argument` except for " -"the ``action`` itself." +":class:`!Action` classes implement the Action API, a callable which returns " +"a callable which processes arguments from the command-line. Any object which " +"follows this API may be passed as the ``action`` parameter to :meth:" +"`~ArgumentParser.add_argument`." msgstr "" #: ../../library/argparse.rst:1286 msgid "" -"Instances of Action (or return value of any callable to the ``action`` " -"parameter) should have attributes \"dest\", \"option_strings\", \"default\", " -"\"type\", \"required\", \"help\", etc. defined. The easiest way to ensure " -"these attributes are defined is to call ``Action.__init__``." +":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " +"the information needed to parse a single argument from one or more strings " +"from the command line. The :class:`!Action` class must accept the two " +"positional arguments plus any keyword arguments passed to :meth:" +"`ArgumentParser.add_argument` except for the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1291 +#: ../../library/argparse.rst:1292 msgid "" -"Action instances should be callable, so subclasses must override the " -"``__call__`` method, which should accept four parameters:" -msgstr "" - -#: ../../library/argparse.rst:1294 -msgid "*parser* - The ArgumentParser object which contains this action." +"Instances of :class:`!Action` (or return value of any callable to the " +"``action`` parameter) should have attributes :attr:`!dest`, :attr:`!" +"option_strings`, :attr:`!default`, :attr:`!type`, :attr:`!required`, :attr:`!" +"help`, etc. defined. The easiest way to ensure these attributes are defined " +"is to call :meth:`!Action.__init__`." msgstr "" -#: ../../library/argparse.rst:1296 -msgid "*namespace* - The :class:`Namespace` object that will be returned by" +#: ../../library/argparse.rst:1300 +msgid "" +":class:`!Action` instances should be callable, so subclasses must override " +"the :meth:`!__call__` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1297 +#: ../../library/argparse.rst:1303 msgid "" -":meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this " -"object using :func:`setattr`." +"*parser* - The :class:`ArgumentParser` object which contains this action." msgstr "" -#: ../../library/argparse.rst:1300 +#: ../../library/argparse.rst:1305 msgid "" -"*values* - The associated command-line arguments, with any type conversions" +"*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:1301 +#: ../../library/argparse.rst:1309 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:1304 -msgid "" -"*option_string* - The option string that was used to invoke this action." -msgstr "" - -#: ../../library/argparse.rst:1305 +#: ../../library/argparse.rst:1313 msgid "" -"The ``option_string`` argument is optional, and will be absent if the action " -"is associated with a positional argument." +"*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:1308 +#: ../../library/argparse.rst:1317 msgid "" -"The ``__call__`` method may perform arbitrary actions, but will typically " -"set attributes on the ``namespace`` based on ``dest`` and ``values``." +"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:1311 +#: ../../library/argparse.rst:1322 msgid "" -"Action subclasses can define a ``format_usage`` method that takes no " -"argument and return a string which will be used when printing the usage of " -"the program. If such method is not provided, a sensible default will be used." +":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 " +"usage of the program. If such method is not provided, a sensible default " +"will be used." msgstr "" -#: ../../library/argparse.rst:1317 +#: ../../library/argparse.rst:1328 msgid "The parse_args() method" -msgstr "" +msgstr "parse_args() 方法" -#: ../../library/argparse.rst:1321 +#: ../../library/argparse.rst:1332 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1324 +#: ../../library/argparse.rst:1335 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." +"created and how they are assigned. See the documentation for :meth:`!" +"add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1328 +#: ../../library/argparse.rst:1339 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "" -#: ../../library/argparse.rst:1331 +#: ../../library/argparse.rst:1342 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1336 +#: ../../library/argparse.rst:1347 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1338 +#: ../../library/argparse.rst:1349 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:1342 +#: ../../library/argparse.rst:1353 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2305,14 +2303,14 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1350 +#: ../../library/argparse.rst:1361 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:1354 +#: ../../library/argparse.rst:1365 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2320,13 +2318,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1357 +#: ../../library/argparse.rst:1368 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1360 +#: ../../library/argparse.rst:1371 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2334,13 +2332,13 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1363 +#: ../../library/argparse.rst:1374 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:1366 +#: ../../library/argparse.rst:1377 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='store_true')\n" @@ -2356,11 +2354,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1375 +#: ../../library/argparse.rst:1386 msgid "Invalid arguments" -msgstr "" +msgstr "無效引數" -#: ../../library/argparse.rst:1377 +#: ../../library/argparse.rst:1388 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -2368,7 +2366,7 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1382 +#: ../../library/argparse.rst:1393 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -2390,11 +2388,11 @@ msgid "" "PROG: error: extra arguments found: badger" msgstr "" -#: ../../library/argparse.rst:1403 +#: ../../library/argparse.rst:1414 msgid "Arguments containing ``-``" -msgstr "" +msgstr "包含 ``-`` 的引數" -#: ../../library/argparse.rst:1405 +#: ../../library/argparse.rst:1416 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -2406,7 +2404,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1413 +#: ../../library/argparse.rst:1424 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2439,7 +2437,7 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -#: ../../library/argparse.rst:1443 +#: ../../library/argparse.rst:1454 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -2447,7 +2445,7 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1448 +#: ../../library/argparse.rst:1459 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -2455,24 +2453,24 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1451 +#: ../../library/argparse.rst:1462 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" -#: ../../library/argparse.rst:1457 +#: ../../library/argparse.rst:1468 msgid "Argument abbreviations (prefix matching)" msgstr "" -#: ../../library/argparse.rst:1459 +#: ../../library/argparse.rst:1470 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:1463 +#: ../../library/argparse.rst:1474 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2496,25 +2494,25 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1474 +#: ../../library/argparse.rst:1485 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:1480 +#: ../../library/argparse.rst:1491 msgid "Beyond ``sys.argv``" msgstr "" -#: ../../library/argparse.rst:1482 +#: ../../library/argparse.rst:1493 msgid "" -"Sometimes it may be useful to have an ArgumentParser parse arguments other " -"than those of :data:`sys.argv`. This can be accomplished by passing a list " -"of strings to :meth:`~ArgumentParser.parse_args`. This is useful for " -"testing at the interactive prompt::" +"Sometimes it may be useful to have an :class:`ArgumentParser` parse " +"arguments other than those of :data:`sys.argv`. This can be accomplished by " +"passing a list of strings to :meth:`~ArgumentParser.parse_args`. This is " +"useful for testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1487 +#: ../../library/argparse.rst:1498 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -2540,24 +2538,24 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1502 +#: ../../library/argparse.rst:1513 msgid "The Namespace object" -msgstr "" +msgstr "命名空間物件" -#: ../../library/argparse.rst:1506 +#: ../../library/argparse.rst:1517 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1509 +#: ../../library/argparse.rst:1520 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:1513 +#: ../../library/argparse.rst:1524 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2571,14 +2569,14 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1519 +#: ../../library/argparse.rst:1530 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:1523 +#: ../../library/argparse.rst:1534 msgid "" ">>> class C:\n" "... pass\n" @@ -2600,92 +2598,92 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1535 +#: ../../library/argparse.rst:1546 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1538 +#: ../../library/argparse.rst:1549 msgid "Sub-commands" msgstr "" -#: ../../library/argparse.rst:1545 +#: ../../library/argparse.rst:1556 msgid "" "Many programs split up their functionality into a number of subcommands, for " "example, the ``svn`` program can invoke subcommands like ``svn checkout``, " "``svn update``, and ``svn commit``. Splitting up functionality this way can " "be a particularly good idea when a program performs several different " "functions which require different kinds of command-line arguments. :class:" -"`ArgumentParser` supports the creation of such subcommands with the :meth:" -"`add_subparsers` method. The :meth:`add_subparsers` method is normally " +"`ArgumentParser` supports the creation of such subcommands with the :meth:`!" +"add_subparsers` method. The :meth:`!add_subparsers` method is normally " "called with no arguments and returns a special action object. This object " "has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a " -"command name and any :class:`ArgumentParser` constructor arguments, and " -"returns an :class:`ArgumentParser` object that can be modified as usual." +"command name and any :class:`!ArgumentParser` constructor arguments, and " +"returns an :class:`!ArgumentParser` object that can be modified as usual." msgstr "" -#: ../../library/argparse.rst:1557 +#: ../../library/argparse.rst:1568 msgid "Description of parameters:" -msgstr "" +msgstr "參數的解釋:" -#: ../../library/argparse.rst:1559 +#: ../../library/argparse.rst:1570 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:1563 +#: ../../library/argparse.rst:1574 msgid "" "*description* - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1566 +#: ../../library/argparse.rst:1577 msgid "" "*prog* - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1570 +#: ../../library/argparse.rst:1581 msgid "" "*parser_class* - class which will be used to create sub-parser instances, by " -"default the class of the current parser (e.g. ArgumentParser)" +"default the class of the current parser (e.g. :class:`ArgumentParser`)" msgstr "" -#: ../../library/argparse.rst:1573 +#: ../../library/argparse.rst:1584 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1576 +#: ../../library/argparse.rst:1587 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1579 +#: ../../library/argparse.rst:1590 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1582 +#: ../../library/argparse.rst:1593 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1584 +#: ../../library/argparse.rst:1595 msgid "" "metavar_ - string presenting available subcommands in help; by default it is " "``None`` and presents subcommands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1587 +#: ../../library/argparse.rst:1598 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1589 +#: ../../library/argparse.rst:1600 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -2708,7 +2706,7 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -#: ../../library/argparse.rst:1608 +#: ../../library/argparse.rst:1619 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 " @@ -2718,7 +2716,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1615 +#: ../../library/argparse.rst:1626 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 " @@ -2727,7 +2725,7 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1623 +#: ../../library/argparse.rst:1634 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -2785,14 +2783,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1651 +#: ../../library/argparse.rst:1662 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:1655 +#: ../../library/argparse.rst:1666 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -2828,7 +2826,7 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1672 +#: ../../library/argparse.rst:1683 msgid "" "Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " "*aliases* argument, which allows multiple strings to refer to the same " @@ -2836,7 +2834,7 @@ msgid "" "``checkout``::" msgstr "" -#: ../../library/argparse.rst:1677 +#: ../../library/argparse.rst:1688 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -2852,13 +2850,13 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1684 +#: ../../library/argparse.rst:1695 msgid "" ":meth:`~_SubParsersAction.add_parser` supports also an additional " "*deprecated* argument, which allows to deprecate the subparser." msgstr "" -#: ../../library/argparse.rst:1698 +#: ../../library/argparse.rst:1709 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 " @@ -2866,7 +2864,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1703 +#: ../../library/argparse.rst:1714 msgid "" ">>> # subcommand functions\n" ">>> def foo(args):\n" @@ -2901,7 +2899,7 @@ msgid "" "((XYZYX))" msgstr "" -#: ../../library/argparse.rst:1735 +#: ../../library/argparse.rst:1746 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -2911,7 +2909,7 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1742 +#: ../../library/argparse.rst:1753 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -2931,15 +2929,15 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1751 -msgid "New *required* keyword argument." +#: ../../library/argparse.rst:1762 +msgid "New *required* keyword-only parameter." msgstr "" -#: ../../library/argparse.rst:1756 +#: ../../library/argparse.rst:1767 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1760 +#: ../../library/argparse.rst:1771 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" @@ -2948,7 +2946,7 @@ msgid "" "the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1766 +#: ../../library/argparse.rst:1777 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -2966,14 +2964,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:1772 +#: ../../library/argparse.rst:1783 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:1776 +#: ../../library/argparse.rst:1787 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -2985,24 +2983,24 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1781 +#: ../../library/argparse.rst:1792 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: ../../library/argparse.rst:1786 +#: ../../library/argparse.rst:1797 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1791 +#: ../../library/argparse.rst:1802 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " "there is a better conceptual grouping of arguments than this default one, " -"appropriate groups can be created using the :meth:`add_argument_group` " +"appropriate groups can be created using the :meth:`!add_argument_group` " "method::" msgstr "" -#: ../../library/argparse.rst:1797 +#: ../../library/argparse.rst:1808 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3026,18 +3024,18 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:1808 +#: ../../library/argparse.rst:1819 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" "class:`ArgumentParser`. When an argument is added to the group, the parser " "treats it just like a normal argument, but displays the argument in a " -"separate group for help messages. The :meth:`add_argument_group` method " +"separate group for help messages. The :meth:`!add_argument_group` method " "accepts *title* and *description* arguments which can be used to customize " "this display::" msgstr "" -#: ../../library/argparse.rst:1816 +#: ../../library/argparse.rst:1827 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3075,7 +3073,7 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1834 +#: ../../library/argparse.rst:1845 msgid "" "The optional, keyword-only parameters argument_default_ and " "conflict_handler_ allow for finer-grained control of the behavior of the " @@ -3084,13 +3082,13 @@ msgid "" "rather than the entire parser." msgstr "" -#: ../../library/argparse.rst:1839 +#: ../../library/argparse.rst:1850 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:1842 +#: ../../library/argparse.rst:1853 msgid "" "Calling :meth:`add_argument_group` on an argument group is deprecated. This " "feature was never supported and does not always work correctly. The function " @@ -3098,18 +3096,18 @@ msgid "" "future." msgstr "" -#: ../../library/argparse.rst:1850 +#: ../../library/argparse.rst:1861 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:1854 +#: ../../library/argparse.rst:1865 msgid "" -"Create a mutually exclusive group. :mod:`argparse` will make sure that only " +"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:1858 +#: ../../library/argparse.rst:1869 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3135,14 +3133,14 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:1870 +#: ../../library/argparse.rst:1881 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:1874 +#: ../../library/argparse.rst:1885 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3160,7 +3158,7 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:1882 +#: ../../library/argparse.rst:1893 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." @@ -3168,7 +3166,7 @@ msgid "" "argument group that has a title and description. For example::" msgstr "" -#: ../../library/argparse.rst:1888 +#: ../../library/argparse.rst:1899 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3204,7 +3202,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1905 +#: ../../library/argparse.rst:1916 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group is deprecated. These features were never " @@ -3212,11 +3210,11 @@ msgid "" "by accident through inheritance and will be removed in the future." msgstr "" -#: ../../library/argparse.rst:1913 +#: ../../library/argparse.rst:1924 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:1917 +#: ../../library/argparse.rst:1928 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -3225,7 +3223,7 @@ msgid "" "command line to be added::" msgstr "" -#: ../../library/argparse.rst:1923 +#: ../../library/argparse.rst:1934 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3239,12 +3237,12 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:1929 +#: ../../library/argparse.rst:1940 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" -#: ../../library/argparse.rst:1931 +#: ../../library/argparse.rst:1942 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3258,20 +3256,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:1937 +#: ../../library/argparse.rst:1948 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:1943 +#: ../../library/argparse.rst:1954 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:1947 +#: ../../library/argparse.rst:1958 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -3283,54 +3281,54 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:1954 +#: ../../library/argparse.rst:1965 msgid "Printing help" -msgstr "" +msgstr "印出幫助訊息" -#: ../../library/argparse.rst:1956 +#: ../../library/argparse.rst:1967 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:1962 +#: ../../library/argparse.rst:1973 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:1968 +#: ../../library/argparse.rst:1979 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:1972 +#: ../../library/argparse.rst:1983 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:1977 +#: ../../library/argparse.rst:1988 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:1982 +#: ../../library/argparse.rst:1993 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:1987 +#: ../../library/argparse.rst:1998 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:1991 +#: ../../library/argparse.rst:2002 msgid "" "Sometimes a script may only parse a few of the command-line arguments, " "passing the remaining arguments on to another script or program. In these " @@ -3341,7 +3339,7 @@ msgid "" "remaining argument strings." msgstr "" -#: ../../library/argparse.rst:2000 +#: ../../library/argparse.rst:2011 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -3355,7 +3353,7 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2007 +#: ../../library/argparse.rst:2018 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`~ArgumentParser.parse_known_args`. The parser may consume an option even if " @@ -3363,11 +3361,11 @@ msgid "" "remaining arguments list." msgstr "" -#: ../../library/argparse.rst:2014 +#: ../../library/argparse.rst:2025 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2018 +#: ../../library/argparse.rst:2029 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -3375,20 +3373,20 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2023 +#: ../../library/argparse.rst:2034 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:2027 +#: ../../library/argparse.rst:2038 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:2030 +#: ../../library/argparse.rst:2041 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -3398,18 +3396,18 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2036 +#: ../../library/argparse.rst:2047 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2040 +#: ../../library/argparse.rst:2051 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:2044 +#: ../../library/argparse.rst:2055 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3423,17 +3421,17 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2052 +#: ../../library/argparse.rst:2063 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:2057 +#: ../../library/argparse.rst:2068 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2062 +#: ../../library/argparse.rst:2073 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -3441,15 +3439,15 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2067 +#: ../../library/argparse.rst:2078 msgid "" -"These parsers do not support all the argparse features, and will raise " -"exceptions if unsupported features are used. In particular, subparsers, and " -"mutually exclusive groups that include both optionals and positionals are " -"not supported." +"These parsers do not support all the :mod:`!argparse` features, and will " +"raise exceptions if unsupported features are used. In particular, " +"subparsers, and mutually exclusive groups that include both optionals and " +"positionals are not supported." msgstr "" -#: ../../library/argparse.rst:2072 +#: ../../library/argparse.rst:2083 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -3457,7 +3455,7 @@ msgid "" "collects all the positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2078 +#: ../../library/argparse.rst:2089 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3477,7 +3475,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:2087 +#: ../../library/argparse.rst:2098 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -3485,371 +3483,42 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2096 +#: ../../library/argparse.rst:2107 msgid "Exceptions" -msgstr "" +msgstr "例外" -#: ../../library/argparse.rst:2100 +#: ../../library/argparse.rst:2111 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: ../../library/argparse.rst:2102 +#: ../../library/argparse.rst:2113 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: ../../library/argparse.rst:2107 +#: ../../library/argparse.rst:2118 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: ../../library/argparse.rst:2111 +#: ../../library/argparse.rst:2122 msgid "Guides and Tutorials" msgstr "" -#: ../../library/argparse.rst:796 +#: ../../library/argparse.rst:802 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/argparse.rst:796 ../../library/argparse.rst:830 -#: ../../library/argparse.rst:844 +#: ../../library/argparse.rst:802 ../../library/argparse.rst:836 +#: ../../library/argparse.rst:850 msgid "in argparse module" msgstr "於 argparse 模組中" -#: ../../library/argparse.rst:830 +#: ../../library/argparse.rst:836 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/argparse.rst:844 +#: ../../library/argparse.rst:850 msgid "+ (plus)" msgstr "+ (加號)" - -#~ msgid "Name" -#~ msgstr "名稱" - -#~ msgid "Description" -#~ msgstr "描述" - -#~ msgid "Values" -#~ msgstr "數值" - -#~ msgid "action_" -#~ msgstr "action_" - -#~ msgid "" -#~ "``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, " -#~ "``'append_const'``, ``'count'``, ``'help'``, ``'version'``" -#~ msgstr "" -#~ "``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, " -#~ "``'append_const'``, ``'count'``, ``'help'``, ``'version'``" - -#~ msgid "choices_" -#~ msgstr "choices_" - -#~ msgid "const_" -#~ msgstr "const_" - -#~ msgid "default_" -#~ msgstr "default_" - -#~ msgid "dest_" -#~ msgstr "dest_" - -#~ msgid "help_" -#~ msgstr "help_" - -#~ msgid "metavar_" -#~ msgstr "metavar_" - -#~ msgid "nargs_" -#~ msgstr "nargs_" - -#~ msgid ":class:`int`, ``'?'``, ``'*'``, or ``'+'``" -#~ msgstr ":class:`int`, ``'?'``, ``'*'``, or ``'+'``" - -#~ msgid "required_" -#~ msgstr "required_" - -#~ msgid "``True`` or ``False``" -#~ msgstr "``True`` 或 ``False``" - -#~ msgid "" -#~ ":class:`int`, :class:`float`, ``argparse.FileType('w')``, or callable " -#~ "function" -#~ msgstr "" -#~ ":class:`int`、:class:`float`、``argparse.FileType('w')`` 或可呼叫的函式" - -#~ msgid "Example" -#~ msgstr "範例" - -#~ msgid "" -#~ "import argparse\n" -#~ "\n" -#~ "parser = argparse.ArgumentParser(description='Process some integers.')\n" -#~ "parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" -#~ " help='an integer for the accumulator')\n" -#~ "parser.add_argument('--sum', dest='accumulate', action='store_const',\n" -#~ " const=sum, default=max,\n" -#~ " help='sum the integers (default: find the max)')\n" -#~ "\n" -#~ "args = parser.parse_args()\n" -#~ "print(args.accumulate(args.integers))" -#~ msgstr "" -#~ "import argparse\n" -#~ "\n" -#~ "parser = argparse.ArgumentParser(description='Process some integers.')\n" -#~ "parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" -#~ " help='an integer for the accumulator')\n" -#~ "parser.add_argument('--sum', dest='accumulate', action='store_const',\n" -#~ " const=sum, default=max,\n" -#~ " help='sum the integers (default: find the max)')\n" -#~ "\n" -#~ "args = parser.parse_args()\n" -#~ "print(args.accumulate(args.integers))" - -#~ msgid "" -#~ "$ python prog.py -h\n" -#~ "usage: prog.py [-h] [--sum] N [N ...]\n" -#~ "\n" -#~ "Process some integers.\n" -#~ "\n" -#~ "positional arguments:\n" -#~ " N an integer for the accumulator\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --sum sum the integers (default: find the max)" -#~ msgstr "" -#~ "$ python prog.py -h\n" -#~ "usage: prog.py [-h] [--sum] N [N ...]\n" -#~ "\n" -#~ "Process some integers.\n" -#~ "\n" -#~ "positional arguments:\n" -#~ " N an integer for the accumulator\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --sum sum the integers (default: find the max)" - -#~ msgid "" -#~ "$ python prog.py 1 2 3 4\n" -#~ "4\n" -#~ "\n" -#~ "$ python prog.py 1 2 3 4 --sum\n" -#~ "10" -#~ msgstr "" -#~ "$ python prog.py 1 2 3 4\n" -#~ "4\n" -#~ "\n" -#~ "$ python prog.py 1 2 3 4 --sum\n" -#~ "10" - -#~ msgid "" -#~ "$ python prog.py a b c\n" -#~ "usage: prog.py [-h] [--sum] N [N ...]\n" -#~ "prog.py: error: argument N: invalid int value: 'a'" -#~ msgstr "" -#~ "$ python prog.py a b c\n" -#~ "usage: prog.py [-h] [--sum] N [N ...]\n" -#~ "prog.py: error: argument N: invalid int value: 'a'" - -#~ msgid "Creating a parser" -#~ msgstr "建立一個剖析器" - -#~ msgid "" -#~ ">>> parser = argparse.ArgumentParser(description='Process some integers.')" -#~ msgstr "" -#~ ">>> parser = argparse.ArgumentParser(description='Process some integers.')" - -#~ msgid "Adding arguments" -#~ msgstr "增加引數" - -#~ msgid "" -#~ ">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" -#~ "... help='an integer for the accumulator')\n" -#~ ">>> parser.add_argument('--sum', dest='accumulate', " -#~ "action='store_const',\n" -#~ "... const=sum, default=max,\n" -#~ "... help='sum the integers (default: find the max)')" -#~ msgstr "" -#~ ">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" -#~ "... help='an integer for the accumulator')\n" -#~ ">>> parser.add_argument('--sum', dest='accumulate', " -#~ "action='store_const',\n" -#~ "... const=sum, default=max,\n" -#~ "... help='sum the integers (default: find the max)')" - -#~ msgid "Parsing arguments" -#~ msgstr "剖析引數" - -#~ msgid "" -#~ ">>> parser.parse_args(['--sum', '7', '-1', '42'])\n" -#~ "Namespace(accumulate=, integers=[7, -1, 42])" -#~ msgstr "" -#~ ">>> parser.parse_args(['--sum', '7', '-1', '42'])\n" -#~ "Namespace(accumulate=, integers=[7, -1, 42])" - -#~ msgid "" -#~ "import argparse\n" -#~ "parser = argparse.ArgumentParser()\n" -#~ "parser.add_argument('--foo', help='foo help')\n" -#~ "args = parser.parse_args()" -#~ msgstr "" -#~ "import argparse\n" -#~ "parser = argparse.ArgumentParser()\n" -#~ "parser.add_argument('--foo', help='foo help')\n" -#~ "args = parser.parse_args()" - -#~ msgid "" -#~ "$ python myprogram.py --help\n" -#~ "usage: myprogram.py [-h] [--foo FOO]\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo FOO foo help\n" -#~ "$ cd ..\n" -#~ "$ python subdir/myprogram.py --help\n" -#~ "usage: myprogram.py [-h] [--foo FOO]\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo FOO foo help" -#~ msgstr "" -#~ "$ python myprogram.py --help\n" -#~ "usage: myprogram.py [-h] [--foo FOO]\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo FOO foo help\n" -#~ "$ cd ..\n" -#~ "$ python subdir/myprogram.py --help\n" -#~ "usage: myprogram.py [-h] [--foo FOO]\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo FOO foo help" - -#~ msgid "" -#~ ">>> parser = argparse.ArgumentParser(prog='PROG')\n" -#~ ">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" -#~ ">>> parser.add_argument('bar', nargs='+', help='bar help')\n" -#~ ">>> parser.print_help()\n" -#~ "usage: PROG [-h] [--foo [FOO]] bar [bar ...]\n" -#~ "\n" -#~ "positional arguments:\n" -#~ " bar bar help\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo [FOO] foo help" -#~ msgstr "" -#~ ">>> parser = argparse.ArgumentParser(prog='PROG')\n" -#~ ">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" -#~ ">>> parser.add_argument('bar', nargs='+', help='bar help')\n" -#~ ">>> parser.print_help()\n" -#~ "usage: PROG [-h] [--foo [FOO]] bar [bar ...]\n" -#~ "\n" -#~ "positional arguments:\n" -#~ " bar bar help\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo [FOO] foo help" - -#~ msgid "" -#~ ">>> parser = argparse.ArgumentParser(description='A foo that bars')\n" -#~ ">>> parser.print_help()\n" -#~ "usage: argparse.py [-h]\n" -#~ "\n" -#~ "A foo that bars\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit" -#~ msgstr "" -#~ ">>> parser = argparse.ArgumentParser(description='A foo that bars')\n" -#~ ">>> parser.print_help()\n" -#~ "usage: argparse.py [-h]\n" -#~ "\n" -#~ "A foo that bars\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit" - -#~ msgid "" -#~ "$ python myprogram.py --help\n" -#~ "usage: myprogram.py [-h] [--foo FOO]\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo FOO foo help" -#~ msgstr "" -#~ "$ python myprogram.py --help\n" -#~ "usage: myprogram.py [-h] [--foo FOO]\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo FOO foo help" - -#~ msgid "" -#~ ">>> parser = argparse.ArgumentParser()\n" -#~ ">>> parser.add_argument('--foo')\n" -#~ ">>> parser.parse_args('--foo 1'.split())\n" -#~ "Namespace(foo='1')" -#~ msgstr "" -#~ ">>> parser = argparse.ArgumentParser()\n" -#~ ">>> parser.add_argument('--foo')\n" -#~ ">>> parser.parse_args('--foo 1'.split())\n" -#~ "Namespace(foo='1')" - -#~ msgid "" -#~ ">>> parser = argparse.ArgumentParser(prog='doors.py')\n" -#~ ">>> parser.add_argument('door', type=int, choices=range(1, 4))\n" -#~ ">>> print(parser.parse_args(['3']))\n" -#~ "Namespace(door=3)\n" -#~ ">>> parser.parse_args(['4'])\n" -#~ "usage: doors.py [-h] {1,2,3}\n" -#~ "doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)" -#~ msgstr "" -#~ ">>> parser = argparse.ArgumentParser(prog='doors.py')\n" -#~ ">>> parser.add_argument('door', type=int, choices=range(1, 4))\n" -#~ ">>> print(parser.parse_args(['3']))\n" -#~ "Namespace(door=3)\n" -#~ ">>> parser.parse_args(['4'])\n" -#~ "usage: doors.py [-h] {1,2,3}\n" -#~ "doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)" - -#~ msgid "" -#~ ">>> parser = argparse.ArgumentParser(prog='frobble')\n" -#~ ">>> parser.add_argument('--foo', action='store_true',\n" -#~ "... help='foo the bars before frobbling')\n" -#~ ">>> parser.add_argument('bar', nargs='+',\n" -#~ "... help='one of the bars to be frobbled')\n" -#~ ">>> parser.parse_args(['-h'])\n" -#~ "usage: frobble [-h] [--foo] bar [bar ...]\n" -#~ "\n" -#~ "positional arguments:\n" -#~ " bar one of the bars to be frobbled\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo foo the bars before frobbling" -#~ msgstr "" -#~ ">>> parser = argparse.ArgumentParser(prog='frobble')\n" -#~ ">>> parser.add_argument('--foo', action='store_true',\n" -#~ "... help='foo the bars before frobbling')\n" -#~ ">>> parser.add_argument('bar', nargs='+',\n" -#~ "... help='one of the bars to be frobbled')\n" -#~ ">>> parser.parse_args(['-h'])\n" -#~ "usage: frobble [-h] [--foo] bar [bar ...]\n" -#~ "\n" -#~ "positional arguments:\n" -#~ " bar one of the bars to be frobbled\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo foo the bars before frobbling" - -#~ msgid "type_" -#~ msgstr "type_" diff --git a/library/builtins.po b/library/builtins.po index d2a6cc577f..ab36c9d83d 100644 --- a/library/builtins.po +++ b/library/builtins.po @@ -1,14 +1,14 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Adrian Liaw , 2018 -# Matt Wang , 2022 +# Matt Wang , 2022-2024 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2022-02-15 20:55+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,14 +28,12 @@ msgstr ":mod:`!builtins` --- 內建物件" msgid "" "This module provides direct access to all 'built-in' identifiers of Python; " "for example, ``builtins.open`` is the full name for the built-in function :" -"func:`open`. See :ref:`built-in-funcs` and :ref:`built-in-consts` for " -"documentation." +"func:`open`." msgstr "" "該模組提供對 Python 所有'內建'識別符號的直接存取;例如 ``builtins.open`` 是內" -"建函式 :func:`open` 的全名。請參閱\\ :ref:`built-in-funcs`\\ 和\\ :ref:" -"`built-in-consts`\\ 的文件。" +"建函式 :func:`open` 的全名。" -#: ../../library/builtins.rst:15 +#: ../../library/builtins.rst:12 msgid "" "This module is not normally accessed explicitly by most applications, but " "can be useful in modules that provide objects with the same name as a built-" @@ -47,7 +45,7 @@ msgstr "" "能很有用,不過其中還會需要內建該名稱。例如,在一個將內建 :func:`open` 包裝起" "來以實現另一版本 :func:`open` 函式的模組中,這個模組可以直接被使用: ::" -#: ../../library/builtins.rst:21 +#: ../../library/builtins.rst:18 msgid "" "import builtins\n" "\n" @@ -66,8 +64,24 @@ msgid "" "\n" " # ..." msgstr "" +"import builtins\n" +"\n" +"def open(path):\n" +" f = builtins.open(path, 'r')\n" +" return UpperCaser(f)\n" +"\n" +"class UpperCaser:\n" +" '''將輸出轉換成大寫的檔案包裝器'''\n" +"\n" +" def __init__(self, f):\n" +" self._f = f\n" +"\n" +" def read(self, count=-1):\n" +" return self._f.read(count).upper()\n" +"\n" +" # ..." -#: ../../library/builtins.rst:38 +#: ../../library/builtins.rst:35 msgid "" "As an implementation detail, most modules have the name ``__builtins__`` " "made available as part of their globals. The value of ``__builtins__`` is " @@ -79,3 +93,19 @@ msgstr "" "以提使用。``__builtins__`` 的值通常是這個模組或者這個模組的 :attr:`~object." "__dict__` 屬性值。由於這是一個實作細節,因此 Python 的其他實作可能不會使用" "它。" + +#: ../../library/builtins.rst:43 +msgid ":ref:`built-in-consts`" +msgstr ":ref:`built-in-consts`" + +#: ../../library/builtins.rst:44 +msgid ":ref:`bltin-exceptions`" +msgstr ":ref:`bltin-exceptions`" + +#: ../../library/builtins.rst:45 +msgid ":ref:`built-in-funcs`" +msgstr ":ref:`built-in-funcs`" + +#: ../../library/builtins.rst:46 +msgid ":ref:`bltin-types`" +msgstr ":ref:`bltin-types`" diff --git a/library/cmath.po b/library/cmath.po index 40159235bf..ba28b03e18 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-11-05 00:13+0000\n" "PO-Revision-Date: 2024-03-14 09:26+0800\n" "Last-Translator: Enkai Huang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -311,93 +310,89 @@ msgstr "如果 *a* 和 *b* 的值相互接近,則回傳 ``True``,否則回 #: ../../library/cmath.rst:223 msgid "" "Whether or not two values are considered close is determined according to " -"given absolute and relative tolerances." +"given absolute and relative tolerances. If no errors occur, the result will " +"be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``." msgstr "" -"兩個值是否被認為相互接近是由給定的絕對和相對容許偏差 (tolerance) 所決定的。" +"兩數是否足夠接近取決於給定的絕對及相對容許偏差 (tolerance)。如果沒有錯誤發" +"生,結果將為:``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``。" -#: ../../library/cmath.rst:226 +#: ../../library/cmath.rst:227 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " "For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default " "tolerance is ``1e-09``, which assures that the two values are the same " -"within about 9 decimal digits. *rel_tol* must be greater than zero." +"within about 9 decimal digits. *rel_tol* must be nonnegative and less than " +"``1.0``." msgstr "" -"*rel_tol* 是相對容許偏差 -- 它是 *a* 和 *b* 之間的最大容許偏差值,相對於 *a* " -"或 *b* 的較大絕對值。例如,要設定 5% 的容許偏差,請傳遞 ``rel_tol=0.05``。預" -"設容許偏差是 ``1e-09``,它確保兩個值在大約 9 位十進制數字內相同。 *rel_tol* " -"必須大於零。" - -#: ../../library/cmath.rst:232 -msgid "" -"*abs_tol* is the minimum absolute tolerance -- useful for comparisons near " -"zero. *abs_tol* must be at least zero." -msgstr "" -"*abs_tol* 是最小絕對容許偏差 -- 對於接近零的比較很有用。 *abs_tol* 必須至少為" -"零。" - -#: ../../library/cmath.rst:235 -msgid "" -"If no errors occur, the result will be: ``abs(a-b) <= max(rel_tol * " -"max(abs(a), abs(b)), abs_tol)``." +"*rel_tol* 為相對容許偏差 ── *a* 與 *b* 兩數差的最大容許值,與 *a* 及 *b* 兩數" +"的絕對值中較大者相關。例如欲設置 5% 的容許偏差,則傳入 ``rel_tol=0.05``。其預" +"設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須不為負" +"且小於 ``1.0``。" + +#: ../../library/cmath.rst:234 +msgid "" +"*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " +"nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " +"as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and " +"rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument " +"to the call." msgstr "" -"如果未發生錯誤,結果將為: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), " -"abs_tol)``。" -#: ../../library/cmath.rst:238 +#: ../../library/cmath.rst:240 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " "close to any other value, including ``NaN``. ``inf`` and ``-inf`` are only " "considered close to themselves." msgstr "" -"IEEE 754 特殊值 ``NaN`` 、 ``inf`` 和 ``-inf`` 將會根據 IEEE 規則進行處理。具" -"體來說, ``NaN`` 不被認為接近任何其他值,包括 ``NaN``。 ``inf`` 和 ``-inf`` " -"只被認為是接近它們自己的。" +"定義於 IEEE 754 浮點標準中的特殊值 ``NaN``、``inf`` 和 ``-inf`` 會根據該標準" +"處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " +"及 ``-inf`` 皆只與自身接近。" -#: ../../library/cmath.rst:247 +#: ../../library/cmath.rst:249 msgid ":pep:`485` -- A function for testing approximate equality" -msgstr ":pep:`485` -- 一個用來測試近似相等的函式" +msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/cmath.rst:251 +#: ../../library/cmath.rst:253 msgid "Constants" msgstr "常數" -#: ../../library/cmath.rst:255 +#: ../../library/cmath.rst:257 msgid "The mathematical constant *π*, as a float." msgstr "數學常數 *π*,作為一個浮點數。" -#: ../../library/cmath.rst:260 +#: ../../library/cmath.rst:262 msgid "The mathematical constant *e*, as a float." msgstr "數學常數 *e*,作為一個浮點數。" -#: ../../library/cmath.rst:265 +#: ../../library/cmath.rst:267 msgid "The mathematical constant *τ*, as a float." msgstr "數學常數 *τ*,作為一個浮點數。" -#: ../../library/cmath.rst:272 +#: ../../library/cmath.rst:274 msgid "Floating-point positive infinity. Equivalent to ``float('inf')``." msgstr "正無窮大的浮點數。相當於 ``float('inf')``。" -#: ../../library/cmath.rst:279 +#: ../../library/cmath.rst:281 msgid "" "Complex number with zero real part and positive infinity imaginary part. " "Equivalent to ``complex(0.0, float('inf'))``." msgstr "實部為零和虛部為正無窮的複數。相當於 ``complex(0.0, float('inf'))``。" -#: ../../library/cmath.rst:287 +#: ../../library/cmath.rst:289 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to " "``float('nan')``." msgstr "浮點「非數字」 (NaN) 值。相當於 ``float('nan')``。" -#: ../../library/cmath.rst:295 +#: ../../library/cmath.rst:297 msgid "" "Complex number with zero real part and NaN imaginary part. Equivalent to " "``complex(0.0, float('nan'))``." msgstr "實部為零和虛部為 NaN 的複數。相當於 ``complex(0.0, float('nan'))``。" -#: ../../library/cmath.rst:303 +#: ../../library/cmath.rst:305 msgid "" "Note that the selection of functions is similar, but not identical, to that " "in module :mod:`math`. The reason for having two modules is that some users " @@ -413,7 +408,7 @@ msgstr "" "sqrt(-1)`` 引發異常,也不願它回傳複數。另請注意, :mod:`cmath` 中所定義的函式" "始終都會回傳複數,即使答案可以表示為實數(在這種情況下,複數的虛部為零)。" -#: ../../library/cmath.rst:311 +#: ../../library/cmath.rst:313 msgid "" "A note on branch cuts: They are curves along which the given function fails " "to be continuous. They are a necessary feature of many complex functions. " @@ -428,17 +423,17 @@ msgstr "" "所有關於複變函數的(不是太初級的)書籍以獲得啟發。對於如何正確地基於數值目的" "選擇分枝切割的相關訊息,以下內容應該是一個很好的參考:" -#: ../../library/cmath.rst:321 +#: ../../library/cmath.rst:323 msgid "" "Kahan, W: Branch cuts for complex elementary functions; or, Much ado about " "nothing's sign bit. In Iserles, A., and Powell, M. (eds.), The state of the " "art in numerical analysis. Clarendon Press (1987) pp165--211." msgstr "" -#: ../../library/cmath.rst:301 +#: ../../library/cmath.rst:303 msgid "module" msgstr "module(模組)" -#: ../../library/cmath.rst:301 +#: ../../library/cmath.rst:303 msgid "math" msgstr "math(數學)" diff --git a/library/codecs.po b/library/codecs.po index 5ccfe0b8b7..90de1fd8dd 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -1667,9 +1667,8 @@ msgid "cp932" msgstr "cp932" #: ../../library/codecs.rst:1135 -#, fuzzy msgid "932, ms932, mskanji, ms-kanji, windows-31j" -msgstr "932, ms932, mskanji, ms-kanji" +msgstr "932, ms932, mskanji, ms-kanji, windows-31j" #: ../../library/codecs.rst:1135 ../../library/codecs.rst:1171 #: ../../library/codecs.rst:1173 ../../library/codecs.rst:1175 @@ -1883,7 +1882,7 @@ msgstr "gb18030-2000" #: ../../library/codecs.rst:1190 msgid "hz" -msgstr "" +msgstr "hz" #: ../../library/codecs.rst:1190 msgid "hzgb, hz-gb, hz-gb-2312" @@ -2047,7 +2046,7 @@ msgstr "iso-8859-11, thai" #: ../../library/codecs.rst:1232 msgid "Thai languages" -msgstr "" +msgstr "泰語" #: ../../library/codecs.rst:1234 msgid "iso8859_13" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 682bcbacad..8bec6881d5 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2023-01-24 03:33+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -379,7 +379,7 @@ msgid "" " 'http://www.cnn.com/',\n" " 'http://europe.wsj.com/',\n" " 'http://www.bbc.co.uk/',\n" -" 'http://nonexistant-subdomain.python.org/']\n" +" 'http://nonexistent-subdomain.python.org/']\n" "\n" "# Retrieve a single page and report the URL and contents\n" "def load_url(url, timeout):\n" diff --git a/library/configparser.po b/library/configparser.po index 3bc3843a4c..1cf79e0a29 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-12 00:13+0000\n" +"POT-Creation-Date: 2024-11-06 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -132,6 +132,21 @@ msgid "" "... config.write(configfile)\n" "..." msgstr "" +">>> import configparser\n" +">>> config = configparser.ConfigParser()\n" +">>> config['DEFAULT'] = {'ServerAliveInterval': '45',\n" +"... 'Compression': 'yes',\n" +"... 'CompressionLevel': '9'}\n" +">>> config['forge.example'] = {}\n" +">>> config['forge.example']['User'] = 'hg'\n" +">>> config['topsecret.server.example'] = {}\n" +">>> topsecret = config['topsecret.server.example']\n" +">>> topsecret['Port'] = '50022' # mutates the parser\n" +">>> topsecret['ForwardX11'] = 'no' # same here\n" +">>> config['DEFAULT']['ForwardX11'] = 'yes'\n" +">>> with open('example.ini', 'w') as configfile:\n" +"... config.write(configfile)\n" +"..." #: ../../library/configparser.rst:104 msgid "" @@ -178,6 +193,35 @@ msgid "" ">>> config['forge.example']['ForwardX11']\n" "'yes'" msgstr "" +">>> config = configparser.ConfigParser()\n" +">>> config.sections()\n" +"[]\n" +">>> config.read('example.ini')\n" +"['example.ini']\n" +">>> config.sections()\n" +"['forge.example', 'topsecret.server.example']\n" +">>> 'forge.example' in config\n" +"True\n" +">>> 'python.org' in config\n" +"False\n" +">>> config['forge.example']['User']\n" +"'hg'\n" +">>> config['DEFAULT']['Compression']\n" +"'yes'\n" +">>> topsecret = config['topsecret.server.example']\n" +">>> topsecret['ForwardX11']\n" +"'no'\n" +">>> topsecret['Port']\n" +"'50022'\n" +">>> for key in config['forge.example']: \n" +"... print(key)\n" +"user\n" +"compressionlevel\n" +"serveraliveinterval\n" +"compression\n" +"forwardx11\n" +">>> config['forge.example']['ForwardX11']\n" +"'yes'" #: ../../library/configparser.rst:143 msgid "" @@ -187,7 +231,7 @@ msgid "" "and stored in lowercase [1]_." msgstr "" -#: ../../library/configparser.rst:148 ../../library/configparser.rst:993 +#: ../../library/configparser.rst:148 ../../library/configparser.rst:1003 msgid "" "It is possible to read several configurations into a single :class:" "`ConfigParser`, where the most recently added configuration has the highest " @@ -197,7 +241,7 @@ msgid "" "``example.ini`` file." msgstr "" -#: ../../library/configparser.rst:155 ../../library/configparser.rst:1000 +#: ../../library/configparser.rst:155 ../../library/configparser.rst:1010 msgid "" "[DEFAULT]\n" "ServerAliveInterval = -1" @@ -205,7 +249,7 @@ msgstr "" "[DEFAULT]\n" "ServerAliveInterval = -1" -#: ../../library/configparser.rst:160 ../../library/configparser.rst:1005 +#: ../../library/configparser.rst:160 ../../library/configparser.rst:1015 msgid "" ">>> config_override = configparser.ConfigParser()\n" ">>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}\n" @@ -488,6 +532,16 @@ msgid "" ">>> unnamed.get(configparser.UNNAMED_SECTION, 'option')\n" "'value'" msgstr "" +">>> config = \"\"\"\n" +"... option = value\n" +"...\n" +"... [ Section 2 ]\n" +"... another = val\n" +"... \"\"\"\n" +">>> unnamed = configparser.ConfigParser(allow_unnamed_section=True)\n" +">>> unnamed.read_string(config)\n" +">>> unnamed.get(configparser.UNNAMED_SECTION, 'option')\n" +"'value'" #: ../../library/configparser.rst:361 msgid "Interpolation of values" @@ -1329,7 +1383,7 @@ msgstr "" msgid "ConfigParser Objects" msgstr "ConfigParser 物件" -#: ../../library/configparser.rst:947 +#: ../../library/configparser.rst:953 msgid "" "The main configuration parser. When *defaults* is given, it is initialized " "into the dictionary of intrinsic defaults. When *dict_type* is given, it " @@ -1337,7 +1391,7 @@ msgid "" "the options within a section, and for the default values." msgstr "" -#: ../../library/configparser.rst:952 +#: ../../library/configparser.rst:958 msgid "" "When *delimiters* is given, it is used as the set of substrings that divide " "keys from values. When *comment_prefixes* is given, it will be used as the " @@ -1346,7 +1400,7 @@ msgid "" "as the set of substrings that prefix comments in non-empty lines." msgstr "" -#: ../../library/configparser.rst:958 +#: ../../library/configparser.rst:964 msgid "" "When *strict* is ``True`` (the default), the parser won't allow for any " "section or option duplicates while reading from a single source (file, " @@ -1359,7 +1413,7 @@ msgid "" "without the trailing delimiter." msgstr "" -#: ../../library/configparser.rst:968 +#: ../../library/configparser.rst:974 msgid "" "When *default_section* is given, it specifies the name for the special " "section holding default values for other sections and interpolation purposes " @@ -1369,7 +1423,7 @@ msgid "" "settings to a new config file." msgstr "" -#: ../../library/configparser.rst:975 +#: ../../library/configparser.rst:981 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -1378,7 +1432,7 @@ msgid "" "`dedicated documentation section <#interpolation-of-values>`_." msgstr "" -#: ../../library/configparser.rst:981 +#: ../../library/configparser.rst:987 msgid "" "All option names used in interpolation will be passed through the :meth:" "`optionxform` method just like any other option name reference. For " @@ -1387,7 +1441,7 @@ msgid "" "%(BAR)s`` are equivalent." msgstr "" -#: ../../library/configparser.rst:987 +#: ../../library/configparser.rst:993 msgid "" "When *converters* is given, it should be a dictionary where each key " "represents the name of a type converter and each value is a callable " @@ -1396,50 +1450,61 @@ msgid "" "object and section proxies." msgstr "" -#: ../../library/configparser.rst:1018 +#: ../../library/configparser.rst:999 +msgid "" +"When *allow_unnamed_section* is ``True`` (default: ``False``), the first " +"section name can be omitted. See the `\"Unnamed Sections\" section <#unnamed-" +"sections>`_." +msgstr "" + +#: ../../library/configparser.rst:1028 msgid "The default *dict_type* is :class:`collections.OrderedDict`." msgstr "" -#: ../../library/configparser.rst:1021 +#: ../../library/configparser.rst:1031 ../../library/configparser.rst:1320 msgid "" "*allow_no_value*, *delimiters*, *comment_prefixes*, *strict*, " "*empty_lines_in_values*, *default_section* and *interpolation* were added." msgstr "" -#: ../../library/configparser.rst:1026 +#: ../../library/configparser.rst:1036 ../../library/configparser.rst:1325 msgid "The *converters* argument was added." msgstr "新增 *converters* 引數。" -#: ../../library/configparser.rst:1029 +#: ../../library/configparser.rst:1039 msgid "" "The *defaults* argument is read with :meth:`read_dict`, providing consistent " "behavior across the parser: non-string keys and values are implicitly " "converted to strings." msgstr "" -#: ../../library/configparser.rst:1034 ../../library/configparser.rst:1306 +#: ../../library/configparser.rst:1044 ../../library/configparser.rst:1328 msgid "" "The default *dict_type* is :class:`dict`, since it now preserves insertion " "order." msgstr "" -#: ../../library/configparser.rst:1038 +#: ../../library/configparser.rst:1048 msgid "" "Raise a :exc:`MultilineContinuationError` when *allow_no_value* is ``True``, " "and a key without a value is continued with an indented line." msgstr "" -#: ../../library/configparser.rst:1044 +#: ../../library/configparser.rst:1052 ../../library/configparser.rst:1332 +msgid "The *allow_unnamed_section* argument was added." +msgstr "新增 *allow_unnamed_section* 引數。" + +#: ../../library/configparser.rst:1057 msgid "Return a dictionary containing the instance-wide defaults." msgstr "" -#: ../../library/configparser.rst:1049 +#: ../../library/configparser.rst:1062 msgid "" "Return a list of the sections available; the *default section* is not " "included in the list." msgstr "" -#: ../../library/configparser.rst:1055 +#: ../../library/configparser.rst:1068 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " @@ -1447,34 +1512,34 @@ msgid "" "the section must be a string; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:1060 +#: ../../library/configparser.rst:1073 msgid "Non-string section names raise :exc:`TypeError`." msgstr "" -#: ../../library/configparser.rst:1066 +#: ../../library/configparser.rst:1079 msgid "" "Indicates whether the named *section* is present in the configuration. The " "*default section* is not acknowledged." msgstr "" -#: ../../library/configparser.rst:1072 +#: ../../library/configparser.rst:1085 msgid "Return a list of options available in the specified *section*." msgstr "" -#: ../../library/configparser.rst:1077 +#: ../../library/configparser.rst:1090 msgid "" "If the given *section* exists, and contains the given *option*, return :" "const:`True`; otherwise return :const:`False`. If the specified *section* " "is :const:`None` or an empty string, DEFAULT is assumed." msgstr "" -#: ../../library/configparser.rst:1084 +#: ../../library/configparser.rst:1097 msgid "" "Attempt to read and parse an iterable of filenames, returning a list of " "filenames which were successfully parsed." msgstr "" -#: ../../library/configparser.rst:1087 +#: ../../library/configparser.rst:1100 msgid "" "If *filenames* is a string, a :class:`bytes` object or a :term:`path-like " "object`, it is treated as a single filename. If a file named in *filenames* " @@ -1485,7 +1550,7 @@ msgid "" "be read." msgstr "" -#: ../../library/configparser.rst:1096 +#: ../../library/configparser.rst:1109 msgid "" "If none of the named files exist, the :class:`ConfigParser` instance will " "contain an empty dataset. An application which requires initial values to " @@ -1493,7 +1558,7 @@ msgid "" "`read_file` before calling :meth:`read` for any optional files::" msgstr "" -#: ../../library/configparser.rst:1102 +#: ../../library/configparser.rst:1115 msgid "" "import configparser, os\n" "\n" @@ -1509,49 +1574,49 @@ msgstr "" "config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')],\n" " encoding='cp1250')" -#: ../../library/configparser.rst:1109 +#: ../../library/configparser.rst:1122 msgid "" "Added the *encoding* parameter. Previously, all files were read using the " "default encoding for :func:`open`." msgstr "" -#: ../../library/configparser.rst:1113 +#: ../../library/configparser.rst:1126 msgid "The *filenames* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/configparser.rst:1116 +#: ../../library/configparser.rst:1129 msgid "The *filenames* parameter accepts a :class:`bytes` object." msgstr "" -#: ../../library/configparser.rst:1122 +#: ../../library/configparser.rst:1135 msgid "" "Read and parse configuration data from *f* which must be an iterable " "yielding Unicode strings (for example files opened in text mode)." msgstr "" -#: ../../library/configparser.rst:1125 +#: ../../library/configparser.rst:1138 msgid "" "Optional argument *source* specifies the name of the file being read. If " "not given and *f* has a :attr:`!name` attribute, that is used for *source*; " "the default is ``''``." msgstr "" -#: ../../library/configparser.rst:1129 +#: ../../library/configparser.rst:1142 msgid "Replaces :meth:`!readfp`." msgstr "取代 :meth:`!readfp`。" -#: ../../library/configparser.rst:1134 +#: ../../library/configparser.rst:1147 msgid "Parse configuration data from a string." msgstr "" -#: ../../library/configparser.rst:1136 +#: ../../library/configparser.rst:1149 msgid "" "Optional argument *source* specifies a context-specific name of the string " "passed. If not given, ``''`` is used. This should commonly be a " "filesystem path or a URL." msgstr "" -#: ../../library/configparser.rst:1145 +#: ../../library/configparser.rst:1158 msgid "" "Load configuration from any object that provides a dict-like ``items()`` " "method. Keys are section names, values are dictionaries with keys and " @@ -1560,17 +1625,17 @@ msgid "" "automatically converted to strings." msgstr "" -#: ../../library/configparser.rst:1151 +#: ../../library/configparser.rst:1164 msgid "" "Optional argument *source* specifies a context-specific name of the " "dictionary passed. If not given, ```` is used." msgstr "" -#: ../../library/configparser.rst:1154 +#: ../../library/configparser.rst:1167 msgid "This method can be used to copy state between parsers." msgstr "" -#: ../../library/configparser.rst:1161 +#: ../../library/configparser.rst:1174 msgid "" "Get an *option* value for the named *section*. If *vars* is provided, it " "must be a dictionary. The *option* is looked up in *vars* (if provided), " @@ -1579,35 +1644,35 @@ msgid "" "provided as a *fallback* value." msgstr "" -#: ../../library/configparser.rst:1167 +#: ../../library/configparser.rst:1180 msgid "" "All the ``'%'`` interpolations are expanded in the return values, unless the " "*raw* argument is true. Values for interpolation keys are looked up in the " "same manner as the option." msgstr "" -#: ../../library/configparser.rst:1171 +#: ../../library/configparser.rst:1184 msgid "" "Arguments *raw*, *vars* and *fallback* are keyword only to protect users " "from trying to use the third argument as the *fallback* fallback (especially " "when using the mapping protocol)." msgstr "" -#: ../../library/configparser.rst:1179 +#: ../../library/configparser.rst:1192 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to an integer. See :meth:`get` for explanation of *raw*, *vars* and " "*fallback*." msgstr "" -#: ../../library/configparser.rst:1186 +#: ../../library/configparser.rst:1199 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a floating-point number. See :meth:`get` for explanation of *raw*, " "*vars* and *fallback*." msgstr "" -#: ../../library/configparser.rst:1193 +#: ../../library/configparser.rst:1206 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a Boolean value. Note that the accepted values for the option are " @@ -1619,34 +1684,34 @@ msgid "" "*fallback*." msgstr "" -#: ../../library/configparser.rst:1206 +#: ../../library/configparser.rst:1219 msgid "" "When *section* is not given, return a list of *section_name*, " "*section_proxy* pairs, including DEFAULTSECT." msgstr "" -#: ../../library/configparser.rst:1209 +#: ../../library/configparser.rst:1222 msgid "" "Otherwise, return a list of *name*, *value* pairs for the options in the " "given *section*. Optional arguments have the same meaning as for the :meth:" "`get` method." msgstr "" -#: ../../library/configparser.rst:1213 +#: ../../library/configparser.rst:1226 msgid "" "Items present in *vars* no longer appear in the result. The previous " "behaviour mixed actual parser options with variables provided for " "interpolation." msgstr "" -#: ../../library/configparser.rst:1221 +#: ../../library/configparser.rst:1234 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. *option* and *value* must be " "strings; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:1228 +#: ../../library/configparser.rst:1241 msgid "" "Write a representation of the configuration to the specified :term:`file " "object`, which must be opened in text mode (accepting strings). This " @@ -1655,27 +1720,27 @@ msgid "" "surrounded by spaces." msgstr "" -#: ../../library/configparser.rst:1236 +#: ../../library/configparser.rst:1249 msgid "" "Comments in the original configuration file are not preserved when writing " "the configuration back. What is considered a comment, depends on the given " "values for *comment_prefix* and *inline_comment_prefix*." msgstr "" -#: ../../library/configparser.rst:1244 +#: ../../library/configparser.rst:1257 msgid "" "Remove the specified *option* from the specified *section*. If the section " "does not exist, raise :exc:`NoSectionError`. If the option existed to be " "removed, return :const:`True`; otherwise return :const:`False`." msgstr "" -#: ../../library/configparser.rst:1252 +#: ../../library/configparser.rst:1265 msgid "" "Remove the specified *section* from the configuration. If the section in " "fact existed, return ``True``. Otherwise return ``False``." msgstr "" -#: ../../library/configparser.rst:1258 +#: ../../library/configparser.rst:1271 msgid "" "Transforms the option name *option* as found in an input file or as passed " "in by client code to the form that should be used in the internal " @@ -1684,7 +1749,7 @@ msgid "" "of this name on instances to affect this behavior." msgstr "" -#: ../../library/configparser.rst:1264 +#: ../../library/configparser.rst:1277 msgid "" "You don't need to subclass the parser to use this method, you can also set " "it on an instance, to a function that takes a string argument and returns a " @@ -1692,7 +1757,7 @@ msgid "" "sensitive::" msgstr "" -#: ../../library/configparser.rst:1269 +#: ../../library/configparser.rst:1282 msgid "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" @@ -1700,30 +1765,30 @@ msgstr "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" -#: ../../library/configparser.rst:1272 +#: ../../library/configparser.rst:1285 msgid "" "Note that when reading configuration files, whitespace around the option " "names is stripped before :meth:`optionxform` is called." msgstr "" -#: ../../library/configparser.rst:1278 +#: ../../library/configparser.rst:1291 msgid "" "A special object representing a section name used to reference the unnamed " "section (see :ref:`unnamed-sections`)." msgstr "" -#: ../../library/configparser.rst:1283 +#: ../../library/configparser.rst:1296 msgid "" "The maximum depth for recursive interpolation for :meth:`~configparser." "ConfigParser.get` when the *raw* parameter is false. This is relevant only " "when the default *interpolation* is used." msgstr "" -#: ../../library/configparser.rst:1291 +#: ../../library/configparser.rst:1304 msgid "RawConfigParser Objects" msgstr "RawConfigParser 物件" -#: ../../library/configparser.rst:1301 +#: ../../library/configparser.rst:1315 msgid "" "Legacy variant of the :class:`ConfigParser`. It has interpolation disabled " "by default and allows for non-string section names, option names, and values " @@ -1731,27 +1796,27 @@ msgid "" "``defaults=`` keyword argument handling." msgstr "" -#: ../../library/configparser.rst:1311 +#: ../../library/configparser.rst:1336 msgid "" "Consider using :class:`ConfigParser` instead which checks types of the " "values to be stored internally. If you don't want interpolation, you can " "use ``ConfigParser(interpolation=None)``." msgstr "" -#: ../../library/configparser.rst:1318 +#: ../../library/configparser.rst:1343 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " "*default section* name is passed, :exc:`ValueError` is raised." msgstr "" -#: ../../library/configparser.rst:1322 +#: ../../library/configparser.rst:1347 msgid "" "Type of *section* is not checked which lets users create non-string named " "sections. This behaviour is unsupported and may cause internal errors." msgstr "" -#: ../../library/configparser.rst:1328 +#: ../../library/configparser.rst:1353 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. While it is possible to use :class:" @@ -1761,7 +1826,7 @@ msgid "" "string values." msgstr "" -#: ../../library/configparser.rst:1335 +#: ../../library/configparser.rst:1360 msgid "" "This method lets users assign non-string values to keys internally. This " "behaviour is unsupported and will cause errors when attempting to write to a " @@ -1769,32 +1834,32 @@ msgid "" "not allow such assignments to take place." msgstr "" -#: ../../library/configparser.rst:1342 +#: ../../library/configparser.rst:1367 msgid "Exceptions" msgstr "例外" -#: ../../library/configparser.rst:1346 +#: ../../library/configparser.rst:1371 msgid "Base class for all other :mod:`configparser` exceptions." msgstr "" -#: ../../library/configparser.rst:1351 +#: ../../library/configparser.rst:1376 msgid "Exception raised when a specified section is not found." msgstr "" -#: ../../library/configparser.rst:1356 +#: ../../library/configparser.rst:1381 msgid "" "Exception raised if :meth:`~ConfigParser.add_section` is called with the " "name of a section that is already present or in strict parsers when a " "section if found more than once in a single input file, string or dictionary." msgstr "" -#: ../../library/configparser.rst:1360 +#: ../../library/configparser.rst:1385 msgid "" "Added the optional *source* and *lineno* attributes and parameters to :meth:" "`!__init__`." msgstr "" -#: ../../library/configparser.rst:1367 +#: ../../library/configparser.rst:1392 msgid "" "Exception raised by strict parsers if a single option appears twice during " "reading from a single file, string or dictionary. This catches misspellings " @@ -1802,64 +1867,64 @@ msgid "" "representing the same case-insensitive configuration key." msgstr "" -#: ../../library/configparser.rst:1375 +#: ../../library/configparser.rst:1400 msgid "" "Exception raised when a specified option is not found in the specified " "section." msgstr "" -#: ../../library/configparser.rst:1381 +#: ../../library/configparser.rst:1406 msgid "" "Base class for exceptions raised when problems occur performing string " "interpolation." msgstr "" -#: ../../library/configparser.rst:1387 +#: ../../library/configparser.rst:1412 msgid "" "Exception raised when string interpolation cannot be completed because the " "number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass of :" "exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1394 +#: ../../library/configparser.rst:1419 msgid "" "Exception raised when an option referenced from a value does not exist. " "Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1400 +#: ../../library/configparser.rst:1425 msgid "" "Exception raised when the source text into which substitutions are made does " "not conform to the required syntax. Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1406 +#: ../../library/configparser.rst:1431 msgid "" "Exception raised when attempting to parse a file which has no section " "headers." msgstr "" -#: ../../library/configparser.rst:1412 +#: ../../library/configparser.rst:1437 msgid "Exception raised when errors occur attempting to parse a file." msgstr "" -#: ../../library/configparser.rst:1414 +#: ../../library/configparser.rst:1439 msgid "" "The ``filename`` attribute and :meth:`!__init__` constructor argument were " "removed. They have been available using the name ``source`` since 3.2." msgstr "" -#: ../../library/configparser.rst:1420 +#: ../../library/configparser.rst:1445 msgid "" "Exception raised when a key without a corresponding value is continued with " "an indented line." msgstr "" -#: ../../library/configparser.rst:1426 +#: ../../library/configparser.rst:1451 msgid "Footnotes" msgstr "註解" -#: ../../library/configparser.rst:1427 +#: ../../library/configparser.rst:1452 msgid "" "Config parsers allow for heavy customization. If you are interested in " "changing the behaviour outlined by the footnote reference, consult the " diff --git a/library/contextvars.po b/library/contextvars.po index 8f8fe6b9cd..b229a722fe 100644 --- a/library/contextvars.po +++ b/library/contextvars.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 23:08+0000\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -73,7 +72,7 @@ msgstr "" #: ../../library/contextvars.rst:49 msgid "The name of the variable. This is a read-only property." -msgstr "" +msgstr "這個變數的名稱。這是一個唯讀屬性。" #: ../../library/contextvars.rst:55 msgid "Return a value for the context variable for the current context." @@ -98,7 +97,7 @@ msgstr "" #: ../../library/contextvars.rst:66 msgid "raise a :exc:`LookupError`." -msgstr "" +msgstr "引發一個 :exc:`LookupError`。" #: ../../library/contextvars.rst:70 msgid "" @@ -203,45 +202,90 @@ msgstr "" #: ../../library/contextvars.rst:147 msgid "" -"Every thread will have a different top-level :class:`~contextvars.Context` " -"object. This means that a :class:`ContextVar` object behaves in a similar " -"fashion to :func:`threading.local` when values are assigned in different " -"threads." +"Each thread has its own effective stack of :class:`!Context` objects. The :" +"term:`current context` is the :class:`!Context` object at the top of the " +"current thread's stack. All :class:`!Context` objects in the stacks are " +"considered to be *entered*." msgstr "" #: ../../library/contextvars.rst:152 -msgid "Context implements the :class:`collections.abc.Mapping` interface." +msgid "" +"*Entering* a context, which can be done by calling its :meth:`~Context.run` " +"method, makes the context the current context by pushing it onto the top of " +"the current thread's context stack." msgstr "" #: ../../library/contextvars.rst:156 msgid "" -"Execute ``callable(*args, **kwargs)`` code in the context object the *run* " -"method is called on. Return the result of the execution or propagate an " -"exception if one occurred." +"*Exiting* from the current context, which can be done by returning from the " +"callback passed to the :meth:`~Context.run` method, restores the current " +"context to what it was before the context was entered by popping the context " +"off the top of the context stack." msgstr "" -#: ../../library/contextvars.rst:160 +#: ../../library/contextvars.rst:161 msgid "" -"Any changes to any context variables that *callable* makes will be contained " -"in the context object::" +"Since each thread has its own context stack, :class:`ContextVar` objects " +"behave in a similar fashion to :func:`threading.local` when values are " +"assigned in different threads." msgstr "" -#: ../../library/contextvars.rst:163 +#: ../../library/contextvars.rst:165 msgid "" -"var = ContextVar('var')\n" +"Attempting to enter an already entered context, including contexts entered " +"in other threads, raises a :exc:`RuntimeError`." +msgstr "" + +#: ../../library/contextvars.rst:168 +msgid "After exiting a context, it can later be re-entered (from any thread)." +msgstr "" + +#: ../../library/contextvars.rst:170 +msgid "" +"Any changes to :class:`ContextVar` values via the :meth:`ContextVar.set` " +"method are recorded in the current context. The :meth:`ContextVar.get` " +"method returns the value associated with the current context. Exiting a " +"context effectively reverts any changes made to context variables while the " +"context was entered (if needed, the values can be restored by re-entering " +"the context)." +msgstr "" + +#: ../../library/contextvars.rst:177 +msgid "Context implements the :class:`collections.abc.Mapping` interface." +msgstr "" + +#: ../../library/contextvars.rst:181 +msgid "" +"Enters the Context, executes ``callable(*args, **kwargs)``, then exits the " +"Context. Returns *callable*'s return value, or propagates an exception if " +"one occurred." +msgstr "" + +#: ../../library/contextvars.rst:185 +msgid "Example:" +msgstr "舉例來說:" + +#: ../../library/contextvars.rst:187 +msgid "" +"import contextvars\n" +"\n" +"var = contextvars.ContextVar('var')\n" "var.set('spam')\n" +"print(var.get()) # 'spam'\n" +"\n" +"ctx = contextvars.copy_context()\n" "\n" "def main():\n" " # 'var' was set to 'spam' before\n" " # calling 'copy_context()' and 'ctx.run(main)', so:\n" -" # var.get() == ctx[var] == 'spam'\n" +" print(var.get()) # 'spam'\n" +" print(ctx[var]) # 'spam'\n" "\n" " var.set('ham')\n" "\n" " # Now, after setting 'var' to 'ham':\n" -" # var.get() == ctx[var] == 'ham'\n" -"\n" -"ctx = copy_context()\n" +" print(var.get()) # 'ham'\n" +" print(ctx[var]) # 'ham'\n" "\n" "# Any changes that the 'main' function makes to 'var'\n" "# will be contained in 'ctx'.\n" @@ -249,67 +293,61 @@ msgid "" "\n" "# The 'main()' function was run in the 'ctx' context,\n" "# so changes to 'var' are contained in it:\n" -"# ctx[var] == 'ham'\n" +"print(ctx[var]) # 'ham'\n" "\n" "# However, outside of 'ctx', 'var' is still set to 'spam':\n" -"# var.get() == 'spam'" +"print(var.get()) # 'spam'" msgstr "" -#: ../../library/contextvars.rst:189 -msgid "" -"The method raises a :exc:`RuntimeError` when called on the same context " -"object from more than one OS thread, or when called recursively." -msgstr "" - -#: ../../library/contextvars.rst:195 +#: ../../library/contextvars.rst:233 msgid "Return a shallow copy of the context object." msgstr "" -#: ../../library/contextvars.rst:199 +#: ../../library/contextvars.rst:237 msgid "" "Return ``True`` if the *context* has a value for *var* set; return ``False`` " "otherwise." msgstr "" -#: ../../library/contextvars.rst:204 +#: ../../library/contextvars.rst:242 msgid "" "Return the value of the *var* :class:`ContextVar` variable. If the variable " "is not set in the context object, a :exc:`KeyError` is raised." msgstr "" -#: ../../library/contextvars.rst:210 +#: ../../library/contextvars.rst:248 msgid "" "Return the value for *var* if *var* has the value in the context object. " "Return *default* otherwise. If *default* is not given, return ``None``." msgstr "" -#: ../../library/contextvars.rst:216 +#: ../../library/contextvars.rst:254 msgid "Return an iterator over the variables stored in the context object." msgstr "" -#: ../../library/contextvars.rst:221 +#: ../../library/contextvars.rst:259 msgid "Return the number of variables set in the context object." msgstr "" -#: ../../library/contextvars.rst:225 +#: ../../library/contextvars.rst:263 msgid "Return a list of all variables in the context object." msgstr "" -#: ../../library/contextvars.rst:229 +#: ../../library/contextvars.rst:267 msgid "Return a list of all variables' values in the context object." msgstr "" -#: ../../library/contextvars.rst:234 +#: ../../library/contextvars.rst:272 msgid "" "Return a list of 2-tuples containing all variables and their values in the " "context object." msgstr "" -#: ../../library/contextvars.rst:239 +#: ../../library/contextvars.rst:277 msgid "asyncio support" -msgstr "" +msgstr "對 asyncio 的支援" -#: ../../library/contextvars.rst:241 +#: ../../library/contextvars.rst:279 msgid "" "Context variables are natively supported in :mod:`asyncio` and are ready to " "be used without any extra configuration. For example, here is a simple echo " @@ -317,7 +355,7 @@ msgid "" "available in the Task that handles that client::" msgstr "" -#: ../../library/contextvars.rst:247 +#: ../../library/contextvars.rst:285 msgid "" "import asyncio\n" "import contextvars\n" diff --git a/library/ctypes.po b/library/ctypes.po index 0fb1ee514b..1ecac422b6 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"POT-Creation-Date: 2024-10-29 00:13+0000\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -376,7 +376,7 @@ msgid "" "learn more about :mod:`ctypes` data types." msgstr "" -#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2203 +#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2213 msgid "Fundamental data types" msgstr "" @@ -740,7 +740,6 @@ msgid "" msgstr "" #: ../../library/ctypes.rst:351 -#, fuzzy msgid "" ">>> printf = libc.printf\n" ">>> printf(b\"Hello, %s\\n\", b\"World!\")\n" @@ -772,7 +771,8 @@ msgstr "" ">>> printf(b\"%f bottles of beer\\n\", 42.5)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"ArgumentError: argument 2: TypeError: Don't know how to convert parameter 2\n" +"ctypes.ArgumentError: argument 2: TypeError: Don't know how to convert " +"parameter 2\n" ">>>" #: ../../library/ctypes.rst:367 @@ -809,7 +809,7 @@ msgstr "" #: ../../library/ctypes.rst:386 msgid "" -"On those platforms it is required to specify the :attr:`~_FuncPtr.argtypes` " +"On those platforms it is required to specify the :attr:`~_CFuncPtr.argtypes` " "attribute for the regular, non-variadic, function arguments:" msgstr "" @@ -820,7 +820,7 @@ msgstr "libc.printf.argtypes = [ctypes.c_char_p]" #: ../../library/ctypes.rst:393 msgid "" "Because specifying the attribute does not inhibit portability it is advised " -"to always specify :attr:`~_FuncPtr.argtypes` for all variadic functions." +"to always specify :attr:`~_CFuncPtr.argtypes` for all variadic functions." msgstr "" #: ../../library/ctypes.rst:400 @@ -872,12 +872,12 @@ msgstr "" #: ../../library/ctypes.rst:428 msgid "" "It is possible to specify the required argument types of functions exported " -"from DLLs by setting the :attr:`~_FuncPtr.argtypes` attribute." +"from DLLs by setting the :attr:`~_CFuncPtr.argtypes` attribute." msgstr "" #: ../../library/ctypes.rst:431 msgid "" -":attr:`~_FuncPtr.argtypes` must be a sequence of C data types (the :func:`!" +":attr:`~_CFuncPtr.argtypes` must be a sequence of C data types (the :func:`!" "printf` function is probably not a good example here, because it takes a " "variable number and different types of parameters depending on the format " "string, on the other hand this is quite handy to experiment with this " @@ -906,7 +906,6 @@ msgid "" msgstr "" #: ../../library/ctypes.rst:445 -#, fuzzy msgid "" ">>> printf(b\"%d %d %d\", 1, 2, 3)\n" "Traceback (most recent call last):\n" @@ -921,7 +920,8 @@ msgstr "" ">>> printf(b\"%d %d %d\", 1, 2, 3)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"ArgumentError: argument 2: TypeError: wrong type\n" +"ctypes.ArgumentError: argument 2: TypeError: 'int' object cannot be " +"interpreted as ctypes.c_char_p\n" ">>> printf(b\"%s %d %f\\n\", b\"X\", 2, 3)\n" "X 2 3.000000\n" "13\n" @@ -931,7 +931,7 @@ msgstr "" msgid "" "If you have defined your own classes which you pass to function calls, you " "have to implement a :meth:`~_CData.from_param` class method for them to be " -"able to use them in the :attr:`~_FuncPtr.argtypes` sequence. The :meth:" +"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. The :meth:" "`~_CData.from_param` class method receives the Python object passed to the " "function call, it should do a typecheck or whatever is needed to make sure " "this object is acceptable, and then return the object itself, its :attr:`!" @@ -948,7 +948,7 @@ msgstr "" #: ../../library/ctypes.rst:478 msgid "" "By default functions are assumed to return the C :c:expr:`int` type. Other " -"return types can be specified by setting the :attr:`~_FuncPtr.restype` " +"return types can be specified by setting the :attr:`~_CFuncPtr.restype` " "attribute of the function object." msgstr "" @@ -964,7 +964,7 @@ msgid ">>> libc.time.restype = c_time_t" msgstr ">>> libc.time.restype = c_time_t" #: ../../library/ctypes.rst:488 -msgid "The argument types can be specified using :attr:`~_FuncPtr.argtypes`::" +msgid "The argument types can be specified using :attr:`~_CFuncPtr.argtypes`::" msgstr "" #: ../../library/ctypes.rst:490 @@ -1016,7 +1016,7 @@ msgstr "" #: ../../library/ctypes.rst:510 msgid "" "If you want to avoid the :func:`ord(\"x\") ` calls above, you can set " -"the :attr:`~_FuncPtr.argtypes` attribute, and the second argument will be " +"the :attr:`~_CFuncPtr.argtypes` attribute, and the second argument will be " "converted from a single character Python bytes object into a C char:" msgstr "" @@ -1053,11 +1053,11 @@ msgstr "" #: ../../library/ctypes.rst:529 msgid "" "You can also use a callable Python object (a function or a class for " -"example) as the :attr:`~_FuncPtr.restype` attribute, if the foreign function " -"returns an integer. The callable will be called with the *integer* the C " -"function returns, and the result of this call will be used as the result of " -"your function call. This is useful to check for error return values and " -"automatically raise an exception::" +"example) as the :attr:`~_CFuncPtr.restype` attribute, if the foreign " +"function returns an integer. The callable will be called with the *integer* " +"the C function returns, and the result of this call will be used as the " +"result of your function call. This is useful to check for error return " +"values and automatically raise an exception::" msgstr "" #: ../../library/ctypes.rst:535 @@ -1107,7 +1107,7 @@ msgstr "" #: ../../library/ctypes.rst:557 msgid "" "Please note that a much more powerful error checking mechanism is available " -"through the :attr:`~_FuncPtr.errcheck` attribute; see the reference manual " +"through the :attr:`~_CFuncPtr.errcheck` attribute; see the reference manual " "for details." msgstr "" @@ -1665,7 +1665,7 @@ msgstr "" #: ../../library/ctypes.rst:861 msgid "" "Usually, ctypes does strict type checking. This means, if you have " -"``POINTER(c_int)`` in the :attr:`~_FuncPtr.argtypes` list of a function or " +"``POINTER(c_int)`` in the :attr:`~_CFuncPtr.argtypes` list of a function or " "as the type of a member field in a structure definition, only instances of " "exactly the same type are accepted. There are some exceptions to this rule, " "where ctypes accepts other objects. For example, you can pass compatible " @@ -1706,7 +1706,7 @@ msgstr "" #: ../../library/ctypes.rst:882 msgid "" "In addition, if a function argument is explicitly declared to be a pointer " -"type (such as ``POINTER(c_int)``) in :attr:`~_FuncPtr.argtypes`, an object " +"type (such as ``POINTER(c_int)``) in :attr:`~_CFuncPtr.argtypes`, an object " "of the pointed type (``c_int`` in this case) can be passed to the function. " "ctypes will apply the required :func:`byref` conversion in this case " "automatically." @@ -2497,7 +2497,7 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1316 ../../library/ctypes.rst:1977 +#: ../../library/ctypes.rst:1316 ../../library/ctypes.rst:1987 msgid "The exact functionality is system dependent." msgstr "" @@ -2875,32 +2875,48 @@ msgid "" "attributes of loaded shared libraries. The function objects created in this " "way by default accept any number of arguments, accept any ctypes data " "instances as arguments, and return the default result type specified by the " -"library loader. They are instances of a private class:" +"library loader." +msgstr "" + +#: ../../library/ctypes.rst:1613 +msgid "" +"They are instances of a private local class :class:`!_FuncPtr` (not exposed " +"in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class:" +msgstr "" + +#: ../../library/ctypes.rst:1616 +msgid "" +">>> import ctypes\n" +">>> lib = ctypes.CDLL(None)\n" +">>> issubclass(lib._FuncPtr, ctypes._CFuncPtr)\n" +"True\n" +">>> lib._FuncPtr is ctypes._CFuncPtr\n" +"False" msgstr "" -#: ../../library/ctypes.rst:1617 +#: ../../library/ctypes.rst:1627 msgid "Base class for C callable foreign functions." msgstr "" -#: ../../library/ctypes.rst:1619 +#: ../../library/ctypes.rst:1629 msgid "" "Instances of foreign functions are also C compatible data types; they " "represent C function pointers." msgstr "" -#: ../../library/ctypes.rst:1622 +#: ../../library/ctypes.rst:1632 msgid "" "This behavior can be customized by assigning to special attributes of the " "foreign function object." msgstr "" -#: ../../library/ctypes.rst:1627 +#: ../../library/ctypes.rst:1637 msgid "" "Assign a ctypes type to specify the result type of the foreign function. Use " "``None`` for :c:expr:`void`, a function not returning anything." msgstr "" -#: ../../library/ctypes.rst:1630 +#: ../../library/ctypes.rst:1640 msgid "" "It is possible to assign a callable Python object that is not a ctypes type, " "in this case the function is assumed to return a C :c:expr:`int`, and the " @@ -2910,7 +2926,7 @@ msgid "" "callable to the :attr:`errcheck` attribute." msgstr "" -#: ../../library/ctypes.rst:1639 +#: ../../library/ctypes.rst:1649 msgid "" "Assign a tuple of ctypes types to specify the argument types that the " "function accepts. Functions using the ``stdcall`` calling convention can " @@ -2919,7 +2935,7 @@ msgid "" "unspecified arguments as well." msgstr "" -#: ../../library/ctypes.rst:1645 +#: ../../library/ctypes.rst:1655 msgid "" "When a foreign function is called, each actual argument is passed to the :" "meth:`~_CData.from_param` class method of the items in the :attr:`argtypes` " @@ -2929,7 +2945,7 @@ msgid "" "object using ctypes conversion rules." msgstr "" -#: ../../library/ctypes.rst:1652 +#: ../../library/ctypes.rst:1662 msgid "" "New: It is now possible to put items in argtypes which are not ctypes types, " "but each item must have a :meth:`~_CData.from_param` method which returns a " @@ -2937,44 +2953,44 @@ msgid "" "defining adapters that can adapt custom objects as function parameters." msgstr "" -#: ../../library/ctypes.rst:1659 +#: ../../library/ctypes.rst:1669 msgid "" "Assign a Python function or another callable to this attribute. The callable " "will be called with three or more arguments:" msgstr "" -#: ../../library/ctypes.rst:1666 +#: ../../library/ctypes.rst:1676 msgid "" "*result* is what the foreign function returns, as specified by the :attr:`!" "restype` attribute." msgstr "" -#: ../../library/ctypes.rst:1669 +#: ../../library/ctypes.rst:1679 msgid "" "*func* is the foreign function object itself, this allows reusing the same " "callable object to check or post process the results of several functions." msgstr "" -#: ../../library/ctypes.rst:1673 +#: ../../library/ctypes.rst:1683 msgid "" "*arguments* is a tuple containing the parameters originally passed to the " "function call, this allows specializing the behavior on the arguments used." msgstr "" -#: ../../library/ctypes.rst:1677 +#: ../../library/ctypes.rst:1687 msgid "" "The object that this function returns will be returned from the foreign " "function call, but it can also check the result value and raise an exception " "if the foreign function call failed." msgstr "" -#: ../../library/ctypes.rst:1684 +#: ../../library/ctypes.rst:1694 msgid "" "This exception is raised when a foreign function call cannot convert one of " "the passed arguments." msgstr "" -#: ../../library/ctypes.rst:1688 ../../library/ctypes.rst:1690 +#: ../../library/ctypes.rst:1698 ../../library/ctypes.rst:1700 msgid "" "On Windows, when a foreign function call raises a system exception (for " "example, due to an access violation), it will be captured and replaced with " @@ -2983,18 +2999,18 @@ msgid "" "hook to replace the exception with its own." msgstr "" -#: ../../library/ctypes.rst:1696 ../../library/ctypes.rst:1698 +#: ../../library/ctypes.rst:1706 ../../library/ctypes.rst:1708 msgid "" "Some ways to invoke foreign function calls may raise an auditing event " "``ctypes.call_function`` with arguments ``function pointer`` and " "``arguments``." msgstr "" -#: ../../library/ctypes.rst:1704 +#: ../../library/ctypes.rst:1714 msgid "Function prototypes" msgstr "" -#: ../../library/ctypes.rst:1706 +#: ../../library/ctypes.rst:1716 msgid "" "Foreign functions can also be created by instantiating function prototypes. " "Function prototypes are similar to function prototypes in C; they describe a " @@ -3005,7 +3021,7 @@ msgid "" "``@wrapper`` syntax. See :ref:`ctypes-callback-functions` for examples." msgstr "" -#: ../../library/ctypes.rst:1717 +#: ../../library/ctypes.rst:1727 msgid "" "The returned function prototype creates functions that use the standard C " "calling convention. The function will release the GIL during the call. If " @@ -3014,37 +3030,37 @@ msgid "" "after the call; *use_last_error* does the same for the Windows error code." msgstr "" -#: ../../library/ctypes.rst:1727 +#: ../../library/ctypes.rst:1737 msgid "" "Windows only: The returned function prototype creates functions that use the " "``stdcall`` calling convention. The function will release the GIL during " "the call. *use_errno* and *use_last_error* have the same meaning as above." msgstr "" -#: ../../library/ctypes.rst:1735 +#: ../../library/ctypes.rst:1745 msgid "" "The returned function prototype creates functions that use the Python " "calling convention. The function will *not* release the GIL during the call." msgstr "" -#: ../../library/ctypes.rst:1738 +#: ../../library/ctypes.rst:1748 msgid "" "Function prototypes created by these factory functions can be instantiated " "in different ways, depending on the type and number of the parameters in the " "call:" msgstr "" -#: ../../library/ctypes.rst:1745 +#: ../../library/ctypes.rst:1755 msgid "" "Returns a foreign function at the specified address which must be an integer." msgstr "" -#: ../../library/ctypes.rst:1752 +#: ../../library/ctypes.rst:1762 msgid "" "Create a C callable function (a callback function) from a Python *callable*." msgstr "" -#: ../../library/ctypes.rst:1759 +#: ../../library/ctypes.rst:1769 msgid "" "Returns a foreign function exported by a shared library. *func_spec* must be " "a 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the " @@ -3052,7 +3068,7 @@ msgid "" "small integer. The second item is the shared library instance." msgstr "" -#: ../../library/ctypes.rst:1769 +#: ../../library/ctypes.rst:1779 msgid "" "Returns a foreign function that will call a COM method. *vtbl_index* is the " "index into the virtual function table, a small non-negative integer. *name* " @@ -3060,79 +3076,79 @@ msgid "" "identifier which is used in extended error reporting." msgstr "" -#: ../../library/ctypes.rst:1774 +#: ../../library/ctypes.rst:1784 msgid "" "COM methods use a special calling convention: They require a pointer to the " "COM interface as first argument, in addition to those parameters that are " "specified in the :attr:`!argtypes` tuple." msgstr "" -#: ../../library/ctypes.rst:1778 +#: ../../library/ctypes.rst:1788 msgid "" "The optional *paramflags* parameter creates foreign function wrappers with " "much more functionality than the features described above." msgstr "" -#: ../../library/ctypes.rst:1781 +#: ../../library/ctypes.rst:1791 msgid "" -"*paramflags* must be a tuple of the same length as :attr:`~_FuncPtr." +"*paramflags* must be a tuple of the same length as :attr:`~_CFuncPtr." "argtypes`." msgstr "" -#: ../../library/ctypes.rst:1783 +#: ../../library/ctypes.rst:1793 msgid "" "Each item in this tuple contains further information about a parameter, it " "must be a tuple containing one, two, or three items." msgstr "" -#: ../../library/ctypes.rst:1786 +#: ../../library/ctypes.rst:1796 msgid "" "The first item is an integer containing a combination of direction flags for " "the parameter:" msgstr "" -#: ../../library/ctypes.rst:1789 +#: ../../library/ctypes.rst:1799 msgid "1" msgstr "1" -#: ../../library/ctypes.rst:1790 +#: ../../library/ctypes.rst:1800 msgid "Specifies an input parameter to the function." msgstr "" -#: ../../library/ctypes.rst:1792 +#: ../../library/ctypes.rst:1802 msgid "2" msgstr "2" -#: ../../library/ctypes.rst:1793 +#: ../../library/ctypes.rst:1803 msgid "Output parameter. The foreign function fills in a value." msgstr "" -#: ../../library/ctypes.rst:1795 +#: ../../library/ctypes.rst:1805 msgid "4" msgstr "4" -#: ../../library/ctypes.rst:1796 +#: ../../library/ctypes.rst:1806 msgid "Input parameter which defaults to the integer zero." msgstr "" -#: ../../library/ctypes.rst:1798 +#: ../../library/ctypes.rst:1808 msgid "" "The optional second item is the parameter name as string. If this is " "specified, the foreign function can be called with named parameters." msgstr "" -#: ../../library/ctypes.rst:1801 +#: ../../library/ctypes.rst:1811 msgid "The optional third item is the default value for this parameter." msgstr "" -#: ../../library/ctypes.rst:1804 +#: ../../library/ctypes.rst:1814 msgid "" "The following example demonstrates how to wrap the Windows ``MessageBoxW`` " "function so that it supports default parameters and named arguments. The C " "declaration from the windows header file is this::" msgstr "" -#: ../../library/ctypes.rst:1808 +#: ../../library/ctypes.rst:1818 msgid "" "WINUSERAPI int WINAPI\n" "MessageBoxW(\n" @@ -3148,11 +3164,11 @@ msgstr "" " LPCWSTR lpCaption,\n" " UINT uType);" -#: ../../library/ctypes.rst:1815 ../../library/ctypes.rst:1838 +#: ../../library/ctypes.rst:1825 ../../library/ctypes.rst:1848 msgid "Here is the wrapping with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1817 +#: ../../library/ctypes.rst:1827 msgid "" ">>> from ctypes import c_int, WINFUNCTYPE, windll\n" ">>> from ctypes.wintypes import HWND, LPCWSTR, UINT\n" @@ -3168,11 +3184,11 @@ msgstr "" "\"Hello from ctypes\"), (1, \"flags\", 0)\n" ">>> MessageBox = prototype((\"MessageBoxW\", windll.user32), paramflags)" -#: ../../library/ctypes.rst:1823 +#: ../../library/ctypes.rst:1833 msgid "The ``MessageBox`` foreign function can now be called in these ways::" msgstr "" -#: ../../library/ctypes.rst:1825 +#: ../../library/ctypes.rst:1835 msgid "" ">>> MessageBox()\n" ">>> MessageBox(text=\"Spam, spam, spam\")\n" @@ -3182,7 +3198,7 @@ msgstr "" ">>> MessageBox(text=\"Spam, spam, spam\")\n" ">>> MessageBox(flags=2, text=\"foo bar\")" -#: ../../library/ctypes.rst:1829 +#: ../../library/ctypes.rst:1839 msgid "" "A second example demonstrates output parameters. The win32 " "``GetWindowRect`` function retrieves the dimensions of a specified window by " @@ -3190,7 +3206,7 @@ msgid "" "the C declaration::" msgstr "" -#: ../../library/ctypes.rst:1833 +#: ../../library/ctypes.rst:1843 msgid "" "WINUSERAPI BOOL WINAPI\n" "GetWindowRect(\n" @@ -3202,7 +3218,7 @@ msgstr "" " HWND hWnd,\n" " LPRECT lpRect);" -#: ../../library/ctypes.rst:1840 +#: ../../library/ctypes.rst:1850 msgid "" ">>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError\n" ">>> from ctypes.wintypes import BOOL, HWND, RECT\n" @@ -3220,7 +3236,7 @@ msgstr "" "paramflags)\n" ">>>" -#: ../../library/ctypes.rst:1847 +#: ../../library/ctypes.rst:1857 msgid "" "Functions with output parameters will automatically return the output " "parameter value if there is a single one, or a tuple containing the output " @@ -3228,16 +3244,16 @@ msgid "" "now returns a RECT instance, when called." msgstr "" -#: ../../library/ctypes.rst:1852 +#: ../../library/ctypes.rst:1862 msgid "" -"Output parameters can be combined with the :attr:`~_FuncPtr.errcheck` " +"Output parameters can be combined with the :attr:`~_CFuncPtr.errcheck` " "protocol to do further output processing and error checking. The win32 " "``GetWindowRect`` api function returns a ``BOOL`` to signal success or " "failure, so this function could do the error checking, and raises an " "exception when the api call failed::" msgstr "" -#: ../../library/ctypes.rst:1857 +#: ../../library/ctypes.rst:1867 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3255,16 +3271,16 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1865 +#: ../../library/ctypes.rst:1875 msgid "" -"If the :attr:`~_FuncPtr.errcheck` function returns the argument tuple it " +"If the :attr:`~_CFuncPtr.errcheck` function returns the argument tuple it " "receives unchanged, :mod:`ctypes` continues the normal processing it does on " "the output parameters. If you want to return a tuple of window coordinates " "instead of a ``RECT`` instance, you can retrieve the fields in the function " "and return them instead, the normal processing will no longer take place::" msgstr "" -#: ../../library/ctypes.rst:1871 +#: ../../library/ctypes.rst:1881 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3284,17 +3300,17 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1884 +#: ../../library/ctypes.rst:1894 msgid "Utility functions" msgstr "" -#: ../../library/ctypes.rst:1888 +#: ../../library/ctypes.rst:1898 msgid "" "Returns the address of the memory buffer as integer. *obj* must be an " "instance of a ctypes type." msgstr "" -#: ../../library/ctypes.rst:1891 +#: ../../library/ctypes.rst:1901 msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." @@ -3302,34 +3318,34 @@ msgstr "" "引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` ``ctypes." "addressof``。" -#: ../../library/ctypes.rst:1896 +#: ../../library/ctypes.rst:1906 msgid "" "Returns the alignment requirements of a ctypes type. *obj_or_type* must be a " "ctypes type or instance." msgstr "" -#: ../../library/ctypes.rst:1902 +#: ../../library/ctypes.rst:1912 msgid "" "Returns a light-weight pointer to *obj*, which must be an instance of a " "ctypes type. *offset* defaults to zero, and must be an integer that will be " "added to the internal pointer value." msgstr "" -#: ../../library/ctypes.rst:1906 +#: ../../library/ctypes.rst:1916 msgid "``byref(obj, offset)`` corresponds to this C code::" msgstr "" -#: ../../library/ctypes.rst:1908 +#: ../../library/ctypes.rst:1918 msgid "(((char *)&obj) + offset)" msgstr "(((char *)&obj) + offset)" -#: ../../library/ctypes.rst:1910 +#: ../../library/ctypes.rst:1920 msgid "" "The returned object can only be used as a foreign function call parameter. " "It behaves similar to ``pointer(obj)``, but the construction is a lot faster." msgstr "" -#: ../../library/ctypes.rst:1916 +#: ../../library/ctypes.rst:1926 msgid "" "This function is similar to the cast operator in C. It returns a new " "instance of *type* which points to the same memory block as *obj*. *type* " @@ -3337,19 +3353,19 @@ msgid "" "as a pointer." msgstr "" -#: ../../library/ctypes.rst:1924 +#: ../../library/ctypes.rst:1934 msgid "" "This function creates a mutable character buffer. The returned object is a " "ctypes array of :class:`c_char`." msgstr "" -#: ../../library/ctypes.rst:1927 +#: ../../library/ctypes.rst:1937 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a bytes object which will be used to initialize the array items." msgstr "" -#: ../../library/ctypes.rst:1930 +#: ../../library/ctypes.rst:1940 msgid "" "If a bytes object is specified as first argument, the buffer is made one " "item larger than its length so that the last element in the array is a NUL " @@ -3358,7 +3374,7 @@ msgid "" "not be used." msgstr "" -#: ../../library/ctypes.rst:1935 +#: ../../library/ctypes.rst:1945 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` " "with arguments ``init``, ``size``." @@ -3366,19 +3382,19 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_string_buffer``。" -#: ../../library/ctypes.rst:1940 +#: ../../library/ctypes.rst:1950 msgid "" "This function creates a mutable unicode character buffer. The returned " "object is a ctypes array of :class:`c_wchar`." msgstr "" -#: ../../library/ctypes.rst:1943 +#: ../../library/ctypes.rst:1953 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a string which will be used to initialize the array items." msgstr "" -#: ../../library/ctypes.rst:1946 +#: ../../library/ctypes.rst:1956 msgid "" "If a string is specified as first argument, the buffer is made one item " "larger than the length of the string so that the last element in the array " @@ -3387,7 +3403,7 @@ msgid "" "should not be used." msgstr "" -#: ../../library/ctypes.rst:1952 +#: ../../library/ctypes.rst:1962 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` " "with arguments ``init``, ``size``." @@ -3395,21 +3411,21 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_unicode_buffer``。" -#: ../../library/ctypes.rst:1957 +#: ../../library/ctypes.rst:1967 msgid "" "Windows only: This function is a hook which allows implementing in-process " "COM servers with ctypes. It is called from the DllCanUnloadNow function " "that the _ctypes extension dll exports." msgstr "" -#: ../../library/ctypes.rst:1964 +#: ../../library/ctypes.rst:1974 msgid "" "Windows only: This function is a hook which allows implementing in-process " "COM servers with ctypes. It is called from the DllGetClassObject function " "that the ``_ctypes`` extension dll exports." msgstr "" -#: ../../library/ctypes.rst:1972 +#: ../../library/ctypes.rst:1982 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version " @@ -3417,94 +3433,94 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1983 +#: ../../library/ctypes.rst:1993 msgid "" "Windows only: return the filename of the VC runtime library used by Python, " "and by the extension modules. If the name of the library cannot be " "determined, ``None`` is returned." msgstr "" -#: ../../library/ctypes.rst:1987 +#: ../../library/ctypes.rst:1997 msgid "" "If you need to free memory, for example, allocated by an extension module " "with a call to the ``free(void *)``, it is important that you use the " "function in the same library that allocated the memory." msgstr "" -#: ../../library/ctypes.rst:1994 +#: ../../library/ctypes.rst:2004 msgid "" "Windows only: Returns a textual description of the error code *code*. If no " "error code is specified, the last error code is used by calling the Windows " "api function GetLastError." msgstr "" -#: ../../library/ctypes.rst:2001 +#: ../../library/ctypes.rst:2011 msgid "" "Windows only: Returns the last error code set by Windows in the calling " "thread. This function calls the Windows ``GetLastError()`` function " "directly, it does not return the ctypes-private copy of the error code." msgstr "" -#: ../../library/ctypes.rst:2007 +#: ../../library/ctypes.rst:2017 msgid "" "Returns the current value of the ctypes-private copy of the system :data:" "`errno` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2010 +#: ../../library/ctypes.rst:2020 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_errno``。" -#: ../../library/ctypes.rst:2014 +#: ../../library/ctypes.rst:2024 msgid "" "Windows only: returns the current value of the ctypes-private copy of the " "system :data:`!LastError` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2017 +#: ../../library/ctypes.rst:2027 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_last_error``。" -#: ../../library/ctypes.rst:2021 +#: ../../library/ctypes.rst:2031 msgid "" "Same as the standard C memmove library function: copies *count* bytes from " "*src* to *dst*. *dst* and *src* must be integers or ctypes instances that " "can be converted to pointers." msgstr "" -#: ../../library/ctypes.rst:2028 +#: ../../library/ctypes.rst:2038 msgid "" "Same as the standard C memset library function: fills the memory block at " "address *dst* with *count* bytes of value *c*. *dst* must be an integer " "specifying an address, or a ctypes instance." msgstr "" -#: ../../library/ctypes.rst:2035 +#: ../../library/ctypes.rst:2045 msgid "" "Create and return a new ctypes pointer type. Pointer types are cached and " "reused internally, so calling this function repeatedly is cheap. *type* must " "be a ctypes type." msgstr "" -#: ../../library/ctypes.rst:2042 +#: ../../library/ctypes.rst:2052 msgid "" "Create a new pointer instance, pointing to *obj*. The returned object is of " "the type ``POINTER(type(obj))``." msgstr "" -#: ../../library/ctypes.rst:2045 +#: ../../library/ctypes.rst:2055 msgid "" "Note: If you just want to pass a pointer to an object to a foreign function " "call, you should use ``byref(obj)`` which is much faster." msgstr "" -#: ../../library/ctypes.rst:2051 +#: ../../library/ctypes.rst:2061 msgid "" "This function resizes the internal memory buffer of *obj*, which must be an " "instance of a ctypes type. It is not possible to make the buffer smaller " @@ -3512,13 +3528,13 @@ msgid "" "but it is possible to enlarge the buffer." msgstr "" -#: ../../library/ctypes.rst:2059 +#: ../../library/ctypes.rst:2069 msgid "" "Set the current value of the ctypes-private copy of the system :data:`errno` " "variable in the calling thread to *value* and return the previous value." msgstr "" -#: ../../library/ctypes.rst:2062 +#: ../../library/ctypes.rst:2072 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." @@ -3526,14 +3542,14 @@ msgstr "" "引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` ``ctypes." "set_errno``。" -#: ../../library/ctypes.rst:2067 +#: ../../library/ctypes.rst:2077 msgid "" "Windows only: set the current value of the ctypes-private copy of the " "system :data:`!LastError` variable in the calling thread to *value* and " "return the previous value." msgstr "" -#: ../../library/ctypes.rst:2071 +#: ../../library/ctypes.rst:2081 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." @@ -3541,19 +3557,19 @@ msgstr "" "引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` ``ctypes." "set_last_error``。" -#: ../../library/ctypes.rst:2076 +#: ../../library/ctypes.rst:2086 msgid "" "Returns the size in bytes of a ctypes type or instance memory buffer. Does " "the same as the C ``sizeof`` operator." msgstr "" -#: ../../library/ctypes.rst:2082 +#: ../../library/ctypes.rst:2092 msgid "" "Return the byte string at *void \\*ptr*. If *size* is specified, it is used " "as size, otherwise the string is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2086 +#: ../../library/ctypes.rst:2096 msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " "arguments ``ptr``, ``size``." @@ -3561,7 +3577,7 @@ msgstr "" "引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." "string_at``。" -#: ../../library/ctypes.rst:2091 +#: ../../library/ctypes.rst:2101 msgid "" "Windows only: this function is probably the worst-named thing in ctypes. It " "creates an instance of :exc:`OSError`. If *code* is not specified, " @@ -3570,20 +3586,20 @@ msgid "" "error." msgstr "" -#: ../../library/ctypes.rst:2097 +#: ../../library/ctypes.rst:2107 msgid "" "An instance of :exc:`WindowsError` used to be created, which is now an alias " "of :exc:`OSError`." msgstr "" -#: ../../library/ctypes.rst:2104 +#: ../../library/ctypes.rst:2114 msgid "" "Return the wide-character string at *void \\*ptr*. If *size* is specified, " "it is used as the number of characters of the string, otherwise the string " "is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2109 +#: ../../library/ctypes.rst:2119 msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " "arguments ``ptr``, ``size``." @@ -3591,11 +3607,11 @@ msgstr "" "引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." "wstring_at``。" -#: ../../library/ctypes.rst:2115 +#: ../../library/ctypes.rst:2125 msgid "Data types" msgstr "" -#: ../../library/ctypes.rst:2120 +#: ../../library/ctypes.rst:2130 msgid "" "This non-public class is the common base class of all ctypes data types. " "Among other things, all ctypes type instances contain a memory block that " @@ -3605,13 +3621,13 @@ msgid "" "alive in case the memory block contains pointers." msgstr "" -#: ../../library/ctypes.rst:2127 +#: ../../library/ctypes.rst:2137 msgid "" "Common methods of ctypes data types, these are all class methods (to be " "exact, they are methods of the :term:`metaclass`):" msgstr "" -#: ../../library/ctypes.rst:2132 +#: ../../library/ctypes.rst:2142 msgid "" "This method returns a ctypes instance that shares the buffer of the *source* " "object. The *source* object must support the writeable buffer interface. " @@ -3620,7 +3636,7 @@ msgid "" "exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2138 ../../library/ctypes.rst:2148 +#: ../../library/ctypes.rst:2148 ../../library/ctypes.rst:2158 msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with " "arguments ``pointer``, ``size``, ``offset``." @@ -3628,7 +3644,7 @@ msgstr "" "引發一個附帶引數 ``pointer``、``size``、``offset`` 的\\ :ref:`稽核事件 " "` ``ctypes.cdata/buffer``。" -#: ../../library/ctypes.rst:2142 +#: ../../library/ctypes.rst:2152 msgid "" "This method creates a ctypes instance, copying the buffer from the *source* " "object buffer which must be readable. The optional *offset* parameter " @@ -3636,45 +3652,45 @@ msgid "" "If the source buffer is not large enough a :exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2152 +#: ../../library/ctypes.rst:2162 msgid "" "This method returns a ctypes type instance using the memory specified by " "*address* which must be an integer." msgstr "" -#: ../../library/ctypes.rst:2155 ../../library/ctypes.rst:2157 +#: ../../library/ctypes.rst:2165 ../../library/ctypes.rst:2167 msgid "" "This method, and others that indirectly call this method, raises an :ref:" "`auditing event ` ``ctypes.cdata`` with argument ``address``." msgstr "" -#: ../../library/ctypes.rst:2163 +#: ../../library/ctypes.rst:2173 msgid "" "This method adapts *obj* to a ctypes type. It is called with the actual " "object used in a foreign function call when the type is present in the " -"foreign function's :attr:`~_FuncPtr.argtypes` tuple; it must return an " +"foreign function's :attr:`~_CFuncPtr.argtypes` tuple; it must return an " "object that can be used as a function call parameter." msgstr "" -#: ../../library/ctypes.rst:2168 +#: ../../library/ctypes.rst:2178 msgid "" "All ctypes data types have a default implementation of this classmethod that " "normally returns *obj* if that is an instance of the type. Some types " "accept other objects as well." msgstr "" -#: ../../library/ctypes.rst:2174 +#: ../../library/ctypes.rst:2184 msgid "" "This method returns a ctypes type instance exported by a shared library. " "*name* is the name of the symbol that exports the data, *library* is the " "loaded shared library." msgstr "" -#: ../../library/ctypes.rst:2178 +#: ../../library/ctypes.rst:2188 msgid "Common instance variables of ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2182 +#: ../../library/ctypes.rst:2192 msgid "" "Sometimes ctypes data instances do not own the memory block they contain, " "instead they share part of the memory block of a base object. The :attr:" @@ -3682,13 +3698,13 @@ msgid "" "block." msgstr "" -#: ../../library/ctypes.rst:2189 +#: ../../library/ctypes.rst:2199 msgid "" "This read-only variable is true when the ctypes data instance has allocated " "the memory block itself, false otherwise." msgstr "" -#: ../../library/ctypes.rst:2194 +#: ../../library/ctypes.rst:2204 msgid "" "This member is either ``None`` or a dictionary containing Python objects " "that need to be kept alive so that the memory block contents is kept valid. " @@ -3696,7 +3712,7 @@ msgid "" "dictionary." msgstr "" -#: ../../library/ctypes.rst:2207 +#: ../../library/ctypes.rst:2217 msgid "" "This non-public class is the base class of all fundamental ctypes data " "types. It is mentioned here because it contains the common attributes of the " @@ -3705,11 +3721,11 @@ msgid "" "types that are not and do not contain pointers can now be pickled." msgstr "" -#: ../../library/ctypes.rst:2213 +#: ../../library/ctypes.rst:2223 msgid "Instances have a single attribute:" msgstr "" -#: ../../library/ctypes.rst:2217 +#: ../../library/ctypes.rst:2227 msgid "" "This attribute contains the actual value of the instance. For integer and " "pointer types, it is an integer, for character types, it is a single " @@ -3717,7 +3733,7 @@ msgid "" "bytes object or string." msgstr "" -#: ../../library/ctypes.rst:2222 +#: ../../library/ctypes.rst:2232 msgid "" "When the ``value`` attribute is retrieved from a ctypes instance, usually a " "new object is returned each time. :mod:`ctypes` does *not* implement " @@ -3725,17 +3741,17 @@ msgid "" "true for all other ctypes object instances." msgstr "" -#: ../../library/ctypes.rst:2228 +#: ../../library/ctypes.rst:2238 msgid "" "Fundamental data types, when returned as foreign function call results, or, " "for example, by retrieving structure field members or array items, are " "transparently converted to native Python types. In other words, if a " -"foreign function has a :attr:`~_FuncPtr.restype` of :class:`c_char_p`, you " +"foreign function has a :attr:`~_CFuncPtr.restype` of :class:`c_char_p`, you " "will always receive a Python bytes object, *not* a :class:`c_char_p` " "instance." msgstr "" -#: ../../library/ctypes.rst:2236 +#: ../../library/ctypes.rst:2246 msgid "" "Subclasses of fundamental data types do *not* inherit this behavior. So, if " "a foreign functions :attr:`!restype` is a subclass of :class:`c_void_p`, you " @@ -3743,25 +3759,25 @@ msgid "" "you can get the value of the pointer by accessing the ``value`` attribute." msgstr "" -#: ../../library/ctypes.rst:2241 +#: ../../library/ctypes.rst:2251 msgid "These are the fundamental ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2245 +#: ../../library/ctypes.rst:2255 msgid "" "Represents the C :c:expr:`signed char` datatype, and interprets the value as " "small integer. The constructor accepts an optional integer initializer; no " "overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2252 +#: ../../library/ctypes.rst:2262 msgid "" "Represents the C :c:expr:`char` datatype, and interprets the value as a " "single character. The constructor accepts an optional string initializer, " "the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2259 +#: ../../library/ctypes.rst:2269 msgid "" "Represents the C :c:expr:`char *` datatype when it points to a zero-" "terminated string. For a general character pointer that may also point to " @@ -3769,182 +3785,182 @@ msgid "" "integer address, or a bytes object." msgstr "" -#: ../../library/ctypes.rst:2267 +#: ../../library/ctypes.rst:2277 msgid "" "Represents the C :c:expr:`double` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2273 +#: ../../library/ctypes.rst:2283 msgid "" "Represents the C :c:expr:`long double` datatype. The constructor accepts an " "optional float initializer. On platforms where ``sizeof(long double) == " "sizeof(double)`` it is an alias to :class:`c_double`." msgstr "" -#: ../../library/ctypes.rst:2279 +#: ../../library/ctypes.rst:2289 msgid "" "Represents the C :c:expr:`float` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2285 +#: ../../library/ctypes.rst:2295 msgid "" "Represents the C :c:expr:`signed int` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`." msgstr "" -#: ../../library/ctypes.rst:2292 +#: ../../library/ctypes.rst:2302 msgid "" "Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias for :" "class:`c_byte`." msgstr "" -#: ../../library/ctypes.rst:2298 +#: ../../library/ctypes.rst:2308 msgid "" "Represents the C 16-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_short`." msgstr "" -#: ../../library/ctypes.rst:2304 +#: ../../library/ctypes.rst:2314 msgid "" "Represents the C 32-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_int`." msgstr "" -#: ../../library/ctypes.rst:2310 +#: ../../library/ctypes.rst:2320 msgid "" "Represents the C 64-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_longlong`." msgstr "" -#: ../../library/ctypes.rst:2316 +#: ../../library/ctypes.rst:2326 msgid "" "Represents the C :c:expr:`signed long` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2322 +#: ../../library/ctypes.rst:2332 msgid "" "Represents the C :c:expr:`signed long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2328 +#: ../../library/ctypes.rst:2338 msgid "" "Represents the C :c:expr:`signed short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2334 +#: ../../library/ctypes.rst:2344 msgid "Represents the C :c:type:`size_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2339 +#: ../../library/ctypes.rst:2349 msgid "Represents the C :c:type:`ssize_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2346 +#: ../../library/ctypes.rst:2356 msgid "Represents the C :c:type:`time_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2353 +#: ../../library/ctypes.rst:2363 msgid "" "Represents the C :c:expr:`unsigned char` datatype, it interprets the value " "as small integer. The constructor accepts an optional integer initializer; " "no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2360 +#: ../../library/ctypes.rst:2370 msgid "" "Represents the C :c:expr:`unsigned int` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`." msgstr "" -#: ../../library/ctypes.rst:2367 +#: ../../library/ctypes.rst:2377 msgid "" "Represents the C 8-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ubyte`." msgstr "" -#: ../../library/ctypes.rst:2373 +#: ../../library/ctypes.rst:2383 msgid "" "Represents the C 16-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ushort`." msgstr "" -#: ../../library/ctypes.rst:2379 +#: ../../library/ctypes.rst:2389 msgid "" "Represents the C 32-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_uint`." msgstr "" -#: ../../library/ctypes.rst:2385 +#: ../../library/ctypes.rst:2395 msgid "" "Represents the C 64-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ulonglong`." msgstr "" -#: ../../library/ctypes.rst:2391 +#: ../../library/ctypes.rst:2401 msgid "" "Represents the C :c:expr:`unsigned long` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2397 +#: ../../library/ctypes.rst:2407 msgid "" "Represents the C :c:expr:`unsigned long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2403 +#: ../../library/ctypes.rst:2413 msgid "" "Represents the C :c:expr:`unsigned short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2409 +#: ../../library/ctypes.rst:2419 msgid "" "Represents the C :c:expr:`void *` type. The value is represented as " "integer. The constructor accepts an optional integer initializer." msgstr "" -#: ../../library/ctypes.rst:2415 +#: ../../library/ctypes.rst:2425 msgid "" "Represents the C :c:type:`wchar_t` datatype, and interprets the value as a " "single character unicode string. The constructor accepts an optional string " "initializer, the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2422 +#: ../../library/ctypes.rst:2432 msgid "" "Represents the C :c:expr:`wchar_t *` datatype, which must be a pointer to a " "zero-terminated wide character string. The constructor accepts an integer " "address, or a string." msgstr "" -#: ../../library/ctypes.rst:2429 +#: ../../library/ctypes.rst:2439 msgid "" "Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` " "from C99). Its value can be ``True`` or ``False``, and the constructor " "accepts any object that has a truth value." msgstr "" -#: ../../library/ctypes.rst:2436 +#: ../../library/ctypes.rst:2446 msgid "" "Windows only: Represents a :c:type:`!HRESULT` value, which contains success " "or error information for a function or method call." msgstr "" -#: ../../library/ctypes.rst:2442 +#: ../../library/ctypes.rst:2452 msgid "" "Represents the C :c:expr:`PyObject *` datatype. Calling this without an " "argument creates a ``NULL`` :c:expr:`PyObject *` pointer." msgstr "" -#: ../../library/ctypes.rst:2445 +#: ../../library/ctypes.rst:2455 msgid "" "The :mod:`!ctypes.wintypes` module provides quite some other Windows " "specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:" @@ -3952,41 +3968,41 @@ msgid "" "are also defined." msgstr "" -#: ../../library/ctypes.rst:2453 +#: ../../library/ctypes.rst:2463 msgid "Structured data types" msgstr "" -#: ../../library/ctypes.rst:2458 +#: ../../library/ctypes.rst:2468 msgid "Abstract base class for unions in native byte order." msgstr "" -#: ../../library/ctypes.rst:2463 +#: ../../library/ctypes.rst:2473 msgid "Abstract base class for unions in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2469 +#: ../../library/ctypes.rst:2479 msgid "Abstract base class for unions in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2475 +#: ../../library/ctypes.rst:2485 msgid "Abstract base class for structures in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2480 +#: ../../library/ctypes.rst:2490 msgid "Abstract base class for structures in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2482 +#: ../../library/ctypes.rst:2492 msgid "" "Structures and unions with non-native byte order cannot contain pointer type " "fields, or any other data types containing pointer type fields." msgstr "" -#: ../../library/ctypes.rst:2488 +#: ../../library/ctypes.rst:2498 msgid "Abstract base class for structures in *native* byte order." msgstr "" -#: ../../library/ctypes.rst:2490 +#: ../../library/ctypes.rst:2500 msgid "" "Concrete structure and union types must be created by subclassing one of " "these types, and at least define a :attr:`_fields_` class variable. :mod:" @@ -3994,34 +4010,34 @@ msgid "" "the fields by direct attribute accesses. These are the" msgstr "" -#: ../../library/ctypes.rst:2498 +#: ../../library/ctypes.rst:2508 msgid "" "A sequence defining the structure fields. The items must be 2-tuples or 3-" "tuples. The first item is the name of the field, the second item specifies " "the type of the field; it can be any ctypes data type." msgstr "" -#: ../../library/ctypes.rst:2502 +#: ../../library/ctypes.rst:2512 msgid "" "For integer type fields like :class:`c_int`, a third optional item can be " "given. It must be a small positive integer defining the bit width of the " "field." msgstr "" -#: ../../library/ctypes.rst:2506 +#: ../../library/ctypes.rst:2516 msgid "" "Field names must be unique within one structure or union. This is not " "checked, only one field can be accessed when names are repeated." msgstr "" -#: ../../library/ctypes.rst:2509 +#: ../../library/ctypes.rst:2519 msgid "" "It is possible to define the :attr:`_fields_` class variable *after* the " "class statement that defines the Structure subclass, this allows creating " "data types that directly or indirectly reference themselves::" msgstr "" -#: ../../library/ctypes.rst:2513 +#: ../../library/ctypes.rst:2523 msgid "" "class List(Structure):\n" " pass\n" @@ -4035,7 +4051,7 @@ msgstr "" " ...\n" " ]" -#: ../../library/ctypes.rst:2519 +#: ../../library/ctypes.rst:2529 msgid "" "The :attr:`_fields_` class variable must, however, be defined before the " "type is first used (an instance is created, :func:`sizeof` is called on it, " @@ -4043,14 +4059,14 @@ msgid "" "raise an AttributeError." msgstr "" -#: ../../library/ctypes.rst:2524 +#: ../../library/ctypes.rst:2534 msgid "" "It is possible to define sub-subclasses of structure types, they inherit the " "fields of the base class plus the :attr:`_fields_` defined in the sub-" "subclass, if any." msgstr "" -#: ../../library/ctypes.rst:2531 +#: ../../library/ctypes.rst:2541 msgid "" "An optional small integer that allows overriding the alignment of structure " "fields in the instance. :attr:`_pack_` must already be defined when :attr:" @@ -4058,21 +4074,21 @@ msgid "" "attribute to 0 is the same as not setting it at all." msgstr "" -#: ../../library/ctypes.rst:2539 +#: ../../library/ctypes.rst:2549 msgid "" "An optional small integer that allows overriding the alignment of the " "structure when being packed or unpacked to/from memory. Setting this " "attribute to 0 is the same as not setting it at all." msgstr "" -#: ../../library/ctypes.rst:2547 +#: ../../library/ctypes.rst:2557 msgid "" "An optional sequence that lists the names of unnamed (anonymous) fields. :" "attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" -#: ../../library/ctypes.rst:2551 +#: ../../library/ctypes.rst:2561 msgid "" "The fields listed in this variable must be structure or union type fields. :" "mod:`ctypes` will create descriptors in the structure type that allows " @@ -4080,11 +4096,11 @@ msgid "" "structure or union field." msgstr "" -#: ../../library/ctypes.rst:2556 +#: ../../library/ctypes.rst:2566 msgid "Here is an example type (Windows)::" msgstr "" -#: ../../library/ctypes.rst:2558 +#: ../../library/ctypes.rst:2568 msgid "" "class _U(Union):\n" " _fields_ = [(\"lptdesc\", POINTER(TYPEDESC)),\n" @@ -4106,7 +4122,7 @@ msgstr "" " _fields_ = [(\"u\", _U),\n" " (\"vt\", VARTYPE)]" -#: ../../library/ctypes.rst:2569 +#: ../../library/ctypes.rst:2579 msgid "" "The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field " "specifies which one of the union fields is valid. Since the ``u`` field is " @@ -4116,7 +4132,7 @@ msgid "" "temporary union instance::" msgstr "" -#: ../../library/ctypes.rst:2576 +#: ../../library/ctypes.rst:2586 msgid "" "td = TYPEDESC()\n" "td.vt = VT_PTR\n" @@ -4128,7 +4144,7 @@ msgstr "" "td.lptdesc = POINTER(some_type)\n" "td.u.lptdesc = POINTER(some_type)" -#: ../../library/ctypes.rst:2581 +#: ../../library/ctypes.rst:2591 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " "fields of the base class. If the subclass definition has a separate :attr:" @@ -4136,7 +4152,7 @@ msgid "" "of the base class." msgstr "" -#: ../../library/ctypes.rst:2586 +#: ../../library/ctypes.rst:2596 msgid "" "Structure and union constructors accept both positional and keyword " "arguments. Positional arguments are used to initialize member fields in the " @@ -4146,15 +4162,15 @@ msgid "" "names not present in :attr:`_fields_`." msgstr "" -#: ../../library/ctypes.rst:2597 +#: ../../library/ctypes.rst:2607 msgid "Arrays and pointers" msgstr "" -#: ../../library/ctypes.rst:2601 +#: ../../library/ctypes.rst:2611 msgid "Abstract base class for arrays." msgstr "" -#: ../../library/ctypes.rst:2603 +#: ../../library/ctypes.rst:2613 msgid "" "The recommended way to create concrete array types is by multiplying any :" "mod:`ctypes` data type with a non-negative integer. Alternatively, you can " @@ -4164,46 +4180,46 @@ msgid "" "an :class:`Array`." msgstr "" -#: ../../library/ctypes.rst:2613 +#: ../../library/ctypes.rst:2623 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" "range subscripts result in an :exc:`IndexError`. Will be returned by :func:" "`len`." msgstr "" -#: ../../library/ctypes.rst:2620 +#: ../../library/ctypes.rst:2630 msgid "Specifies the type of each element in the array." msgstr "" -#: ../../library/ctypes.rst:2623 +#: ../../library/ctypes.rst:2633 msgid "" "Array subclass constructors accept positional arguments, used to initialize " "the elements in order." msgstr "" -#: ../../library/ctypes.rst:2628 +#: ../../library/ctypes.rst:2638 msgid "" "Create an array. Equivalent to ``type * length``, where *type* is a :mod:" "`ctypes` data type and *length* an integer." msgstr "" -#: ../../library/ctypes.rst:2632 +#: ../../library/ctypes.rst:2642 msgid "" "This function is :term:`soft deprecated` in favor of multiplication. There " "are no plans to remove it." msgstr "" -#: ../../library/ctypes.rst:2638 +#: ../../library/ctypes.rst:2648 msgid "Private, abstract base class for pointers." msgstr "" -#: ../../library/ctypes.rst:2640 +#: ../../library/ctypes.rst:2650 msgid "" "Concrete pointer types are created by calling :func:`POINTER` with the type " "that will be pointed to; this is done automatically by :func:`pointer`." msgstr "" -#: ../../library/ctypes.rst:2644 +#: ../../library/ctypes.rst:2654 msgid "" "If a pointer points to an array, its elements can be read and written using " "standard subscript and slice accesses. Pointer objects have no size, so :" @@ -4212,11 +4228,11 @@ msgid "" "probably crash with an access violation (if you're lucky)." msgstr "" -#: ../../library/ctypes.rst:2654 +#: ../../library/ctypes.rst:2664 msgid "Specifies the type pointed to." msgstr "" -#: ../../library/ctypes.rst:2658 +#: ../../library/ctypes.rst:2668 msgid "" "Returns the object to which to pointer points. Assigning to this attribute " "changes the pointer to point to the assigned object." diff --git a/library/dis.po b/library/dis.po index 7a33889933..6cf423905f 100644 --- a/library/dis.po +++ b/library/dis.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"POT-Creation-Date: 2024-11-05 00:13+0000\n" "PO-Revision-Date: 2018-07-27 16:55+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1709,7 +1709,7 @@ msgstr "" #: ../../library/dis.rst:1553 msgid "" "Pushes a new function object on the stack built from the code object at " -"``STACK[1]``." +"``STACK[-1]``." msgstr "" #: ../../library/dis.rst:1555 @@ -1970,11 +1970,11 @@ msgstr "" #: ../../library/dis.rst:1743 ../../library/dis.rst:1797 msgid "Operand" -msgstr "" +msgstr "運算元" #: ../../library/dis.rst:1743 ../../library/dis.rst:1797 msgid "Description" -msgstr "" +msgstr "描述" #: ../../library/dis.rst:1745 msgid "``INTRINSIC_1_INVALID``" diff --git a/library/email.message.po b/library/email.message.po index 49155f42d7..6be5abfbdc 100644 --- a/library/email.message.po +++ b/library/email.message.po @@ -28,7 +28,7 @@ msgstr "**原始碼:**\\ :source:`Lib/email/message.py`" #: ../../library/email.message.rst:14 msgid "[1]_" -msgstr "" +msgstr "[1]_" #: ../../library/email.message.rst:16 msgid "" diff --git a/library/enum.po b/library/enum.po index d67a0bd1b5..25abbe8562 100644 --- a/library/enum.po +++ b/library/enum.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-11-02 00:13+0000\n" "PO-Revision-Date: 2023-09-11 14:08+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -83,7 +83,7 @@ msgid "" "... BLUE = 3\n" "\n" ">>> # functional syntax\n" -">>> Color = Enum('Color', ['RED', 'GREEN', 'BLUE'])" +">>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])" msgstr "" #: ../../library/enum.rst:49 diff --git a/library/functions.po b/library/functions.po index 59b35e4bb2..aec90b86d9 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-12 00:13+0000\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -514,8 +514,8 @@ msgid "" "ways." msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" -#: ../../library/functions.rst:141 ../../library/functions.rst:932 -#: ../../library/functions.rst:1312 +#: ../../library/functions.rst:141 ../../library/functions.rst:942 +#: ../../library/functions.rst:1323 msgid "See also :func:`format` for more information." msgstr "可參考 :func:`format` 獲取更多資訊。" @@ -534,7 +534,7 @@ msgstr "" "(參見 :ref:`typesnumeric`),其他 class 不能繼承自它。它只有 ``False`` 和 " "``True`` 兩個實例(參見 :ref:`typebool`)。" -#: ../../library/functions.rst:156 ../../library/functions.rst:797 +#: ../../library/functions.rst:156 ../../library/functions.rst:807 msgid "The parameter is now positional-only." msgstr "現在為僅限位置參數。" @@ -932,8 +932,8 @@ msgid "" "number from real and imaginary parts." msgstr "" -#: ../../library/functions.rst:384 ../../library/functions.rst:742 -#: ../../library/functions.rst:988 +#: ../../library/functions.rst:384 ../../library/functions.rst:752 +#: ../../library/functions.rst:998 msgid "Examples:" msgstr "例如: ::" @@ -1022,8 +1022,8 @@ msgstr "" msgid "The complex type is described in :ref:`typesnumeric`." msgstr "複數型別在 :ref:`typesnumeric` 中有相關描述。" -#: ../../library/functions.rst:447 ../../library/functions.rst:794 -#: ../../library/functions.rst:1037 +#: ../../library/functions.rst:447 ../../library/functions.rst:804 +#: ../../library/functions.rst:1047 msgid "Grouping digits with underscores as in code literals is allowed." msgstr "可以使用底線將程式碼文字中的數字進行分組。" @@ -1228,7 +1228,13 @@ msgstr "引發" msgid "Syntax errors are reported as exceptions." msgstr "" -#: ../../library/functions.rst:591 +#: ../../library/functions.rst:593 ../../library/functions.rst:654 +msgid "" +"This function executes arbitrary code. Calling it with user-supplied input " +"may lead to security vulnerabilities." +msgstr "" + +#: ../../library/functions.rst:596 msgid "" "The *expression* argument is parsed and evaluated as a Python expression " "(technically speaking, a condition list) using the *globals* and *locals* " @@ -1258,11 +1264,11 @@ msgstr "" "locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透過 :keyword:" "`nonlocal` 陳述式)。" -#: ../../library/functions.rst:607 +#: ../../library/functions.rst:612 msgid "Example:" msgstr "範例:" -#: ../../library/functions.rst:613 +#: ../../library/functions.rst:618 msgid "" "This function can also be used to execute arbitrary code objects (such as " "those created by :func:`compile`). In this case, pass a code object instead " @@ -1273,7 +1279,7 @@ msgstr "" "情況下,傳入的引數是程式碼物件而不是字串。如果編譯該物件時的 *mode* 引數是 " "``'exec'``,那麼 :func:`eval` 回傳值為 ``None``。" -#: ../../library/functions.rst:618 +#: ../../library/functions.rst:623 msgid "" "Hints: dynamic execution of statements is supported by the :func:`exec` " "function. The :func:`globals` and :func:`locals` functions return the " @@ -1284,13 +1290,13 @@ msgstr "" "函式分別回傳當前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" "`eval` 或 :func:`exec` 可能會方便許多。" -#: ../../library/functions.rst:623 +#: ../../library/functions.rst:628 msgid "" "If the given source is a string, then leading and trailing spaces and tabs " "are stripped." msgstr "如果給定來源是一個字串,那麼其前後的空格和定位字元會被移除。" -#: ../../library/functions.rst:626 +#: ../../library/functions.rst:631 msgid "" "See :func:`ast.literal_eval` for a function that can safely evaluate strings " "with expressions containing only literals." @@ -1298,8 +1304,8 @@ msgstr "" "另外可以參閱 :func:`ast.literal_eval`,該函式可以安全執行僅包含文字的運算式字" "串。" -#: ../../library/functions.rst:629 ../../library/functions.rst:631 -#: ../../library/functions.rst:686 ../../library/functions.rst:688 +#: ../../library/functions.rst:634 ../../library/functions.rst:636 +#: ../../library/functions.rst:696 ../../library/functions.rst:698 msgid "" "Raises an :ref:`auditing event ` ``exec`` with the code object as " "the argument. Code compilation events may also be raised." @@ -1307,17 +1313,17 @@ msgstr "" "引發一個附帶程式碼物件為引數的\\ :ref:`稽核事件 ` ``exec``。也可能" "會引發程式碼編譯事件。" -#: ../../library/functions.rst:636 ../../library/functions.rst:708 +#: ../../library/functions.rst:641 ../../library/functions.rst:718 msgid "The *globals* and *locals* arguments can now be passed as keywords." msgstr "" -#: ../../library/functions.rst:640 ../../library/functions.rst:712 +#: ../../library/functions.rst:645 ../../library/functions.rst:722 msgid "" "The semantics of the default *locals* namespace have been adjusted as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:647 +#: ../../library/functions.rst:657 msgid "" "This function supports dynamic execution of Python code. *source* must be " "either a string or a code object. If it is a string, the string is parsed " @@ -1337,7 +1343,7 @@ msgstr "" "`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使" "用。該函式回傳值是 ``None``。" -#: ../../library/functions.rst:658 +#: ../../library/functions.rst:668 msgid "" "In all cases, if the optional parts are omitted, the code is executed in the " "current scope. If only *globals* is provided, it must be a dictionary (and " @@ -1353,7 +1359,7 @@ msgstr "" "用作全域和區域變數。如果提供了 *locals*,則它可以是任何對映物件。請記住在 " "module 層級中全域和區域變數是相同的 dictionary。" -#: ../../library/functions.rst:668 +#: ../../library/functions.rst:678 msgid "" "When ``exec`` gets two separate objects as *globals* and *locals*, the code " "will be executed as if it were embedded in a class definition. This means " @@ -1362,7 +1368,7 @@ msgid "" "are treated as class variables in a class definition)." msgstr "" -#: ../../library/functions.rst:674 +#: ../../library/functions.rst:684 msgid "" "If the *globals* dictionary does not contain a value for the key " "``__builtins__``, a reference to the dictionary of the built-in module :mod:" @@ -1375,7 +1381,7 @@ msgstr "" "dictionary 傳入 :func:`exec` 之前,你可以透過將它插入 *globals* 來控制你需要" "哪些內建函式來執行程式碼。" -#: ../../library/functions.rst:680 +#: ../../library/functions.rst:690 msgid "" "The *closure* argument specifies a closure--a tuple of cellvars. It's only " "valid when the *object* is a code object containing :term:`free (closure) " @@ -1387,7 +1393,7 @@ msgstr "" "variables) ` 的程式碼物件時,它才有效。Tuple 的長度必須與程" "式碼物件的 :attr:`~codeobject.co_freevars` 屬性完全匹配。" -#: ../../library/functions.rst:693 +#: ../../library/functions.rst:703 msgid "" "The built-in functions :func:`globals` and :func:`locals` return the current " "global and local namespace, respectively, which may be useful to pass around " @@ -1396,7 +1402,7 @@ msgstr "" "內建 :func:`globals` 和 :func:`locals` 函式各自回傳當前的全域和區域命名空間," "因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數以供後續使用。" -#: ../../library/functions.rst:699 +#: ../../library/functions.rst:709 msgid "" "The default *locals* act as described for function :func:`locals` below. " "Pass an explicit *locals* dictionary if you need to see effects of the code " @@ -1406,11 +1412,11 @@ msgstr "" "func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 *locals* " "dictionary 。" -#: ../../library/functions.rst:703 +#: ../../library/functions.rst:713 msgid "Added the *closure* parameter." msgstr "增加了 *closure* 參數。" -#: ../../library/functions.rst:718 +#: ../../library/functions.rst:728 msgid "" "Construct an iterator from those elements of *iterable* for which *function* " "is true. *iterable* may be either a sequence, a container which supports " @@ -1422,7 +1428,7 @@ msgstr "" "*function* 是 ``None``,則會假設它是一個識別性函式,即 *iterable* 中所有假值" "元素會被移除。" -#: ../../library/functions.rst:724 +#: ../../library/functions.rst:734 msgid "" "Note that ``filter(function, iterable)`` is equivalent to the generator " "expression ``(item for item in iterable if function(item))`` if function is " @@ -1433,7 +1439,7 @@ msgstr "" "是 ``None`` 的時候為 ``(item for item in iterable if function(item))``;" "function 是 ``None`` 的時候為 ``(item for item in iterable if item)``。" -#: ../../library/functions.rst:729 +#: ../../library/functions.rst:739 msgid "" "See :func:`itertools.filterfalse` for the complementary function that " "returns elements of *iterable* for which *function* is false." @@ -1441,11 +1447,11 @@ msgstr "" "請參閱 :func:`itertools.filterfalse`,只有 *function* 為 false 時才選取 " "*iterable* 中元素的互補函式。" -#: ../../library/functions.rst:740 +#: ../../library/functions.rst:750 msgid "Return a floating-point number constructed from a number or a string." msgstr "回傳從數字或字串生成的浮點數。" -#: ../../library/functions.rst:744 +#: ../../library/functions.rst:754 msgid "" ">>> float('+1.23')\n" "1.23\n" @@ -1469,7 +1475,7 @@ msgstr "" ">>> float('-Infinity')\n" "-inf" -#: ../../library/functions.rst:757 +#: ../../library/functions.rst:767 msgid "" "If the argument is a string, it should contain a decimal number, optionally " "preceded by a sign, and optionally embedded in whitespace. The optional " @@ -1484,7 +1490,7 @@ msgstr "" "數也可以是 NaN(非數字)或正負無窮大的字串。確切地說,除去首尾的空格後,輸入" "必須遵循以下語法中 :token:`~float:floatvalue` 的生成規則:" -#: ../../library/functions.rst:778 +#: ../../library/functions.rst:788 msgid "" "Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", " "and \"iNfINity\" are all acceptable spellings for positive infinity." @@ -1492,7 +1498,7 @@ msgstr "" "字母大小寫不影響,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表" "示正無窮大。" -#: ../../library/functions.rst:781 +#: ../../library/functions.rst:791 msgid "" "Otherwise, if the argument is an integer or a floating-point number, a " "floating-point number with the same value (within Python's floating-point " @@ -1502,7 +1508,7 @@ msgstr "" "否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的" "浮點數。如果引數在 Python 浮點精度範圍外,則會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:786 +#: ../../library/functions.rst:796 msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." "__float__()``. If :meth:`~object.__float__` is not defined then it falls " @@ -1511,22 +1517,22 @@ msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" "定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:790 +#: ../../library/functions.rst:800 msgid "If no argument is given, ``0.0`` is returned." msgstr "如果沒有引數,則回傳 ``0.0``。" -#: ../../library/functions.rst:792 +#: ../../library/functions.rst:802 msgid "The float type is described in :ref:`typesnumeric`." msgstr ":ref:`typesnumeric` 描述了浮點數型別。" -#: ../../library/functions.rst:800 +#: ../../library/functions.rst:810 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not " "defined." msgstr "" "如果 :meth:`~object.__float__` 未定義,則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:810 +#: ../../library/functions.rst:820 msgid "" "Convert a *value* to a \"formatted\" representation, as controlled by " "*format_spec*. The interpretation of *format_spec* will depend on the type " @@ -1537,7 +1543,7 @@ msgstr "" "取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" "`formatspec`。" -#: ../../library/functions.rst:815 +#: ../../library/functions.rst:825 msgid "" "The default *format_spec* is an empty string which usually gives the same " "effect as calling :func:`str(value) `." @@ -1545,7 +1551,7 @@ msgstr "" "預設的 *format_spec* 是一個空字串,它通常和呼叫 :func:`str(value) ` 的效" "果相同。" -#: ../../library/functions.rst:818 +#: ../../library/functions.rst:828 msgid "" "A call to ``format(value, format_spec)`` is translated to ``type(value)." "__format__(value, format_spec)`` which bypasses the instance dictionary when " @@ -1559,7 +1565,7 @@ msgstr "" "實例中的字典。如果搜尋到 :mod:`object` 這個 method 但 *format_spec* 不為空," "或是 *format_spec* 或回傳值不是字串,則會引發 :exc:`TypeError`。" -#: ../../library/functions.rst:825 +#: ../../library/functions.rst:835 msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." @@ -1567,7 +1573,7 @@ msgstr "" "當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:834 +#: ../../library/functions.rst:844 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " "*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" @@ -1577,7 +1583,7 @@ msgstr "" "``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" "`frozenset` 和 :ref:`types-set`。" -#: ../../library/functions.rst:838 +#: ../../library/functions.rst:848 msgid "" "For other containers see the built-in :class:`set`, :class:`list`, :class:" "`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." @@ -1585,7 +1591,7 @@ msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" -#: ../../library/functions.rst:846 +#: ../../library/functions.rst:856 msgid "" "Return the value of the named attribute of *object*. *name* must be a " "string. If the string is the name of one of the object's attributes, the " @@ -1600,7 +1606,7 @@ msgstr "" "`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" "`setattr`)。" -#: ../../library/functions.rst:855 +#: ../../library/functions.rst:865 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " @@ -1611,7 +1617,7 @@ msgstr "" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" "使用 :func:`getattr` 來取得它。" -#: ../../library/functions.rst:863 +#: ../../library/functions.rst:873 msgid "" "Return the dictionary implementing the current module namespace. For code " "within functions, this is set when the function is defined and remains the " @@ -1620,7 +1626,7 @@ msgstr "" "回傳代表當前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" "函式時設定且不論該函式是在何處呼叫都會保持相同。" -#: ../../library/functions.rst:870 +#: ../../library/functions.rst:880 msgid "" "The arguments are an object and a string. The result is ``True`` if the " "string is the name of one of the object's attributes, ``False`` if not. " @@ -1631,7 +1637,7 @@ msgstr "" "則回傳 ``False``。(此功能是透過呼叫 ``getattr(object, name)`` 並檢查是否引" "發 :exc:`AttributeError` 來實作的。)" -#: ../../library/functions.rst:878 +#: ../../library/functions.rst:888 msgid "" "Return the hash value of the object (if it has one). Hash values are " "integers. They are used to quickly compare dictionary keys during a " @@ -1642,7 +1648,7 @@ msgstr "" "時用來快速比較 dictionary 的鍵。相同大小的數字數值有相同的雜湊值(即使它們型" "別不同,如 1 和 1.0)。" -#: ../../library/functions.rst:885 +#: ../../library/functions.rst:895 msgid "" "For objects with custom :meth:`~object.__hash__` methods, note that :func:" "`hash` truncates the return value based on the bit width of the host machine." @@ -1650,7 +1656,7 @@ msgstr "" "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" "運行機器的位元長度來截斷回傳值。" -#: ../../library/functions.rst:892 +#: ../../library/functions.rst:902 msgid "" "Invoke the built-in help system. (This function is intended for interactive " "use.) If no argument is given, the interactive help system starts on the " @@ -1664,7 +1670,7 @@ msgstr "" "關鍵字或說明文件主題中搜索該字串,並在控制台上列印幫助資訊。如果引數是其他任" "意物件,則會生成該物件的幫助頁。" -#: ../../library/functions.rst:899 +#: ../../library/functions.rst:909 msgid "" "Note that if a slash(/) appears in the parameter list of a function when " "invoking :func:`help`, it means that the parameters prior to the slash are " @@ -1675,12 +1681,12 @@ msgstr "" "前面的參數是僅限位置 (positional-only) 參數。有關更多資訊,請參閱\\ :ref:`常" "見問答集中的僅限位置參數條目 `。" -#: ../../library/functions.rst:904 +#: ../../library/functions.rst:914 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." msgstr "此函式會被 :mod:`site` module 加入到內建命名空間。" -#: ../../library/functions.rst:906 +#: ../../library/functions.rst:916 msgid "" "Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " "for callables are now more comprehensive and consistent." @@ -1688,7 +1694,7 @@ msgstr "" "對於 :mod:`pydoc` 和 :mod:`inspect` 的變更,使得可呼叫物件回報的的簽名 " "(signature) 更加全面和一致。" -#: ../../library/functions.rst:913 +#: ../../library/functions.rst:923 msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " "\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" @@ -1698,7 +1704,7 @@ msgstr "" "class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並且回傳一" "個整數。舉例來說:" -#: ../../library/functions.rst:922 +#: ../../library/functions.rst:932 msgid "" "If you want to convert an integer number to an uppercase or lower " "hexadecimal string with prefix or not, you can use either of the following " @@ -1707,20 +1713,20 @@ msgstr "" "如果要將整數轉換為大寫或小寫的十六進位制字串,並可選擇有無 \"0x\" 前綴,則可" "以使用如下方法:" -#: ../../library/functions.rst:934 +#: ../../library/functions.rst:944 msgid "" "See also :func:`int` for converting a hexadecimal string to an integer using " "a base of 16." msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基數的整數。" -#: ../../library/functions.rst:939 +#: ../../library/functions.rst:949 msgid "" "To obtain a hexadecimal string representation for a float, use the :meth:" "`float.hex` method." msgstr "" "如果要獲取浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" -#: ../../library/functions.rst:945 +#: ../../library/functions.rst:955 msgid "" "Return the \"identity\" of an object. This is an integer which is " "guaranteed to be unique and constant for this object during its lifetime. " @@ -1730,18 +1736,18 @@ msgstr "" "回傳物件的 \"識別性\" 。該值是一個整數,在此物件的生命週期中保證是唯一且恆定" "的。兩個生命期不重疊的物件可能具有相同的 :func:`id` 值。" -#: ../../library/functions.rst:950 +#: ../../library/functions.rst:960 msgid "This is the address of the object in memory." msgstr "這是該物件在記憶體中的位址。" -#: ../../library/functions.rst:952 +#: ../../library/functions.rst:962 msgid "" "Raises an :ref:`auditing event ` ``builtins.id`` with argument " "``id``." msgstr "" "引發一個附帶引數 ``id`` 的\\ :ref:`稽核事件 ` ``builtins.id``。" -#: ../../library/functions.rst:958 +#: ../../library/functions.rst:968 msgid "" "If the *prompt* argument is present, it is written to standard output " "without a trailing newline. The function then reads a line from input, " @@ -1752,7 +1758,7 @@ msgstr "" "從輸入中讀取一行,將其轉換為字串(去除末尾的換行符)並回傳。當讀取到 EOF 時," "則引發 :exc:`EOFError`。例如: ::" -#: ../../library/functions.rst:963 +#: ../../library/functions.rst:973 msgid "" ">>> s = input('--> ') \n" "--> Monty Python's Flying Circus\n" @@ -1764,7 +1770,7 @@ msgstr "" ">>> s \n" "\"Monty Python's Flying Circus\"" -#: ../../library/functions.rst:968 +#: ../../library/functions.rst:978 msgid "" "If the :mod:`readline` module was loaded, then :func:`input` will use it to " "provide elaborate line editing and history features." @@ -1772,7 +1778,7 @@ msgstr "" "如果載入了 :mod:`readline` module,:func:`input` 將使用它來提供複雜的行編輯和" "歷史記錄功能。" -#: ../../library/functions.rst:971 ../../library/functions.rst:973 +#: ../../library/functions.rst:981 ../../library/functions.rst:983 msgid "" "Raises an :ref:`auditing event ` ``builtins.input`` with argument " "``prompt`` before reading input" @@ -1780,7 +1786,7 @@ msgstr "" "引發一個附帶讀取輸入前的引數 ``prompt`` 的\\ :ref:`稽核事件 ` " "``builtins.input``。" -#: ../../library/functions.rst:976 ../../library/functions.rst:978 +#: ../../library/functions.rst:986 ../../library/functions.rst:988 msgid "" "Raises an :ref:`auditing event ` ``builtins.input/result`` with " "the result after successfully reading input." @@ -1788,13 +1794,13 @@ msgstr "" "引發一個附帶成功讀取結果的\\ :ref:`稽核事件 ` ``builtins.input/" "result``。" -#: ../../library/functions.rst:985 +#: ../../library/functions.rst:995 msgid "" "Return an integer object constructed from a number or a string, or return " "``0`` if no arguments are given." msgstr "" -#: ../../library/functions.rst:990 +#: ../../library/functions.rst:1000 msgid "" ">>> int(123.45)\n" "123\n" @@ -1822,7 +1828,7 @@ msgstr "" ">>> int('01110011', base=2)\n" "115" -#: ../../library/functions.rst:1005 +#: ../../library/functions.rst:1015 msgid "" "If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." "__int__()``. If the argument defines :meth:`~object.__index__`, it returns " @@ -1835,7 +1841,7 @@ msgstr "" "義了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數,則會向零" "的方向無條件捨去。" -#: ../../library/functions.rst:1011 +#: ../../library/functions.rst:1021 msgid "" "If the argument is not a number or if *base* is given, then it must be a " "string, :class:`bytes`, or :class:`bytearray` instance representing an " @@ -1848,7 +1854,7 @@ msgstr "" "以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在" "數字間有單一底線。" -#: ../../library/functions.rst:1017 +#: ../../library/functions.rst:1027 msgid "" "A base-n integer string contains digits, each representing a value from 0 to " "n-1. The values 0--9 can be represented by any Unicode decimal digit. The " @@ -1870,11 +1876,11 @@ msgstr "" "進制中的一個,所以 ``int('010', 0)`` 是非法的,但 ``int('010')`` 和 " "``int('010', 8)`` 是有效的。" -#: ../../library/functions.rst:1028 +#: ../../library/functions.rst:1038 msgid "The integer type is described in :ref:`typesnumeric`." msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" -#: ../../library/functions.rst:1030 +#: ../../library/functions.rst:1040 msgid "" "If *base* is not an instance of :class:`int` and the *base* object has a :" "meth:`base.__index__ ` method, that method is called to " @@ -1886,22 +1892,22 @@ msgstr "" "的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." "__index__ `。" -#: ../../library/functions.rst:1040 +#: ../../library/functions.rst:1050 msgid "The first parameter is now positional-only." msgstr "第一個參數為僅限位置參數。" -#: ../../library/functions.rst:1043 +#: ../../library/functions.rst:1053 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not " "defined." msgstr "" "如果未定義 :meth:`~object.__int__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:1046 +#: ../../library/functions.rst:1056 msgid "The delegation to :meth:`~object.__trunc__` is deprecated." msgstr "對 :meth:`~object.__trunc__` 的委派已棄用。" -#: ../../library/functions.rst:1049 +#: ../../library/functions.rst:1059 msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " @@ -1915,7 +1921,7 @@ msgstr "" "`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" "數字串轉換的長度限制 `\\ 說明文件。" -#: ../../library/functions.rst:1059 +#: ../../library/functions.rst:1069 msgid "" "Return ``True`` if the *object* argument is an instance of the *classinfo* " "argument, or of a (direct, indirect, or :term:`virtual `) of *classinfo*. A class is considered a " @@ -1955,7 +1961,7 @@ msgstr "" "是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:1091 +#: ../../library/functions.rst:1101 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " @@ -1979,11 +1985,11 @@ msgstr "" "__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 *sentinel* 則引發 :" "exc:`StopIteration`,否則回傳呼叫結果。" -#: ../../library/functions.rst:1105 +#: ../../library/functions.rst:1115 msgid "See also :ref:`typeiter`." msgstr "另請參閱 :ref:`typeiter`。" -#: ../../library/functions.rst:1107 +#: ../../library/functions.rst:1117 msgid "" "One useful application of the second form of :func:`iter` is to build a " "block-reader. For example, reading fixed-width blocks from a binary database " @@ -1992,7 +1998,7 @@ msgstr "" ":func:`iter` 的第二種形式有一個好用的應用,是能夠建立一個區塊閱讀器 (block-" "reader)。例如,從二進位資料庫檔案中讀取固定寬度的區塊,直到檔案的結尾: ::" -#: ../../library/functions.rst:1111 +#: ../../library/functions.rst:1121 msgid "" "from functools import partial\n" "with open('mydata.db', 'rb') as f:\n" @@ -2004,7 +2010,7 @@ msgstr "" " for block in iter(partial(f.read, 64), b''):\n" " process_block(block)" -#: ../../library/functions.rst:1119 +#: ../../library/functions.rst:1129 msgid "" "Return the length (the number of items) of an object. The argument may be a " "sequence (such as a string, bytes, tuple, list, or range) or a collection " @@ -2013,7 +2019,7 @@ msgstr "" "回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 " "range)或集合(如 dictionary、set 或 frozen set)。" -#: ../../library/functions.rst:1125 +#: ../../library/functions.rst:1135 msgid "" "``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." "maxsize`, such as :class:`range(2 ** 100) `." @@ -2021,7 +2027,7 @@ msgstr "" "如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," "則 ``len`` 會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:1134 +#: ../../library/functions.rst:1144 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." @@ -2029,33 +2035,33 @@ msgstr "" "除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` " "和 :ref:`typesseq`。" -#: ../../library/functions.rst:1140 +#: ../../library/functions.rst:1150 msgid "" "Return a mapping object representing the current local symbol table, with " "variable names as the keys, and their currently bound references as the " "values." msgstr "" -#: ../../library/functions.rst:1144 +#: ../../library/functions.rst:1154 msgid "" "At module scope, as well as when using :func:`exec` or :func:`eval` with a " "single namespace, this function returns the same namespace as :func:" "`globals`." msgstr "" -#: ../../library/functions.rst:1148 +#: ../../library/functions.rst:1158 msgid "" "At class scope, it returns the namespace that will be passed to the " "metaclass constructor." msgstr "" -#: ../../library/functions.rst:1151 +#: ../../library/functions.rst:1161 msgid "" "When using ``exec()`` or ``eval()`` with separate local and global " "arguments, it returns the local namespace passed in to the function call." msgstr "" -#: ../../library/functions.rst:1154 +#: ../../library/functions.rst:1164 msgid "" "In all of the above cases, each call to ``locals()`` in a given frame of " "execution will return the *same* mapping object. Changes made through the " @@ -2065,7 +2071,7 @@ msgid "" "returned mapping object." msgstr "" -#: ../../library/functions.rst:1161 +#: ../../library/functions.rst:1171 msgid "" "In an :term:`optimized scope` (including functions, generators, and " "coroutines), each call to ``locals()`` instead returns a fresh dictionary " @@ -2077,7 +2083,7 @@ msgid "" "previously returned dictionaries." msgstr "" -#: ../../library/functions.rst:1170 +#: ../../library/functions.rst:1180 msgid "" "Calling ``locals()`` as part of a comprehension in a function, generator, or " "coroutine is equivalent to calling it in the containing scope, except that " @@ -2086,19 +2092,19 @@ msgid "" "function." msgstr "" -#: ../../library/functions.rst:1176 +#: ../../library/functions.rst:1186 msgid "" "Calling ``locals()`` as part of a generator expression is equivalent to " "calling it in a nested generator function." msgstr "" -#: ../../library/functions.rst:1179 +#: ../../library/functions.rst:1189 msgid "" "The behaviour of ``locals()`` in a comprehension has been updated as " "described in :pep:`709`." msgstr "" -#: ../../library/functions.rst:1183 +#: ../../library/functions.rst:1193 msgid "" "As part of :pep:`667`, the semantics of mutating the mapping objects " "returned from this function are now defined. The behavior in :term:" @@ -2107,7 +2113,7 @@ msgid "" "versions." msgstr "" -#: ../../library/functions.rst:1193 +#: ../../library/functions.rst:1203 msgid "" "Return an iterator that applies *function* to every item of *iterable*, " "yielding the results. If additional *iterables* arguments are passed, " @@ -2122,13 +2128,13 @@ msgstr "" "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," "請參閱 :func:`itertools.starmap`。" -#: ../../library/functions.rst:1205 +#: ../../library/functions.rst:1215 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." msgstr "回傳 iterable 中最大的元素,或者回傳兩個以上的引數中最大的。" -#: ../../library/functions.rst:1208 +#: ../../library/functions.rst:1218 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The largest item in the iterable is returned. If two or more positional " @@ -2137,7 +2143,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素" "會被回傳。如果提供了兩個或以上的位置引數,則回傳最大的位置引數。" -#: ../../library/functions.rst:1213 ../../library/functions.rst:1251 +#: ../../library/functions.rst:1223 ../../library/functions.rst:1261 msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " @@ -2150,7 +2156,7 @@ msgstr "" "的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" "`ValueError`。" -#: ../../library/functions.rst:1219 +#: ../../library/functions.rst:1229 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2161,15 +2167,15 @@ msgstr "" "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " "iterable, key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1224 ../../library/functions.rst:1262 +#: ../../library/functions.rst:1234 ../../library/functions.rst:1272 msgid "Added the *default* keyword-only parameter." msgstr "新增 *default* 僅限關鍵字參數。" -#: ../../library/functions.rst:1227 ../../library/functions.rst:1265 +#: ../../library/functions.rst:1237 ../../library/functions.rst:1275 msgid "The *key* can be ``None``." msgstr "*key* 可以為 ``None``。" -#: ../../library/functions.rst:1235 +#: ../../library/functions.rst:1245 msgid "" "Return a \"memory view\" object created from the given argument. See :ref:" "`typememoryview` for more information." @@ -2177,13 +2183,13 @@ msgstr "" "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" "閱\\ :ref:`typememoryview`。" -#: ../../library/functions.rst:1243 +#: ../../library/functions.rst:1253 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." msgstr "回傳 iterable 中最小的元素,或者回傳兩個以上的引數中最小的。" -#: ../../library/functions.rst:1246 +#: ../../library/functions.rst:1256 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The smallest item in the iterable is returned. If two or more positional " @@ -2192,7 +2198,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" "被回傳。如果提供了兩個以上的位置引數,則回傳最小的位置引數。" -#: ../../library/functions.rst:1257 +#: ../../library/functions.rst:1267 msgid "" "If multiple items are minimal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2203,7 +2209,7 @@ msgstr "" "``sorted(iterable, key=keyfunc)[0]`` 和 ``heapq.nsmallest(1, iterable, " "key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1272 +#: ../../library/functions.rst:1282 msgid "" "Retrieve the next item from the :term:`iterator` by calling its :meth:" "`~iterator.__next__` method. If *default* is given, it is returned if the " @@ -2213,16 +2219,18 @@ msgstr "" "素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" "exc:`StopIteration`。" -#: ../../library/functions.rst:1279 +#: ../../library/functions.rst:1289 msgid "" -"Return a new featureless object. :class:`object` is a base for all classes. " -"It has methods that are common to all instances of Python classes. This " -"function does not accept any arguments." +"This is the ultimate base class of all other classes. It has methods that " +"are common to all instances of Python classes. When the constructor is " +"called, it returns a new featureless object. The constructor does not accept " +"any arguments." msgstr "" -"回傳一個沒有特徵的新物件。:class:`object` 是所有 class 的基礎,它具有所有 " -"Python class 實例的通用 method。這個函式不接受任何引數。" +"這是所有其他 class 的基礎,它具有所有 Python class 實例的通用 method。當建構" +"函式被呼叫時,它會回傳一個新的沒有特徵 (featureless) 的物件。這個建構函式不接" +"受任何引數。" -#: ../../library/functions.rst:1285 +#: ../../library/functions.rst:1296 msgid "" ":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, " "so you can't assign arbitrary attributes to an instance of :class:`object`." @@ -2230,7 +2238,7 @@ msgstr "" "由於 :class:`object` 實例\\ *沒有* :attr:`~object.__dict__` 屬性,因此無法將" "任意屬性賦給 :class:`object` 的實例。" -#: ../../library/functions.rst:1292 +#: ../../library/functions.rst:1303 msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " "result is a valid Python expression. If *x* is not a Python :class:`int` " @@ -2241,7 +2249,7 @@ msgstr "" "Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" "`~object.__index__` method 回傳一個整數。舉例來說:" -#: ../../library/functions.rst:1302 +#: ../../library/functions.rst:1313 msgid "" "If you want to convert an integer number to an octal string either with the " "prefix \"0o\" or not, you can use either of the following ways." @@ -2249,7 +2257,7 @@ msgstr "" "如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方" "法。" -#: ../../library/functions.rst:1319 +#: ../../library/functions.rst:1330 msgid "" "Open *file* and return a corresponding :term:`file object`. If the file " "cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more " @@ -2259,7 +2267,7 @@ msgstr "" "啟,則引發 :exc:`OSError`。關於使用此函式的更多方法,請參閱\\ :ref:`tut-" "files`。" -#: ../../library/functions.rst:1323 +#: ../../library/functions.rst:1334 msgid "" "*file* is a :term:`path-like object` giving the pathname (absolute or " "relative to the current working directory) of the file to be opened or an " @@ -2272,7 +2280,7 @@ msgstr "" "器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關" "閉,除非 *closefd* 被設為 ``False``。)" -#: ../../library/functions.rst:1329 +#: ../../library/functions.rst:1340 msgid "" "*mode* is an optional string that specifies the mode in which the file is " "opened. It defaults to ``'r'`` which means open for reading in text mode. " @@ -2293,71 +2301,71 @@ msgstr "" "getencoding` 來獲取當前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" "式且不要指定 *encoding*。)可用的模式有:" -#: ../../library/functions.rst:1346 +#: ../../library/functions.rst:1357 msgid "Character" msgstr "字元" -#: ../../library/functions.rst:1346 +#: ../../library/functions.rst:1357 msgid "Meaning" msgstr "意義" -#: ../../library/functions.rst:1348 +#: ../../library/functions.rst:1359 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/functions.rst:1348 +#: ../../library/functions.rst:1359 msgid "open for reading (default)" msgstr "讀取(預設)" -#: ../../library/functions.rst:1349 +#: ../../library/functions.rst:1360 msgid "``'w'``" msgstr "``'w'``" -#: ../../library/functions.rst:1349 +#: ../../library/functions.rst:1360 msgid "open for writing, truncating the file first" msgstr "寫入,會先清除檔案內容" -#: ../../library/functions.rst:1350 +#: ../../library/functions.rst:1361 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/functions.rst:1350 +#: ../../library/functions.rst:1361 msgid "open for exclusive creation, failing if the file already exists" msgstr "唯一性建立,如果文件已存在則會失敗" -#: ../../library/functions.rst:1351 +#: ../../library/functions.rst:1362 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/functions.rst:1351 +#: ../../library/functions.rst:1362 msgid "open for writing, appending to the end of file if it exists" msgstr "寫入,如果檔案存在則在其末端附加內容" -#: ../../library/functions.rst:1352 +#: ../../library/functions.rst:1363 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/functions.rst:1352 ../../library/functions.rst:1496 +#: ../../library/functions.rst:1363 ../../library/functions.rst:1507 msgid "binary mode" msgstr "二進制模式" -#: ../../library/functions.rst:1353 +#: ../../library/functions.rst:1364 msgid "``'t'``" msgstr "``'t'``" -#: ../../library/functions.rst:1353 +#: ../../library/functions.rst:1364 msgid "text mode (default)" msgstr "文字模式(預設)" -#: ../../library/functions.rst:1354 +#: ../../library/functions.rst:1365 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/functions.rst:1354 +#: ../../library/functions.rst:1365 msgid "open for updating (reading and writing)" msgstr "更新(讀取並寫入)" -#: ../../library/functions.rst:1357 +#: ../../library/functions.rst:1368 msgid "" "The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). " "Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'`` and " @@ -2367,7 +2375,7 @@ msgstr "" "``'w+b'`` 模式會開啟並清除檔案。``'r+'`` 和 ``'r+b'`` 模式會開啟且保留檔案內" "容。" -#: ../../library/functions.rst:1361 +#: ../../library/functions.rst:1372 msgid "" "As mentioned in the :ref:`io-overview`, Python distinguishes between binary " "and text I/O. Files opened in binary mode (including ``'b'`` in the *mode* " @@ -2383,7 +2391,7 @@ msgstr "" "``'t'``),檔案的內容會以 :class:`str` 回傳,其位元組已經先被解碼,使用的是取" "決於平台的編碼系統或是給定的 *encoding*。" -#: ../../library/functions.rst:1371 +#: ../../library/functions.rst:1382 msgid "" "Python doesn't depend on the underlying operating system's notion of text " "files; all the processing is done by Python itself, and is therefore " @@ -2392,7 +2400,7 @@ msgstr "" "Python 不會使用底層作業系統對於文字檔案的操作概念;所有的處理都是由 Python 獨" "自完成的,因此能獨立於不同平台。" -#: ../../library/functions.rst:1375 +#: ../../library/functions.rst:1386 msgid "" "*buffering* is an optional integer used to set the buffering policy. Pass 0 " "to switch buffering off (only allowed in binary mode), 1 to select line " @@ -2413,7 +2421,7 @@ msgstr "" "``write_through`` 旗標。若未給定 *buffering* 引數,則預設的緩衝策略會運作如" "下:" -#: ../../library/functions.rst:1385 +#: ../../library/functions.rst:1396 msgid "" "Binary files are buffered in fixed-size chunks; the size of the buffer is " "chosen using a heuristic trying to determine the underlying device's \"block " @@ -2425,7 +2433,7 @@ msgstr "" "DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 8192 個位元" "組。" -#: ../../library/functions.rst:1390 +#: ../../library/functions.rst:1401 msgid "" "\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " "returns ``True``) use line buffering. Other text files use the policy " @@ -2434,7 +2442,7 @@ msgstr "" "「互動式」文字檔(:meth:`~io.IOBase.isatty` 回傳 ``True`` 的檔案)會使用列緩" "衝。其他文字檔則使用上述的二進制檔案緩衝策略。" -#: ../../library/functions.rst:1394 +#: ../../library/functions.rst:1405 msgid "" "*encoding* is the name of the encoding used to decode or encode the file. " "This should only be used in text mode. The default encoding is platform " @@ -2447,7 +2455,7 @@ msgstr "" "Python 支援的任何 :term:`text encoding`\\ (文字編碼)都是可以使用的。關於支" "援的編碼系統清單,請參閱 :mod:`codecs` module。" -#: ../../library/functions.rst:1400 +#: ../../library/functions.rst:1411 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " @@ -2460,7 +2468,7 @@ msgstr "" "handlers`\\ 有列出清單),不過任何已註冊到 :func:`codecs.register_error` 的錯" "誤處理程式名稱也都是有效的。標準的名稱包括:" -#: ../../library/functions.rst:1408 +#: ../../library/functions.rst:1419 msgid "" "``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " "error. The default value of ``None`` has the same effect." @@ -2468,20 +2476,20 @@ msgstr "" "``'strict'`` 如果發生編碼錯誤,則引發 :exc:`ValueError` 例外。預設值 " "``None`` 也有相同的效果。" -#: ../../library/functions.rst:1412 +#: ../../library/functions.rst:1423 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." msgstr "``'ignore'`` 忽略錯誤。請注意,忽略編碼錯誤可能導致資料遺失。" -#: ../../library/functions.rst:1415 +#: ../../library/functions.rst:1426 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." msgstr "" "``'replace'`` 會在格式不正確的資料位置插入一個替換標誌(像是 ``'?'``)。" -#: ../../library/functions.rst:1418 +#: ../../library/functions.rst:1429 msgid "" "``'surrogateescape'`` will represent any incorrect bytes as low surrogate " "code units ranging from U+DC80 to U+DCFF. These surrogate code units will " @@ -2494,7 +2502,7 @@ msgstr "" "被還原回 ``surrogateescape`` 錯誤處理程式當時所處理的那些相同位元組。這對於處" "理未知編碼方式的檔案會很好用。" -#: ../../library/functions.rst:1425 +#: ../../library/functions.rst:1436 msgid "" "``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " "not supported by the encoding are replaced with the appropriate XML " @@ -2503,7 +2511,7 @@ msgstr "" "``'xmlcharrefreplace'`` 僅在寫入檔案時可支援。編碼系統不支援的字元會被替換為" "適當的 XML 字元參考 (character reference) ``&#nnn;``。" -#: ../../library/functions.rst:1429 +#: ../../library/functions.rst:1440 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." @@ -2511,7 +2519,7 @@ msgstr "" "``'backslashreplace'`` 會用 Python 的反斜線跳脫序列 (backslashed escape " "sequence) 替換格式不正確的資料。" -#: ../../library/functions.rst:1432 +#: ../../library/functions.rst:1443 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." @@ -2519,7 +2527,7 @@ msgstr "" "``'namereplace'``\\ (也僅在寫入時支援)會將不支援的字元替換為 ``\\N{...}`` " "跳脫序列。" -#: ../../library/functions.rst:1440 +#: ../../library/functions.rst:1451 msgid "" "*newline* determines how to parse newline characters from the stream. It can " "be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " @@ -2528,7 +2536,7 @@ msgstr "" "*newline* 會決定如何剖析資料串流 (stream) 中的換行字元。它可以是 ``None``、" "``''``、``'\\n'``、``'\\r'`` 或 ``'\\r\\n'``。它的運作規則如下:" -#: ../../library/functions.rst:1444 +#: ../../library/functions.rst:1455 msgid "" "When reading input from the stream, if *newline* is ``None``, universal " "newlines mode is enabled. Lines in the input can end in ``'\\n'``, " @@ -2544,7 +2552,7 @@ msgstr "" "傳給呼叫方時,行尾符號不會被轉換。如果它是任何其他有效的值,則輸入資料的行只" "會由給定的字串做結尾,且在回傳給呼叫方時,行尾符號不會被轉換。" -#: ../../library/functions.rst:1452 +#: ../../library/functions.rst:1463 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -2557,7 +2565,7 @@ msgstr "" "``''`` 或 ``'\\n'``,則不做任何轉換。如果 *newline* 是任何其他有效的值,則寫" "入的任何 ``'\\n'`` 字元都將轉換為給定的字串。" -#: ../../library/functions.rst:1458 +#: ../../library/functions.rst:1469 msgid "" "If *closefd* is ``False`` and a file descriptor rather than a filename was " "given, the underlying file descriptor will be kept open when the file is " @@ -2568,7 +2576,7 @@ msgstr "" "則當檔案關閉時,底層的檔案描述器會保持開啟狀態。如果有給定一個檔名,則 " "*closefd* 必須是 ``True``\\ (預設值);否則將引發錯誤。" -#: ../../library/functions.rst:1463 +#: ../../library/functions.rst:1474 msgid "" "A custom opener can be used by passing a callable as *opener*. The " "underlying file descriptor for the file object is then obtained by calling " @@ -2581,11 +2589,11 @@ msgstr "" "必須回傳一個開啟的檔案描述器(將 :mod:`os.open` 作為 *opener* 傳入,在功能上" "的結果會相當於傳入 ``None``)。" -#: ../../library/functions.rst:1469 +#: ../../library/functions.rst:1480 msgid "The newly created file is :ref:`non-inheritable `." msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" -#: ../../library/functions.rst:1471 +#: ../../library/functions.rst:1482 msgid "" "The following example uses the :ref:`dir_fd ` parameter of the :func:" "`os.open` function to open a file relative to a given directory::" @@ -2593,7 +2601,7 @@ msgstr "" "下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" -#: ../../library/functions.rst:1474 +#: ../../library/functions.rst:1485 msgid "" ">>> import os\n" ">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" @@ -2606,7 +2614,7 @@ msgid "" ">>> os.close(dir_fd) # don't leak a file descriptor" msgstr "" -#: ../../library/functions.rst:1484 +#: ../../library/functions.rst:1495 msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " @@ -2630,7 +2638,7 @@ msgstr "" "BufferedRandom`。當緩衝被停用時,會回傳原始資料串流 :class:`io.FileIO`,它" "是 :class:`io.RawIOBase` 的一個 subclass。" -#: ../../library/functions.rst:1505 +#: ../../library/functions.rst:1516 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " "(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" @@ -2640,7 +2648,7 @@ msgstr "" "`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" "`shutil`。" -#: ../../library/functions.rst:1509 +#: ../../library/functions.rst:1520 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -2648,25 +2656,25 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/functions.rst:1511 +#: ../../library/functions.rst:1522 msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." msgstr "``mode`` 和 ``flags`` 引數可能會被原始的呼叫所修改或推論 (infer)。" -#: ../../library/functions.rst:1516 +#: ../../library/functions.rst:1527 msgid "The *opener* parameter was added." msgstr "增加了 *opener* 參數。" -#: ../../library/functions.rst:1517 +#: ../../library/functions.rst:1528 msgid "The ``'x'`` mode was added." msgstr "增加了 ``'x'`` 模式。" -#: ../../library/functions.rst:1518 +#: ../../library/functions.rst:1529 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "過去引發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" -#: ../../library/functions.rst:1519 +#: ../../library/functions.rst:1530 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." @@ -2674,11 +2682,11 @@ msgstr "" "如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" "`FileExistsError`。" -#: ../../library/functions.rst:1524 +#: ../../library/functions.rst:1535 msgid "The file is now non-inheritable." msgstr "檔案在此版本開始是不可繼承的。" -#: ../../library/functions.rst:1528 +#: ../../library/functions.rst:1539 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" @@ -2687,15 +2695,15 @@ msgstr "" "如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" "不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" -#: ../../library/functions.rst:1531 +#: ../../library/functions.rst:1542 msgid "The ``'namereplace'`` error handler was added." msgstr "增加了 ``'namereplace'`` 錯誤處理程式。" -#: ../../library/functions.rst:1535 +#: ../../library/functions.rst:1546 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" -#: ../../library/functions.rst:1536 +#: ../../library/functions.rst:1547 msgid "" "On Windows, opening a console buffer may return a subclass of :class:`io." "RawIOBase` other than :class:`io.FileIO`." @@ -2703,11 +2711,11 @@ msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" -#: ../../library/functions.rst:1539 +#: ../../library/functions.rst:1550 msgid "The ``'U'`` mode has been removed." msgstr "``'U'`` 模式被移除。" -#: ../../library/functions.rst:1544 +#: ../../library/functions.rst:1555 msgid "" "Given a string representing one Unicode character, return an integer " "representing the Unicode code point of that character. For example, " @@ -2718,7 +2726,7 @@ msgstr "" "``ord('a')`` 回傳整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這" "是 :func:`chr` 的逆函式。" -#: ../../library/functions.rst:1552 +#: ../../library/functions.rst:1563 msgid "" "Return *base* to the power *exp*; if *mod* is present, return *base* to the " "power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " @@ -2729,7 +2737,7 @@ msgstr "" "*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" -#: ../../library/functions.rst:1557 +#: ../../library/functions.rst:1568 msgid "" "The arguments must have numeric types. With mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " @@ -2753,7 +2761,7 @@ msgstr "" "`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 ``pow(-9, 2.0)`` " "會回傳 ``81.0``。" -#: ../../library/functions.rst:1569 +#: ../../library/functions.rst:1580 msgid "" "For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must " "also be of integer type and *mod* must be nonzero. If *mod* is present and " @@ -2766,11 +2774,11 @@ msgstr "" "與 *mod* 互質。在這種情況下,會回傳 ``pow(inv_base, -exp, mod)``,其中 " "*inv_base* 是 *base* 對 *mod* 的模倒數 (inverse modulo)。" -#: ../../library/functions.rst:1575 +#: ../../library/functions.rst:1586 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "以下是一個計算 ``38`` 對 ``97`` 取模倒數的範例: ::" -#: ../../library/functions.rst:1577 +#: ../../library/functions.rst:1588 msgid "" ">>> pow(38, -1, mod=97)\n" "23\n" @@ -2782,7 +2790,7 @@ msgstr "" ">>> 23 * 38 % 97 == 1\n" "True" -#: ../../library/functions.rst:1582 +#: ../../library/functions.rst:1593 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." @@ -2790,12 +2798,12 @@ msgstr "" "對於 :class:`int` 運算元,現在 ``pow`` 的三引數形式允許第二個引數為負數,也容" "許模倒數的計算。" -#: ../../library/functions.rst:1587 +#: ../../library/functions.rst:1598 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "允許關鍵字引數。在此之前只支援位置引數。" -#: ../../library/functions.rst:1594 +#: ../../library/functions.rst:1605 msgid "" "Print *objects* to the text stream *file*, separated by *sep* and followed " "by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " @@ -2804,7 +2812,7 @@ msgstr "" "將 *objects* 列印到文字資料串流 *file*,用 *sep* 分隔並以 *end* 結尾。如果有" "給定 *sep*、*end*、*file* 和 *flush*,那麼它們必須是關鍵字引數的形式。" -#: ../../library/functions.rst:1598 +#: ../../library/functions.rst:1609 msgid "" "All non-keyword arguments are converted to strings like :func:`str` does and " "written to the stream, separated by *sep* and followed by *end*. Both *sep* " @@ -2817,7 +2825,7 @@ msgstr "" "以是 ``None``,這表示使用預設值。如果沒有給定 *objects*,:func:`print` 就只會" "寫入 *end*。" -#: ../../library/functions.rst:1604 +#: ../../library/functions.rst:1615 msgid "" "The *file* argument must be an object with a ``write(string)`` method; if it " "is not present or ``None``, :data:`sys.stdout` will be used. Since printed " @@ -2829,7 +2837,7 @@ msgstr "" "串,所以 :func:`print` 不能用於二進位模式的檔案物件。對於此類物件,請改用 " "``file.write(...)``。" -#: ../../library/functions.rst:1609 +#: ../../library/functions.rst:1620 msgid "" "Output buffering is usually determined by *file*. However, if *flush* is " "true, the stream is forcibly flushed." @@ -2837,15 +2845,15 @@ msgstr "" "輸出緩衝通常會由 *file* 決定。但是如果 *flush* 為 true,則資料串流會被強制清" "除。" -#: ../../library/functions.rst:1613 +#: ../../library/functions.rst:1624 msgid "Added the *flush* keyword argument." msgstr "增加了 *flush* 關鍵字引數。" -#: ../../library/functions.rst:1619 +#: ../../library/functions.rst:1630 msgid "Return a property attribute." msgstr "回傳 property 屬性。" -#: ../../library/functions.rst:1621 +#: ../../library/functions.rst:1632 msgid "" "*fget* is a function for getting an attribute value. *fset* is a function " "for setting an attribute value. *fdel* is a function for deleting an " @@ -2854,11 +2862,11 @@ msgstr "" "*fget* 是一個用於取得屬性值的函式,*fset* 是一個用於設定屬性值的函式,*fdel* " "是一個用於刪除屬性值的函式,而 *doc* 會為該屬性建立一個說明字串。" -#: ../../library/functions.rst:1625 +#: ../../library/functions.rst:1636 msgid "A typical use is to define a managed attribute ``x``::" msgstr "一個典型的用途是定義一個受管理的屬性 ``x``: ::" -#: ../../library/functions.rst:1627 +#: ../../library/functions.rst:1638 msgid "" "class C:\n" " def __init__(self):\n" @@ -2890,7 +2898,7 @@ msgstr "" "\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" -#: ../../library/functions.rst:1642 +#: ../../library/functions.rst:1653 msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." @@ -2898,7 +2906,7 @@ msgstr "" "如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會呼叫取得器 (getter),``c.x = " "value`` 會呼叫設定器 (setter),而 ``del c.x`` 會呼叫刪除器 (deleter)。" -#: ../../library/functions.rst:1645 +#: ../../library/functions.rst:1656 msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " @@ -2909,7 +2917,7 @@ msgstr "" "*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" "`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" -#: ../../library/functions.rst:1649 +#: ../../library/functions.rst:1660 msgid "" "class Parrot:\n" " def __init__(self):\n" @@ -2921,14 +2929,14 @@ msgid "" " return self._voltage" msgstr "" -#: ../../library/functions.rst:1658 +#: ../../library/functions.rst:1669 msgid "" "The ``@property`` decorator turns the :meth:`!voltage` method into a " "\"getter\" for a read-only attribute with the same name, and it sets the " "docstring for *voltage* to \"Get the current voltage.\"" msgstr "" -#: ../../library/functions.rst:1666 +#: ../../library/functions.rst:1677 msgid "" "A property object has ``getter``, ``setter``, and ``deleter`` methods usable " "as decorators that create a copy of the property with the corresponding " @@ -2936,7 +2944,7 @@ msgid "" "with an example:" msgstr "" -#: ../../library/functions.rst:1671 +#: ../../library/functions.rst:1682 msgid "" "class C:\n" " def __init__(self):\n" @@ -2972,36 +2980,36 @@ msgstr "" " def x(self):\n" " del self._x" -#: ../../library/functions.rst:1690 +#: ../../library/functions.rst:1701 msgid "" "This code is exactly equivalent to the first example. Be sure to give the " "additional functions the same name as the original property (``x`` in this " "case.)" msgstr "" -#: ../../library/functions.rst:1694 +#: ../../library/functions.rst:1705 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." msgstr "" -#: ../../library/functions.rst:1697 +#: ../../library/functions.rst:1708 msgid "The docstrings of property objects are now writeable." msgstr "" -#: ../../library/functions.rst:1702 +#: ../../library/functions.rst:1713 msgid "" "Attribute holding the name of the property. The name of the property can be " "changed at runtime." msgstr "" -#: ../../library/functions.rst:1713 +#: ../../library/functions.rst:1724 msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1719 +#: ../../library/functions.rst:1730 msgid "" "Return a string containing a printable representation of an object. For " "many types, this function makes an attempt to return a string that would " @@ -3014,11 +3022,11 @@ msgid "" "raise :exc:`RuntimeError`." msgstr "" -#: ../../library/functions.rst:1730 +#: ../../library/functions.rst:1741 msgid "This class has a custom representation that can be evaluated::" msgstr "" -#: ../../library/functions.rst:1732 +#: ../../library/functions.rst:1743 msgid "" "class Person:\n" " def __init__(self, name, age):\n" @@ -3036,7 +3044,7 @@ msgstr "" " def __repr__(self):\n" " return f\"Person('{self.name}', {self.age})\"" -#: ../../library/functions.rst:1743 +#: ../../library/functions.rst:1754 msgid "" "Return a reverse :term:`iterator`. *seq* must be an object which has a :" "meth:`~object.__reversed__` method or supports the sequence protocol (the :" @@ -3044,14 +3052,14 @@ msgid "" "with integer arguments starting at ``0``)." msgstr "" -#: ../../library/functions.rst:1751 +#: ../../library/functions.rst:1762 msgid "" "Return *number* rounded to *ndigits* precision after the decimal point. If " "*ndigits* is omitted or is ``None``, it returns the nearest integer to its " "input." msgstr "" -#: ../../library/functions.rst:1755 +#: ../../library/functions.rst:1766 msgid "" "For the built-in types supporting :func:`round`, values are rounded to the " "closest multiple of 10 to the power minus *ndigits*; if two multiples are " @@ -3062,13 +3070,13 @@ msgid "" "``None``. Otherwise, the return value has the same type as *number*." msgstr "" -#: ../../library/functions.rst:1764 +#: ../../library/functions.rst:1775 msgid "" "For a general Python object ``number``, ``round`` delegates to ``number." "__round__``." msgstr "" -#: ../../library/functions.rst:1769 +#: ../../library/functions.rst:1780 msgid "" "The behavior of :func:`round` for floats can be surprising: for example, " "``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is " @@ -3077,21 +3085,21 @@ msgid "" "information." msgstr "" -#: ../../library/functions.rst:1781 +#: ../../library/functions.rst:1792 msgid "" "Return a new :class:`set` object, optionally with elements taken from " "*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" "set` for documentation about this class." msgstr "" -#: ../../library/functions.rst:1785 +#: ../../library/functions.rst:1796 msgid "" "For other containers see the built-in :class:`frozenset`, :class:`list`, :" "class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " "module." msgstr "" -#: ../../library/functions.rst:1792 +#: ../../library/functions.rst:1803 msgid "" "This is the counterpart of :func:`getattr`. The arguments are an object, a " "string, and an arbitrary value. The string may name an existing attribute " @@ -3100,7 +3108,7 @@ msgid "" "is equivalent to ``x.foobar = 123``." msgstr "" -#: ../../library/functions.rst:1798 +#: ../../library/functions.rst:1809 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " "unless the object chooses to enforce that, for example in a custom :meth:" @@ -3109,21 +3117,21 @@ msgid "" "notation, but is accessible through :func:`getattr` etc.." msgstr "" -#: ../../library/functions.rst:1806 +#: ../../library/functions.rst:1817 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " "with two leading underscores) name in order to set it with :func:`setattr`." msgstr "" -#: ../../library/functions.rst:1815 +#: ../../library/functions.rst:1826 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " "``None``." msgstr "" -#: ../../library/functions.rst:1823 +#: ../../library/functions.rst:1834 msgid "" "Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, " "and :attr:`!step` which merely return the argument values (or their " @@ -3131,48 +3139,48 @@ msgid "" "by NumPy and other third-party packages." msgstr "" -#: ../../library/functions.rst:1828 +#: ../../library/functions.rst:1839 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " "example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" "`itertools.islice` for an alternate version that returns an :term:`iterator`." msgstr "" -#: ../../library/functions.rst:1833 +#: ../../library/functions.rst:1844 msgid "" "Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" "`~slice.stop`, and :attr:`~slice.step` are hashable)." msgstr "" -#: ../../library/functions.rst:1839 +#: ../../library/functions.rst:1850 msgid "Return a new sorted list from the items in *iterable*." msgstr "" -#: ../../library/functions.rst:1841 +#: ../../library/functions.rst:1852 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" -#: ../../library/functions.rst:1843 +#: ../../library/functions.rst:1854 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each element in *iterable* (for example, ``key=str." "lower``). The default value is ``None`` (compare the elements directly)." msgstr "" -#: ../../library/functions.rst:1847 +#: ../../library/functions.rst:1858 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -#: ../../library/functions.rst:1850 +#: ../../library/functions.rst:1861 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." msgstr "" -#: ../../library/functions.rst:1853 +#: ../../library/functions.rst:1864 msgid "" "The built-in :func:`sorted` function is guaranteed to be stable. A sort is " "stable if it guarantees not to change the relative order of elements that " @@ -3180,7 +3188,7 @@ msgid "" "example, sort by department, then by salary grade)." msgstr "" -#: ../../library/functions.rst:1858 +#: ../../library/functions.rst:1869 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -3192,22 +3200,22 @@ msgid "" "method." msgstr "" -#: ../../library/functions.rst:1867 +#: ../../library/functions.rst:1878 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functions.rst:1871 +#: ../../library/functions.rst:1882 msgid "Transform a method into a static method." msgstr "" -#: ../../library/functions.rst:1873 +#: ../../library/functions.rst:1884 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -#: ../../library/functions.rst:1876 +#: ../../library/functions.rst:1887 msgid "" "class C:\n" " @staticmethod\n" @@ -3217,7 +3225,7 @@ msgstr "" " @staticmethod\n" " def f(arg1, arg2, argN): ..." -#: ../../library/functions.rst:1880 +#: ../../library/functions.rst:1891 msgid "" "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -3225,7 +3233,7 @@ msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" -#: ../../library/functions.rst:1883 +#: ../../library/functions.rst:1894 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " "an instance (such as ``C().f()``). Moreover, the static method :term:" @@ -3233,14 +3241,14 @@ msgid "" "(such as ``f()``)." msgstr "" -#: ../../library/functions.rst:1888 +#: ../../library/functions.rst:1899 msgid "" "Static methods in Python are similar to those found in Java or C++. Also, " "see :func:`classmethod` for a variant that is useful for creating alternate " "class constructors." msgstr "" -#: ../../library/functions.rst:1892 +#: ../../library/functions.rst:1903 msgid "" "Like all decorators, it is also possible to call ``staticmethod`` as a " "regular function and do something with its result. This is needed in some " @@ -3249,7 +3257,7 @@ msgid "" "cases, use this idiom::" msgstr "" -#: ../../library/functions.rst:1898 +#: ../../library/functions.rst:1909 msgid "" "def regular_function():\n" " ...\n" @@ -3263,11 +3271,11 @@ msgstr "" "class C:\n" " method = staticmethod(regular_function)" -#: ../../library/functions.rst:1904 +#: ../../library/functions.rst:1915 msgid "For more information on static methods, see :ref:`types`." msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" -#: ../../library/functions.rst:1906 +#: ../../library/functions.rst:1917 msgid "" "Static methods now inherit the method attributes (:attr:`~function." "__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" @@ -3279,25 +3287,25 @@ msgstr "" "__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " "``__wrapped__`` 屬性,且為如一般函式的可呼叫物件。" -#: ../../library/functions.rst:1922 +#: ../../library/functions.rst:1933 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" -#: ../../library/functions.rst:1924 +#: ../../library/functions.rst:1935 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -#: ../../library/functions.rst:1930 +#: ../../library/functions.rst:1941 msgid "" "Sums *start* and the items of an *iterable* from left to right and returns " "the total. The *iterable*'s items are normally numbers, and the start value " "is not allowed to be a string." msgstr "" -#: ../../library/functions.rst:1934 +#: ../../library/functions.rst:1945 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " "preferred, fast way to concatenate a sequence of strings is by calling ``''." @@ -3306,37 +3314,37 @@ msgid "" "using :func:`itertools.chain`." msgstr "" -#: ../../library/functions.rst:1940 +#: ../../library/functions.rst:1951 msgid "The *start* parameter can be specified as a keyword argument." msgstr "*start* 參數可被指定為關鍵字引數。" -#: ../../library/functions.rst:1943 +#: ../../library/functions.rst:1954 msgid "" "Summation of floats switched to an algorithm that gives higher accuracy and " "better commutativity on most builds." msgstr "" -#: ../../library/functions.rst:1950 +#: ../../library/functions.rst:1961 msgid "" "Return a proxy object that delegates method calls to a parent or sibling " "class of *type*. This is useful for accessing inherited methods that have " "been overridden in a class." msgstr "" -#: ../../library/functions.rst:1954 +#: ../../library/functions.rst:1965 msgid "" "The *object_or_type* determines the :term:`method resolution order` to be " "searched. The search starts from the class right after the *type*." msgstr "" -#: ../../library/functions.rst:1958 +#: ../../library/functions.rst:1969 msgid "" "For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" "> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -#: ../../library/functions.rst:1962 +#: ../../library/functions.rst:1973 msgid "" "The :attr:`~type.__mro__` attribute of the class corresponding to " "*object_or_type* lists the method resolution search order used by both :func:" @@ -3344,7 +3352,7 @@ msgid "" "whenever the inheritance hierarchy is updated." msgstr "" -#: ../../library/functions.rst:1967 +#: ../../library/functions.rst:1978 msgid "" "If the second argument is omitted, the super object returned is unbound. If " "the second argument is an object, ``isinstance(obj, type)`` must be true. " @@ -3352,7 +3360,7 @@ msgid "" "(this is useful for classmethods)." msgstr "" -#: ../../library/functions.rst:1972 +#: ../../library/functions.rst:1983 msgid "" "When called directly within an ordinary method of a class, both arguments " "may be omitted (\"zero-argument :func:`!super`\"). In this case, *type* will " @@ -3362,7 +3370,7 @@ msgid "" "including generator expressions, which implicitly create nested functions.)" msgstr "" -#: ../../library/functions.rst:1979 +#: ../../library/functions.rst:1990 msgid "" "There are two typical use cases for *super*. In a class hierarchy with " "single inheritance, *super* can be used to refer to parent classes without " @@ -3370,7 +3378,7 @@ msgid "" "closely parallels the use of *super* in other programming languages." msgstr "" -#: ../../library/functions.rst:1984 +#: ../../library/functions.rst:1995 msgid "" "The second use case is to support cooperative multiple inheritance in a " "dynamic execution environment. This use case is unique to Python and is not " @@ -3383,11 +3391,11 @@ msgid "" "classes that are unknown prior to runtime)." msgstr "" -#: ../../library/functions.rst:1994 +#: ../../library/functions.rst:2005 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" -#: ../../library/functions.rst:1996 +#: ../../library/functions.rst:2007 msgid "" "class C(B):\n" " def method(self, arg):\n" @@ -3395,14 +3403,14 @@ msgid "" " # super(C, self).method(arg)" msgstr "" -#: ../../library/functions.rst:2001 +#: ../../library/functions.rst:2012 msgid "" "In addition to method lookups, :func:`super` also works for attribute " "lookups. One possible use case for this is calling :term:`descriptors " "` in a parent or sibling class." msgstr "" -#: ../../library/functions.rst:2005 +#: ../../library/functions.rst:2016 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -3412,7 +3420,7 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" -#: ../../library/functions.rst:2013 +#: ../../library/functions.rst:2024 msgid "" "Also note that, aside from the zero argument form, :func:`super` is not " "limited to use inside methods. The two argument form specifies the " @@ -3422,33 +3430,33 @@ msgid "" "accessing the current instance for ordinary methods." msgstr "" -#: ../../library/functions.rst:2020 +#: ../../library/functions.rst:2031 msgid "" "For practical suggestions on how to design cooperative classes using :func:" "`super`, see `guide to using super() `_." msgstr "" -#: ../../library/functions.rst:2030 +#: ../../library/functions.rst:2041 msgid "" "Rather than being a function, :class:`tuple` is actually an immutable " "sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:2039 +#: ../../library/functions.rst:2050 msgid "" "With one argument, return the type of an *object*. The return value is a " "type object and generally the same object as returned by :attr:`object." "__class__`." msgstr "" -#: ../../library/functions.rst:2043 +#: ../../library/functions.rst:2054 msgid "" "The :func:`isinstance` built-in function is recommended for testing the type " "of an object, because it takes subclasses into account." msgstr "" -#: ../../library/functions.rst:2046 +#: ../../library/functions.rst:2057 msgid "" "With three arguments, return a new type object. This is essentially a " "dynamic form of the :keyword:`class` statement. The *name* string is the " @@ -3461,21 +3469,21 @@ msgid "" "type` objects:" msgstr "" -#: ../../library/functions.rst:2061 +#: ../../library/functions.rst:2072 msgid "See also:" msgstr "" -#: ../../library/functions.rst:2063 +#: ../../library/functions.rst:2074 msgid "" ":ref:`Documentation on attributes and methods on classes `." msgstr "" -#: ../../library/functions.rst:2064 +#: ../../library/functions.rst:2075 msgid ":ref:`bltin-type-objects`" msgstr ":ref:`bltin-type-objects`" -#: ../../library/functions.rst:2066 +#: ../../library/functions.rst:2077 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -3483,23 +3491,23 @@ msgid "" "would." msgstr "" -#: ../../library/functions.rst:2071 +#: ../../library/functions.rst:2082 msgid "See also :ref:`class-customization`." msgstr "另請參閱 :ref:`class-customization`。" -#: ../../library/functions.rst:2073 +#: ../../library/functions.rst:2084 msgid "" "Subclasses of :class:`!type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" -#: ../../library/functions.rst:2080 +#: ../../library/functions.rst:2091 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " "or any other object with a :attr:`!__dict__` attribute." msgstr "" -#: ../../library/functions.rst:2083 +#: ../../library/functions.rst:2094 msgid "" "Objects such as modules and instances have an updateable :attr:`~object." "__dict__` attribute; however, other objects may have write restrictions on " @@ -3507,34 +3515,34 @@ msgid "" "MappingProxyType` to prevent direct dictionary updates)." msgstr "" -#: ../../library/functions.rst:2088 +#: ../../library/functions.rst:2099 msgid "Without an argument, :func:`vars` acts like :func:`locals`." msgstr "" -#: ../../library/functions.rst:2090 +#: ../../library/functions.rst:2101 msgid "" "A :exc:`TypeError` exception is raised if an object is specified but it " "doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " "defines the :attr:`~object.__slots__` attribute)." msgstr "" -#: ../../library/functions.rst:2096 +#: ../../library/functions.rst:2107 msgid "" "The result of calling this function without an argument has been updated as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:2102 +#: ../../library/functions.rst:2113 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." msgstr "" -#: ../../library/functions.rst:2105 +#: ../../library/functions.rst:2116 msgid "Example::" msgstr "例如: ::" -#: ../../library/functions.rst:2107 +#: ../../library/functions.rst:2118 msgid "" ">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" "... print(item)\n" @@ -3550,27 +3558,27 @@ msgstr "" "(2, 'spice')\n" "(3, 'everything nice')" -#: ../../library/functions.rst:2114 +#: ../../library/functions.rst:2125 msgid "" "More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " "tuple contains the *i*-th element from each of the argument iterables." msgstr "" -#: ../../library/functions.rst:2117 +#: ../../library/functions.rst:2128 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " "columns into rows. This is similar to `transposing a matrix `_." msgstr "" -#: ../../library/functions.rst:2121 +#: ../../library/functions.rst:2132 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " "iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" "`list`." msgstr "" -#: ../../library/functions.rst:2125 +#: ../../library/functions.rst:2136 msgid "" "One thing to consider is that the iterables passed to :func:`zip` could have " "different lengths; sometimes by design, and sometimes because of a bug in " @@ -3578,14 +3586,14 @@ msgid "" "approaches to dealing with this issue:" msgstr "" -#: ../../library/functions.rst:2130 +#: ../../library/functions.rst:2141 msgid "" "By default, :func:`zip` stops when the shortest iterable is exhausted. It " "will ignore the remaining items in the longer iterables, cutting off the " "result to the length of the shortest iterable::" msgstr "" -#: ../../library/functions.rst:2134 +#: ../../library/functions.rst:2145 msgid "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" @@ -3593,14 +3601,14 @@ msgstr "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" -#: ../../library/functions.rst:2137 +#: ../../library/functions.rst:2148 msgid "" ":func:`zip` is often used in cases where the iterables are assumed to be of " "equal length. In such cases, it's recommended to use the ``strict=True`` " "option. Its output is the same as regular :func:`zip`::" msgstr "" -#: ../../library/functions.rst:2141 +#: ../../library/functions.rst:2152 msgid "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" @@ -3608,37 +3616,37 @@ msgstr "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" -#: ../../library/functions.rst:2144 +#: ../../library/functions.rst:2155 msgid "" "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " "is exhausted before the others:" msgstr "" -#: ../../library/functions.rst:2162 +#: ../../library/functions.rst:2173 msgid "" "Without the ``strict=True`` argument, any bug that results in iterables of " "different lengths will be silenced, possibly manifesting as a hard-to-find " "bug in another part of the program." msgstr "" -#: ../../library/functions.rst:2166 +#: ../../library/functions.rst:2177 msgid "" "Shorter iterables can be padded with a constant value to make all the " "iterables have the same length. This is done by :func:`itertools." "zip_longest`." msgstr "" -#: ../../library/functions.rst:2170 +#: ../../library/functions.rst:2181 msgid "" "Edge cases: With a single iterable argument, :func:`zip` returns an iterator " "of 1-tuples. With no arguments, it returns an empty iterator." msgstr "" -#: ../../library/functions.rst:2173 +#: ../../library/functions.rst:2184 msgid "Tips and tricks:" msgstr "" -#: ../../library/functions.rst:2175 +#: ../../library/functions.rst:2186 msgid "" "The left-to-right evaluation order of the iterables is guaranteed. This " "makes possible an idiom for clustering a data series into n-length groups " @@ -3647,13 +3655,13 @@ msgid "" "iterator. This has the effect of dividing the input into n-length chunks." msgstr "" -#: ../../library/functions.rst:2181 +#: ../../library/functions.rst:2192 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -#: ../../library/functions.rst:2184 +#: ../../library/functions.rst:2195 msgid "" ">>> x = [1, 2, 3]\n" ">>> y = [4, 5, 6]\n" @@ -3671,17 +3679,17 @@ msgstr "" ">>> x == list(x2) and y == list(y2)\n" "True" -#: ../../library/functions.rst:2192 +#: ../../library/functions.rst:2203 msgid "Added the ``strict`` argument." msgstr "增加了 ``strict`` 引數。" -#: ../../library/functions.rst:2204 +#: ../../library/functions.rst:2215 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2207 +#: ../../library/functions.rst:2218 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -3693,7 +3701,7 @@ msgid "" "discouraged in favor of :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2216 +#: ../../library/functions.rst:2227 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -3703,7 +3711,7 @@ msgid "" "determine the package context of the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2223 +#: ../../library/functions.rst:2234 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -3712,7 +3720,7 @@ msgid "" "details)." msgstr "" -#: ../../library/functions.rst:2229 +#: ../../library/functions.rst:2240 msgid "" "When the *name* variable is of the form ``package.module``, normally, the " "top-level package (the name up till the first dot) is returned, *not* the " @@ -3720,37 +3728,37 @@ msgid "" "given, the module named by *name* is returned." msgstr "" -#: ../../library/functions.rst:2234 +#: ../../library/functions.rst:2245 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" msgstr "" -#: ../../library/functions.rst:2237 +#: ../../library/functions.rst:2248 msgid "spam = __import__('spam', globals(), locals(), [], 0)" msgstr "spam = __import__('spam', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2239 +#: ../../library/functions.rst:2250 msgid "The statement ``import spam.ham`` results in this call::" msgstr "" -#: ../../library/functions.rst:2241 +#: ../../library/functions.rst:2252 msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2243 +#: ../../library/functions.rst:2254 msgid "" "Note how :func:`__import__` returns the toplevel module here because this is " "the object that is bound to a name by the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2246 +#: ../../library/functions.rst:2257 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" msgstr "" -#: ../../library/functions.rst:2249 +#: ../../library/functions.rst:2260 msgid "" "_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" "eggs = _temp.eggs\n" @@ -3760,36 +3768,36 @@ msgstr "" "eggs = _temp.eggs\n" "saus = _temp.sausage" -#: ../../library/functions.rst:2253 +#: ../../library/functions.rst:2264 msgid "" "Here, the ``spam.ham`` module is returned from :func:`__import__`. From " "this object, the names to import are retrieved and assigned to their " "respective names." msgstr "" -#: ../../library/functions.rst:2257 +#: ../../library/functions.rst:2268 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2260 +#: ../../library/functions.rst:2271 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." msgstr "" -#: ../../library/functions.rst:2264 +#: ../../library/functions.rst:2275 msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." msgstr "" -#: ../../library/functions.rst:2269 +#: ../../library/functions.rst:2280 msgid "Footnotes" msgstr "註解" -#: ../../library/functions.rst:2270 +#: ../../library/functions.rst:2281 msgid "" "Note that the parser only accepts the Unix-style end of line convention. If " "you are reading the code from a file, make sure to use newline conversion " @@ -3802,107 +3810,107 @@ msgstr "" msgid "Boolean" msgstr "Boolean(布林值)" -#: ../../library/functions.rst:154 ../../library/functions.rst:2037 +#: ../../library/functions.rst:154 ../../library/functions.rst:2048 msgid "type" msgstr "type(型別)" -#: ../../library/functions.rst:643 +#: ../../library/functions.rst:648 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/functions.rst:643 +#: ../../library/functions.rst:648 msgid "exec" msgstr "exec" -#: ../../library/functions.rst:736 +#: ../../library/functions.rst:746 msgid "NaN" msgstr "NaN" -#: ../../library/functions.rst:736 +#: ../../library/functions.rst:746 msgid "Infinity" msgstr "Infinity(無窮)" -#: ../../library/functions.rst:804 +#: ../../library/functions.rst:814 msgid "__format__" msgstr "__format__" -#: ../../library/functions.rst:804 ../../library/functions.rst:1914 +#: ../../library/functions.rst:814 ../../library/functions.rst:1925 msgid "string" msgstr "string(字串)" -#: ../../library/functions.rst:804 +#: ../../library/functions.rst:814 msgid "format() (built-in function)" msgstr "format()(內建函式)" -#: ../../library/functions.rst:1314 +#: ../../library/functions.rst:1325 msgid "file object" msgstr "file object(檔案物件)" -#: ../../library/functions.rst:1314 ../../library/functions.rst:1435 +#: ../../library/functions.rst:1325 ../../library/functions.rst:1446 msgid "open() built-in function" msgstr "open() 內建函式" -#: ../../library/functions.rst:1342 +#: ../../library/functions.rst:1353 msgid "file" msgstr "file(檔案)" -#: ../../library/functions.rst:1342 +#: ../../library/functions.rst:1353 msgid "modes" msgstr "modes(模式)" -#: ../../library/functions.rst:1435 +#: ../../library/functions.rst:1446 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "line-buffered I/O" msgstr "line-buffered I/O(行緩衝 I/O)" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "unbuffered I/O" msgstr "unbuffered I/O(非緩衝 I/O)" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "buffer size, I/O" msgstr "buffer size, I/O(緩衝區大小、I/O)" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "text mode" msgstr "text mode(文字模式)" -#: ../../library/functions.rst:1496 ../../library/functions.rst:2198 +#: ../../library/functions.rst:1507 ../../library/functions.rst:2209 msgid "module" msgstr "module(模組)" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "sys" msgstr "sys" -#: ../../library/functions.rst:1914 +#: ../../library/functions.rst:1925 msgid "str() (built-in function)" msgstr "str() (內建函式)" -#: ../../library/functions.rst:2037 +#: ../../library/functions.rst:2048 msgid "object" msgstr "object(物件)" -#: ../../library/functions.rst:2198 +#: ../../library/functions.rst:2209 msgid "statement" msgstr "statement(陳述式)" -#: ../../library/functions.rst:2198 +#: ../../library/functions.rst:2209 msgid "import" msgstr "import(引入)" -#: ../../library/functions.rst:2198 +#: ../../library/functions.rst:2209 msgid "builtins" msgstr "builtins(內建)" diff --git a/library/getopt.po b/library/getopt.po index f4467adec5..8ec79f09ad 100644 --- a/library/getopt.po +++ b/library/getopt.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-11-05 00:13+0000\n" "PO-Revision-Date: 2016-01-31 07:19+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -132,15 +131,65 @@ msgstr "" msgid "An example using only Unix style options:" msgstr "" -#: ../../library/getopt.rst:110 +#: ../../library/getopt.rst:100 +msgid "" +">>> import getopt\n" +">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" +">>> args\n" +"['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']\n" +">>> optlist, args = getopt.getopt(args, 'abc:d:')\n" +">>> optlist\n" +"[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]\n" +">>> args\n" +"['a1', 'a2']" +msgstr "" +">>> import getopt\n" +">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" +">>> args\n" +"['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']\n" +">>> optlist, args = getopt.getopt(args, 'abc:d:')\n" +">>> optlist\n" +"[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]\n" +">>> args\n" +"['a1', 'a2']" + +#: ../../library/getopt.rst:112 msgid "Using long option names is equally easy:" msgstr "" -#: ../../library/getopt.rst:123 -msgid "In a script, typical usage is something like this::" +#: ../../library/getopt.rst:114 +msgid "" +">>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n" +">>> args = s.split()\n" +">>> args\n" +"['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', " +"'a2']\n" +">>> optlist, args = getopt.getopt(args, 'x', [\n" +"... 'condition=', 'output-file=', 'testing'])\n" +">>> optlist\n" +"[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-" +"x', '')]\n" +">>> args\n" +"['a1', 'a2']" +msgstr "" +">>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n" +">>> args = s.split()\n" +">>> args\n" +"['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', " +"'a2']\n" +">>> optlist, args = getopt.getopt(args, 'x', [\n" +"... 'condition=', 'output-file=', 'testing'])\n" +">>> optlist\n" +"[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-" +"x', '')]\n" +">>> args\n" +"['a1', 'a2']" + +#: ../../library/getopt.rst:127 +msgid "In a script, typical usage is something like this:" msgstr "" -#: ../../library/getopt.rst:125 +#: ../../library/getopt.rst:129 msgid "" "import getopt, sys\n" "\n" @@ -171,15 +220,42 @@ msgid "" "if __name__ == \"__main__\":\n" " main()" msgstr "" +"import getopt, sys\n" +"\n" +"def main():\n" +" try:\n" +" opts, args = getopt.getopt(sys.argv[1:], \"ho:v\", [\"help\", " +"\"output=\"])\n" +" except getopt.GetoptError as err:\n" +" # 印出幫助訊息並退出:\n" +" print(err) # 會印出像是 \"option -a not recognized\" 的訊息\n" +" usage()\n" +" sys.exit(2)\n" +" output = None\n" +" verbose = False\n" +" for o, a in opts:\n" +" if o == \"-v\":\n" +" verbose = True\n" +" elif o in (\"-h\", \"--help\"):\n" +" usage()\n" +" sys.exit()\n" +" elif o in (\"-o\", \"--output\"):\n" +" output = a\n" +" else:\n" +" assert False, \"unhandled option\"\n" +" # ...\n" +"\n" +"if __name__ == \"__main__\":\n" +" main()" -#: ../../library/getopt.rst:152 +#: ../../library/getopt.rst:158 msgid "" "Note that an equivalent command line interface could be produced with less " "code and more informative help and error messages by using the :mod:" -"`argparse` module::" +"`argparse` module:" msgstr "" -#: ../../library/getopt.rst:155 +#: ../../library/getopt.rst:161 msgid "" "import argparse\n" "\n" @@ -192,10 +268,10 @@ msgid "" " # ... do something with args.verbose .." msgstr "" -#: ../../library/getopt.rst:167 +#: ../../library/getopt.rst:175 msgid "Module :mod:`argparse`" msgstr ":mod:`argparse` 模組" -#: ../../library/getopt.rst:168 +#: ../../library/getopt.rst:176 msgid "Alternative command line option and argument parsing library." msgstr "" diff --git a/library/glob.po b/library/glob.po index 08c7f860d9..287f0efe19 100644 --- a/library/glob.po +++ b/library/glob.po @@ -186,7 +186,7 @@ msgstr "" #: ../../library/glob.rst:131 msgid "For example:" -msgstr "" +msgstr "舉例來說:" #: ../../library/glob.rst:142 msgid "" @@ -221,10 +221,9 @@ msgstr "" #: ../../library/glob.rst:165 msgid "Examples" -msgstr "" +msgstr "範例" #: ../../library/glob.rst:167 -#, fuzzy msgid "" "Consider a directory containing the following files: :file:`1.gif`, :file:`2." "txt`, :file:`card.gif` and a subdirectory :file:`sub` which contains only " @@ -285,10 +284,9 @@ msgstr "" "['.card.gif']" #: ../../library/glob.rst:196 -#, fuzzy msgid "" "The :mod:`fnmatch` module offers shell-style filename (not path) expansion." -msgstr "Shell 風格檔案名(不是路徑)的擴展" +msgstr ":mod:`fnmatch` 模組提供了 shell 風格檔案名(不是路徑)的擴展" #: ../../library/glob.rst:199 msgid "The :mod:`pathlib` module offers high-level path objects." @@ -333,6 +331,3 @@ msgstr ". (點)" #: ../../library/glob.rst:61 msgid "**" msgstr "**" - -#~ msgid "Module :mod:`fnmatch`" -#~ msgstr ":mod:`fnmatch` 模組" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index c84bdc92dd..19f0cfe625 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-08 03:35+0000\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -72,7 +72,7 @@ msgstr "" #: ../../library/importlib.metadata.rst:55 msgid "https://importlib-metadata.readthedocs.io/" -msgstr "" +msgstr "https://importlib-metadata.readthedocs.io/" #: ../../library/importlib.metadata.rst:56 msgid "" @@ -369,13 +369,10 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:231 -msgid "A concrete implementation of the" -msgstr "" - -#: ../../library/importlib.metadata.rst:232 msgid "" -"`PackageMetadata protocol `_." +"A concrete implementation of the `PackageMetadata protocol `_." msgstr "" #: ../../library/importlib.metadata.rst:234 @@ -878,7 +875,7 @@ msgstr "" #: ../../library/importlib.metadata.rst:558 msgid "" -"class DatabaseDistribution(importlib.metadata.Distributon):\n" +"class DatabaseDistribution(importlib.metadata.Distribution):\n" " def __init__(self, record):\n" " self.record = record\n" "\n" diff --git a/library/ipaddress.po b/library/ipaddress.po index a5c2cc8284..f168829f23 100644 --- a/library/ipaddress.po +++ b/library/ipaddress.po @@ -480,7 +480,7 @@ msgstr "" #: ../../library/ipaddress.rst:405 ../../library/ipaddress.rst:789 #: ../../library/ipaddress.rst:925 msgid "Operators" -msgstr "" +msgstr "運算子" #: ../../library/ipaddress.rst:407 msgid "" @@ -491,7 +491,7 @@ msgstr "" #: ../../library/ipaddress.rst:413 msgid "Comparison operators" -msgstr "" +msgstr "比較運算子" #: ../../library/ipaddress.rst:415 msgid "" @@ -526,7 +526,7 @@ msgstr "" #: ../../library/ipaddress.rst:432 msgid "Arithmetic operators" -msgstr "" +msgstr "算術運算子" #: ../../library/ipaddress.rst:434 msgid "" @@ -879,7 +879,7 @@ msgstr "" #: ../../library/ipaddress.rst:804 msgid "Iteration" -msgstr "" +msgstr "疊代" #: ../../library/ipaddress.rst:806 msgid "" diff --git a/library/locale.po b/library/locale.po index c36cbfaff7..6a5c230140 100644 --- a/library/locale.po +++ b/library/locale.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -331,111 +331,110 @@ msgstr "" #: ../../library/locale.rst:161 msgid "" -"Return some locale-specific information as a string (or a tuple for " -"``ALT_DIGITS``). This function is not available on all systems, and the set " -"of possible options might also vary across platforms. The possible argument " -"values are numbers, for which symbolic constants are available in the locale " -"module." +"Return some locale-specific information as a string. This function is not " +"available on all systems, and the set of possible options might also vary " +"across platforms. The possible argument values are numbers, for which " +"symbolic constants are available in the locale module." msgstr "" -#: ../../library/locale.rst:167 +#: ../../library/locale.rst:166 msgid "" "The :func:`nl_langinfo` function accepts one of the following keys. Most " "descriptions are taken from the corresponding description in the GNU C " "library." msgstr "" -#: ../../library/locale.rst:173 +#: ../../library/locale.rst:172 msgid "" "Get a string with the name of the character encoding used in the selected " "locale." msgstr "" -#: ../../library/locale.rst:178 +#: ../../library/locale.rst:177 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent date and time in a locale-specific way." msgstr "" -#: ../../library/locale.rst:183 +#: ../../library/locale.rst:182 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent a date in a locale-specific way." msgstr "" -#: ../../library/locale.rst:188 +#: ../../library/locale.rst:187 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent a time in a locale-specific way." msgstr "" -#: ../../library/locale.rst:193 +#: ../../library/locale.rst:192 msgid "" "Get a format string for :func:`time.strftime` to represent time in the am/pm " "format." msgstr "" -#: ../../library/locale.rst:204 +#: ../../library/locale.rst:203 msgid "Get the name of the n-th day of the week." msgstr "" -#: ../../library/locale.rst:208 +#: ../../library/locale.rst:207 msgid "" "This follows the US convention of :const:`DAY_1` being Sunday, not the " "international convention (ISO 8601) that Monday is the first day of the week." msgstr "" -#: ../../library/locale.rst:220 +#: ../../library/locale.rst:219 msgid "Get the abbreviated name of the n-th day of the week." msgstr "" -#: ../../library/locale.rst:235 +#: ../../library/locale.rst:234 msgid "Get the name of the n-th month." msgstr "" -#: ../../library/locale.rst:250 +#: ../../library/locale.rst:249 msgid "Get the abbreviated name of the n-th month." msgstr "" -#: ../../library/locale.rst:254 +#: ../../library/locale.rst:253 msgid "Get the radix character (decimal dot, decimal comma, etc.)." msgstr "" -#: ../../library/locale.rst:258 +#: ../../library/locale.rst:257 msgid "Get the separator character for thousands (groups of three digits)." msgstr "" -#: ../../library/locale.rst:262 +#: ../../library/locale.rst:261 msgid "" "Get a regular expression that can be used with the regex function to " "recognize a positive response to a yes/no question." msgstr "" -#: ../../library/locale.rst:267 +#: ../../library/locale.rst:266 msgid "" "Get a regular expression that can be used with the ``regex(3)`` function to " "recognize a negative response to a yes/no question." msgstr "" -#: ../../library/locale.rst:272 +#: ../../library/locale.rst:271 msgid "" "The regular expressions for :const:`YESEXPR` and :const:`NOEXPR` use syntax " "suitable for the ``regex`` function from the C library, which might differ " "from the syntax used in :mod:`re`." msgstr "" -#: ../../library/locale.rst:279 +#: ../../library/locale.rst:278 msgid "" "Get the currency symbol, preceded by \"-\" if the symbol should appear " "before the value, \"+\" if the symbol should appear after the value, or \"." "\" if the symbol should replace the radix character." msgstr "" -#: ../../library/locale.rst:285 +#: ../../library/locale.rst:284 msgid "Get a string that represents the era used in the current locale." msgstr "" -#: ../../library/locale.rst:287 +#: ../../library/locale.rst:286 msgid "" "Most locales do not define this value. An example of a locale which does " "define this value is the Japanese one. In Japan, the traditional " @@ -443,7 +442,7 @@ msgid "" "then-emperor's reign." msgstr "" -#: ../../library/locale.rst:292 +#: ../../library/locale.rst:291 msgid "" "Normally it should not be necessary to use this value directly. Specifying " "the ``E`` modifier in their format strings causes the :func:`time.strftime` " @@ -452,35 +451,38 @@ msgid "" "systems." msgstr "" -#: ../../library/locale.rst:300 +#: ../../library/locale.rst:299 msgid "" "Get a format string for :func:`time.strftime` to represent date and time in " "a locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:305 +#: ../../library/locale.rst:304 msgid "" "Get a format string for :func:`time.strftime` to represent a date in a " "locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:310 +#: ../../library/locale.rst:309 msgid "" "Get a format string for :func:`time.strftime` to represent a time in a " "locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:315 -msgid "Get a tuple of up to 100 strings used to represent the values 0 to 99." +#: ../../library/locale.rst:314 +msgid "" +"Get a string consisting of up to 100 semicolon-separated symbols used to " +"represent the values 0 to 99 in a locale-specific way. In most locales this " +"is an empty string." msgstr "" -#: ../../library/locale.rst:320 +#: ../../library/locale.rst:321 msgid "" "Tries to determine the default locale settings and returns them as a tuple " "of the form ``(language code, encoding)``." msgstr "" -#: ../../library/locale.rst:323 +#: ../../library/locale.rst:324 msgid "" "According to POSIX, a program which has not called ``setlocale(LC_ALL, '')`` " "runs using the portable ``'C'`` locale. Calling ``setlocale(LC_ALL, '')`` " @@ -489,7 +491,7 @@ msgid "" "emulate the behavior in the way described above." msgstr "" -#: ../../library/locale.rst:329 +#: ../../library/locale.rst:330 msgid "" "To maintain compatibility with other platforms, not only the :envvar:`LANG` " "variable is tested, but a list of variables given as envvars parameter. The " @@ -499,21 +501,21 @@ msgid "" "``'LC_CTYPE'``, ``'LANG'`` and ``'LANGUAGE'``, in that order." msgstr "" -#: ../../library/locale.rst:336 ../../library/locale.rst:349 +#: ../../library/locale.rst:337 ../../library/locale.rst:350 msgid "" "Except for the code ``'C'``, the language code corresponds to :rfc:`1766`. " "*language code* and *encoding* may be ``None`` if their values cannot be " "determined." msgstr "" -#: ../../library/locale.rst:345 +#: ../../library/locale.rst:346 msgid "" "Returns the current setting for the given locale category as sequence " "containing *language code*, *encoding*. *category* may be one of the :const:" "`!LC_\\*` values except :const:`LC_ALL`. It defaults to :const:`LC_CTYPE`." msgstr "" -#: ../../library/locale.rst:356 +#: ../../library/locale.rst:357 msgid "" "Return the :term:`locale encoding` used for text data, according to user " "preferences. User preferences are expressed differently on different " @@ -521,72 +523,72 @@ msgid "" "this function only returns a guess." msgstr "" -#: ../../library/locale.rst:361 +#: ../../library/locale.rst:362 msgid "" "On some systems, it is necessary to invoke :func:`setlocale` to obtain the " "user preferences, so this function is not thread-safe. If invoking setlocale " "is not necessary or desired, *do_setlocale* should be set to ``False``." msgstr "" -#: ../../library/locale.rst:365 +#: ../../library/locale.rst:366 msgid "" "On Android or if the :ref:`Python UTF-8 Mode ` is enabled, always " "return ``'utf-8'``, the :term:`locale encoding` and the *do_setlocale* " "argument are ignored." msgstr "" -#: ../../library/locale.rst:369 ../../library/locale.rst:387 +#: ../../library/locale.rst:370 ../../library/locale.rst:388 msgid "" "The :ref:`Python preinitialization ` configures the LC_CTYPE " "locale. See also the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../library/locale.rst:372 +#: ../../library/locale.rst:373 msgid "" "The function now always returns ``\"utf-8\"`` on Android or if the :ref:" "`Python UTF-8 Mode ` is enabled." msgstr "" -#: ../../library/locale.rst:379 +#: ../../library/locale.rst:380 msgid "Get the current :term:`locale encoding`:" msgstr "" -#: ../../library/locale.rst:381 +#: ../../library/locale.rst:382 msgid "On Android and VxWorks, return ``\"utf-8\"``." msgstr "" -#: ../../library/locale.rst:382 +#: ../../library/locale.rst:383 msgid "" "On Unix, return the encoding of the current :data:`LC_CTYPE` locale. Return " "``\"utf-8\"`` if ``nl_langinfo(CODESET)`` returns an empty string: for " "example, if the current LC_CTYPE locale is not supported." msgstr "" -#: ../../library/locale.rst:385 +#: ../../library/locale.rst:386 msgid "On Windows, return the ANSI code page." msgstr "" -#: ../../library/locale.rst:390 +#: ../../library/locale.rst:391 msgid "" "This function is similar to :func:`getpreferredencoding(False) " "` except this function ignores the :ref:`Python UTF-8 " "Mode `." msgstr "" -#: ../../library/locale.rst:399 +#: ../../library/locale.rst:400 msgid "" "Returns a normalized locale code for the given locale name. The returned " "locale code is formatted for use with :func:`setlocale`. If normalization " "fails, the original name is returned unchanged." msgstr "" -#: ../../library/locale.rst:403 +#: ../../library/locale.rst:404 msgid "" "If the given encoding is not known, the function defaults to the default " "encoding for the locale code just like :func:`setlocale`." msgstr "" -#: ../../library/locale.rst:409 +#: ../../library/locale.rst:410 msgid "" "Compares two strings according to the current :const:`LC_COLLATE` setting. " "As any other compare function, returns a negative, or a positive value, or " @@ -594,7 +596,7 @@ msgid "" "is equal to it." msgstr "" -#: ../../library/locale.rst:417 +#: ../../library/locale.rst:418 msgid "" "Transforms a string to one that can be used in locale-aware comparisons. " "For example, ``strxfrm(s1) < strxfrm(s2)`` is equivalent to ``strcoll(s1, " @@ -602,7 +604,7 @@ msgid "" "repeatedly, e.g. when collating a sequence of strings." msgstr "" -#: ../../library/locale.rst:426 +#: ../../library/locale.rst:427 msgid "" "Formats a number *val* according to the current :const:`LC_NUMERIC` setting. " "The format follows the conventions of the ``%`` operator. For floating-" @@ -610,29 +612,29 @@ msgid "" "is ``True``, also takes the grouping into account." msgstr "" -#: ../../library/locale.rst:431 +#: ../../library/locale.rst:432 msgid "" "If *monetary* is true, the conversion uses monetary thousands separator and " "grouping strings." msgstr "" -#: ../../library/locale.rst:434 +#: ../../library/locale.rst:435 msgid "" "Processes formatting specifiers as in ``format % val``, but takes the " "current locale settings into account." msgstr "" -#: ../../library/locale.rst:437 +#: ../../library/locale.rst:438 msgid "The *monetary* keyword parameter was added." msgstr "" -#: ../../library/locale.rst:443 +#: ../../library/locale.rst:444 msgid "" "Formats a number *val* according to the current :const:`LC_MONETARY` " "settings." msgstr "" -#: ../../library/locale.rst:445 +#: ../../library/locale.rst:446 msgid "" "The returned string includes the currency symbol if *symbol* is true, which " "is the default. If *grouping* is ``True`` (which is not the default), " @@ -640,43 +642,43 @@ msgid "" "not the default), the international currency symbol is used." msgstr "" -#: ../../library/locale.rst:452 +#: ../../library/locale.rst:453 msgid "" "This function will not work with the 'C' locale, so you have to set a locale " "via :func:`setlocale` first." msgstr "" -#: ../../library/locale.rst:458 +#: ../../library/locale.rst:459 msgid "" "Formats a floating-point number using the same format as the built-in " "function ``str(float)``, but takes the decimal point into account." msgstr "" -#: ../../library/locale.rst:464 +#: ../../library/locale.rst:465 msgid "" "Converts a string into a normalized number string, following the :const:" "`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:472 +#: ../../library/locale.rst:473 msgid "" "Converts a normalized number string into a formatted string following the :" "const:`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:480 +#: ../../library/locale.rst:481 msgid "" "Converts a string to a number, following the :const:`LC_NUMERIC` settings, " "by calling *func* on the result of calling :func:`delocalize` on *string*." msgstr "" -#: ../../library/locale.rst:486 +#: ../../library/locale.rst:487 msgid "" "Converts a string to an integer, following the :const:`LC_NUMERIC` " "conventions." msgstr "" -#: ../../library/locale.rst:491 +#: ../../library/locale.rst:492 msgid "" "Locale category for the character type functions. Most importantly, this " "category defines the text encoding, i.e. how bytes are interpreted as " @@ -686,32 +688,32 @@ msgid "" "SSH connections." msgstr "" -#: ../../library/locale.rst:498 +#: ../../library/locale.rst:499 msgid "" "Python doesn't internally use locale-dependent character transformation " "functions from ``ctype.h``. Instead, an internal ``pyctype.h`` provides " "locale-independent equivalents like :c:macro:`!Py_TOLOWER`." msgstr "" -#: ../../library/locale.rst:505 +#: ../../library/locale.rst:506 msgid "" "Locale category for sorting strings. The functions :func:`strcoll` and :" "func:`strxfrm` of the :mod:`locale` module are affected." msgstr "" -#: ../../library/locale.rst:511 +#: ../../library/locale.rst:512 msgid "" "Locale category for the formatting of time. The function :func:`time." "strftime` follows these conventions." msgstr "" -#: ../../library/locale.rst:517 +#: ../../library/locale.rst:518 msgid "" "Locale category for formatting of monetary values. The available options " "are available from the :func:`localeconv` function." msgstr "" -#: ../../library/locale.rst:523 +#: ../../library/locale.rst:524 msgid "" "Locale category for message display. Python currently does not support " "application specific locale-aware messages. Messages displayed by the " @@ -719,13 +721,13 @@ msgid "" "affected by this category." msgstr "" -#: ../../library/locale.rst:528 +#: ../../library/locale.rst:529 msgid "" "This value may not be available on operating systems not conforming to the " "POSIX standard, most notably Windows." msgstr "" -#: ../../library/locale.rst:534 +#: ../../library/locale.rst:535 msgid "" "Locale category for formatting numbers. The functions :func:" "`format_string`, :func:`atoi`, :func:`atof` and :func:`.str` of the :mod:" @@ -733,7 +735,7 @@ msgid "" "operations are not affected." msgstr "" -#: ../../library/locale.rst:542 +#: ../../library/locale.rst:543 msgid "" "Combination of all locale settings. If this flag is used when the locale is " "changed, setting the locale for all categories is attempted. If that fails " @@ -743,17 +745,17 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:551 +#: ../../library/locale.rst:552 msgid "" "This is a symbolic constant used for different values returned by :func:" "`localeconv`." msgstr "" -#: ../../library/locale.rst:555 +#: ../../library/locale.rst:556 msgid "Example::" msgstr "範例: ::" -#: ../../library/locale.rst:557 +#: ../../library/locale.rst:558 msgid "" ">>> import locale\n" ">>> loc = locale.getlocale() # get current locale\n" @@ -766,11 +768,11 @@ msgid "" ">>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale" msgstr "" -#: ../../library/locale.rst:568 +#: ../../library/locale.rst:569 msgid "Background, details, hints, tips and caveats" msgstr "" -#: ../../library/locale.rst:570 +#: ../../library/locale.rst:571 msgid "" "The C standard defines the locale as a program-wide property that may be " "relatively expensive to change. On top of that, some implementations are " @@ -778,7 +780,7 @@ msgid "" "This makes the locale somewhat painful to use correctly." msgstr "" -#: ../../library/locale.rst:575 +#: ../../library/locale.rst:576 msgid "" "Initially, when a program is started, the locale is the ``C`` locale, no " "matter what the user's preferred locale is. There is one exception: the :" @@ -788,7 +790,7 @@ msgid "" "categories by calling ``setlocale(LC_ALL, '')``." msgstr "" -#: ../../library/locale.rst:582 +#: ../../library/locale.rst:583 msgid "" "It is generally a bad idea to call :func:`setlocale` in some library " "routine, since as a side effect it affects the entire program. Saving and " @@ -796,7 +798,7 @@ msgid "" "that happen to run before the settings have been restored." msgstr "" -#: ../../library/locale.rst:587 +#: ../../library/locale.rst:588 msgid "" "If, when coding a module for general use, you need a locale independent " "version of an operation that is affected by the locale (such as certain " @@ -807,14 +809,14 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:594 +#: ../../library/locale.rst:595 msgid "" "The only way to perform numeric operations according to the locale is to use " "the special functions defined by this module: :func:`atof`, :func:`atoi`, :" "func:`format_string`, :func:`.str`." msgstr "" -#: ../../library/locale.rst:598 +#: ../../library/locale.rst:599 msgid "" "There is no way to perform case conversions and character classifications " "according to the locale. For (Unicode) text strings these are done " @@ -825,11 +827,11 @@ msgid "" "whitespace." msgstr "" -#: ../../library/locale.rst:609 +#: ../../library/locale.rst:610 msgid "For extension writers and programs that embed Python" msgstr "" -#: ../../library/locale.rst:611 +#: ../../library/locale.rst:612 msgid "" "Extension modules should never call :func:`setlocale`, except to find out " "what the current locale is. But since the return value can only be used " @@ -837,7 +839,7 @@ msgid "" "whether or not the locale is ``C``)." msgstr "" -#: ../../library/locale.rst:616 +#: ../../library/locale.rst:617 msgid "" "When Python code uses the :mod:`locale` module to change the locale, this " "also affects the embedding application. If the embedding application " @@ -847,11 +849,11 @@ msgid "" "accessible as a shared library." msgstr "" -#: ../../library/locale.rst:627 +#: ../../library/locale.rst:628 msgid "Access to message catalogs" msgstr "" -#: ../../library/locale.rst:636 +#: ../../library/locale.rst:637 msgid "" "The locale module exposes the C library's gettext interface on systems that " "provide this interface. It consists of the functions :func:`gettext`, :func:" @@ -862,7 +864,7 @@ msgid "" "locating message catalogs." msgstr "" -#: ../../library/locale.rst:643 +#: ../../library/locale.rst:644 msgid "" "Python applications should normally find no need to invoke these functions, " "and should use :mod:`gettext` instead. A known exception to this rule are " diff --git a/library/math.po b/library/math.po index b691fbe5dc..f4edab863e 100644 --- a/library/math.po +++ b/library/math.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-11-05 00:13+0000\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -52,10 +51,544 @@ msgid "" msgstr "此模組提供下列函式。除非特意註明,否則回傳值皆為浮點數。" #: ../../library/math.rst:30 +msgid "**Number-theoretic and representation functions**" +msgstr "**數論與表現函式**" + +#: ../../library/math.rst:32 +msgid ":func:`ceil(x) `" +msgstr ":func:`ceil(x) `" + +#: ../../library/math.rst:32 +msgid "Ceiling of *x*, the smallest integer greater than or equal to *x*" +msgstr "" + +#: ../../library/math.rst:33 +msgid ":func:`comb(n, k) `" +msgstr ":func:`comb(n, k) `" + +#: ../../library/math.rst:33 +msgid "" +"Number of ways to choose *k* items from *n* items without repetition and " +"without order" +msgstr "從 *n* 個物品中不重複且不考慮排序地取出 *k* 個物品的方法數。" + +#: ../../library/math.rst:34 +msgid ":func:`copysign(x, y) `" +msgstr ":func:`copysign(x, y) `" + +#: ../../library/math.rst:34 +msgid "Magnitude (absolute value) of *x* with the sign of *y*" +msgstr "" + +#: ../../library/math.rst:35 +msgid ":func:`fabs(x) `" +msgstr ":func:`fabs(x) `" + +#: ../../library/math.rst:35 +msgid "Absolute value of *x*" +msgstr "*x* 的絕對值。" + +#: ../../library/math.rst:36 +msgid ":func:`factorial(n) `" +msgstr ":func:`factorial(n) `" + +#: ../../library/math.rst:36 +msgid "*n* factorial" +msgstr "" + +#: ../../library/math.rst:37 +msgid ":func:`floor (x) `" +msgstr ":func:`floor (x) `" + +#: ../../library/math.rst:37 +msgid "Floor of *x*, the largest integer less than or equal to *x*" +msgstr "" + +#: ../../library/math.rst:38 +msgid ":func:`fma(x, y, z) `" +msgstr ":func:`fma(x, y, z) `" + +#: ../../library/math.rst:38 +msgid "Fused multiply-add operation: ``(x * y) + z``" +msgstr "" + +#: ../../library/math.rst:39 +msgid ":func:`fmod(x, y) `" +msgstr ":func:`fmod(x, y) `" + +#: ../../library/math.rst:39 +msgid "Remainder of division ``x / y``" +msgstr "" + +#: ../../library/math.rst:40 +msgid ":func:`frexp(x) `" +msgstr ":func:`frexp(x) `" + +#: ../../library/math.rst:40 +msgid "Mantissa and exponent of *x*" +msgstr "" + +#: ../../library/math.rst:41 +msgid ":func:`fsum(iterable) `" +msgstr ":func:`fsum(iterable) `" + +#: ../../library/math.rst:41 +msgid "Sum of values in the input *iterable*" +msgstr "" + +#: ../../library/math.rst:42 +msgid ":func:`gcd(*integers) `" +msgstr ":func:`gcd(*integers) `" + +#: ../../library/math.rst:42 +msgid "Greatest common divisor of the integer arguments" +msgstr "" + +#: ../../library/math.rst:43 +msgid ":func:`isclose(a, b, rel_tol, abs_tol) `" +msgstr ":func:`isclose(a, b, rel_tol, abs_tol) `" + +#: ../../library/math.rst:43 +msgid "Check if the values *a* and *b* are close to each other" +msgstr "" + +#: ../../library/math.rst:44 +msgid ":func:`isfinite(x) `" +msgstr ":func:`isfinite(x) `" + +#: ../../library/math.rst:44 +msgid "Check if *x* is neither an infinity nor a NaN" +msgstr "" + +#: ../../library/math.rst:45 +msgid ":func:`isinf(x) `" +msgstr ":func:`isinf(x) `" + +#: ../../library/math.rst:45 +msgid "Check if *x* is a positive or negative infinity" +msgstr "" + +#: ../../library/math.rst:46 +msgid ":func:`isnan(x) `" +msgstr ":func:`isnan(x) `" + +#: ../../library/math.rst:46 +msgid "Check if *x* is a NaN (not a number)" +msgstr "" + +#: ../../library/math.rst:47 +msgid ":func:`isqrt(n) `" +msgstr ":func:`isqrt(n) `" + +#: ../../library/math.rst:47 +msgid "Integer square root of a nonnegative integer *n*" +msgstr "" + +#: ../../library/math.rst:48 +msgid ":func:`lcm(*integers) `" +msgstr ":func:`lcm(*integers) `" + +#: ../../library/math.rst:48 +msgid "Least common multiple of the integer arguments" +msgstr "" + +#: ../../library/math.rst:49 +msgid ":func:`ldexp(x, i) `" +msgstr ":func:`ldexp(x, i) `" + +#: ../../library/math.rst:49 +msgid "``x * (2**i)``, inverse of function :func:`frexp`" +msgstr "" + +#: ../../library/math.rst:50 +msgid ":func:`modf(x) `" +msgstr ":func:`modf(x) `" + +#: ../../library/math.rst:50 +msgid "Fractional and integer parts of *x*" +msgstr "" + +#: ../../library/math.rst:51 +msgid ":func:`nextafter(x, y, steps) `" +msgstr ":func:`nextafter(x, y, steps) `" + +#: ../../library/math.rst:51 +msgid "Floating-point value *steps* steps after *x* towards *y*" +msgstr "" + +#: ../../library/math.rst:52 +msgid ":func:`perm(n, k) `" +msgstr ":func:`perm(n, k) `" + +#: ../../library/math.rst:52 +msgid "" +"Number of ways to choose *k* items from *n* items without repetition and " +"with order" +msgstr "從 *n* 個物品中不重複但考慮排序地取出 *k* 個物品的方法數。" + +#: ../../library/math.rst:53 +msgid ":func:`prod(iterable, start) `" +msgstr ":func:`prod(iterable, start) `" + +#: ../../library/math.rst:53 +msgid "Product of elements in the input *iterable* with a *start* value" +msgstr "" + +#: ../../library/math.rst:54 +msgid ":func:`remainder(x, y) `" +msgstr ":func:`remainder(x, y) `" + +#: ../../library/math.rst:54 +msgid "Remainder of *x* with respect to *y*" +msgstr "" + +#: ../../library/math.rst:55 +msgid ":func:`sumprod(p, q) `" +msgstr ":func:`sumprod(p, q) `" + +#: ../../library/math.rst:55 +msgid "Sum of products from two iterables *p* and *q*" +msgstr "" + +#: ../../library/math.rst:56 +msgid ":func:`trunc(x) `" +msgstr ":func:`trunc(x) `" + +#: ../../library/math.rst:56 +msgid "Integer part of *x*" +msgstr "" + +#: ../../library/math.rst:57 +msgid ":func:`ulp(x) `" +msgstr ":func:`ulp(x) `" + +#: ../../library/math.rst:57 +msgid "Value of the least significant bit of *x*" +msgstr "" + +#: ../../library/math.rst:59 +msgid "**Power and logarithmic functions**" +msgstr "" + +#: ../../library/math.rst:61 +msgid ":func:`cbrt(x) `" +msgstr ":func:`cbrt(x) `" + +#: ../../library/math.rst:61 +msgid "Cube root of *x*" +msgstr "" + +#: ../../library/math.rst:62 +msgid ":func:`exp(x) `" +msgstr ":func:`exp(x) `" + +#: ../../library/math.rst:62 +msgid "*e* raised to the power *x*" +msgstr "" + +#: ../../library/math.rst:63 +msgid ":func:`exp2(x) `" +msgstr ":func:`exp2(x) `" + +#: ../../library/math.rst:63 +msgid "*2* raised to the power *x*" +msgstr "" + +#: ../../library/math.rst:64 +msgid ":func:`expm1(x) `" +msgstr ":func:`expm1(x) `" + +#: ../../library/math.rst:64 +msgid "*e* raised to the power *x*, minus 1" +msgstr "" + +#: ../../library/math.rst:65 +msgid ":func:`log(x, base) `" +msgstr ":func:`log(x, base) `" + +#: ../../library/math.rst:65 +msgid "Logarithm of *x* to the given base (*e* by default)" +msgstr "" + +#: ../../library/math.rst:66 +msgid ":func:`log1p(x) `" +msgstr ":func:`log1p(x) `" + +#: ../../library/math.rst:66 +msgid "Natural logarithm of *1+x* (base *e*)" +msgstr "" + +#: ../../library/math.rst:67 +msgid ":func:`log2(x) `" +msgstr ":func:`log2(x) `" + +#: ../../library/math.rst:67 +msgid "Base-2 logarithm of *x*" +msgstr "" + +#: ../../library/math.rst:68 +msgid ":func:`log10(x) `" +msgstr ":func:`log10(x) `" + +#: ../../library/math.rst:68 +msgid "Base-10 logarithm of *x*" +msgstr "" + +#: ../../library/math.rst:69 +msgid ":func:`pow(x, y) `" +msgstr ":func:`pow(x, y) `" + +#: ../../library/math.rst:69 +msgid "*x* raised to the power *y*" +msgstr "" + +#: ../../library/math.rst:70 +msgid ":func:`sqrt(x) `" +msgstr ":func:`sqrt(x) `" + +#: ../../library/math.rst:70 +msgid "Square root of *x*" +msgstr "*x* 的平方根" + +#: ../../library/math.rst:72 +msgid "**Trigonometric functions**" +msgstr "" + +#: ../../library/math.rst:74 +msgid ":func:`acos(x) `" +msgstr ":func:`acos(x) `" + +#: ../../library/math.rst:74 +msgid "Arc cosine of *x*" +msgstr "" + +#: ../../library/math.rst:75 +msgid ":func:`asin(x) `" +msgstr ":func:`asin(x) `" + +#: ../../library/math.rst:75 +msgid "Arc sine of *x*" +msgstr "" + +#: ../../library/math.rst:76 +msgid ":func:`atan(x) `" +msgstr ":func:`atan(x) `" + +#: ../../library/math.rst:76 +msgid "Arc tangent of *x*" +msgstr "" + +#: ../../library/math.rst:77 +msgid ":func:`atan2(y, x) `" +msgstr ":func:`atan2(y, x) `" + +#: ../../library/math.rst:77 +msgid "``atan(y / x)``" +msgstr "``atan(y / x)``" + +#: ../../library/math.rst:78 +msgid ":func:`cos(x) `" +msgstr ":func:`cos(x) `" + +#: ../../library/math.rst:78 +msgid "Cosine of *x*" +msgstr "" + +#: ../../library/math.rst:79 +msgid ":func:`dist(p, q) `" +msgstr ":func:`dist(p, q) `" + +#: ../../library/math.rst:79 +msgid "" +"Euclidean distance between two points *p* and *q* given as an iterable of " +"coordinates" +msgstr "" + +#: ../../library/math.rst:80 +msgid ":func:`hypot(*coordinates) `" +msgstr ":func:`hypot(*coordinates) `" + +#: ../../library/math.rst:80 +msgid "Euclidean norm of an iterable of coordinates" +msgstr "" + +#: ../../library/math.rst:81 +msgid ":func:`sin(x) `" +msgstr ":func:`sin(x) `" + +#: ../../library/math.rst:81 +msgid "Sine of *x*" +msgstr "" + +#: ../../library/math.rst:82 +msgid ":func:`tan(x) `" +msgstr ":func:`tan(x) `" + +#: ../../library/math.rst:82 +msgid "Tangent of *x*" +msgstr "" + +#: ../../library/math.rst:84 +msgid "**Angular conversion**" +msgstr "" + +#: ../../library/math.rst:86 +msgid ":func:`degrees(x) `" +msgstr ":func:`degrees(x) `" + +#: ../../library/math.rst:86 +msgid "Convert angle *x* from radians to degrees" +msgstr "" + +#: ../../library/math.rst:87 +msgid ":func:`radians(x) `" +msgstr ":func:`radians(x) `" + +#: ../../library/math.rst:87 +msgid "Convert angle *x* from degrees to radians" +msgstr "" + +#: ../../library/math.rst:89 +msgid "**Hyperbolic functions**" +msgstr "" + +#: ../../library/math.rst:91 +msgid ":func:`acosh(x) `" +msgstr ":func:`acosh(x) `" + +#: ../../library/math.rst:91 +msgid "Inverse hyperbolic cosine of *x*" +msgstr "" + +#: ../../library/math.rst:92 +msgid ":func:`asinh(x) `" +msgstr ":func:`asinh(x) `" + +#: ../../library/math.rst:92 +msgid "Inverse hyperbolic sine of *x*" +msgstr "" + +#: ../../library/math.rst:93 +msgid ":func:`atanh(x) `" +msgstr ":func:`atanh(x) `" + +#: ../../library/math.rst:93 +msgid "Inverse hyperbolic tangent of *x*" +msgstr "" + +#: ../../library/math.rst:94 +msgid ":func:`cosh(x) `" +msgstr ":func:`cosh(x) `" + +#: ../../library/math.rst:94 +msgid "Hyperbolic cosine of *x*" +msgstr "" + +#: ../../library/math.rst:95 +msgid ":func:`sinh(x) `" +msgstr ":func:`sinh(x) `" + +#: ../../library/math.rst:95 +msgid "Hyperbolic sine of *x*" +msgstr "" + +#: ../../library/math.rst:96 +msgid ":func:`tanh(x) `" +msgstr ":func:`tanh(x) `" + +#: ../../library/math.rst:96 +msgid "Hyperbolic tangent of *x*" +msgstr "" + +#: ../../library/math.rst:98 +msgid "**Special functions**" +msgstr "" + +#: ../../library/math.rst:100 +msgid ":func:`erf(x) `" +msgstr ":func:`erf(x) `" + +#: ../../library/math.rst:100 +msgid "`Error function `_ at *x*" +msgstr "" + +#: ../../library/math.rst:101 +msgid ":func:`erfc(x) `" +msgstr ":func:`erfc(x) `" + +#: ../../library/math.rst:101 +msgid "" +"`Complementary error function `_ at *x*" +msgstr "" + +#: ../../library/math.rst:102 +msgid ":func:`gamma(x) `" +msgstr ":func:`gamma(x) `" + +#: ../../library/math.rst:102 +msgid "`Gamma function `_ at *x*" +msgstr "" + +#: ../../library/math.rst:103 +msgid ":func:`lgamma(x) `" +msgstr ":func:`lgamma(x) `" + +#: ../../library/math.rst:103 +msgid "" +"Natural logarithm of the absolute value of the `Gamma function `_ at *x*" +msgstr "" + +#: ../../library/math.rst:105 +msgid "**Constants**" +msgstr "**常數**" + +#: ../../library/math.rst:107 +msgid ":data:`pi`" +msgstr ":data:`pi`" + +#: ../../library/math.rst:107 +msgid "*π* = 3.141592..." +msgstr "*π* = 3.141592..." + +#: ../../library/math.rst:108 +msgid ":data:`e`" +msgstr ":data:`e`" + +#: ../../library/math.rst:108 +msgid "*e* = 2.718281..." +msgstr "*e* = 2.718281..." + +#: ../../library/math.rst:109 +msgid ":data:`tau`" +msgstr ":data:`tau`" + +#: ../../library/math.rst:109 +msgid "*τ* = 2\\ *π* = 6.283185..." +msgstr "*τ* = 2\\ *π* = 6.283185..." + +#: ../../library/math.rst:110 +msgid ":data:`inf`" +msgstr ":data:`inf`" + +#: ../../library/math.rst:110 +msgid "Positive infinity" +msgstr "正無限大" + +#: ../../library/math.rst:111 +msgid ":data:`nan`" +msgstr ":data:`nan`" + +#: ../../library/math.rst:111 +msgid "\"Not a number\" (NaN)" +msgstr "" + +#: ../../library/math.rst:116 msgid "Number-theoretic and representation functions" msgstr "數論與表現函式" -#: ../../library/math.rst:34 +#: ../../library/math.rst:120 msgid "" "Return the ceiling of *x*, the smallest integer greater than or equal to " "*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ `,並回傳 :class:`~numbers." "Integral` 型別的值。" -#: ../../library/math.rst:41 +#: ../../library/math.rst:127 msgid "" "Return the number of ways to choose *k* items from *n* items without " "repetition and without order." msgstr "回傳從 *n* 個物品中不重複且不考慮排序地取出 *k* 個物品的方法數。" -#: ../../library/math.rst:44 +#: ../../library/math.rst:130 msgid "" "Evaluates to ``n! / (k! * (n - k)!)`` when ``k <= n`` and evaluates to zero " "when ``k > n``." msgstr "當 ``k <= n`` 時其值為 ``n! / (k! * (n - k)!)``,否則其值為 ``0``。" -#: ../../library/math.rst:47 +#: ../../library/math.rst:133 msgid "" "Also called the binomial coefficient because it is equivalent to the " "coefficient of k-th term in polynomial expansion of ``(1 + x)ⁿ``." @@ -85,7 +618,7 @@ msgstr "" "因為此值等同於 ``(1 + x)ⁿ`` 進行多項式展開後第 k 項的係數,所以又稱為二項式係" "數。" -#: ../../library/math.rst:51 ../../library/math.rst:274 +#: ../../library/math.rst:137 ../../library/math.rst:362 msgid "" "Raises :exc:`TypeError` if either of the arguments are not integers. Raises :" "exc:`ValueError` if either of the arguments are negative." @@ -93,7 +626,7 @@ msgstr "" "當任一參數非整數型別時會引發 :exc:`TypeError`。當任一參數為負數時會引發 :exc:" "`ValueError`。" -#: ../../library/math.rst:59 +#: ../../library/math.rst:145 msgid "" "Return a float with the magnitude (absolute value) of *x* but the sign of " "*y*. On platforms that support signed zeros, ``copysign(1.0, -0.0)`` " @@ -102,23 +635,22 @@ msgstr "" "回傳與 *x* 相同長度(絕對值)且與 *y* 同號的浮點數。在支援帶符號零的平臺上," "``copysign(1.0, -0.0)`` 回傳 *-1.0*。" -#: ../../library/math.rst:66 +#: ../../library/math.rst:152 msgid "Return the absolute value of *x*." msgstr "回傳 *x* 的絕對值。" -#: ../../library/math.rst:71 +#: ../../library/math.rst:157 msgid "" "Return *n* factorial as an integer. Raises :exc:`ValueError` if *n* is not " "integral or is negative." msgstr "" "以整數回傳 *n* 的階乘。若 *n* 非整數型別或其值為負會引發 :exc:`ValueError`。" -#: ../../library/math.rst:74 -#, fuzzy +#: ../../library/math.rst:160 msgid "Floats with integral values (like ``5.0``) are no longer accepted." -msgstr "允許傳入其值為整數的浮點數(如:``5.0``)已被棄用。" +msgstr "傳入其值為整數的浮點數(如 ``5.0``)已被棄用。" -#: ../../library/math.rst:80 +#: ../../library/math.rst:166 msgid "" "Return the floor of *x*, the largest integer less than or equal to *x*. If " "*x* is not a float, delegates to :meth:`x.__floor__ `, " @@ -128,7 +660,7 @@ msgstr "" "將委派給 :meth:`x.__floor__ `,並回傳 :class:`~numbers." "Integral` 型別的值。" -#: ../../library/math.rst:87 +#: ../../library/math.rst:173 msgid "" "Fused multiply-add operation. Return ``(x * y) + z``, computed as though " "with infinite precision and range followed by a single round to the " @@ -136,7 +668,7 @@ msgid "" "direct expression ``(x * y) + z``." msgstr "" -#: ../../library/math.rst:92 +#: ../../library/math.rst:178 msgid "" "This function follows the specification of the fusedMultiplyAdd operation " "described in the IEEE 754 standard. The standard leaves one case " @@ -145,7 +677,7 @@ msgid "" "not raise any exception." msgstr "" -#: ../../library/math.rst:103 +#: ../../library/math.rst:189 msgid "" "Return ``fmod(x, y)``, as defined by the platform C library. Note that the " "Python expression ``x % y`` may not return the same result. The intent of " @@ -169,7 +701,7 @@ msgstr "" "示成浮點數,並會四捨五入為出乎意料的 ``1e100``。因此,處理浮點數時通常會選擇" "函式 :func:`fmod`,而處理整數時會選擇 Python 運算式 ``x % y``。" -#: ../../library/math.rst:118 +#: ../../library/math.rst:204 msgid "" "Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a " "float and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is " @@ -180,7 +712,7 @@ msgstr "" "數,且兩者精確地使 ``x == m * 2**e``。若 *x* 為零,回傳 ``(0.0, 0)``,否則令 " "``0.5 <= abs(m) < 1``。此函式用於以可攜的方式「分割」浮點數內部表示法。" -#: ../../library/math.rst:126 +#: ../../library/math.rst:212 msgid "" "Return an accurate floating-point sum of values in the iterable. Avoids " "loss of precision by tracking multiple intermediate partial sums." @@ -188,7 +720,7 @@ msgstr "" "回傳可疊代物件(iterable)中所有值的精確浮點數和。透過追蹤過程中多個部分和" "(partial sum)以避免精確度損失。" -#: ../../library/math.rst:129 +#: ../../library/math.rst:215 msgid "" "The algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the " "typical case where the rounding mode is half-even. On some non-Windows " @@ -200,7 +732,7 @@ msgstr "" "有些非 Windows 平台建置時,底層 C 函式庫使用延伸精度加法運算,而可能導致對過" "程中同一部分和重複捨入,並使其最低有效位不如預期。" -#: ../../library/math.rst:135 +#: ../../library/math.rst:221 msgid "" "For further discussion and two alternative approaches, see the `ASPN " "cookbook recipes for accurate floating-point summation `_。" -#: ../../library/math.rst:142 +#: ../../library/math.rst:228 msgid "" "Return the greatest common divisor of the specified integer arguments. If " "any of the arguments is nonzero, then the returned value is the largest " @@ -222,54 +754,51 @@ msgstr "" "最大的正整數。若所有引數皆為零,則回傳值為 ``0``。``gcd()`` 若未傳入任何引數" "也將回傳 ``0``。" -#: ../../library/math.rst:150 +#: ../../library/math.rst:236 msgid "" "Added support for an arbitrary number of arguments. Formerly, only two " "arguments were supported." msgstr "新增支援任意數量的引數。先前僅支援兩個引數。" -#: ../../library/math.rst:157 +#: ../../library/math.rst:243 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "若 *a* 及 *b* 兩值足夠接近便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:160 +#: ../../library/math.rst:246 msgid "" "Whether or not two values are considered close is determined according to " -"given absolute and relative tolerances." -msgstr "兩數是否足夠接近取決於給定的絕對及相對容許偏差(tolerance)。" +"given absolute and relative tolerances. If no errors occur, the result will " +"be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``." +msgstr "" +"兩數是否足夠接近取決於給定的絕對及相對容許偏差 (tolerance)。如果沒有錯誤發" +"生,結果將為:``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``。" -#: ../../library/math.rst:163 +#: ../../library/math.rst:250 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " "For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default " "tolerance is ``1e-09``, which assures that the two values are the same " -"within about 9 decimal digits. *rel_tol* must be greater than zero." +"within about 9 decimal digits. *rel_tol* must be nonnegative and less than " +"``1.0``." msgstr "" "*rel_tol* 為相對容許偏差 ── *a* 與 *b* 兩數差的最大容許值,與 *a* 及 *b* 兩數" "的絕對值中較大者相關。例如欲設置 5% 的容許偏差,則傳入 ``rel_tol=0.05``。其預" -"設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須大於 " -"``0``。" +"設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須不為負" +"且小於 ``1.0``。" -#: ../../library/math.rst:169 +#: ../../library/math.rst:257 msgid "" -"*abs_tol* is the minimum absolute tolerance -- useful for comparisons near " -"zero. *abs_tol* must be at least zero." +"*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " +"nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " +"as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and " +"rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument " +"to the call." msgstr "" -"*abs_tol* 為最小絕對容許偏差 ── 於接近零的比較時很有用。*abs_tol* 須大於等於 " -"``0``。" -#: ../../library/math.rst:172 -msgid "" -"If no errors occur, the result will be: ``abs(a-b) <= max(rel_tol * " -"max(abs(a), abs(b)), abs_tol)``." -msgstr "" -"若未發生任何錯誤,函式結果為 ``abs(a-b) <= max(rel_tol * max(abs(a), " -"abs(b)), abs_tol)``。" - -#: ../../library/math.rst:175 +#: ../../library/math.rst:263 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -280,11 +809,11 @@ msgstr "" "處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " "及 ``-inf`` 皆只與自身接近。" -#: ../../library/math.rst:184 +#: ../../library/math.rst:272 msgid ":pep:`485` -- A function for testing approximate equality" msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/math.rst:189 +#: ../../library/math.rst:277 msgid "" "Return ``True`` if *x* is neither an infinity nor a NaN, and ``False`` " "otherwise. (Note that ``0.0`` *is* considered finite.)" @@ -292,20 +821,20 @@ msgstr "" "若 *x* 不是無限值或 ``NaN`` 便回傳 ``True``,否則回傳 ``False``。(注意 " "``0.0`` 被視為有限數。)" -#: ../../library/math.rst:197 +#: ../../library/math.rst:285 msgid "" "Return ``True`` if *x* is a positive or negative infinity, and ``False`` " "otherwise." msgstr "若 *x* 是正無限值或負無限值便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:203 +#: ../../library/math.rst:291 msgid "" "Return ``True`` if *x* is a NaN (not a number), and ``False`` otherwise." msgstr "" "若 *x* 是 ``NaN`` ── 即非數字(NaN, not a number)── 便回傳 ``True``,否則回" "傳 ``False``。" -#: ../../library/math.rst:208 +#: ../../library/math.rst:296 msgid "" "Return the integer square root of the nonnegative integer *n*. This is the " "floor of the exact square root of *n*, or equivalently the greatest integer " @@ -314,7 +843,7 @@ msgstr "" "回傳非負整數 *n* 的整數平方根。此值為 *n* 精確平方根經下取整的值,亦等同於滿" "足 *a*\\ ² |nbsp| ≤ |nbsp| *n* 的最大整數值 *a*。" -#: ../../library/math.rst:212 +#: ../../library/math.rst:300 msgid "" "For some applications, it may be more convenient to have the least integer " "*a* such that *n* |nbsp| ≤ |nbsp| *a*\\ ², or in other words the ceiling of " @@ -325,7 +854,7 @@ msgstr "" "者說 *n* 精確平方根經上取整的值 ── 會更加方便。對正數 *n*,此值可使用 ``a = " "1 + isqrt(n - 1)`` 計算。" -#: ../../library/math.rst:222 +#: ../../library/math.rst:310 msgid "" "Return the least common multiple of the specified integer arguments. If all " "arguments are nonzero, then the returned value is the smallest positive " @@ -337,86 +866,86 @@ msgstr "" "最小的正整數。若存在任一引數值為零,則回傳值為 ``0``。``lcm()`` 若未傳入任何" "引數將回傳 ``1``。" -#: ../../library/math.rst:233 +#: ../../library/math.rst:321 msgid "" "Return ``x * (2**i)``. This is essentially the inverse of function :func:" "`frexp`." msgstr "回傳 ``x * (2**i)``。此函式本質上為 :func:`frexp` 的反函式。" -#: ../../library/math.rst:239 +#: ../../library/math.rst:327 msgid "" "Return the fractional and integer parts of *x*. Both results carry the sign " "of *x* and are floats." msgstr "" -#: ../../library/math.rst:245 +#: ../../library/math.rst:333 msgid "Return the floating-point value *steps* steps after *x* towards *y*." msgstr "" -#: ../../library/math.rst:247 +#: ../../library/math.rst:335 msgid "If *x* is equal to *y*, return *y*, unless *steps* is zero." msgstr "" -#: ../../library/math.rst:249 +#: ../../library/math.rst:337 msgid "Examples:" msgstr "範例:" -#: ../../library/math.rst:251 +#: ../../library/math.rst:339 msgid "``math.nextafter(x, math.inf)`` goes up: towards positive infinity." msgstr "" -#: ../../library/math.rst:252 +#: ../../library/math.rst:340 msgid "``math.nextafter(x, -math.inf)`` goes down: towards minus infinity." msgstr "" -#: ../../library/math.rst:253 +#: ../../library/math.rst:341 msgid "``math.nextafter(x, 0.0)`` goes towards zero." msgstr "" -#: ../../library/math.rst:254 +#: ../../library/math.rst:342 msgid "``math.nextafter(x, math.copysign(math.inf, x))`` goes away from zero." msgstr "" -#: ../../library/math.rst:256 +#: ../../library/math.rst:344 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`。" -#: ../../library/math.rst:260 +#: ../../library/math.rst:348 msgid "Added the *steps* argument." msgstr "新增 *steps* 引數。" -#: ../../library/math.rst:265 +#: ../../library/math.rst:353 msgid "" "Return the number of ways to choose *k* items from *n* items without " "repetition and with order." msgstr "" -#: ../../library/math.rst:268 +#: ../../library/math.rst:356 msgid "" "Evaluates to ``n! / (n - k)!`` when ``k <= n`` and evaluates to zero when " "``k > n``." msgstr "" -#: ../../library/math.rst:271 +#: ../../library/math.rst:359 msgid "" "If *k* is not specified or is ``None``, then *k* defaults to *n* and the " "function returns ``n!``." msgstr "" -#: ../../library/math.rst:282 +#: ../../library/math.rst:370 msgid "" "Calculate the product of all the elements in the input *iterable*. The " "default *start* value for the product is ``1``." msgstr "" -#: ../../library/math.rst:285 +#: ../../library/math.rst:373 msgid "" "When the iterable is empty, return the start value. This function is " "intended specifically for use with numeric values and may reject non-numeric " "types." msgstr "" -#: ../../library/math.rst:294 +#: ../../library/math.rst:382 msgid "" "Return the IEEE 754-style remainder of *x* with respect to *y*. For finite " "*x* and finite nonzero *y*, this is the difference ``x - n*y``, where ``n`` " @@ -426,7 +955,7 @@ msgid "" "thus always satisfies ``abs(r) <= 0.5 * abs(y)``." msgstr "" -#: ../../library/math.rst:301 +#: ../../library/math.rst:389 msgid "" "Special cases follow IEEE 754: in particular, ``remainder(x, math.inf)`` is " "*x* for any finite *x*, and ``remainder(x, 0)`` and ``remainder(math.inf, " @@ -434,35 +963,35 @@ msgid "" "remainder operation is zero, that zero will have the same sign as *x*." msgstr "" -#: ../../library/math.rst:307 +#: ../../library/math.rst:395 msgid "" "On platforms using IEEE 754 binary floating point, the result of this " "operation is always exactly representable: no rounding error is introduced." msgstr "" -#: ../../library/math.rst:315 +#: ../../library/math.rst:403 msgid "Return the sum of products of values from two iterables *p* and *q*." msgstr "" -#: ../../library/math.rst:317 +#: ../../library/math.rst:405 msgid "Raises :exc:`ValueError` if the inputs do not have the same length." msgstr "" -#: ../../library/math.rst:319 ../../library/math.rst:514 +#: ../../library/math.rst:407 ../../library/math.rst:602 msgid "Roughly equivalent to::" -msgstr "" +msgstr "大致等價於: ::" -#: ../../library/math.rst:321 +#: ../../library/math.rst:409 msgid "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" msgstr "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" -#: ../../library/math.rst:323 +#: ../../library/math.rst:411 msgid "" "For float and mixed int/float inputs, the intermediate products and sums are " "computed with extended precision." msgstr "" -#: ../../library/math.rst:331 +#: ../../library/math.rst:419 msgid "" "Return *x* with the fractional part removed, leaving the integer part. This " "rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " @@ -471,54 +1000,54 @@ msgid "" "class:`~numbers.Integral` value." msgstr "" -#: ../../library/math.rst:339 +#: ../../library/math.rst:427 msgid "Return the value of the least significant bit of the float *x*:" msgstr "" -#: ../../library/math.rst:341 +#: ../../library/math.rst:429 msgid "If *x* is a NaN (not a number), return *x*." msgstr "" -#: ../../library/math.rst:342 +#: ../../library/math.rst:430 msgid "If *x* is negative, return ``ulp(-x)``." -msgstr "" +msgstr "如果 *x* 為負,回傳 ``ulp(-x)``。" -#: ../../library/math.rst:343 +#: ../../library/math.rst:431 msgid "If *x* is a positive infinity, return *x*." -msgstr "" +msgstr "如果 *x* 為正無限大,回傳 *x*。" -#: ../../library/math.rst:344 +#: ../../library/math.rst:432 msgid "" "If *x* is equal to zero, return the smallest positive *denormalized* " "representable float (smaller than the minimum positive *normalized* float, :" "data:`sys.float_info.min `)." msgstr "" -#: ../../library/math.rst:347 +#: ../../library/math.rst:435 msgid "" "If *x* is equal to the largest positive representable float, return the " "value of the least significant bit of *x*, such that the first float smaller " "than *x* is ``x - ulp(x)``." msgstr "" -#: ../../library/math.rst:350 +#: ../../library/math.rst:438 msgid "" "Otherwise (*x* is a positive finite number), return the value of the least " "significant bit of *x*, such that the first float bigger than *x* is ``x + " "ulp(x)``." msgstr "" -#: ../../library/math.rst:354 +#: ../../library/math.rst:442 msgid "ULP stands for \"Unit in the Last Place\"." msgstr "" -#: ../../library/math.rst:356 +#: ../../library/math.rst:444 msgid "" "See also :func:`math.nextafter` and :data:`sys.float_info.epsilon `." msgstr "" -#: ../../library/math.rst:362 +#: ../../library/math.rst:450 msgid "" "Note that :func:`frexp` and :func:`modf` have a different call/return " "pattern than their C equivalents: they take a single argument and return a " @@ -526,7 +1055,7 @@ msgid "" "'output parameter' (there is no such thing in Python)." msgstr "" -#: ../../library/math.rst:367 +#: ../../library/math.rst:455 msgid "" "For the :func:`ceil`, :func:`floor`, and :func:`modf` functions, note that " "*all* floating-point numbers of sufficiently large magnitude are exact " @@ -535,26 +1064,26 @@ msgid "" "``abs(x) >= 2**52`` necessarily has no fractional bits." msgstr "" -#: ../../library/math.rst:375 +#: ../../library/math.rst:463 msgid "Power and logarithmic functions" msgstr "" -#: ../../library/math.rst:379 +#: ../../library/math.rst:467 msgid "Return the cube root of *x*." msgstr "" -#: ../../library/math.rst:386 +#: ../../library/math.rst:474 msgid "" "Return *e* raised to the power *x*, where *e* = 2.718281... is the base of " "natural logarithms. This is usually more accurate than ``math.e ** x`` or " "``pow(math.e, x)``." msgstr "" -#: ../../library/math.rst:393 +#: ../../library/math.rst:481 msgid "Return *2* raised to the power *x*." msgstr "" -#: ../../library/math.rst:400 +#: ../../library/math.rst:488 msgid "" "Return *e* raised to the power *x*, minus 1. Here *e* is the base of " "natural logarithms. For small floats *x*, the subtraction in ``exp(x) - 1`` " @@ -563,90 +1092,90 @@ msgid "" "compute this quantity to full precision:" msgstr "" -#: ../../library/math.rst:417 +#: ../../library/math.rst:505 msgid "With one argument, return the natural logarithm of *x* (to base *e*)." msgstr "" -#: ../../library/math.rst:419 +#: ../../library/math.rst:507 msgid "" "With two arguments, return the logarithm of *x* to the given *base*, " "calculated as ``log(x)/log(base)``." msgstr "" -#: ../../library/math.rst:425 +#: ../../library/math.rst:513 msgid "" "Return the natural logarithm of *1+x* (base *e*). The result is calculated " "in a way which is accurate for *x* near zero." msgstr "" -#: ../../library/math.rst:431 +#: ../../library/math.rst:519 msgid "" "Return the base-2 logarithm of *x*. This is usually more accurate than " "``log(x, 2)``." msgstr "" -#: ../../library/math.rst:438 +#: ../../library/math.rst:526 msgid "" ":meth:`int.bit_length` returns the number of bits necessary to represent an " "integer in binary, excluding the sign and leading zeros." msgstr "" -#: ../../library/math.rst:444 +#: ../../library/math.rst:532 msgid "" "Return the base-10 logarithm of *x*. This is usually more accurate than " "``log(x, 10)``." msgstr "" -#: ../../library/math.rst:450 +#: ../../library/math.rst:538 msgid "" -"Return ``x`` raised to the power ``y``. Exceptional cases follow the IEEE " -"754 standard as far as possible. In particular, ``pow(1.0, x)`` and " -"``pow(x, 0.0)`` always return ``1.0``, even when ``x`` is a zero or a NaN. " -"If both ``x`` and ``y`` are finite, ``x`` is negative, and ``y`` is not an " -"integer then ``pow(x, y)`` is undefined, and raises :exc:`ValueError`." +"Return *x* raised to the power *y*. Exceptional cases follow the IEEE 754 " +"standard as far as possible. In particular, ``pow(1.0, x)`` and ``pow(x, " +"0.0)`` always return ``1.0``, even when *x* is a zero or a NaN. If both *x* " +"and *y* are finite, *x* is negative, and *y* is not an integer then ``pow(x, " +"y)`` is undefined, and raises :exc:`ValueError`." msgstr "" -#: ../../library/math.rst:457 +#: ../../library/math.rst:545 msgid "" "Unlike the built-in ``**`` operator, :func:`math.pow` converts both its " "arguments to type :class:`float`. Use ``**`` or the built-in :func:`pow` " "function for computing exact integer powers." msgstr "" -#: ../../library/math.rst:461 +#: ../../library/math.rst:549 msgid "" "The special cases ``pow(0.0, -inf)`` and ``pow(-0.0, -inf)`` were changed to " "return ``inf`` instead of raising :exc:`ValueError`, for consistency with " "IEEE 754." msgstr "" -#: ../../library/math.rst:469 +#: ../../library/math.rst:557 msgid "Return the square root of *x*." msgstr "" -#: ../../library/math.rst:473 +#: ../../library/math.rst:561 msgid "Trigonometric functions" msgstr "" -#: ../../library/math.rst:477 +#: ../../library/math.rst:565 msgid "" "Return the arc cosine of *x*, in radians. The result is between ``0`` and " "``pi``." msgstr "" -#: ../../library/math.rst:483 +#: ../../library/math.rst:571 msgid "" "Return the arc sine of *x*, in radians. The result is between ``-pi/2`` and " "``pi/2``." msgstr "" -#: ../../library/math.rst:489 +#: ../../library/math.rst:577 msgid "" "Return the arc tangent of *x*, in radians. The result is between ``-pi/2`` " "and ``pi/2``." msgstr "" -#: ../../library/math.rst:495 +#: ../../library/math.rst:583 msgid "" "Return ``atan(y / x)``, in radians. The result is between ``-pi`` and " "``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " @@ -656,128 +1185,128 @@ msgid "" "``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." msgstr "" -#: ../../library/math.rst:505 +#: ../../library/math.rst:593 msgid "Return the cosine of *x* radians." msgstr "" -#: ../../library/math.rst:510 +#: ../../library/math.rst:598 msgid "" "Return the Euclidean distance between two points *p* and *q*, each given as " "a sequence (or iterable) of coordinates. The two points must have the same " "dimension." msgstr "" -#: ../../library/math.rst:516 +#: ../../library/math.rst:604 msgid "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" msgstr "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" -#: ../../library/math.rst:523 +#: ../../library/math.rst:611 msgid "" "Return the Euclidean norm, ``sqrt(sum(x**2 for x in coordinates))``. This is " "the length of the vector from the origin to the point given by the " "coordinates." msgstr "" -#: ../../library/math.rst:527 +#: ../../library/math.rst:615 msgid "" "For a two dimensional point ``(x, y)``, this is equivalent to computing the " "hypotenuse of a right triangle using the Pythagorean theorem, ``sqrt(x*x + " "y*y)``." msgstr "" -#: ../../library/math.rst:531 +#: ../../library/math.rst:619 msgid "" "Added support for n-dimensional points. Formerly, only the two dimensional " "case was supported." msgstr "" -#: ../../library/math.rst:535 +#: ../../library/math.rst:623 msgid "" "Improved the algorithm's accuracy so that the maximum error is under 1 ulp " "(unit in the last place). More typically, the result is almost always " "correctly rounded to within 1/2 ulp." msgstr "" -#: ../../library/math.rst:543 +#: ../../library/math.rst:631 msgid "Return the sine of *x* radians." msgstr "" -#: ../../library/math.rst:548 +#: ../../library/math.rst:636 msgid "Return the tangent of *x* radians." msgstr "" -#: ../../library/math.rst:552 +#: ../../library/math.rst:640 msgid "Angular conversion" msgstr "" -#: ../../library/math.rst:556 +#: ../../library/math.rst:644 msgid "Convert angle *x* from radians to degrees." msgstr "" -#: ../../library/math.rst:561 +#: ../../library/math.rst:649 msgid "Convert angle *x* from degrees to radians." msgstr "" -#: ../../library/math.rst:565 +#: ../../library/math.rst:653 msgid "Hyperbolic functions" msgstr "" -#: ../../library/math.rst:567 +#: ../../library/math.rst:655 msgid "" "`Hyperbolic functions `_ " "are analogs of trigonometric functions that are based on hyperbolas instead " "of circles." msgstr "" -#: ../../library/math.rst:573 +#: ../../library/math.rst:661 msgid "Return the inverse hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:578 +#: ../../library/math.rst:666 msgid "Return the inverse hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:583 +#: ../../library/math.rst:671 msgid "Return the inverse hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:588 +#: ../../library/math.rst:676 msgid "Return the hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:593 +#: ../../library/math.rst:681 msgid "Return the hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:598 +#: ../../library/math.rst:686 msgid "Return the hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:602 +#: ../../library/math.rst:690 msgid "Special functions" -msgstr "" +msgstr "特殊函式" -#: ../../library/math.rst:606 +#: ../../library/math.rst:694 msgid "" "Return the `error function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:609 +#: ../../library/math.rst:697 msgid "" "The :func:`erf` function can be used to compute traditional statistical " "functions such as the `cumulative standard normal distribution `_::" msgstr "" -#: ../../library/math.rst:613 +#: ../../library/math.rst:701 msgid "" "def phi(x):\n" " 'Cumulative distribution function for the standard normal distribution'\n" " return (1.0 + erf(x / sqrt(2.0))) / 2.0" msgstr "" -#: ../../library/math.rst:622 +#: ../../library/math.rst:710 msgid "" "Return the complementary error function at *x*. The `complementary error " "function `_ is defined as " @@ -786,31 +1315,31 @@ msgid "" "Loss_of_significance>`_\\." msgstr "" -#: ../../library/math.rst:633 +#: ../../library/math.rst:721 msgid "" "Return the `Gamma function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:641 +#: ../../library/math.rst:729 msgid "" "Return the natural logarithm of the absolute value of the Gamma function at " "*x*." msgstr "" -#: ../../library/math.rst:648 +#: ../../library/math.rst:736 msgid "Constants" msgstr "常數" -#: ../../library/math.rst:652 +#: ../../library/math.rst:740 msgid "The mathematical constant *π* = 3.141592..., to available precision." msgstr "" -#: ../../library/math.rst:657 +#: ../../library/math.rst:745 msgid "The mathematical constant *e* = 2.718281..., to available precision." msgstr "" -#: ../../library/math.rst:662 +#: ../../library/math.rst:750 msgid "" "The mathematical constant *τ* = 6.283185..., to available precision. Tau is " "a circle constant equal to 2\\ *π*, the ratio of a circle's circumference to " @@ -819,13 +1348,13 @@ msgid "" "celebrating `Tau day `_ by eating twice as much pie!" msgstr "" -#: ../../library/math.rst:673 +#: ../../library/math.rst:761 msgid "" "A floating-point positive infinity. (For negative infinity, use ``-math." "inf``.) Equivalent to the output of ``float('inf')``." msgstr "" -#: ../../library/math.rst:681 +#: ../../library/math.rst:769 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to the output of " "``float('nan')``. Due to the requirements of the `IEEE-754 standard \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -350,26 +350,26 @@ msgstr "" #: ../../library/os.rst:2592 ../../library/os.rst:2614 #: ../../library/os.rst:3322 ../../library/os.rst:3456 #: ../../library/os.rst:3479 ../../library/os.rst:3493 -#: ../../library/os.rst:3712 ../../library/os.rst:3737 -#: ../../library/os.rst:3762 ../../library/os.rst:3816 -#: ../../library/os.rst:3825 ../../library/os.rst:3834 -#: ../../library/os.rst:3842 ../../library/os.rst:3851 -#: ../../library/os.rst:3860 ../../library/os.rst:3932 -#: ../../library/os.rst:3995 ../../library/os.rst:4005 -#: ../../library/os.rst:4023 ../../library/os.rst:4032 -#: ../../library/os.rst:4042 ../../library/os.rst:4052 -#: ../../library/os.rst:4062 ../../library/os.rst:4073 -#: ../../library/os.rst:4218 ../../library/os.rst:4287 -#: ../../library/os.rst:4322 ../../library/os.rst:4330 -#: ../../library/os.rst:4337 ../../library/os.rst:4344 -#: ../../library/os.rst:4351 ../../library/os.rst:4358 -#: ../../library/os.rst:4365 ../../library/os.rst:4372 -#: ../../library/os.rst:4380 ../../library/os.rst:4388 -#: ../../library/os.rst:4395 ../../library/os.rst:4402 -#: ../../library/os.rst:4411 ../../library/os.rst:4419 -#: ../../library/os.rst:4427 ../../library/os.rst:4434 -#: ../../library/os.rst:4441 ../../library/os.rst:4490 -#: ../../library/os.rst:4517 ../../library/os.rst:4541 +#: ../../library/os.rst:3713 ../../library/os.rst:3738 +#: ../../library/os.rst:3763 ../../library/os.rst:3817 +#: ../../library/os.rst:3826 ../../library/os.rst:3835 +#: ../../library/os.rst:3843 ../../library/os.rst:3852 +#: ../../library/os.rst:3861 ../../library/os.rst:3933 +#: ../../library/os.rst:3996 ../../library/os.rst:4006 +#: ../../library/os.rst:4024 ../../library/os.rst:4033 +#: ../../library/os.rst:4043 ../../library/os.rst:4053 +#: ../../library/os.rst:4063 ../../library/os.rst:4074 +#: ../../library/os.rst:4219 ../../library/os.rst:4288 +#: ../../library/os.rst:4323 ../../library/os.rst:4331 +#: ../../library/os.rst:4338 ../../library/os.rst:4345 +#: ../../library/os.rst:4352 ../../library/os.rst:4359 +#: ../../library/os.rst:4366 ../../library/os.rst:4373 +#: ../../library/os.rst:4381 ../../library/os.rst:4389 +#: ../../library/os.rst:4396 ../../library/os.rst:4403 +#: ../../library/os.rst:4412 ../../library/os.rst:4420 +#: ../../library/os.rst:4428 ../../library/os.rst:4435 +#: ../../library/os.rst:4442 ../../library/os.rst:4491 +#: ../../library/os.rst:4518 ../../library/os.rst:4541 #: ../../library/os.rst:4557 ../../library/os.rst:4564 #: ../../library/os.rst:4575 ../../library/os.rst:4585 #: ../../library/os.rst:4594 ../../library/os.rst:4626 @@ -1517,8 +1517,8 @@ msgstr "" #: ../../library/os.rst:2759 ../../library/os.rst:3049 #: ../../library/os.rst:3336 ../../library/os.rst:3500 #: ../../library/os.rst:3516 ../../library/os.rst:3556 -#: ../../library/os.rst:3655 ../../library/os.rst:3716 -#: ../../library/os.rst:4113 ../../library/os.rst:4293 +#: ../../library/os.rst:3656 ../../library/os.rst:3717 +#: ../../library/os.rst:4114 ../../library/os.rst:4294 #: ../../library/os.rst:4859 msgid "Accepts a :term:`path-like object`." msgstr "" @@ -3386,9 +3386,9 @@ msgid "" "``follow_symlinks=False``, or use :func:`lstat`." msgstr "" -#: ../../library/os.rst:3014 ../../library/os.rst:4092 -#: ../../library/os.rst:4108 ../../library/os.rst:4124 -#: ../../library/os.rst:4144 +#: ../../library/os.rst:3014 ../../library/os.rst:4093 +#: ../../library/os.rst:4109 ../../library/os.rst:4125 +#: ../../library/os.rst:4145 msgid "" "This function can support :ref:`specifying a file descriptor ` and :" "ref:`not following symlinks `." @@ -3408,7 +3408,7 @@ msgid "" "junction points, which will raise the usual exceptions." msgstr "" -#: ../../library/os.rst:3030 ../../library/os.rst:3799 +#: ../../library/os.rst:3030 ../../library/os.rst:3800 msgid "Example::" msgstr "範例: ::" @@ -4087,7 +4087,7 @@ msgid "" "directory, and assumes that its caller doesn't either." msgstr "" -#: ../../library/os.rst:3621 ../../library/os.rst:3682 +#: ../../library/os.rst:3621 ../../library/os.rst:3683 msgid "" "This example displays the number of bytes taken by non-directory files in " "each directory under the starting directory, except that it doesn't look " @@ -4124,10 +4124,11 @@ msgid "" " for name in files:\n" " os.remove(os.path.join(root, name))\n" " for name in dirs:\n" -" os.rmdir(os.path.join(root, name))" +" os.rmdir(os.path.join(root, name))\n" +"os.rmdir(top)" msgstr "" -#: ../../library/os.rst:3649 +#: ../../library/os.rst:3650 msgid "" "Raises an :ref:`auditing event ` ``os.walk`` with arguments " "``top``, ``topdown``, ``onerror``, ``followlinks``." @@ -4135,25 +4136,25 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``followlinks`` 的\\ :" "ref:`稽核事件 ` ``os.walk``。" -#: ../../library/os.rst:3651 +#: ../../library/os.rst:3652 msgid "" "This function now calls :func:`os.scandir` instead of :func:`os.listdir`, " "making it faster by reducing the number of calls to :func:`os.stat`." msgstr "" -#: ../../library/os.rst:3665 +#: ../../library/os.rst:3666 msgid "" "This behaves exactly like :func:`walk`, except that it yields a 4-tuple " "``(dirpath, dirnames, filenames, dirfd)``, and it supports ``dir_fd``." msgstr "" -#: ../../library/os.rst:3668 +#: ../../library/os.rst:3669 msgid "" "*dirpath*, *dirnames* and *filenames* are identical to :func:`walk` output, " "and *dirfd* is a file descriptor referring to the directory *dirpath*." msgstr "" -#: ../../library/os.rst:3671 +#: ../../library/os.rst:3672 msgid "" "This function always supports :ref:`paths relative to directory descriptors " "` and :ref:`not following symlinks `. Note however " @@ -4161,14 +4162,14 @@ msgid "" "*follow_symlinks* is ``False``." msgstr "" -#: ../../library/os.rst:3678 +#: ../../library/os.rst:3679 msgid "" "Since :func:`fwalk` yields file descriptors, those are only valid until the " "next iteration step, so you should duplicate them (e.g. with :func:`dup`) if " "you want to keep them longer." msgstr "" -#: ../../library/os.rst:3686 +#: ../../library/os.rst:3687 msgid "" "import os\n" "for root, dirs, files, rootfd in os.fwalk('python/Lib/email'):\n" @@ -4180,13 +4181,13 @@ msgid "" " dirs.remove('CVS') # don't visit CVS directories" msgstr "" -#: ../../library/os.rst:3695 +#: ../../library/os.rst:3696 msgid "" "In the next example, walking the tree bottom-up is essential: :func:`rmdir` " "doesn't allow deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3699 +#: ../../library/os.rst:3700 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4200,7 +4201,7 @@ msgid "" " os.rmdir(name, dir_fd=rootfd)" msgstr "" -#: ../../library/os.rst:3710 +#: ../../library/os.rst:3711 msgid "" "Raises an :ref:`auditing event ` ``os.fwalk`` with arguments " "``top``, ``topdown``, ``onerror``, ``follow_symlinks``, ``dir_fd``." @@ -4208,11 +4209,11 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``follow_symlinks``、" "``dir_fd`` 的\\ :ref:`稽核事件 ` ``os.fwalk``。" -#: ../../library/os.rst:3719 +#: ../../library/os.rst:3720 msgid "Added support for :class:`bytes` paths." msgstr "新增對 :class:`bytes` 路徑的支援。" -#: ../../library/os.rst:3725 +#: ../../library/os.rst:3726 msgid "" "Create an anonymous file and return a file descriptor that refers to it. " "*flags* must be one of the ``os.MFD_*`` constants available on the system " @@ -4220,7 +4221,7 @@ msgid "" "descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3730 +#: ../../library/os.rst:3731 msgid "" "The name supplied in *name* is used as a filename and will be displayed as " "the target of the corresponding symbolic link in the directory ``/proc/self/" @@ -4230,15 +4231,15 @@ msgid "" "side effects." msgstr "" -#: ../../library/os.rst:3760 +#: ../../library/os.rst:3761 msgid "These flags can be passed to :func:`memfd_create`." msgstr "這些旗標可以傳給 :func:`memfd_create`。" -#: ../../library/os.rst:3764 +#: ../../library/os.rst:3765 msgid "The ``MFD_HUGE*`` flags are only available since Linux 4.14." msgstr "``MFD_HUGE*`` 旗標僅在 Linux 4.14 以上可用。" -#: ../../library/os.rst:3771 +#: ../../library/os.rst:3772 msgid "" "Create and return an event file descriptor. The file descriptors supports " "raw :func:`read` and :func:`write` with a buffer size of 8, :func:`~select." @@ -4247,7 +4248,7 @@ msgid "" "ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3777 +#: ../../library/os.rst:3778 msgid "" "*initval* is the initial value of the event counter. The initial value must " "be a 32 bit unsigned integer. Please note that the initial value is limited " @@ -4255,39 +4256,39 @@ msgid "" "integer with a maximum value of 2\\ :sup:`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3782 +#: ../../library/os.rst:3783 msgid "" "*flags* can be constructed from :const:`EFD_CLOEXEC`, :const:`EFD_NONBLOCK`, " "and :const:`EFD_SEMAPHORE`." msgstr "" -#: ../../library/os.rst:3785 +#: ../../library/os.rst:3786 msgid "" "If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero, :" "func:`eventfd_read` returns 1 and decrements the counter by one." msgstr "" -#: ../../library/os.rst:3788 +#: ../../library/os.rst:3789 msgid "" "If :const:`EFD_SEMAPHORE` is not specified and the event counter is non-" "zero, :func:`eventfd_read` returns the current event counter value and " "resets the counter to zero." msgstr "" -#: ../../library/os.rst:3792 +#: ../../library/os.rst:3793 msgid "" "If the event counter is zero and :const:`EFD_NONBLOCK` is not specified, :" "func:`eventfd_read` blocks." msgstr "" -#: ../../library/os.rst:3795 +#: ../../library/os.rst:3796 msgid "" ":func:`eventfd_write` increments the event counter. Write blocks if the " "write operation would increment the counter to a value larger than 2\\ :sup:" "`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3801 +#: ../../library/os.rst:3802 msgid "" "import os\n" "\n" @@ -4305,64 +4306,64 @@ msgid "" " os.close(fd)" msgstr "" -#: ../../library/os.rst:3822 +#: ../../library/os.rst:3823 msgid "" "Read value from an :func:`eventfd` file descriptor and return a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3831 +#: ../../library/os.rst:3832 msgid "" "Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3840 +#: ../../library/os.rst:3841 msgid "Set close-on-exec flag for new :func:`eventfd` file descriptor." msgstr "" -#: ../../library/os.rst:3848 +#: ../../library/os.rst:3849 msgid "" "Set :const:`O_NONBLOCK` status flag for new :func:`eventfd` file descriptor." msgstr "設定新的 :func:`eventfd` 檔案描述器的 :const:`O_NONBLOCK` 狀態旗標。" -#: ../../library/os.rst:3857 +#: ../../library/os.rst:3858 msgid "" "Provide semaphore-like semantics for reads from an :func:`eventfd` file " "descriptor. On read the internal counter is decremented by one." msgstr "" -#: ../../library/os.rst:3868 +#: ../../library/os.rst:3869 msgid "Timer File Descriptors" msgstr "" -#: ../../library/os.rst:3872 +#: ../../library/os.rst:3873 msgid "" "These functions provide support for Linux's *timer file descriptor* API. " "Naturally, they are all only available on Linux." msgstr "" -#: ../../library/os.rst:3877 +#: ../../library/os.rst:3878 msgid "Create and return a timer file descriptor (*timerfd*)." msgstr "" -#: ../../library/os.rst:3879 +#: ../../library/os.rst:3880 msgid "The file descriptor returned by :func:`timerfd_create` supports:" msgstr "" -#: ../../library/os.rst:3881 +#: ../../library/os.rst:3882 msgid ":func:`read`" msgstr ":func:`read`" -#: ../../library/os.rst:3882 +#: ../../library/os.rst:3883 msgid ":func:`~select.select`" msgstr ":func:`~select.select`" -#: ../../library/os.rst:3883 +#: ../../library/os.rst:3884 msgid ":func:`~select.poll`" msgstr ":func:`~select.poll`" -#: ../../library/os.rst:3885 +#: ../../library/os.rst:3886 msgid "" "The file descriptor's :func:`read` method can be called with a buffer size " "of 8. If the timer has already expired one or more times, :func:`read` " @@ -4371,31 +4372,31 @@ msgid "" "byteorder)``." msgstr "" -#: ../../library/os.rst:3890 +#: ../../library/os.rst:3891 msgid "" ":func:`~select.select` and :func:`~select.poll` can be used to wait until " "timer expires and the file descriptor is readable." msgstr "" -#: ../../library/os.rst:3893 +#: ../../library/os.rst:3894 msgid "" "*clockid* must be a valid :ref:`clock ID `, as " "defined in the :py:mod:`time` module:" msgstr "" -#: ../../library/os.rst:3896 +#: ../../library/os.rst:3897 msgid ":const:`time.CLOCK_REALTIME`" msgstr ":const:`time.CLOCK_REALTIME`" -#: ../../library/os.rst:3897 +#: ../../library/os.rst:3898 msgid ":const:`time.CLOCK_MONOTONIC`" msgstr ":const:`time.CLOCK_MONOTONIC`" -#: ../../library/os.rst:3898 +#: ../../library/os.rst:3899 msgid ":const:`time.CLOCK_BOOTTIME` (Since Linux 3.15 for timerfd_create)" msgstr "" -#: ../../library/os.rst:3900 +#: ../../library/os.rst:3901 msgid "" "If *clockid* is :const:`time.CLOCK_REALTIME`, a settable system-wide real-" "time clock is used. If system clock is changed, timer setting need to be " @@ -4403,35 +4404,35 @@ msgid "" "`TFD_TIMER_CANCEL_ON_SET`." msgstr "" -#: ../../library/os.rst:3905 +#: ../../library/os.rst:3906 msgid "" "If *clockid* is :const:`time.CLOCK_MONOTONIC`, a non-settable monotonically " "increasing clock is used. Even if the system clock is changed, the timer " "setting will not be affected." msgstr "" -#: ../../library/os.rst:3909 +#: ../../library/os.rst:3910 msgid "" "If *clockid* is :const:`time.CLOCK_BOOTTIME`, same as :const:`time." "CLOCK_MONOTONIC` except it includes any time that the system is suspended." msgstr "" -#: ../../library/os.rst:3912 +#: ../../library/os.rst:3913 msgid "" "The file descriptor's behaviour can be modified by specifying a *flags* " "value. Any of the following variables may used, combined using bitwise OR " "(the ``|`` operator):" msgstr "" -#: ../../library/os.rst:3916 +#: ../../library/os.rst:3917 msgid ":const:`TFD_NONBLOCK`" msgstr ":const:`TFD_NONBLOCK`" -#: ../../library/os.rst:3917 +#: ../../library/os.rst:3918 msgid ":const:`TFD_CLOEXEC`" msgstr ":const:`TFD_CLOEXEC`" -#: ../../library/os.rst:3919 +#: ../../library/os.rst:3920 msgid "" "If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks until the " "timer expires. If it is set as a flag, :func:`read` doesn't block, but If " @@ -4439,46 +4440,46 @@ msgid "" "raises :class:`OSError` with ``errno`` is set to :const:`errno.EAGAIN`." msgstr "" -#: ../../library/os.rst:3925 +#: ../../library/os.rst:3926 msgid ":const:`TFD_CLOEXEC` is always set by Python automatically." msgstr "" -#: ../../library/os.rst:3927 +#: ../../library/os.rst:3928 msgid "" "The file descriptor must be closed with :func:`os.close` when it is no " "longer needed, or else the file descriptor will be leaked." msgstr "" -#: ../../library/os.rst:3930 +#: ../../library/os.rst:3931 msgid "The :manpage:`timerfd_create(2)` man page." msgstr ":manpage:`timerfd_create(2)` 手冊頁。" -#: ../../library/os.rst:3939 +#: ../../library/os.rst:3940 msgid "" "Alter a timer file descriptor's internal timer. This function operates the " "same interval timer as :func:`timerfd_settime_ns`." msgstr "" -#: ../../library/os.rst:3942 +#: ../../library/os.rst:3943 msgid "*fd* must be a valid timer file descriptor." msgstr "" -#: ../../library/os.rst:3944 +#: ../../library/os.rst:3945 msgid "" "The timer's behaviour can be modified by specifying a *flags* value. Any of " "the following variables may used, combined using bitwise OR (the ``|`` " "operator):" msgstr "" -#: ../../library/os.rst:3948 +#: ../../library/os.rst:3949 msgid ":const:`TFD_TIMER_ABSTIME`" msgstr ":const:`TFD_TIMER_ABSTIME`" -#: ../../library/os.rst:3949 +#: ../../library/os.rst:3950 msgid ":const:`TFD_TIMER_CANCEL_ON_SET`" msgstr ":const:`TFD_TIMER_CANCEL_ON_SET`" -#: ../../library/os.rst:3951 +#: ../../library/os.rst:3952 msgid "" "The timer is disabled by setting *initial* to zero (``0``). If *initial* is " "equal to or greater than zero, the timer is enabled. If *initial* is less " @@ -4486,20 +4487,20 @@ msgid "" "const:`errno.EINVAL`" msgstr "" -#: ../../library/os.rst:3956 +#: ../../library/os.rst:3957 msgid "" "By default the timer will fire when *initial* seconds have elapsed. (If " "*initial* is zero, timer will fire immediately.)" msgstr "" -#: ../../library/os.rst:3959 +#: ../../library/os.rst:3960 msgid "" "However, if the :const:`TFD_TIMER_ABSTIME` flag is set, the timer will fire " "when the timer's clock (set by *clockid* in :func:`timerfd_create`) reaches " "*initial* seconds." msgstr "" -#: ../../library/os.rst:3963 +#: ../../library/os.rst:3964 msgid "" "The timer's interval is set by the *interval* :py:class:`float`. If " "*interval* is zero, the timer only fires once, on the initial expiration. If " @@ -4509,7 +4510,7 @@ msgid "" "EINVAL`" msgstr "" -#: ../../library/os.rst:3970 +#: ../../library/os.rst:3971 msgid "" "If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along with :const:" "`TFD_TIMER_ABSTIME` and the clock for this timer is :const:`time." @@ -4518,86 +4519,86 @@ msgid "" "ECANCELED." msgstr "" -#: ../../library/os.rst:3976 +#: ../../library/os.rst:3977 msgid "" "Linux manages system clock as UTC. A daylight-savings time transition is " "done by changing time offset only and doesn't cause discontinuous system " "clock change." msgstr "" -#: ../../library/os.rst:3980 +#: ../../library/os.rst:3981 msgid "" "Discontinuous system clock change will be caused by the following events:" msgstr "" -#: ../../library/os.rst:3982 +#: ../../library/os.rst:3983 msgid "``settimeofday``" msgstr "``settimeofday``" -#: ../../library/os.rst:3983 +#: ../../library/os.rst:3984 msgid "``clock_settime``" msgstr "``clock_settime``" -#: ../../library/os.rst:3984 +#: ../../library/os.rst:3985 msgid "set the system date and time by ``date`` command" msgstr "" -#: ../../library/os.rst:3986 +#: ../../library/os.rst:3987 msgid "" "Return a two-item tuple of (``next_expiration``, ``interval``) from the " "previous timer state, before this function executed." msgstr "" -#: ../../library/os.rst:3991 +#: ../../library/os.rst:3992 msgid "" ":manpage:`timerfd_create(2)`, :manpage:`timerfd_settime(2)`, :manpage:" "`settimeofday(2)`, :manpage:`clock_settime(2)`, and :manpage:`date(1)`." msgstr "" -#: ../../library/os.rst:4002 +#: ../../library/os.rst:4003 msgid "" "Similar to :func:`timerfd_settime`, but use time as nanoseconds. This " "function operates the same interval timer as :func:`timerfd_settime`." msgstr "" -#: ../../library/os.rst:4012 +#: ../../library/os.rst:4013 msgid "Return a two-item tuple of floats (``next_expiration``, ``interval``)." msgstr "" -#: ../../library/os.rst:4014 +#: ../../library/os.rst:4015 msgid "" "``next_expiration`` denotes the relative time until next the timer next " "fires, regardless of if the :const:`TFD_TIMER_ABSTIME` flag is set." msgstr "" -#: ../../library/os.rst:4017 +#: ../../library/os.rst:4018 msgid "" "``interval`` denotes the timer's interval. If zero, the timer will only fire " "once, after ``next_expiration`` seconds have elapsed." msgstr "" -#: ../../library/os.rst:4021 +#: ../../library/os.rst:4022 msgid ":manpage:`timerfd_gettime(2)`" msgstr ":manpage:`timerfd_gettime(2)`" -#: ../../library/os.rst:4030 +#: ../../library/os.rst:4031 msgid "Similar to :func:`timerfd_gettime`, but return time as nanoseconds." msgstr "" -#: ../../library/os.rst:4038 +#: ../../library/os.rst:4039 msgid "" "A flag for the :func:`timerfd_create` function, which sets the :const:" "`O_NONBLOCK` status flag for the new timer file descriptor. If :const:" "`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks." msgstr "" -#: ../../library/os.rst:4048 +#: ../../library/os.rst:4049 msgid "" "A flag for the :func:`timerfd_create` function, If :const:`TFD_CLOEXEC` is " "set as a flag, set close-on-exec flag for new file descriptor." msgstr "" -#: ../../library/os.rst:4058 +#: ../../library/os.rst:4059 msgid "" "A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " "functions. If this flag is set, *initial* is interpreted as an absolute " @@ -4605,22 +4606,22 @@ msgid "" "Epoch)." msgstr "" -#: ../../library/os.rst:4068 +#: ../../library/os.rst:4069 msgid "" "A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " "functions along with :const:`TFD_TIMER_ABSTIME`. The timer is cancelled when " "the time of the underlying clock changes discontinuously." msgstr "" -#: ../../library/os.rst:4079 +#: ../../library/os.rst:4080 msgid "Linux extended attributes" msgstr "" -#: ../../library/os.rst:4083 +#: ../../library/os.rst:4084 msgid "These functions are all available on Linux only." msgstr "" -#: ../../library/os.rst:4087 +#: ../../library/os.rst:4088 msgid "" "Return the value of the extended filesystem attribute *attribute* for " "*path*. *attribute* can be bytes or str (directly or indirectly through the :" @@ -4628,7 +4629,7 @@ msgid "" "encoding." msgstr "" -#: ../../library/os.rst:4095 +#: ../../library/os.rst:4096 msgid "" "Raises an :ref:`auditing event ` ``os.getxattr`` with arguments " "``path``, ``attribute``." @@ -4636,12 +4637,12 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.getxattr``。" -#: ../../library/os.rst:4097 ../../library/os.rst:4129 -#: ../../library/os.rst:4154 +#: ../../library/os.rst:4098 ../../library/os.rst:4130 +#: ../../library/os.rst:4155 msgid "Accepts a :term:`path-like object` for *path* and *attribute*." msgstr "" -#: ../../library/os.rst:4103 +#: ../../library/os.rst:4104 msgid "" "Return a list of the extended filesystem attributes on *path*. The " "attributes in the list are represented as strings decoded with the " @@ -4649,14 +4650,14 @@ msgid "" "the current directory." msgstr "" -#: ../../library/os.rst:4111 +#: ../../library/os.rst:4112 msgid "" "Raises an :ref:`auditing event ` ``os.listxattr`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listxattr``。" -#: ../../library/os.rst:4119 +#: ../../library/os.rst:4120 msgid "" "Removes the extended filesystem attribute *attribute* from *path*. " "*attribute* should be bytes or str (directly or indirectly through the :" @@ -4664,7 +4665,7 @@ msgid "" "`filesystem encoding and error handler`." msgstr "" -#: ../../library/os.rst:4127 +#: ../../library/os.rst:4128 msgid "" "Raises an :ref:`auditing event ` ``os.removexattr`` with arguments " "``path``, ``attribute``." @@ -4672,7 +4673,7 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.removexattr``。" -#: ../../library/os.rst:4135 +#: ../../library/os.rst:4136 msgid "" "Set the extended filesystem attribute *attribute* on *path* to *value*. " "*attribute* must be a bytes or str with no embedded NULs (directly or " @@ -4684,13 +4685,13 @@ msgid "" "will not be created and ``EEXISTS`` will be raised." msgstr "" -#: ../../library/os.rst:4149 +#: ../../library/os.rst:4150 msgid "" "A bug in Linux kernel versions less than 2.6.39 caused the flags argument to " "be ignored on some filesystems." msgstr "" -#: ../../library/os.rst:4152 +#: ../../library/os.rst:4153 msgid "" "Raises an :ref:`auditing event ` ``os.setxattr`` with arguments " "``path``, ``attribute``, ``value``, ``flags``." @@ -4698,33 +4699,33 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute``、``value``、``flags`` 的\\ :ref:`稽" "核事件 ` ``os.setxattr``。" -#: ../../library/os.rst:4160 +#: ../../library/os.rst:4161 msgid "" "The maximum size the value of an extended attribute can be. Currently, this " "is 64 KiB on Linux." msgstr "" -#: ../../library/os.rst:4166 +#: ../../library/os.rst:4167 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must create an attribute." msgstr "" -#: ../../library/os.rst:4172 +#: ../../library/os.rst:4173 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must replace an existing attribute." msgstr "" -#: ../../library/os.rst:4179 +#: ../../library/os.rst:4180 msgid "Process Management" msgstr "行程管理" -#: ../../library/os.rst:4181 +#: ../../library/os.rst:4182 msgid "These functions may be used to create and manage processes." msgstr "" -#: ../../library/os.rst:4183 +#: ../../library/os.rst:4184 msgid "" "The various :func:`exec\\* ` functions take a list of arguments for " "the new program loaded into the process. In each case, the first of these " @@ -4735,7 +4736,7 @@ msgid "" "standard output; ``foo`` will seem to be ignored." msgstr "" -#: ../../library/os.rst:4194 +#: ../../library/os.rst:4195 msgid "" "Generate a :const:`SIGABRT` signal to the current process. On Unix, the " "default behavior is to produce a core dump; on Windows, the process " @@ -4744,31 +4745,31 @@ msgid "" "`SIGABRT` with :func:`signal.signal`." msgstr "" -#: ../../library/os.rst:4203 +#: ../../library/os.rst:4204 msgid "Add a path to the DLL search path." msgstr "" -#: ../../library/os.rst:4205 +#: ../../library/os.rst:4206 msgid "" "This search path is used when resolving dependencies for imported extension " "modules (the module itself is resolved through :data:`sys.path`), and also " "by :mod:`ctypes`." msgstr "" -#: ../../library/os.rst:4209 +#: ../../library/os.rst:4210 msgid "" "Remove the directory by calling **close()** on the returned object or using " "it in a :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:4212 +#: ../../library/os.rst:4213 msgid "" "See the `Microsoft documentation `_ for more information about how " "DLLs are loaded." msgstr "" -#: ../../library/os.rst:4216 +#: ../../library/os.rst:4217 msgid "" "Raises an :ref:`auditing event ` ``os.add_dll_directory`` with " "argument ``path``." @@ -4776,7 +4777,7 @@ msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os." "add_dll_directory``。" -#: ../../library/os.rst:4220 +#: ../../library/os.rst:4221 msgid "" "Previous versions of CPython would resolve DLLs using the default behavior " "for the current process. This led to inconsistencies, such as only sometimes " @@ -4784,14 +4785,14 @@ msgid "" "such as ``AddDllDirectory`` having no effect." msgstr "" -#: ../../library/os.rst:4227 +#: ../../library/os.rst:4228 msgid "" "In 3.8, the two primary ways DLLs are loaded now explicitly override the " "process-wide behavior to ensure consistency. See the :ref:`porting notes " "` for information on updating libraries." msgstr "" -#: ../../library/os.rst:4242 +#: ../../library/os.rst:4243 msgid "" "These functions all execute a new program, replacing the current process; " "they do not return. On Unix, the new executable is loaded into the current " @@ -4799,7 +4800,7 @@ msgid "" "reported as :exc:`OSError` exceptions." msgstr "" -#: ../../library/os.rst:4247 +#: ../../library/os.rst:4248 msgid "" "The current process is replaced immediately. Open file objects and " "descriptors are not flushed, so if there may be data buffered on these open " @@ -4807,7 +4808,7 @@ msgid "" "fsync` before calling an :func:`exec\\* ` function." msgstr "" -#: ../../library/os.rst:4253 +#: ../../library/os.rst:4254 msgid "" "The \"l\" and \"v\" variants of the :func:`exec\\* ` functions differ " "in how command-line arguments are passed. The \"l\" variants are perhaps " @@ -4820,7 +4821,7 @@ msgid "" "is not enforced." msgstr "" -#: ../../library/os.rst:4262 +#: ../../library/os.rst:4263 msgid "" "The variants which include a \"p\" near the end (:func:`execlp`, :func:" "`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the :envvar:`PATH` " @@ -4834,7 +4835,7 @@ msgid "" "even on Windows, as plain names will not be resolved." msgstr "" -#: ../../library/os.rst:4273 +#: ../../library/os.rst:4274 msgid "" "For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -4844,7 +4845,7 @@ msgid "" "process to inherit the environment of the current process." msgstr "" -#: ../../library/os.rst:4280 +#: ../../library/os.rst:4281 msgid "" "For :func:`execve` on some platforms, *path* may also be specified as an " "open file descriptor. This functionality may not be supported on your " @@ -4853,7 +4854,7 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:4285 +#: ../../library/os.rst:4286 msgid "" "Raises an :ref:`auditing event ` ``os.exec`` with arguments " "``path``, ``args``, ``env``." @@ -4861,25 +4862,25 @@ msgstr "" "引發一個附帶引數 ``path``、``args``、``env`` 的\\ :ref:`稽核事件 ` " "``os.exec``。" -#: ../../library/os.rst:4289 +#: ../../library/os.rst:4290 msgid "" "Added support for specifying *path* as an open file descriptor for :func:" "`execve`." msgstr "" -#: ../../library/os.rst:4298 +#: ../../library/os.rst:4299 msgid "" "Exit the process with status *n*, without calling cleanup handlers, flushing " "stdio buffers, etc." msgstr "" -#: ../../library/os.rst:4303 +#: ../../library/os.rst:4304 msgid "" "The standard way to exit is :func:`sys.exit(n) `. :func:`!_exit` " "should normally only be used in the child process after a :func:`fork`." msgstr "" -#: ../../library/os.rst:4306 +#: ../../library/os.rst:4307 msgid "" "The following exit codes are defined and can be used with :func:`_exit`, " "although they are not required. These are typically used for system " @@ -4887,139 +4888,139 @@ msgid "" "delivery program." msgstr "" -#: ../../library/os.rst:4312 +#: ../../library/os.rst:4313 msgid "" "Some of these may not be available on all Unix platforms, since there is " "some variation. These constants are defined where they are defined by the " "underlying platform." msgstr "" -#: ../../library/os.rst:4319 +#: ../../library/os.rst:4320 msgid "" "Exit code that means no error occurred. May be taken from the defined value " "of ``EXIT_SUCCESS`` on some platforms. Generally has a value of zero." msgstr "" -#: ../../library/os.rst:4327 +#: ../../library/os.rst:4328 msgid "" "Exit code that means the command was used incorrectly, such as when the " "wrong number of arguments are given." msgstr "" -#: ../../library/os.rst:4335 +#: ../../library/os.rst:4336 msgid "Exit code that means the input data was incorrect." msgstr "" -#: ../../library/os.rst:4342 +#: ../../library/os.rst:4343 msgid "Exit code that means an input file did not exist or was not readable." msgstr "" -#: ../../library/os.rst:4349 +#: ../../library/os.rst:4350 msgid "Exit code that means a specified user did not exist." msgstr "" -#: ../../library/os.rst:4356 +#: ../../library/os.rst:4357 msgid "Exit code that means a specified host did not exist." msgstr "" -#: ../../library/os.rst:4363 +#: ../../library/os.rst:4364 msgid "Exit code that means that a required service is unavailable." msgstr "" -#: ../../library/os.rst:4370 +#: ../../library/os.rst:4371 msgid "Exit code that means an internal software error was detected." msgstr "" -#: ../../library/os.rst:4377 +#: ../../library/os.rst:4378 msgid "" "Exit code that means an operating system error was detected, such as the " "inability to fork or create a pipe." msgstr "" -#: ../../library/os.rst:4385 +#: ../../library/os.rst:4386 msgid "" "Exit code that means some system file did not exist, could not be opened, or " "had some other kind of error." msgstr "" -#: ../../library/os.rst:4393 +#: ../../library/os.rst:4394 msgid "Exit code that means a user specified output file could not be created." msgstr "" -#: ../../library/os.rst:4400 +#: ../../library/os.rst:4401 msgid "" "Exit code that means that an error occurred while doing I/O on some file." msgstr "" -#: ../../library/os.rst:4407 +#: ../../library/os.rst:4408 msgid "" "Exit code that means a temporary failure occurred. This indicates something " "that may not really be an error, such as a network connection that couldn't " "be made during a retryable operation." msgstr "" -#: ../../library/os.rst:4416 +#: ../../library/os.rst:4417 msgid "" "Exit code that means that a protocol exchange was illegal, invalid, or not " "understood." msgstr "" -#: ../../library/os.rst:4424 +#: ../../library/os.rst:4425 msgid "" "Exit code that means that there were insufficient permissions to perform the " "operation (but not intended for file system problems)." msgstr "" -#: ../../library/os.rst:4432 +#: ../../library/os.rst:4433 msgid "Exit code that means that some kind of configuration error occurred." msgstr "" -#: ../../library/os.rst:4439 +#: ../../library/os.rst:4440 msgid "Exit code that means something like \"an entry was not found\"." msgstr "" -#: ../../library/os.rst:4446 +#: ../../library/os.rst:4447 msgid "" "Fork a child process. Return ``0`` in the child and the child's process id " "in the parent. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4449 +#: ../../library/os.rst:4450 msgid "" "Note that some platforms including FreeBSD <= 6.3 and Cygwin have known " "issues when using ``fork()`` from a thread." msgstr "" -#: ../../library/os.rst:4452 +#: ../../library/os.rst:4453 msgid "" "Raises an :ref:`auditing event ` ``os.fork`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.fork``。" -#: ../../library/os.rst:4456 +#: ../../library/os.rst:4457 msgid "" "If you use TLS sockets in an application calling ``fork()``, see the warning " "in the :mod:`ssl` documentation." msgstr "" -#: ../../library/os.rst:4461 ../../library/os.rst:4505 +#: ../../library/os.rst:4462 ../../library/os.rst:4506 msgid "" "On macOS the use of this function is unsafe when mixed with using higher-" "level system APIs, and that includes using :mod:`urllib.request`." msgstr "" -#: ../../library/os.rst:4464 +#: ../../library/os.rst:4465 msgid "" "Calling ``fork()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4468 +#: ../../library/os.rst:4469 msgid "" "If Python is able to detect that your process has multiple threads, :func:" "`os.fork` now raises a :exc:`DeprecationWarning`." msgstr "" -#: ../../library/os.rst:4472 +#: ../../library/os.rst:4473 msgid "" "We chose to surface this as a warning, when detectable, to better inform " "developers of a design problem that the POSIX platform specifically notes as " @@ -5030,21 +5031,21 @@ msgid "" "``free``)." msgstr "" -#: ../../library/os.rst:4481 +#: ../../library/os.rst:4482 msgid "" "Users of macOS or users of libc or malloc implementations other than those " "typically found in glibc to date are among those already more likely to " "experience deadlocks running such code." msgstr "" -#: ../../library/os.rst:4485 +#: ../../library/os.rst:4486 msgid "" "See `this discussion on fork being incompatible with threads `_ for technical details of why we're surfacing " "this longstanding platform compatibility problem to developers." msgstr "" -#: ../../library/os.rst:4495 +#: ../../library/os.rst:4496 msgid "" "Fork a child process, using a new pseudo-terminal as the child's controlling " "terminal. Return a pair of ``(pid, fd)``, where *pid* is ``0`` in the child, " @@ -5053,39 +5054,38 @@ msgid "" "the :mod:`pty` module. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4501 +#: ../../library/os.rst:4502 msgid "" "Raises an :ref:`auditing event ` ``os.forkpty`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.forkpty``。" -#: ../../library/os.rst:4508 +#: ../../library/os.rst:4509 msgid "" "Calling ``forkpty()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4512 +#: ../../library/os.rst:4513 msgid "" "If Python is able to detect that your process has multiple threads, this now " "raises a :exc:`DeprecationWarning`. See the longer explanation on :func:`os." "fork`." msgstr "" -#: ../../library/os.rst:4526 +#: ../../library/os.rst:4527 msgid "" "Send signal *sig* to the process *pid*. Constants for the specific signals " "available on the host platform are defined in the :mod:`signal` module." msgstr "" -#: ../../library/os.rst:4529 +#: ../../library/os.rst:4530 msgid "" "Windows: The :const:`signal.CTRL_C_EVENT` and :const:`signal." "CTRL_BREAK_EVENT` signals are special signals which can only be sent to " "console processes which share a common console window, e.g., some " "subprocesses. Any other value for *sig* will cause the process to be " "unconditionally killed by the TerminateProcess API, and the exit code will " -"be set to *sig*. The Windows version of :func:`kill` additionally takes " -"process handles to be killed." +"be set to *sig*." msgstr "" #: ../../library/os.rst:4537 @@ -6276,7 +6276,7 @@ msgid "" msgstr "" #: ../../library/os.rst:5544 -msgid "See also the :func:`sched_getaffinity` functions." +msgid "See also the :func:`sched_getaffinity` function." msgstr "也請見 :func:`sched_getaffinity` 函式。" #: ../../library/os.rst:5551 @@ -6515,7 +6515,7 @@ msgstr "" #: ../../library/os.rst:372 ../../library/os.rst:438 ../../library/os.rst:447 #: ../../library/os.rst:456 ../../library/os.rst:470 ../../library/os.rst:666 -#: ../../library/os.rst:4522 ../../library/os.rst:4549 +#: ../../library/os.rst:4523 ../../library/os.rst:4549 msgid "process" msgstr "process" @@ -6569,7 +6569,7 @@ msgstr "pty" #: ../../library/os.rst:2045 ../../library/os.rst:2457 #: ../../library/os.rst:2658 ../../library/os.rst:3562 -#: ../../library/os.rst:3661 +#: ../../library/os.rst:3662 msgid "directory" msgstr "directory(目錄)" @@ -6593,19 +6593,19 @@ msgstr "以及 os.makedirs()" msgid "stat" msgstr "stat" -#: ../../library/os.rst:3562 ../../library/os.rst:3661 +#: ../../library/os.rst:3562 ../../library/os.rst:3662 msgid "walking" msgstr "" -#: ../../library/os.rst:3562 ../../library/os.rst:3661 +#: ../../library/os.rst:3562 ../../library/os.rst:3662 msgid "traversal" msgstr "traversal(遍歷)" -#: ../../library/os.rst:4522 ../../library/os.rst:4549 +#: ../../library/os.rst:4523 ../../library/os.rst:4549 msgid "killing" msgstr "" -#: ../../library/os.rst:4522 ../../library/os.rst:4549 +#: ../../library/os.rst:4523 ../../library/os.rst:4549 msgid "signalling" msgstr "signalling(信號)" diff --git a/library/pathlib.po b/library/pathlib.po index ffd0c4ac4f..4db35f669b 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -23,9 +23,8 @@ msgid ":mod:`!pathlib` --- Object-oriented filesystem paths" msgstr ":mod:`!pathlib` --- 物件導向檔案系統路徑" #: ../../library/pathlib.rst:9 -#, fuzzy msgid "**Source code:** :source:`Lib/pathlib/`" -msgstr "**原始碼:**\\ :source:`Lib/pathlib.py`" +msgstr "**原始碼:**\\ :source:`Lib/pathlib/`" #: ../../library/pathlib.rst:15 msgid "" @@ -188,9 +187,8 @@ msgstr "" "'#!/bin/bash\\n'" #: ../../library/pathlib.rst:97 -#, fuzzy msgid "Exceptions" -msgstr "operations(操作)" +msgstr "例外" #: ../../library/pathlib.rst:101 msgid "" @@ -864,9 +862,8 @@ msgstr "" "''" #: ../../library/pathlib.rst:447 -#, fuzzy msgid "The last dot-separated portion of the final component, if any::" -msgstr "若存在則為最後的路徑組成的檔案副檔名: ::" +msgstr "以點分隔路徑的最後一個部分(如存在): ::" #: ../../library/pathlib.rst:449 msgid "" @@ -885,14 +882,12 @@ msgstr "" "''" #: ../../library/pathlib.rst:456 -#, fuzzy msgid "This is commonly called the file extension." -msgstr "路徑檔案副檔名的串列: ::" +msgstr "這通常被稱為檔案副檔名。" #: ../../library/pathlib.rst:460 -#, fuzzy msgid "A list of the path's suffixes, often called file extensions::" -msgstr "路徑檔案副檔名的串列: ::" +msgstr "一個路徑後綴 (suffix) 的串列,通常被稱為檔案副檔名: ::" #: ../../library/pathlib.rst:462 msgid "" @@ -912,7 +907,7 @@ msgstr "" #: ../../library/pathlib.rst:472 msgid "The final path component, without its suffix::" -msgstr "最後的路徑組成,不包括後綴 (suffix): ::" +msgstr "最後的路徑組成,不包括後綴: ::" #: ../../library/pathlib.rst:474 msgid "" @@ -1054,16 +1049,14 @@ msgstr "" "PureWindowsPath('c:/Program Files')" #: ../../library/pathlib.rst:568 -#, fuzzy msgid "" "Match this path against the provided glob-style pattern. Return ``True`` if " "matching is successful, ``False`` otherwise. For example::" msgstr "" "將路徑與 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回傳 " -"``True``,否則回傳 ``False``。" +"``True``,否則回傳 ``False``,例如: ::" #: ../../library/pathlib.rst:571 -#, fuzzy msgid "" ">>> PurePath('a/b.py').full_match('a/*.py')\n" "True\n" @@ -1074,12 +1067,14 @@ msgid "" ">>> PurePath('/a/b/c.py').full_match('**/*.py')\n" "True" msgstr "" -">>> PurePath('a/b.py').match('*.py')\n" +">>> PurePath('a/b.py').full_match('a/*.py')\n" "True\n" -">>> PurePath('/a/b/c.py').match('b/*.py')\n" +">>> PurePath('a/b.py').full_match('*.py')\n" +"False\n" +">>> PurePath('/a/b/c.py').full_match('/a/**')\n" "True\n" -">>> PurePath('/a/b/c.py').match('a/*.py')\n" -"False" +">>> PurePath('/a/b/c.py').full_match('**/*.py')\n" +"True" #: ../../library/pathlib.rst:581 ../../library/pathlib.rst:1291 msgid ":ref:`pathlib-pattern-language` documentation." @@ -1090,16 +1085,15 @@ msgid "As with other methods, case-sensitivity follows platform defaults::" msgstr "像其它方法一樣,是否區分大小寫會遵循平台的預設行為: ::" #: ../../library/pathlib.rst:585 -#, fuzzy msgid "" ">>> PurePosixPath('b.py').full_match('*.PY')\n" "False\n" ">>> PureWindowsPath('b.py').full_match('*.PY')\n" "True" msgstr "" -">>> PurePosixPath('b.py').match('*.PY')\n" +">>> PurePosixPath('b.py').full_match('*.PY')\n" "False\n" -">>> PureWindowsPath('b.py').match('*.PY')\n" +">>> PureWindowsPath('b.py').full_match('*.PY')\n" "True" #: ../../library/pathlib.rst:590 @@ -1108,13 +1102,12 @@ msgid "" msgstr "將 *case_sensitive* 設定成 ``True`` 或 ``False`` 會覆蓋這個行為。" #: ../../library/pathlib.rst:597 -#, fuzzy msgid "" "Match this path against the provided non-recursive glob-style pattern. " "Return ``True`` if matching is successful, ``False`` otherwise." msgstr "" -"將路徑與 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回傳 " -"``True``,否則回傳 ``False``。" +"將路徑與非遞迴 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回" +"傳 ``True``,否則回傳 ``False``。" #: ../../library/pathlib.rst:600 msgid "" @@ -1478,7 +1471,6 @@ msgstr "" "你的應用程式導致漏洞或故障): ::" #: ../../library/pathlib.rst:802 -#, fuzzy msgid "" ">>> import os\n" ">>> os.name\n" @@ -1506,7 +1498,7 @@ msgstr "" " File \"\", line 1, in \n" " File \"pathlib.py\", line 798, in __new__\n" " % (cls.__name__,))\n" -"NotImplementedError: cannot instantiate 'WindowsPath' on your system" +"UnsupportedOperation: cannot instantiate 'WindowsPath' on your system" #: ../../library/pathlib.rst:816 msgid "" @@ -1536,12 +1528,11 @@ msgid "Return a new path object from parsing a 'file' URI. For example::" msgstr "" #: ../../library/pathlib.rst:835 -#, fuzzy msgid "" ">>> p = Path.from_uri('file:///etc/hosts')\n" "PosixPath('/etc/hosts')" msgstr "" -">>> PosixPath('/etc/hosts')\n" +">>> p = Path.from_uri('file:///etc/hosts')\n" "PosixPath('/etc/hosts')" #: ../../library/pathlib.rst:838 @@ -1549,17 +1540,16 @@ msgid "On Windows, DOS device and UNC paths may be parsed from URIs::" msgstr "" #: ../../library/pathlib.rst:840 -#, fuzzy msgid "" ">>> p = Path.from_uri('file:///c:/windows')\n" "WindowsPath('c:/windows')\n" ">>> p = Path.from_uri('file://server/share')\n" "WindowsPath('//server/share')" msgstr "" -">>> PureWindowsPath('c:/', 'Users', 'Ximénez')\n" -"PureWindowsPath('c:/Users/Ximénez')\n" -">>> PureWindowsPath('//server/share/file')\n" -"PureWindowsPath('//server/share/file')" +">>> p = Path.from_uri('file:///c:/windows')\n" +"WindowsPath('c:/windows')\n" +">>> p = Path.from_uri('file://server/share')\n" +"WindowsPath('//server/share')" #: ../../library/pathlib.rst:845 msgid "Several variant forms are supported::" @@ -1584,15 +1574,14 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:864 -#, fuzzy msgid "" "Represent the path as a 'file' URI. :exc:`ValueError` is raised if the path " "isn't absolute." msgstr "" -"以 ``file`` URI 來表示一個路徑。如果不是絕對路徑會引發 :exc:`ValueError`。" +"以 ``file`` URI 來表示一個路徑。如果路徑不是絕對的則會引發 :exc:" +"`ValueError`。" #: ../../library/pathlib.rst:867 -#, fuzzy msgid "" ">>> p = PosixPath('/etc/passwd')\n" ">>> p.as_uri()\n" @@ -1601,12 +1590,12 @@ msgid "" ">>> p.as_uri()\n" "'file:///c:/Windows'" msgstr "" -">>> p = PurePath('/etc')\n" -">>> str(p)\n" -"'/etc'\n" -">>> p = PureWindowsPath('c:/Program Files')\n" -">>> str(p)\n" -"'c:\\\\Program Files'" +">>> p = PosixPath('/etc/passwd')\n" +">>> p.as_uri()\n" +"'file:///etc/passwd'\n" +">>> p = WindowsPath('c:/Windows')\n" +">>> p.as_uri()\n" +"'file:///c:/Windows'" #: ../../library/pathlib.rst:876 msgid "" @@ -1727,16 +1716,15 @@ msgstr "" "PosixPath('/home/antoine/pathlib/setup.py')" #: ../../library/pathlib.rst:951 -#, fuzzy msgid "" "If a path doesn't exist or a symlink loop is encountered, and *strict* is " "``True``, :exc:`OSError` is raised. If *strict* is ``False``, the path is " "resolved as far as possible and any remainder is appended without checking " "whether it exists." msgstr "" -"如果路徑不存在且 *strict* 為 ``True``,則引發 :exc:`FileNotFoundError`。如果 " -"*strict* 為 ``False``,則將盡可能解析該路徑,並將任何剩餘部分追加到路徑中,而" -"不檢查其是否存在。如果在解析過程中遇到無窮迴圈,則引發 :exc:`RuntimeError`。" +"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引發 :exc:" +"`OSError`。如果 *strict* 為 ``False``,則將盡可能解析該路徑,並將任何剩餘部分" +"追加到路徑中,而不檢查其是否存在。" #: ../../library/pathlib.rst:956 msgid "The *strict* parameter was added (pre-3.6 behavior is strict)." @@ -1869,13 +1857,12 @@ msgstr "" "False" #: ../../library/pathlib.rst:1045 -#, fuzzy msgid "" "Return ``True`` if the path points to a regular file, ``False`` if it points " "to another kind of file." msgstr "" -"如果該路徑指向一個普通檔案(或者是一個指向普通檔案的符號連結)則回傳 " -"``True``,如果指向其他類型的檔案則回傳 ``False``。" +"如果該路徑指向一個普通檔案則回傳 ``True``,如果指向其他類型的檔案則回傳 " +"``False``。" #: ../../library/pathlib.rst:1048 ../../library/pathlib.rst:1063 #: ../../library/pathlib.rst:1111 ../../library/pathlib.rst:1120 @@ -1888,30 +1875,27 @@ msgstr "" "限錯誤)則會傳遞出來。" #: ../../library/pathlib.rst:1051 -#, fuzzy msgid "" "This method normally follows symlinks; to exclude symlinks, add the argument " "``follow_symlinks=False``." msgstr "" -"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"此方法通常會跟隨符號連結;如果想將符號連結除外,可以加上引數 " "``follow_symlinks=False``。" #: ../../library/pathlib.rst:1060 -#, fuzzy msgid "" "Return ``True`` if the path points to a directory, ``False`` if it points to " "another kind of file." msgstr "" -"如果該路徑指向一個目錄(或者是一個指向目錄的符號連結)則回傳 ``True``,如果指" -"向其他類型的檔案則回傳 ``False``。" +"如果該路徑指向一個目錄則回傳 ``True``,如果指向其他類型的檔案則回傳 " +"``False``。" #: ../../library/pathlib.rst:1066 -#, fuzzy msgid "" "This method normally follows symlinks; to exclude symlinks to directories, " "add the argument ``follow_symlinks=False``." msgstr "" -"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"此方法通常會跟隨符號連結;如果想將對目錄的符號連結除外,可以加上引數 " "``follow_symlinks=False``。" #: ../../library/pathlib.rst:1075 @@ -2174,7 +2158,6 @@ msgstr "" "對到的檔案(任意類型): ::" #: ../../library/pathlib.rst:1279 -#, fuzzy msgid "" ">>> sorted(Path('.').glob('*.py'))\n" "[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." @@ -2188,6 +2171,11 @@ msgid "" " PosixPath('setup.py'),\n" " PosixPath('test_pathlib.py')]" msgstr "" +">>> sorted(Path('.').glob('*.py'))\n" +"[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." +"py')]\n" +">>> sorted(Path('.').glob('*/*.py'))\n" +"[PosixPath('docs/conf.py')]\n" ">>> sorted(Path('.').glob('**/*.py'))\n" "[PosixPath('build/lib/pathlib.py'),\n" " PosixPath('docs/conf.py'),\n" @@ -2223,9 +2211,8 @@ msgstr "" "``pathlib.Path.glob``。" #: ../../library/pathlib.rst:1307 ../../library/pathlib.rst:1332 -#, fuzzy msgid "The *recurse_symlinks* parameter was added." -msgstr "新增 *follow_symlinks* 參數。" +msgstr "新增 *recurse_symlinks* 參數。" #: ../../library/pathlib.rst:1313 msgid "" @@ -2235,18 +2222,16 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:1321 -#, fuzzy msgid "" "Glob the given relative *pattern* recursively. This is like calling :func:" "`Path.glob` with \"``**/``\" added in front of the *pattern*." msgstr "" "遞迴地 glob 給定的相對 *pattern*。這相當於在給定的相對 *pattern* 前面加上 " -"\"``**/``\" 並呼叫 :func:`Path.glob`,其中 *patterns* 和給 :mod:`fnmatch` 的" -"相同: ::" +"\"``**/``\" 並呼叫 :func:`Path.glob`。" #: ../../library/pathlib.rst:1325 msgid ":ref:`pathlib-pattern-language` and :meth:`Path.glob` documentation." -msgstr "" +msgstr ":ref:`pathlib-pattern-language` 和 :meth:`Path.glob` 文件。" #: ../../library/pathlib.rst:1327 msgid "" @@ -2670,7 +2655,6 @@ msgid "Permissions and ownership" msgstr "" #: ../../library/pathlib.rst:1590 -#, fuzzy msgid "" "Return the name of the user owning the file. :exc:`KeyError` is raised if " "the file's user identifier (UID) isn't found in the system database." @@ -2679,12 +2663,11 @@ msgstr "" "(UID),則會引發 :exc:`KeyError`。" #: ../../library/pathlib.rst:1593 -#, fuzzy msgid "" "This method normally follows symlinks; to get the owner of the symlink, add " "the argument ``follow_symlinks=False``." msgstr "" -"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"此方法通常會跟隨符號連結;如果想取得符號連結的擁有者,可以加上引數 " "``follow_symlinks=False``。" #: ../../library/pathlib.rst:1596 @@ -2694,7 +2677,6 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:1606 -#, fuzzy msgid "" "Return the name of the group owning the file. :exc:`KeyError` is raised if " "the file's group identifier (GID) isn't found in the system database." @@ -2703,12 +2685,11 @@ msgstr "" "發 :exc:`KeyError`。" #: ../../library/pathlib.rst:1609 -#, fuzzy msgid "" "This method normally follows symlinks; to get the group of the symlink, add " "the argument ``follow_symlinks=False``." msgstr "" -"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"此方法通常會跟隨符號連結;如果想取得符號連結的群組,可以加上引數 " "``follow_symlinks=False``。" #: ../../library/pathlib.rst:1612 @@ -2828,11 +2809,11 @@ msgstr "" #: ../../library/pathlib.rst:1674 msgid "Meaning" -msgstr "" +msgstr "意涵" #: ../../library/pathlib.rst:1676 msgid "\"``**/*``\"" -msgstr "" +msgstr "\"``**/*``\"" #: ../../library/pathlib.rst:1676 msgid "Any path with at least one segment." @@ -2840,7 +2821,7 @@ msgstr "" #: ../../library/pathlib.rst:1677 msgid "\"``**/*.py``\"" -msgstr "" +msgstr "\"``**/*.py``\"" #: ../../library/pathlib.rst:1677 msgid "Any path with a final segment ending \"``.py``\"." @@ -2848,7 +2829,7 @@ msgstr "" #: ../../library/pathlib.rst:1678 msgid "\"``assets/**``\"" -msgstr "" +msgstr "\"``assets/**``\"" #: ../../library/pathlib.rst:1678 msgid "Any path starting with \"``assets/``\"." @@ -2856,7 +2837,7 @@ msgstr "" #: ../../library/pathlib.rst:1679 msgid "\"``assets/**/*``\"" -msgstr "" +msgstr "\"``assets/**/*``\"" #: ../../library/pathlib.rst:1679 msgid "" @@ -2882,18 +2863,16 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:1693 -#, fuzzy msgid "" "Globbing with a pattern that ends with a pathname components separator (:" "data:`~os.sep` or :data:`~os.altsep`) returns only directories." msgstr "" "如果 *pattern* 以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os." -"altsep`)作結尾則只會回傳目錄。" +"altsep`)作結尾來 glob 則只會回傳目錄。" #: ../../library/pathlib.rst:1699 -#, fuzzy msgid "Comparison to the :mod:`glob` module" -msgstr "與 :mod:`os` 模組裡的工具的對應關係" +msgstr "與 :mod:`glob` 模組的比較" #: ../../library/pathlib.rst:1701 msgid "" @@ -2942,9 +2921,8 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:1724 -#, fuzzy msgid "Comparison to the :mod:`os` and :mod:`os.path` modules" -msgstr ":mod:`os` 和 :mod:`os.path`" +msgstr "與 :mod:`os` 和 :mod:`os.path` 模組的比較" #: ../../library/pathlib.rst:1726 msgid "" diff --git a/library/pydoc.po b/library/pydoc.po index d301141ac0..8e39b85b7c 100644 --- a/library/pydoc.po +++ b/library/pydoc.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-30 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -80,18 +79,19 @@ msgstr "" #: ../../library/pydoc.rst:54 msgid "" "When printing output to the console, :program:`pydoc` attempts to paginate " -"the output for easier reading. If the :envvar:`PAGER` environment variable " -"is set, :program:`pydoc` will use its value as a pagination program." +"the output for easier reading. If either the :envvar:`MANPAGER` or the :" +"envvar:`PAGER` environment variable is set, :program:`pydoc` will use its " +"value as a pagination program. When both are set, :envvar:`MANPAGER` is used." msgstr "" -#: ../../library/pydoc.rst:58 +#: ../../library/pydoc.rst:59 msgid "" "Specifying a ``-w`` flag before the argument will cause HTML documentation " "to be written out to a file in the current directory, instead of displaying " "text on the console." msgstr "" -#: ../../library/pydoc.rst:62 +#: ../../library/pydoc.rst:63 msgid "" "Specifying a ``-k`` flag before the argument will search the synopsis lines " "of all available modules for the keyword given as the argument, again in a " @@ -99,7 +99,7 @@ msgid "" "module is the first line of its documentation string." msgstr "" -#: ../../library/pydoc.rst:67 +#: ../../library/pydoc.rst:68 msgid "" "You can also use :program:`pydoc` to start an HTTP server on the local " "machine that will serve documentation to visiting web browsers. :program:" @@ -109,7 +109,7 @@ msgid "" "arbitrary unused port." msgstr "" -#: ../../library/pydoc.rst:73 +#: ../../library/pydoc.rst:74 msgid "" ":program:`python -m pydoc -n ` will start the server listening at " "the given hostname. By default the hostname is 'localhost' but if you want " @@ -118,7 +118,7 @@ msgid "" "especially useful if you want to run pydoc from within a container." msgstr "" -#: ../../library/pydoc.rst:79 +#: ../../library/pydoc.rst:80 msgid "" ":program:`python -m pydoc -b` will start the server and additionally open a " "web browser to a module index page. Each served page has a navigation bar " @@ -127,7 +127,7 @@ msgid "" "*Topics* and *Keywords* pages." msgstr "" -#: ../../library/pydoc.rst:85 +#: ../../library/pydoc.rst:86 msgid "" "When :program:`pydoc` generates documentation, it uses the current " "environment and path to locate modules. Thus, invoking :program:`pydoc " @@ -135,7 +135,7 @@ msgid "" "started the Python interpreter and typed ``import spam``." msgstr "" -#: ../../library/pydoc.rst:90 +#: ../../library/pydoc.rst:91 msgid "" "Module docs for core modules are assumed to reside in ``https://docs.python." "org/X.Y/library/`` where ``X`` and ``Y`` are the major and minor version " @@ -144,21 +144,21 @@ msgid "" "directory containing the Library Reference Manual pages." msgstr "" -#: ../../library/pydoc.rst:97 +#: ../../library/pydoc.rst:98 msgid "Added the ``-b`` option." msgstr "新增 ``-b`` 選項。" -#: ../../library/pydoc.rst:100 +#: ../../library/pydoc.rst:101 msgid "The ``-g`` command line option was removed." msgstr "" -#: ../../library/pydoc.rst:103 +#: ../../library/pydoc.rst:104 msgid "" ":mod:`!pydoc` now uses :func:`inspect.signature` rather than :func:`inspect." "getfullargspec` to extract signature information from callables." msgstr "" -#: ../../library/pydoc.rst:108 +#: ../../library/pydoc.rst:109 msgid "Added the ``-n`` option." msgstr "新增 ``-n`` 選項。" diff --git a/library/re.po b/library/re.po index ade794f4a6..c5ceb995d2 100644 --- a/library/re.po +++ b/library/re.po @@ -1615,7 +1615,7 @@ msgstr "" #: ../../library/re.rst:1184 msgid "Exceptions" -msgstr "" +msgstr "例外" #: ../../library/re.rst:1188 msgid "" diff --git a/library/selectors.po b/library/selectors.po index 8ba4c1202d..6b0f35f089 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -114,7 +114,7 @@ msgstr "" #: ../../library/selectors.rst:61 msgid "Constant" -msgstr "" +msgstr "常數" #: ../../library/selectors.rst:61 msgid "Meaning" diff --git a/library/sqlite3.po b/library/sqlite3.po index 05aaa3758b..7d1f66f4ea 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-11-02 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -811,7 +811,7 @@ msgstr "" #: ../../library/sqlite3.rst:596 msgid "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" -msgstr "" +msgstr "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" #: ../../library/sqlite3.rst:597 msgid "SQLite docs: Database Connection Configuration Options" @@ -2959,20 +2959,22 @@ msgid "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" "Traceback (most recent call last):\n" -"OperationalError: attempt to write a readonly database" +"OperationalError: attempt to write a readonly database\n" +">>> con.close()" msgstr "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" "Traceback (most recent call last):\n" -"OperationalError: attempt to write a readonly database" +"OperationalError: attempt to write a readonly database\n" +">>> con.close()" -#: ../../library/sqlite3.rst:2464 +#: ../../library/sqlite3.rst:2465 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: ../../library/sqlite3.rst:2467 +#: ../../library/sqlite3.rst:2468 msgid "" ">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" "Traceback (most recent call last):\n" @@ -2982,11 +2984,11 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: unable to open database file" -#: ../../library/sqlite3.rst:2474 +#: ../../library/sqlite3.rst:2475 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:2476 +#: ../../library/sqlite3.rst:2477 msgid "" "db = \"file:mem1?mode=memory&cache=shared\"\n" "con1 = sqlite3.connect(db, uri=True)\n" @@ -3012,24 +3014,24 @@ msgstr "" "con1.close()\n" "con2.close()" -#: ../../library/sqlite3.rst:2490 +#: ../../library/sqlite3.rst:2491 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:2499 +#: ../../library/sqlite3.rst:2500 msgid "How to create and use row factories" msgstr "" -#: ../../library/sqlite3.rst:2501 +#: ../../library/sqlite3.rst:2502 msgid "" "By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :" "class:`!tuple` does not suit your needs, you can use the :class:`sqlite3." "Row` class or a custom :attr:`~Cursor.row_factory`." msgstr "" -#: ../../library/sqlite3.rst:2506 +#: ../../library/sqlite3.rst:2507 msgid "" "While :attr:`!row_factory` exists as an attribute both on the :class:" "`Cursor` and the :class:`Connection`, it is recommended to set :class:" @@ -3037,7 +3039,7 @@ msgid "" "use the same row factory." msgstr "" -#: ../../library/sqlite3.rst:2511 +#: ../../library/sqlite3.rst:2512 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -3045,7 +3047,7 @@ msgid "" "attribute:" msgstr "" -#: ../../library/sqlite3.rst:2516 +#: ../../library/sqlite3.rst:2517 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" @@ -3053,11 +3055,11 @@ msgstr "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" -#: ../../library/sqlite3.rst:2521 +#: ../../library/sqlite3.rst:2522 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: ../../library/sqlite3.rst:2523 +#: ../../library/sqlite3.rst:2524 msgid "" ">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" ">>> row = res.fetchone()\n" @@ -3072,7 +3074,7 @@ msgid "" ">>> con.close()" msgstr "" -#: ../../library/sqlite3.rst:2539 +#: ../../library/sqlite3.rst:2540 msgid "" "The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the " "above example. In such cases, SQLite returns a single row with columns " @@ -3080,13 +3082,13 @@ msgid "" "alias``." msgstr "" -#: ../../library/sqlite3.rst:2544 +#: ../../library/sqlite3.rst:2545 msgid "" "You can create a custom :attr:`~Cursor.row_factory` that returns each row as " "a :class:`dict`, with column names mapped to values:" msgstr "" -#: ../../library/sqlite3.rst:2547 +#: ../../library/sqlite3.rst:2548 msgid "" "def dict_factory(cursor, row):\n" " fields = [column[0] for column in cursor.description]\n" @@ -3096,12 +3098,12 @@ msgstr "" " fields = [column[0] for column in cursor.description]\n" " return {key: value for key, value in zip(fields, row)}" -#: ../../library/sqlite3.rst:2553 +#: ../../library/sqlite3.rst:2554 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2555 +#: ../../library/sqlite3.rst:2556 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = dict_factory\n" @@ -3117,11 +3119,11 @@ msgstr "" "{'a': 1, 'b': 2}\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2564 +#: ../../library/sqlite3.rst:2565 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2566 +#: ../../library/sqlite3.rst:2567 msgid "" "from collections import namedtuple\n" "\n" @@ -3137,11 +3139,11 @@ msgstr "" " cls = namedtuple(\"Row\", fields)\n" " return cls._make(row)" -#: ../../library/sqlite3.rst:2575 +#: ../../library/sqlite3.rst:2576 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: ../../library/sqlite3.rst:2577 +#: ../../library/sqlite3.rst:2578 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = namedtuple_factory\n" @@ -3167,18 +3169,18 @@ msgstr "" "2\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2591 +#: ../../library/sqlite3.rst:2592 msgid "" "With some adjustments, the above recipe can be adapted to use a :class:" "`~dataclasses.dataclass`, or any other custom class, instead of a :class:" "`~collections.namedtuple`." msgstr "" -#: ../../library/sqlite3.rst:2599 +#: ../../library/sqlite3.rst:2600 msgid "How to handle non-UTF-8 text encodings" msgstr "" -#: ../../library/sqlite3.rst:2601 +#: ../../library/sqlite3.rst:2602 msgid "" "By default, :mod:`!sqlite3` uses :class:`str` to adapt SQLite values with " "the ``TEXT`` data type. This works well for UTF-8 encoded text, but it might " @@ -3186,7 +3188,7 @@ msgid "" "`~Connection.text_factory` to handle such cases." msgstr "" -#: ../../library/sqlite3.rst:2607 +#: ../../library/sqlite3.rst:2608 msgid "" "Because of SQLite's `flexible typing`_, it is not uncommon to encounter " "table columns with the ``TEXT`` data type containing non-UTF-8 encodings, or " @@ -3197,39 +3199,39 @@ msgid "" "text using this :attr:`~Connection.text_factory`:" msgstr "" -#: ../../library/sqlite3.rst:2616 +#: ../../library/sqlite3.rst:2617 msgid "con.text_factory = lambda data: str(data, encoding=\"latin2\")" msgstr "con.text_factory = lambda data: str(data, encoding=\"latin2\")" -#: ../../library/sqlite3.rst:2620 +#: ../../library/sqlite3.rst:2621 msgid "" "For invalid UTF-8 or arbitrary data in stored in ``TEXT`` table columns, you " "can use the following technique, borrowed from the :ref:`unicode-howto`:" msgstr "" -#: ../../library/sqlite3.rst:2623 +#: ../../library/sqlite3.rst:2624 msgid "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" msgstr "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" -#: ../../library/sqlite3.rst:2629 +#: ../../library/sqlite3.rst:2630 msgid "" "The :mod:`!sqlite3` module API does not support strings containing " "surrogates." msgstr "" -#: ../../library/sqlite3.rst:2634 +#: ../../library/sqlite3.rst:2635 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../library/sqlite3.rst:2640 +#: ../../library/sqlite3.rst:2641 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:2646 +#: ../../library/sqlite3.rst:2647 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:2648 +#: ../../library/sqlite3.rst:2649 msgid "" ":mod:`!sqlite3` offers multiple methods of controlling whether, when and how " "database transactions are opened and closed. :ref:`sqlite3-transaction-" @@ -3237,24 +3239,24 @@ msgid "" "isolation-level` retains the pre-Python 3.12 behaviour." msgstr "" -#: ../../library/sqlite3.rst:2657 +#: ../../library/sqlite3.rst:2658 msgid "Transaction control via the ``autocommit`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2659 +#: ../../library/sqlite3.rst:2660 msgid "" "The recommended way of controlling transaction behaviour is through the :" "attr:`Connection.autocommit` attribute, which should preferably be set using " "the *autocommit* parameter of :func:`connect`." msgstr "" -#: ../../library/sqlite3.rst:2664 +#: ../../library/sqlite3.rst:2665 msgid "" "It is suggested to set *autocommit* to ``False``, which implies :pep:`249`-" "compliant transaction control. This means:" msgstr "" -#: ../../library/sqlite3.rst:2668 +#: ../../library/sqlite3.rst:2669 msgid "" ":mod:`!sqlite3` ensures that a transaction is always open, so :func:" "`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback` will " @@ -3263,21 +3265,21 @@ msgid "" "when opening transactions." msgstr "" -#: ../../library/sqlite3.rst:2673 +#: ../../library/sqlite3.rst:2674 msgid "Transactions should be committed explicitly using :meth:`!commit`." msgstr "" -#: ../../library/sqlite3.rst:2674 +#: ../../library/sqlite3.rst:2675 msgid "Transactions should be rolled back explicitly using :meth:`!rollback`." msgstr "" -#: ../../library/sqlite3.rst:2675 +#: ../../library/sqlite3.rst:2676 msgid "" "An implicit rollback is performed if the database is :meth:`~Connection." "close`-ed with pending changes." msgstr "" -#: ../../library/sqlite3.rst:2678 +#: ../../library/sqlite3.rst:2679 msgid "" "Set *autocommit* to ``True`` to enable SQLite's `autocommit mode`_. In this " "mode, :meth:`Connection.commit` and :meth:`Connection.rollback` have no " @@ -3286,25 +3288,25 @@ msgid "" "in_transaction` to query the low-level SQLite autocommit mode." msgstr "" -#: ../../library/sqlite3.rst:2686 +#: ../../library/sqlite3.rst:2687 msgid "" "Set *autocommit* to :data:`LEGACY_TRANSACTION_CONTROL` to leave transaction " "control behaviour to the :attr:`Connection.isolation_level` attribute. See :" "ref:`sqlite3-transaction-control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:2695 +#: ../../library/sqlite3.rst:2696 msgid "Transaction control via the ``isolation_level`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2699 +#: ../../library/sqlite3.rst:2700 msgid "" "The recommended way of controlling transactions is via the :attr:" "`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-control-" "autocommit`." msgstr "" -#: ../../library/sqlite3.rst:2703 +#: ../../library/sqlite3.rst:2704 msgid "" "If :attr:`Connection.autocommit` is set to :data:" "`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour is " @@ -3312,7 +3314,7 @@ msgid "" "Otherwise, :attr:`!isolation_level` has no effect." msgstr "" -#: ../../library/sqlite3.rst:2709 +#: ../../library/sqlite3.rst:2710 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " "``None``, new transactions are implicitly opened before :meth:`~Cursor." @@ -3326,7 +3328,7 @@ msgid "" "attribute." msgstr "" -#: ../../library/sqlite3.rst:2722 +#: ../../library/sqlite3.rst:2723 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " @@ -3336,20 +3338,20 @@ msgid "" "in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:2730 +#: ../../library/sqlite3.rst:2731 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:2734 +#: ../../library/sqlite3.rst:2735 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:2738 +#: ../../library/sqlite3.rst:2739 msgid "" "The recommended way of controlling transactions is now via the :attr:" "`~Connection.autocommit` attribute." diff --git a/library/stdtypes.po b/library/stdtypes.po index e25ed787d8..7421a5e216 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-12 00:13+0000\n" +"POT-Creation-Date: 2024-10-30 00:13+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-" @@ -6447,7 +6447,7 @@ msgstr "" msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " -"from the method). or an iterable of key/value pairs (as tuples or other " +"from the method) or an iterable of key/value pairs (as tuples or other " "iterables of length two). If keyword arguments are specified, the dictionary " "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" @@ -7777,7 +7777,7 @@ msgstr "更多資訊請見 :ref:`instance-methods`。" #: ../../library/stdtypes.rst:5388 msgid "Code Objects" -msgstr "" +msgstr "程式碼物件" #: ../../library/stdtypes.rst:5394 msgid "" @@ -7826,7 +7826,7 @@ msgstr "" #: ../../library/stdtypes.rst:5434 msgid "The Null Object" -msgstr "" +msgstr "Null 物件" #: ../../library/stdtypes.rst:5436 msgid "" @@ -8005,6 +8005,13 @@ msgid "" "... '571186405732').to_bytes(53, 'big')\n" "..." msgstr "" +">>> import sys\n" +">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" +">>> assert sys.int_info.str_digits_check_threshold == 640, sys.int_info\n" +">>> msg = int('578966293710682886880994035146873798396722250538762761564'\n" +"... '9252925514383915483333812743580549779436104706260696366600'\n" +"... '571186405732').to_bytes(53, 'big')\n" +"..." #: ../../library/stdtypes.rst:5588 msgid "Affected APIs" @@ -8179,6 +8186,15 @@ msgid "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" msgstr "" +">>> import sys\n" +">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" +"... upper_bound = 68000\n" +"... lower_bound = 4004\n" +"... current_limit = sys.get_int_max_str_digits()\n" +"... if current_limit == 0 or current_limit > upper_bound:\n" +"... sys.set_int_max_str_digits(upper_bound)\n" +"... elif current_limit < lower_bound:\n" +"... sys.set_int_max_str_digits(lower_bound)" #: ../../library/stdtypes.rst:5678 msgid "If you need to disable it entirely, set it to ``0``." @@ -8963,12 +8979,3 @@ msgstr "..." #: ../../library/stdtypes.rst:5443 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" - -#~ msgid "" -#~ ">>> int.__subclasses__()\n" -#~ "[, , , ]" -#~ msgstr "" -#~ ">>> int.__subclasses__()\n" -#~ "[, , , ]" diff --git a/library/string.po b/library/string.po index e780be5352..8e279ed304 100644 --- a/library/string.po +++ b/library/string.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2024-11-02 00:13+0000\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -457,13 +457,13 @@ msgstr "" msgid "The meaning of the various alignment options is as follows:" msgstr "" -#: ../../library/string.rst:342 ../../library/string.rst:373 +#: ../../library/string.rst:342 ../../library/string.rst:374 msgid "Option" msgstr "選項" -#: ../../library/string.rst:342 ../../library/string.rst:373 -#: ../../library/string.rst:456 ../../library/string.rst:467 -#: ../../library/string.rst:502 +#: ../../library/string.rst:342 ../../library/string.rst:374 +#: ../../library/string.rst:457 ../../library/string.rst:468 +#: ../../library/string.rst:503 msgid "Meaning" msgstr "含義" @@ -495,19 +495,20 @@ msgstr "``'='``" msgid "" "Forces the padding to be placed after the sign (if any) but before the " "digits. This is used for printing fields in the form '+000000120'. This " -"alignment option is only valid for numeric types. It becomes the default " -"for numbers when '0' immediately precedes the field width." +"alignment option is only valid for numeric types, excluding :class:" +"`complex`. It becomes the default for numbers when '0' immediately precedes " +"the field width." msgstr "" -#: ../../library/string.rst:356 +#: ../../library/string.rst:357 msgid "``'^'``" msgstr "``'^'``" -#: ../../library/string.rst:356 +#: ../../library/string.rst:357 msgid "Forces the field to be centered within the available space." msgstr "強制欄位在可用空間內置中。" -#: ../../library/string.rst:360 +#: ../../library/string.rst:361 msgid "" "Note that unless a minimum field width is defined, the field width will " "always be the same size as the data to fill it, so that the alignment option " @@ -516,54 +517,54 @@ msgstr "" "請注意,除非有定義了最小欄位寬度,否則欄位寬度將始終與填充它的資料大小相同," "故在該情況下的對齊選項是沒有意義的。" -#: ../../library/string.rst:364 +#: ../../library/string.rst:365 msgid "" "The *sign* option is only valid for number types, and can be one of the " "following:" msgstr "*sign* 選項只適用於數字型別,並可為以下之一:" -#: ../../library/string.rst:375 +#: ../../library/string.rst:376 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/string.rst:375 +#: ../../library/string.rst:376 msgid "" "indicates that a sign should be used for both positive as well as negative " "numbers." msgstr "表示正數與負數均需使用符號。" -#: ../../library/string.rst:378 +#: ../../library/string.rst:379 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/string.rst:378 +#: ../../library/string.rst:379 msgid "" "indicates that a sign should be used only for negative numbers (this is the " "default behavior)." msgstr "" -#: ../../library/string.rst:367 ../../library/string.rst:381 +#: ../../library/string.rst:368 ../../library/string.rst:382 msgid "space" msgstr "" -#: ../../library/string.rst:381 +#: ../../library/string.rst:382 msgid "" "indicates that a leading space should be used on positive numbers, and a " "minus sign on negative numbers." msgstr "表示正數應使用前導空格,負數應使用減號。" -#: ../../library/string.rst:388 +#: ../../library/string.rst:389 msgid "" "The ``'z'`` option coerces negative zero floating-point values to positive " "zero after rounding to the format precision. This option is only valid for " "floating-point presentation types." msgstr "" -#: ../../library/string.rst:392 +#: ../../library/string.rst:393 msgid "Added the ``'z'`` option (see also :pep:`682`)." msgstr "新增 ``'z'`` 選項(請見 :pep:`682`\\ )。" -#: ../../library/string.rst:397 +#: ../../library/string.rst:398 msgid "" "The ``'#'`` option causes the \"alternate form\" to be used for the " "conversion. The alternate form is defined differently for different types. " @@ -577,17 +578,17 @@ msgid "" "and ``'G'`` conversions, trailing zeros are not removed from the result." msgstr "" -#: ../../library/string.rst:411 +#: ../../library/string.rst:412 msgid "" "The ``','`` option signals the use of a comma for a thousands separator. For " "a locale aware separator, use the ``'n'`` integer presentation type instead." msgstr "" -#: ../../library/string.rst:415 +#: ../../library/string.rst:416 msgid "Added the ``','`` option (see also :pep:`378`)." msgstr "新增 ``','`` 選項(請見 :pep:`378`\\ )。" -#: ../../library/string.rst:420 +#: ../../library/string.rst:421 msgid "" "The ``'_'`` option signals the use of an underscore for a thousands " "separator for floating-point presentation types and for integer presentation " @@ -599,11 +600,11 @@ msgstr "" "號。對於整數表示型別 ``'b'``,``'o'``,``'x'`` 和 ``'X'``,每 4 位數字會插入" "底線。對於其他表示型別,指定此選項會出錯。" -#: ../../library/string.rst:427 +#: ../../library/string.rst:428 msgid "Added the ``'_'`` option (see also :pep:`515`)." msgstr "新增 ``'_'`` 選項(請見 :pep:`515`\\ )。" -#: ../../library/string.rst:430 +#: ../../library/string.rst:431 msgid "" "*width* is a decimal integer defining the minimum total field width, " "including any prefixes, separators, and other formatting characters. If not " @@ -612,24 +613,24 @@ msgstr "" "*width* 是一個十進位整數,定義了最小總欄位寬度,包括任何前綴、分隔符號和其他" "格式字元。如果未指定,則欄位寬度將由內容決定。" -#: ../../library/string.rst:434 +#: ../../library/string.rst:435 msgid "" "When no explicit alignment is given, preceding the *width* field by a zero " -"(``'0'``) character enables sign-aware zero-padding for numeric types. This " -"is equivalent to a *fill* character of ``'0'`` with an *alignment* type of " -"``'='``." +"(``'0'``) character enables sign-aware zero-padding for numeric types, " +"excluding :class:`complex`. This is equivalent to a *fill* character of " +"``'0'`` with an *alignment* type of ``'='``." msgstr "" -"當未給予明確的對齊指示,在 *width* 欄位前面填入零 (``'0'``) 字元將會為數值型" -"別啟用有符號察覺的零填充 (sign-aware zero-padding)。這相當於使用 ``'0'`` 為 " -"*fill* 字元且對齊類型為 ``'='``。" +"當未給予明確的對齊指示,在 *width* 欄位前面填入零 (``'0'``) 字元將會為 :" +"class:`complex` 以外的數值型別啟用有符號察覺的零填充 (sign-aware zero-" +"padding)。這相當於使用 ``'0'`` 為 *fill* 字元且對齊類型為 ``'='``。" -#: ../../library/string.rst:439 +#: ../../library/string.rst:440 msgid "" "Preceding the *width* field by ``'0'`` no longer affects the default " "alignment for strings." msgstr "在 *width* 欄位前面加上 ``'0'`` 不再影響字串的預設對齊方式。" -#: ../../library/string.rst:443 +#: ../../library/string.rst:444 msgid "" "The *precision* is a decimal integer indicating how many digits should be " "displayed after the decimal point for presentation types ``'f'`` and " @@ -644,89 +645,89 @@ msgstr "" "示類型,該欄位指定最大欄位大小 - 換言之,將使用欄位中的多少字元。整數表示類型" "不允許使用 *precision*。" -#: ../../library/string.rst:451 +#: ../../library/string.rst:452 msgid "Finally, the *type* determines how the data should be presented." msgstr "最終,型別決定了資料將會如何呈現" -#: ../../library/string.rst:453 +#: ../../library/string.rst:454 msgid "The available string presentation types are:" msgstr "可用的字串表示型別有:" -#: ../../library/string.rst:456 ../../library/string.rst:467 -#: ../../library/string.rst:502 +#: ../../library/string.rst:457 ../../library/string.rst:468 +#: ../../library/string.rst:503 msgid "Type" msgstr "型別" -#: ../../library/string.rst:458 +#: ../../library/string.rst:459 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/string.rst:458 +#: ../../library/string.rst:459 msgid "String format. This is the default type for strings and may be omitted." msgstr "" -#: ../../library/string.rst:461 ../../library/string.rst:490 -#: ../../library/string.rst:575 +#: ../../library/string.rst:462 ../../library/string.rst:491 +#: ../../library/string.rst:576 msgid "None" msgstr "None" -#: ../../library/string.rst:461 +#: ../../library/string.rst:462 msgid "The same as ``'s'``." msgstr "" -#: ../../library/string.rst:464 +#: ../../library/string.rst:465 msgid "The available integer presentation types are:" msgstr "" -#: ../../library/string.rst:469 +#: ../../library/string.rst:470 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/string.rst:469 +#: ../../library/string.rst:470 msgid "Binary format. Outputs the number in base 2." msgstr "" -#: ../../library/string.rst:471 +#: ../../library/string.rst:472 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/string.rst:471 +#: ../../library/string.rst:472 msgid "" "Character. Converts the integer to the corresponding unicode character " "before printing." msgstr "" -#: ../../library/string.rst:474 +#: ../../library/string.rst:475 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/string.rst:474 +#: ../../library/string.rst:475 msgid "Decimal Integer. Outputs the number in base 10." msgstr "" -#: ../../library/string.rst:476 +#: ../../library/string.rst:477 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/string.rst:476 +#: ../../library/string.rst:477 msgid "Octal format. Outputs the number in base 8." msgstr "" -#: ../../library/string.rst:478 +#: ../../library/string.rst:479 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/string.rst:478 +#: ../../library/string.rst:479 msgid "" "Hex format. Outputs the number in base 16, using lower-case letters for the " "digits above 9." msgstr "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用小寫字母。" -#: ../../library/string.rst:481 +#: ../../library/string.rst:482 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/string.rst:481 +#: ../../library/string.rst:482 msgid "" "Hex format. Outputs the number in base 16, using upper-case letters for the " "digits above 9. In case ``'#'`` is specified, the prefix ``'0x'`` will be " @@ -735,21 +736,21 @@ msgstr "" "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用大寫字母。如果指定了 " "``'#'``,則前綴 ``'0x'`` 也會被轉成大寫的 ``'0X'``。" -#: ../../library/string.rst:486 ../../library/string.rst:568 +#: ../../library/string.rst:487 ../../library/string.rst:569 msgid "``'n'``" msgstr "``'n'``" -#: ../../library/string.rst:486 +#: ../../library/string.rst:487 msgid "" "Number. This is the same as ``'d'``, except that it uses the current locale " "setting to insert the appropriate number separator characters." msgstr "" -#: ../../library/string.rst:490 +#: ../../library/string.rst:491 msgid "The same as ``'d'``." msgstr "" -#: ../../library/string.rst:493 +#: ../../library/string.rst:494 msgid "" "In addition to the above presentation types, integers can be formatted with " "the floating-point presentation types listed below (except ``'n'`` and " @@ -757,17 +758,17 @@ msgid "" "floating-point number before formatting." msgstr "" -#: ../../library/string.rst:498 +#: ../../library/string.rst:499 msgid "" "The available presentation types for :class:`float` and :class:`~decimal." "Decimal` values are:" msgstr "" -#: ../../library/string.rst:504 +#: ../../library/string.rst:505 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/string.rst:504 +#: ../../library/string.rst:505 msgid "" "Scientific notation. For a given precision ``p``, formats the number in " "scientific notation with the letter 'e' separating the coefficient from the " @@ -779,21 +780,21 @@ msgid "" "is used." msgstr "" -#: ../../library/string.rst:515 +#: ../../library/string.rst:516 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/string.rst:515 +#: ../../library/string.rst:516 msgid "" "Scientific notation. Same as ``'e'`` except it uses an upper case 'E' as the " "separator character." msgstr "" -#: ../../library/string.rst:518 +#: ../../library/string.rst:519 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/string.rst:518 +#: ../../library/string.rst:519 msgid "" "Fixed-point notation. For a given precision ``p``, formats the number as a " "decimal number with exactly ``p`` digits following the decimal point. With " @@ -803,21 +804,21 @@ msgid "" "point is omitted unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:527 +#: ../../library/string.rst:528 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/string.rst:527 +#: ../../library/string.rst:528 msgid "" "Fixed-point notation. Same as ``'f'``, but converts ``nan`` to ``NAN`` and " "``inf`` to ``INF``." msgstr "" -#: ../../library/string.rst:530 +#: ../../library/string.rst:531 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/string.rst:530 +#: ../../library/string.rst:531 msgid "" "General format. For a given precision ``p >= 1``, this rounds the number to " "``p`` significant digits and then formats the result in either fixed-point " @@ -825,7 +826,7 @@ msgid "" "``0`` is treated as equivalent to a precision of ``1``." msgstr "" -#: ../../library/string.rst:537 +#: ../../library/string.rst:538 msgid "" "The precise rules are as follows: suppose that the result formatted with " "presentation type ``'e'`` and precision ``p-1`` would have exponent " @@ -838,7 +839,7 @@ msgid "" "unless the ``'#'`` option is used." msgstr "" -#: ../../library/string.rst:550 +#: ../../library/string.rst:551 msgid "" "With no precision given, uses a precision of ``6`` significant digits for :" "class:`float`. For :class:`~decimal.Decimal`, the coefficient of the result " @@ -848,40 +849,40 @@ msgid "" "notation is used otherwise." msgstr "" -#: ../../library/string.rst:559 +#: ../../library/string.rst:560 msgid "" "Positive and negative infinity, positive and negative zero, and nans, are " "formatted as ``inf``, ``-inf``, ``0``, ``-0`` and ``nan`` respectively, " "regardless of the precision." msgstr "" -#: ../../library/string.rst:564 +#: ../../library/string.rst:565 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/string.rst:564 +#: ../../library/string.rst:565 msgid "" "General format. Same as ``'g'`` except switches to ``'E'`` if the number " "gets too large. The representations of infinity and NaN are uppercased, too." msgstr "" -#: ../../library/string.rst:568 +#: ../../library/string.rst:569 msgid "" "Number. This is the same as ``'g'``, except that it uses the current locale " "setting to insert the appropriate number separator characters." msgstr "" -#: ../../library/string.rst:572 +#: ../../library/string.rst:573 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/string.rst:572 +#: ../../library/string.rst:573 msgid "" "Percentage. Multiplies the number by 100 and displays in fixed (``'f'``) " "format, followed by a percent sign." msgstr "" -#: ../../library/string.rst:575 +#: ../../library/string.rst:576 msgid "" "For :class:`float` this is like the ``'g'`` type, except that when fixed-" "point notation is used to format the result, it always includes at least one " @@ -890,30 +891,42 @@ msgid "" "as large as needed to represent the given value faithfully." msgstr "" -#: ../../library/string.rst:583 +#: ../../library/string.rst:584 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: ../../library/string.rst:587 +#: ../../library/string.rst:588 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:595 +#: ../../library/string.rst:592 +msgid "" +"The available presentation types for :class:`complex` are the same as those " +"for :class:`float` (``'%'`` is not allowed). Both the real and imaginary " +"components of a complex number are formatted as floating-point numbers, " +"according to the specified presentation type. They are separated by the " +"mandatory sign of the imaginary part, the latter being terminated by a ``j`` " +"suffix. If the presentation type is missing, the result will match the " +"output of :func:`str` (complex numbers with a non-zero real part are also " +"surrounded by parentheses), possibly altered by other format modifiers." +msgstr "" + +#: ../../library/string.rst:605 msgid "Format examples" msgstr "格式範例" -#: ../../library/string.rst:597 +#: ../../library/string.rst:607 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "本節包含 :meth:`str.format` 語法以及與舊式 ``%`` 格式的比較。" -#: ../../library/string.rst:600 +#: ../../library/string.rst:610 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " @@ -922,17 +935,17 @@ msgstr "" "此語法在大多情況下與舊式的 ``%`` 格式類似,只是增加了 ``{}`` 和 ``:`` 來取代 " "``%``。例如,``'%03.2f'`` 可以改寫為 ``'{:03.2f}'``。" -#: ../../library/string.rst:604 +#: ../../library/string.rst:614 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "新的語法還支援新的選項,將在以下的範例中說明。" -#: ../../library/string.rst:607 +#: ../../library/string.rst:617 msgid "Accessing arguments by position::" msgstr "按位置存取引數: ::" -#: ../../library/string.rst:609 +#: ../../library/string.rst:619 msgid "" ">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" "'a, b, c'\n" @@ -947,11 +960,11 @@ msgid "" "'abracadabra'" msgstr "" -#: ../../library/string.rst:620 +#: ../../library/string.rst:630 msgid "Accessing arguments by name::" msgstr "按名稱存取引數: ::" -#: ../../library/string.rst:622 +#: ../../library/string.rst:632 msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" @@ -961,11 +974,11 @@ msgid "" "'Coordinates: 37.24N, -115.81W'" msgstr "" -#: ../../library/string.rst:628 +#: ../../library/string.rst:638 msgid "Accessing arguments' attributes::" msgstr "存取引數的屬性: ::" -#: ../../library/string.rst:630 +#: ../../library/string.rst:640 msgid "" ">>> c = 3-5j\n" ">>> ('The complex number {0} is formed from the real part {0.real} '\n" @@ -982,22 +995,22 @@ msgid "" "'Point(4, 2)'" msgstr "" -#: ../../library/string.rst:643 +#: ../../library/string.rst:653 msgid "Accessing arguments' items::" msgstr "存取引數的內容: ::" -#: ../../library/string.rst:645 +#: ../../library/string.rst:655 msgid "" ">>> coord = (3, 5)\n" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" "'X: 3; Y: 5'" msgstr "" -#: ../../library/string.rst:649 +#: ../../library/string.rst:659 msgid "Replacing ``%s`` and ``%r``::" msgstr "替換 ``%s`` 和 ``%r``: ::" -#: ../../library/string.rst:651 +#: ../../library/string.rst:661 msgid "" ">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " "'test2')\n" @@ -1007,11 +1020,11 @@ msgstr "" "'test2')\n" "\"repr() shows quotes: 'test1'; str() doesn't: test2\"" -#: ../../library/string.rst:654 +#: ../../library/string.rst:664 msgid "Aligning the text and specifying a width::" msgstr "對齊文字以及指定寬度: ::" -#: ../../library/string.rst:656 +#: ../../library/string.rst:666 msgid "" ">>> '{:<30}'.format('left aligned')\n" "'left aligned '\n" @@ -1023,11 +1036,11 @@ msgid "" "'***********centered***********'" msgstr "" -#: ../../library/string.rst:665 +#: ../../library/string.rst:675 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "替換 ``%+f``、``%-f`` 和 ``% f`` 以及指定正負號: ::" -#: ../../library/string.rst:667 +#: ../../library/string.rst:677 msgid "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" @@ -1038,12 +1051,12 @@ msgid "" "'3.140000; -3.140000'" msgstr "" -#: ../../library/string.rst:674 +#: ../../library/string.rst:684 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "替換 ``%x`` 和 ``%o`` 並將其值轉換為不同的進位制: ::" -#: ../../library/string.rst:676 +#: ../../library/string.rst:686 msgid "" ">>> # format also supports binary numbers\n" ">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" @@ -1053,11 +1066,11 @@ msgid "" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" msgstr "" -#: ../../library/string.rst:683 +#: ../../library/string.rst:693 msgid "Using the comma as a thousands separator::" msgstr "使用逗號作為千位分隔符: ::" -#: ../../library/string.rst:685 +#: ../../library/string.rst:695 msgid "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" @@ -1065,11 +1078,11 @@ msgstr "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" -#: ../../library/string.rst:688 +#: ../../library/string.rst:698 msgid "Expressing a percentage::" msgstr "表示為百分比: ::" -#: ../../library/string.rst:690 +#: ../../library/string.rst:700 msgid "" ">>> points = 19\n" ">>> total = 22\n" @@ -1081,11 +1094,11 @@ msgstr "" ">>> 'Correct answers: {:.2%}'.format(points/total)\n" "'Correct answers: 86.36%'" -#: ../../library/string.rst:695 +#: ../../library/string.rst:705 msgid "Using type-specific formatting::" msgstr "作為特定型別格式: ::" -#: ../../library/string.rst:697 +#: ../../library/string.rst:707 msgid "" ">>> import datetime\n" ">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" @@ -1097,11 +1110,11 @@ msgstr "" ">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" "'2010-07-04 12:15:58'" -#: ../../library/string.rst:702 +#: ../../library/string.rst:712 msgid "Nesting arguments and more complex examples::" msgstr "巢狀引數及更多複雜範例: ::" -#: ../../library/string.rst:704 +#: ../../library/string.rst:714 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1159,11 +1172,11 @@ msgstr "" " 10 A 12 1010\n" " 11 B 13 1011" -#: ../../library/string.rst:736 +#: ../../library/string.rst:746 msgid "Template strings" msgstr "模板字串" -#: ../../library/string.rst:738 +#: ../../library/string.rst:748 msgid "" "Template strings provide simpler string substitutions as described in :pep:" "`292`. A primary use case for template strings is for internationalization " @@ -1177,17 +1190,17 @@ msgstr "" "化工具更容易翻譯。基於模板字串建構的 i18n 函式庫範例,請參閱 `flufl.i18n " "`_ 套件。" -#: ../../library/string.rst:748 +#: ../../library/string.rst:758 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:750 +#: ../../library/string.rst:760 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:752 +#: ../../library/string.rst:762 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1197,30 +1210,30 @@ msgid "" "specification." msgstr "" -#: ../../library/string.rst:759 +#: ../../library/string.rst:769 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: ../../library/string.rst:763 +#: ../../library/string.rst:773 msgid "" "Any other appearance of ``$`` in the string will result in a :exc:" "`ValueError` being raised." msgstr "" -#: ../../library/string.rst:766 +#: ../../library/string.rst:776 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:772 +#: ../../library/string.rst:782 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:777 +#: ../../library/string.rst:787 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -1232,7 +1245,7 @@ msgstr "" "的字典型物件。或者如果關鍵字就是佔位符號時,你也可以改提供關鍵字引數。當 " "*mapping* 跟 *kwds* 同時給定並存在重複時,*kwds* 的佔位符號會被優先使用。" -#: ../../library/string.rst:786 +#: ../../library/string.rst:796 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -1245,7 +1258,7 @@ msgstr "" "與 :meth:`substitute` 不同的是,任何包含 ``$`` 的字句會直接回傳 ``$`` 而非引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:792 +#: ../../library/string.rst:802 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -1259,7 +1272,7 @@ msgstr "" "完全安全,因為它會默默忽略格式錯誤的模板,這些模板包含了多餘的左右定界符、不" "匹配的括號,或者不是有效的 Python 識別字的佔位符號。" -#: ../../library/string.rst:802 +#: ../../library/string.rst:812 msgid "" "Returns false if the template has invalid placeholders that will cause :meth:" "`substitute` to raise :exc:`ValueError`." @@ -1267,18 +1280,18 @@ msgstr "" "如果模板有將導致 :meth:`substitute` 引發 :exc:`ValueError` 的無效佔位符號,就" "會回傳 false。" -#: ../../library/string.rst:810 +#: ../../library/string.rst:820 msgid "" "Returns a list of the valid identifiers in the template, in the order they " "first appear, ignoring any invalid identifiers." msgstr "" "回傳模板中有效識別字的串列,按照它們首次出現的順序,並忽略任何無效的識別字。" -#: ../../library/string.rst:815 +#: ../../library/string.rst:825 msgid ":class:`Template` instances also provide one public data attribute:" msgstr ":class:`Template` 實例也提供一個公開的資料屬性:" -#: ../../library/string.rst:819 +#: ../../library/string.rst:829 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." @@ -1286,11 +1299,11 @@ msgstr "" "這是傳遞給建構函式 *template* 引數的物件。一般來說,你不應該改變它,但並沒有" "強制設定成唯讀。" -#: ../../library/string.rst:822 +#: ../../library/string.rst:832 msgid "Here is an example of how to use a Template::" msgstr "以下是如何使用 Template 的一個範例: ::" -#: ../../library/string.rst:824 +#: ../../library/string.rst:834 msgid "" ">>> from string import Template\n" ">>> s = Template('$who likes $what')\n" @@ -1324,7 +1337,7 @@ msgstr "" ">>> Template('$who likes $what').safe_substitute(d)\n" "'tim likes $what'" -#: ../../library/string.rst:840 +#: ../../library/string.rst:850 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1334,7 +1347,7 @@ msgstr "" "進階用法:你可以衍生 :class:`Template` 類別來自定義佔位符號語法、左右定界符字" "元,或者用於剖析模板字串的正規表示式。你可以透過覆寫這些類別屬性來達成:" -#: ../../library/string.rst:845 +#: ../../library/string.rst:855 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " @@ -1348,7 +1361,7 @@ msgstr "" "注意你不能在建立類別後修改左右定界符。(意即在子類別的命名空間中必須設置不同" "的左右定界符)" -#: ../../library/string.rst:852 +#: ../../library/string.rst:862 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1356,19 +1369,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:859 +#: ../../library/string.rst:869 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: ../../library/string.rst:863 +#: ../../library/string.rst:873 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:867 +#: ../../library/string.rst:877 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1377,7 +1390,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:875 +#: ../../library/string.rst:885 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1386,7 +1399,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:883 +#: ../../library/string.rst:893 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1395,13 +1408,13 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:889 +#: ../../library/string.rst:899 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "*escaped* -- 此群組與跳脫序列匹配,例如在預設模式下為 ``$$``。" -#: ../../library/string.rst:892 +#: ../../library/string.rst:902 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." @@ -1409,7 +1422,7 @@ msgstr "" "*named* -- 此群組與不帶大括號的佔位符號名稱匹配;它不應包含擷取群組中的左右定" "界符號。" -#: ../../library/string.rst:895 +#: ../../library/string.rst:905 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." @@ -1417,7 +1430,7 @@ msgstr "" "*braced* -- 此群組與大括號括起來的佔位符號名稱匹配;它不應在擷取群組中包含左" "右定界符或大括號。" -#: ../../library/string.rst:898 +#: ../../library/string.rst:908 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." @@ -1425,7 +1438,7 @@ msgstr "" "*invalid* -- 此群組與任何其他左右定界符模式(通常是單一左右定界符)匹配,且它" "應該出現在正規表示式的最後。" -#: ../../library/string.rst:901 +#: ../../library/string.rst:911 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." @@ -1433,11 +1446,11 @@ msgstr "" "當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引發 :exc:" "`ValueError`。" -#: ../../library/string.rst:906 +#: ../../library/string.rst:916 msgid "Helper functions" msgstr "輔助函式" -#: ../../library/string.rst:910 +#: ../../library/string.rst:920 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " "using :meth:`str.capitalize`, and join the capitalized words using :meth:" @@ -1456,9 +1469,9 @@ msgid "{} (curly brackets)" msgstr "{} (花括號)" #: ../../library/string.rst:195 ../../library/string.rst:335 -#: ../../library/string.rst:367 ../../library/string.rst:386 -#: ../../library/string.rst:395 ../../library/string.rst:409 -#: ../../library/string.rst:418 +#: ../../library/string.rst:368 ../../library/string.rst:387 +#: ../../library/string.rst:396 ../../library/string.rst:410 +#: ../../library/string.rst:419 msgid "in string formatting" msgstr "於字串格式化" @@ -1494,34 +1507,34 @@ msgstr "= (等於)" msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/string.rst:367 +#: ../../library/string.rst:368 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../library/string.rst:367 +#: ../../library/string.rst:368 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/string.rst:386 +#: ../../library/string.rst:387 msgid "z" msgstr "z" -#: ../../library/string.rst:395 +#: ../../library/string.rst:396 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/string.rst:409 +#: ../../library/string.rst:410 msgid ", (comma)" msgstr ", (逗號)" -#: ../../library/string.rst:418 +#: ../../library/string.rst:419 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../library/string.rst:746 +#: ../../library/string.rst:756 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/string.rst:746 +#: ../../library/string.rst:756 msgid "in template strings" msgstr "於 template strings(模板字串)" diff --git a/library/time.po b/library/time.po index c3f7ef4998..b110d06f95 100644 --- a/library/time.po +++ b/library/time.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-11-01 00:15+0000\n" "PO-Revision-Date: 2024-08-14 16:05+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -266,14 +266,14 @@ msgstr "" #: ../../library/time.rst:149 ../../library/time.rst:161 #: ../../library/time.rst:174 ../../library/time.rst:183 #: ../../library/time.rst:196 ../../library/time.rst:205 -#: ../../library/time.rst:721 ../../library/time.rst:745 -#: ../../library/time.rst:841 ../../library/time.rst:852 -#: ../../library/time.rst:862 ../../library/time.rst:872 -#: ../../library/time.rst:881 ../../library/time.rst:890 -#: ../../library/time.rst:899 ../../library/time.rst:910 -#: ../../library/time.rst:918 ../../library/time.rst:929 -#: ../../library/time.rst:940 ../../library/time.rst:949 -#: ../../library/time.rst:962 +#: ../../library/time.rst:734 ../../library/time.rst:758 +#: ../../library/time.rst:854 ../../library/time.rst:865 +#: ../../library/time.rst:875 ../../library/time.rst:885 +#: ../../library/time.rst:894 ../../library/time.rst:903 +#: ../../library/time.rst:912 ../../library/time.rst:923 +#: ../../library/time.rst:931 ../../library/time.rst:942 +#: ../../library/time.rst:953 ../../library/time.rst:962 +#: ../../library/time.rst:975 msgid "Availability" msgstr "" @@ -476,7 +476,7 @@ msgstr "" "示)。該時鐘不受系統時鐘更新的影響。回傳值的參考點沒有定義,因此只有兩次呼叫" "結果之間的差異才是有效的。" -#: ../../library/time.rst:290 ../../library/time.rst:687 +#: ../../library/time.rst:290 ../../library/time.rst:700 msgid "Clock:" msgstr "" @@ -534,8 +534,8 @@ msgstr "" #: ../../library/time.rst:330 msgid "" -"On CPython, use the same clock than :func:`time.monotonic` and is a " -"monotonic clock, i.e. a clock that cannot go backwards." +"On CPython, use the same clock as :func:`time.monotonic` and is a monotonic " +"clock, i.e. a clock that cannot go backwards." msgstr "" #: ../../library/time.rst:333 @@ -550,9 +550,8 @@ msgid "On Windows, the function is now system-wide." msgstr "在 Windows 上,此函式現在涵蓋整個系統。" #: ../../library/time.rst:341 -#, fuzzy -msgid "Use the same clock than :func:`time.monotonic`." -msgstr "``'monotonic'``::func:`time.monotonic`" +msgid "Use the same clock as :func:`time.monotonic`." +msgstr "與 :func:`time.monotonic` 使用相同的時鐘。" #: ../../library/time.rst:347 msgid "Similar to :func:`perf_counter`, but return time as nanoseconds." @@ -846,23 +845,31 @@ msgstr "" "一年中的週數(星期天作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期天之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:478 ../../library/time.rst:489 +#: ../../library/time.rst:478 ../../library/time.rst:492 msgid "\\(4)" msgstr "\\(4)" #: ../../library/time.rst:486 +msgid "``%u``" +msgstr "``%u``" + +#: ../../library/time.rst:486 +msgid "Day of the week (Monday is 1; Sunday is 7) as a decimal number [1, 7]." +msgstr "一週中的日期(周一為 1;週日為 7),表示為十進位數 [1,7]。" + +#: ../../library/time.rst:489 msgid "``%w``" msgstr "``%w``" -#: ../../library/time.rst:486 +#: ../../library/time.rst:489 msgid "Weekday as a decimal number [0(Sunday),6]." msgstr "週間日,表示為十進位數 [0(星期天),6]。" -#: ../../library/time.rst:489 +#: ../../library/time.rst:492 msgid "``%W``" msgstr "``%W``" -#: ../../library/time.rst:489 +#: ../../library/time.rst:492 msgid "" "Week number of the year (Monday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Monday are " @@ -871,43 +878,43 @@ msgstr "" "一年中的週數(星期一作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期一之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:497 +#: ../../library/time.rst:500 msgid "``%x``" msgstr "``%x``" -#: ../../library/time.rst:497 +#: ../../library/time.rst:500 msgid "Locale's appropriate date representation." msgstr "區域設定的合適的日期表示法。" -#: ../../library/time.rst:500 +#: ../../library/time.rst:503 msgid "``%X``" msgstr "``%X``" -#: ../../library/time.rst:500 +#: ../../library/time.rst:503 msgid "Locale's appropriate time representation." msgstr "區域設定的合適的時間表示法。" -#: ../../library/time.rst:503 +#: ../../library/time.rst:506 msgid "``%y``" msgstr "``%y``" -#: ../../library/time.rst:503 +#: ../../library/time.rst:506 msgid "Year without century as a decimal number [00,99]." msgstr "去掉世紀的年份,表示為十進位數 [00,99]。" -#: ../../library/time.rst:506 +#: ../../library/time.rst:509 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/time.rst:506 +#: ../../library/time.rst:509 msgid "Year with century as a decimal number." msgstr "帶世紀的年份,表示為十進位數。" -#: ../../library/time.rst:509 +#: ../../library/time.rst:512 msgid "``%z``" msgstr "``%z``" -#: ../../library/time.rst:509 +#: ../../library/time.rst:512 msgid "" "Time zone offset indicating a positive or negative time difference from UTC/" "GMT of the form +HHMM or -HHMM, where H represents decimal hour digits and M " @@ -916,27 +923,49 @@ msgstr "" "時區偏移量,表示與 UTC/GMT 的正或負時間差,形式為 +HHMM 或 -HHMM,其中 H 代表" "十進位的小時數碼 (digits),M 代表十進位的分鐘數碼 [-23:59, +23:59]。 [1]_" -#: ../../library/time.rst:515 +#: ../../library/time.rst:518 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/time.rst:515 +#: ../../library/time.rst:518 msgid "Time zone name (no characters if no time zone exists). Deprecated. [1]_" msgstr "時區名稱(如果不存在時區,則無字元)。已被棄用。 [1]_" -#: ../../library/time.rst:518 +#: ../../library/time.rst:521 +msgid "``%G``" +msgstr "``%G``" + +#: ../../library/time.rst:521 +msgid "" +"ISO 8601 year (similar to ``%Y`` but follows the rules for the ISO 8601 " +"calendar year). The year starts with the week that contains the first " +"Thursday of the calendar year." +msgstr "" + +#: ../../library/time.rst:526 +msgid "``%V``" +msgstr "``%V``" + +#: ../../library/time.rst:526 +msgid "" +"ISO 8601 week number (as a decimal number [01,53]). The first week of the " +"year is the one that contains the first Thursday of the year. Weeks start on " +"Monday." +msgstr "" + +#: ../../library/time.rst:531 msgid "``%%``" msgstr "``%%``" -#: ../../library/time.rst:518 +#: ../../library/time.rst:531 msgid "A literal ``'%'`` character." msgstr "字面意義上的 ``'%'`` 字元。" -#: ../../library/time.rst:521 +#: ../../library/time.rst:534 msgid "Notes:" msgstr "註解:" -#: ../../library/time.rst:524 +#: ../../library/time.rst:537 msgid "" "The ``%f`` format directive only applies to :func:`strptime`, not to :func:" "`strftime`. However, see also :meth:`datetime.datetime.strptime` and :meth:" @@ -947,7 +976,7 @@ msgstr "" "在 :meth:`datetime.datetime.strptime` 和 :meth:`datetime.datetime.strftime` " "其中的 ``%f`` 格式的指令\\ :ref:`適用於微秒 `。" -#: ../../library/time.rst:530 +#: ../../library/time.rst:543 msgid "" "When used with the :func:`strptime` function, the ``%p`` directive only " "affects the output hour field if the ``%I`` directive is used to parse the " @@ -956,7 +985,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%p`` 指令僅在使用 ``%I`` 指令剖析小時" "時影響輸出小時的欄位。" -#: ../../library/time.rst:536 +#: ../../library/time.rst:549 msgid "" "The range really is ``0`` to ``61``; value ``60`` is valid in timestamps " "representing `leap seconds`_ and value ``61`` is supported for historical " @@ -965,7 +994,7 @@ msgstr "" "範圍確實是從 ``0`` 到 ``61``;數值 ``60`` 在表示 `leap seconds`_ 的時間戳中是" "有效的,而數值 ``61`` 是出於歷史因素而被支援。" -#: ../../library/time.rst:541 +#: ../../library/time.rst:554 msgid "" "When used with the :func:`strptime` function, ``%U`` and ``%W`` are only " "used in calculations when the day of the week and the year are specified." @@ -973,7 +1002,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%U`` 和 ``%W`` 僅在指定週間的某天和年" "份時用於計算中。" -#: ../../library/time.rst:544 +#: ../../library/time.rst:557 msgid "" "Here is an example, a format for dates compatible with that specified in " "the :rfc:`2822` Internet email standard. [1]_ ::" @@ -981,7 +1010,7 @@ msgstr "" "以下是一個範例,其為一種與 :rfc:`2822` 網際網路電子郵件標準中指定的日期格式兼" "容的格式。 [1]_: ::" -#: ../../library/time.rst:547 +#: ../../library/time.rst:560 msgid "" ">>> from time import gmtime, strftime\n" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" @@ -991,7 +1020,7 @@ msgstr "" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" "'Thu, 28 Jun 2001 14:17:15 +0000'" -#: ../../library/time.rst:551 +#: ../../library/time.rst:564 msgid "" "Additional directives may be supported on certain platforms, but only the " "ones listed here have a meaning standardized by ANSI C. To see the full set " @@ -1001,7 +1030,7 @@ msgstr "" "某些平台可能支援額外的指令,但只有這裡列出的指令具有 ANSI C 標準化的意義。要" "查看你的平台上支援的完整格式碼集,請參閱 :manpage:`strftime(3)` 文件。" -#: ../../library/time.rst:556 +#: ../../library/time.rst:569 msgid "" "On some platforms, an optional field width and precision specification can " "immediately follow the initial ``'%'`` of a directive in the following " @@ -1011,7 +1040,7 @@ msgstr "" "在某些平台上,可選的欄位寬度和精度規範可以以此順序緊跟在指令初始的 ``'%'`` 之" "後;這也是不可攜 (portable) 的。欄位寬度通常為 2,除了 ``%j`` 為 3。" -#: ../../library/time.rst:567 +#: ../../library/time.rst:580 msgid "" "Parse a string representing a time according to a format. The return value " "is a :class:`struct_time` as returned by :func:`gmtime` or :func:`localtime`." @@ -1019,7 +1048,7 @@ msgstr "" "根據格式剖析表示時間的字串。回傳值是 :class:`struct_time`,如同由 :func:" "`gmtime` 或 :func:`localtime` 回傳的一樣。" -#: ../../library/time.rst:571 +#: ../../library/time.rst:584 msgid "" "The *format* parameter uses the same directives as those used by :func:" "`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which matches the " @@ -1035,11 +1064,11 @@ msgstr "" "時,用來填充任何缺失資料的預設值為 ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``。" "*string* 和 *format* 都必須是字串。" -#: ../../library/time.rst:579 +#: ../../library/time.rst:592 msgid "For example:" msgstr "例如:" -#: ../../library/time.rst:586 +#: ../../library/time.rst:599 msgid "" "Support for the ``%Z`` directive is based on the values contained in " "``tzname`` and whether ``daylight`` is true. Because of this, it is " @@ -1050,7 +1079,7 @@ msgstr "" "因此,除了識別始終已知的 UTC 和 GMT(且被考慮為非日光節約時區)外,這是特定於" "平台的。" -#: ../../library/time.rst:591 +#: ../../library/time.rst:604 msgid "" "Only the directives specified in the documentation are supported. Because " "``strftime()`` is implemented per platform it can sometimes offer more " @@ -1062,7 +1091,7 @@ msgstr "" "提供比列出的還要更多的指令。但是 ``strptime()`` 與任何平台無關,因此不一定支" "援所有未記載為支援的指令。" -#: ../../library/time.rst:600 +#: ../../library/time.rst:613 msgid "" "The type of the time value sequence returned by :func:`gmtime`, :func:" "`localtime`, and :func:`strptime`. It is an object with a :term:`named " @@ -1073,110 +1102,110 @@ msgstr "" "別。它是一個具有 :term:`named tuple` 介面的物件:值可以通過索引和屬性名稱存" "取。包含以下值:" -#: ../../library/time.rst:607 +#: ../../library/time.rst:620 msgid "Index" msgstr "索引" -#: ../../library/time.rst:608 +#: ../../library/time.rst:621 msgid "Attribute" msgstr "屬性" -#: ../../library/time.rst:609 +#: ../../library/time.rst:622 msgid "Values" msgstr "值" -#: ../../library/time.rst:611 +#: ../../library/time.rst:624 msgid "0" msgstr "0" -#: ../../library/time.rst:613 +#: ../../library/time.rst:626 msgid "(for example, 1993)" msgstr "(例如 1993)" -#: ../../library/time.rst:615 +#: ../../library/time.rst:628 msgid "1" msgstr "1" -#: ../../library/time.rst:617 +#: ../../library/time.rst:630 msgid "range [1, 12]" msgstr "範圍 [1, 12]" -#: ../../library/time.rst:619 +#: ../../library/time.rst:632 msgid "2" msgstr "2" -#: ../../library/time.rst:621 +#: ../../library/time.rst:634 msgid "range [1, 31]" msgstr "範圍 [1, 31]" -#: ../../library/time.rst:623 +#: ../../library/time.rst:636 msgid "3" msgstr "3" -#: ../../library/time.rst:625 +#: ../../library/time.rst:638 msgid "range [0, 23]" msgstr "範圍 [0, 23]" -#: ../../library/time.rst:627 +#: ../../library/time.rst:640 msgid "4" msgstr "4" -#: ../../library/time.rst:629 +#: ../../library/time.rst:642 msgid "range [0, 59]" msgstr "範圍 [0, 59]" -#: ../../library/time.rst:631 +#: ../../library/time.rst:644 msgid "5" msgstr "5" -#: ../../library/time.rst:633 +#: ../../library/time.rst:646 msgid "range [0, 61]; see :ref:`Note (2) ` in :func:`strftime`" msgstr "" "範圍 [0, 61];參見 :func:`strftime` 中的\\ :ref:`註釋 (2) `" -#: ../../library/time.rst:635 +#: ../../library/time.rst:648 msgid "6" msgstr "6" -#: ../../library/time.rst:637 +#: ../../library/time.rst:650 msgid "range [0, 6]; Monday is 0" msgstr "範圍 [0, 6];星期一是 0" -#: ../../library/time.rst:639 +#: ../../library/time.rst:652 msgid "7" msgstr "7" -#: ../../library/time.rst:641 +#: ../../library/time.rst:654 msgid "range [1, 366]" msgstr "範圍 [1, 366]" -#: ../../library/time.rst:643 +#: ../../library/time.rst:656 msgid "8" msgstr "8" -#: ../../library/time.rst:645 +#: ../../library/time.rst:658 msgid "0, 1 or -1; see below" msgstr "0、1 或 -1;見下文" -#: ../../library/time.rst:647 ../../library/time.rst:651 +#: ../../library/time.rst:660 ../../library/time.rst:664 msgid "N/A" msgstr "N/A" -#: ../../library/time.rst:649 +#: ../../library/time.rst:662 msgid "abbreviation of timezone name" msgstr "時區名稱的縮寫" -#: ../../library/time.rst:653 +#: ../../library/time.rst:666 msgid "offset east of UTC in seconds" msgstr "UTC 向東的偏移量(以秒為單位)" -#: ../../library/time.rst:655 +#: ../../library/time.rst:668 msgid "" "Note that unlike the C structure, the month value is a range of [1, 12], not " "[0, 11]." msgstr "請注意,與 C 結構不同,月份值的範圍是 [1, 12],而不是 [0, 11]。" -#: ../../library/time.rst:658 +#: ../../library/time.rst:671 msgid "" "In calls to :func:`mktime`, :attr:`tm_isdst` may be set to 1 when daylight " "savings time is in effect, and 0 when it is not. A value of -1 indicates " @@ -1186,7 +1215,7 @@ msgstr "" "在呼叫 :func:`mktime` 時,當日光節約時間生效的時候,:attr:`tm_isdst` 可以設定" "為 1,不生效時設定為 0。值 -1 表示未知是否生效,通常結果會填入正確的狀態。" -#: ../../library/time.rst:662 +#: ../../library/time.rst:675 msgid "" "When a tuple with an incorrect length is passed to a function expecting a :" "class:`struct_time`, or having elements of the wrong type, a :exc:" @@ -1195,7 +1224,7 @@ msgstr "" "當一個長度不正確的元組被傳遞給預期得到 :class:`struct_time` 的函式時,或者其" "中有元素型別錯誤時,將引發 :exc:`TypeError`。" -#: ../../library/time.rst:668 +#: ../../library/time.rst:681 msgid "" "Return the time in seconds since the epoch_ as a floating-point number. The " "handling of `leap seconds`_ is platform dependent. On Windows and most Unix " @@ -1207,7 +1236,7 @@ msgstr "" "關的。在 Windows 和大多數 Unix 系統上,閏秒不計入自 epoch_ 起的秒數中。這通常" "被稱為 `Unix 時間 `_。" -#: ../../library/time.rst:674 +#: ../../library/time.rst:687 msgid "" "Note that even though the time is always returned as a floating-point " "number, not all systems provide time with a better precision than 1 second. " @@ -1219,7 +1248,7 @@ msgstr "" "間。雖然此函式通常回傳非遞減的值,但如果在兩次呼叫之間系統時鐘被回調,則它可" "能回傳比之前呼叫更小的值。" -#: ../../library/time.rst:680 +#: ../../library/time.rst:693 msgid "" "The number returned by :func:`.time` may be converted into a more common " "time format (i.e. year, month, day, hour, etc...) in UTC by passing it to :" @@ -1233,31 +1262,31 @@ msgstr "" "為當地時間。在這兩種情況下都會回傳一個 :class:`struct_time` 物件,從中可以作" "為屬性存取日曆日期的組成部分。" -#: ../../library/time.rst:689 +#: ../../library/time.rst:702 msgid "On Windows, call ``GetSystemTimeAsFileTime()``." msgstr "" -#: ../../library/time.rst:690 +#: ../../library/time.rst:703 msgid "Call ``clock_gettime(CLOCK_REALTIME)`` if available." msgstr "" -#: ../../library/time.rst:691 +#: ../../library/time.rst:704 msgid "Otherwise, call ``gettimeofday()``." msgstr "" -#: ../../library/time.rst:693 +#: ../../library/time.rst:706 msgid "" "Use :func:`time_ns` to avoid the precision loss caused by the :class:`float` " "type." msgstr "使用 :func:`time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:699 +#: ../../library/time.rst:712 msgid "" "Similar to :func:`~time.time` but returns time as an integer number of " "nanoseconds since the epoch_." msgstr "類似於 :func:`~time.time`,但回傳自 epoch_ 起的以奈秒為單位的整數。" -#: ../../library/time.rst:712 +#: ../../library/time.rst:725 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current thread. It does not include time elapsed during " @@ -1266,21 +1295,21 @@ msgid "" "of two calls in the same thread is valid." msgstr "" -#: ../../library/time.rst:718 +#: ../../library/time.rst:731 msgid "" "Use :func:`thread_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" -#: ../../library/time.rst:723 +#: ../../library/time.rst:736 msgid "Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``." msgstr "" -#: ../../library/time.rst:730 +#: ../../library/time.rst:743 msgid "Similar to :func:`thread_time` but return time as nanoseconds." msgstr "" -#: ../../library/time.rst:737 +#: ../../library/time.rst:750 msgid "" "Reset the time conversion rules used by the library routines. The " "environment variable :envvar:`TZ` specifies how this is done. It will also " @@ -1291,46 +1320,46 @@ msgid "" "when daylight saving time applies)." msgstr "" -#: ../../library/time.rst:749 +#: ../../library/time.rst:762 msgid "" "Although in many cases, changing the :envvar:`TZ` environment variable may " "affect the output of functions like :func:`localtime` without calling :func:" "`tzset`, this behavior should not be relied on." msgstr "" -#: ../../library/time.rst:753 +#: ../../library/time.rst:766 msgid "The :envvar:`TZ` environment variable should contain no whitespace." msgstr "" -#: ../../library/time.rst:755 +#: ../../library/time.rst:768 msgid "" "The standard format of the :envvar:`TZ` environment variable is (whitespace " "added for clarity)::" msgstr "" -#: ../../library/time.rst:758 +#: ../../library/time.rst:771 msgid "std offset [dst [offset [,start[/time], end[/time]]]]" msgstr "std offset [dst [offset [,start[/time], end[/time]]]]" -#: ../../library/time.rst:760 +#: ../../library/time.rst:773 msgid "Where the components are:" msgstr "" -#: ../../library/time.rst:762 +#: ../../library/time.rst:775 msgid "``std`` and ``dst``" msgstr "``std`` 和 ``dst``" -#: ../../library/time.rst:763 +#: ../../library/time.rst:776 msgid "" "Three or more alphanumerics giving the timezone abbreviations. These will be " "propagated into time.tzname" msgstr "" -#: ../../library/time.rst:766 +#: ../../library/time.rst:779 msgid "``offset``" msgstr "``offset``" -#: ../../library/time.rst:767 +#: ../../library/time.rst:780 msgid "" "The offset has the form: ``± hh[:mm[:ss]]``. This indicates the value added " "the local time to arrive at UTC. If preceded by a '-', the timezone is east " @@ -1338,41 +1367,41 @@ msgid "" "summer time is assumed to be one hour ahead of standard time." msgstr "" -#: ../../library/time.rst:772 +#: ../../library/time.rst:785 msgid "``start[/time], end[/time]``" msgstr "``start[/time], end[/time]``" -#: ../../library/time.rst:773 +#: ../../library/time.rst:786 msgid "" "Indicates when to change to and back from DST. The format of the start and " "end dates are one of the following:" msgstr "" -#: ../../library/time.rst:776 +#: ../../library/time.rst:789 msgid ":samp:`J{n}`" msgstr ":samp:`J{n}`" -#: ../../library/time.rst:777 +#: ../../library/time.rst:790 msgid "" "The Julian day *n* (1 <= *n* <= 365). Leap days are not counted, so in all " "years February 28 is day 59 and March 1 is day 60." msgstr "" -#: ../../library/time.rst:780 +#: ../../library/time.rst:793 msgid ":samp:`{n}`" msgstr ":samp:`{n}`" -#: ../../library/time.rst:781 +#: ../../library/time.rst:794 msgid "" "The zero-based Julian day (0 <= *n* <= 365). Leap days are counted, and it " "is possible to refer to February 29." msgstr "" -#: ../../library/time.rst:784 +#: ../../library/time.rst:797 msgid ":samp:`M{m}.{n}.{d}`" msgstr ":samp:`M{m}.{n}.{d}`" -#: ../../library/time.rst:785 +#: ../../library/time.rst:798 msgid "" "The *d*'th day (0 <= *d* <= 6) of week *n* of month *m* of the year (1 <= " "*n* <= 5, 1 <= *m* <= 12, where week 5 means \"the last *d* day in month " @@ -1380,13 +1409,13 @@ msgid "" "first week in which the *d*'th day occurs. Day zero is a Sunday." msgstr "" -#: ../../library/time.rst:791 +#: ../../library/time.rst:804 msgid "" "``time`` has the same format as ``offset`` except that no leading sign ('-' " "or '+') is allowed. The default, if time is not given, is 02:00:00." msgstr "" -#: ../../library/time.rst:796 +#: ../../library/time.rst:809 msgid "" ">>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'\n" ">>> time.tzset()\n" @@ -1406,7 +1435,7 @@ msgstr "" ">>> time.strftime('%X %x %Z')\n" "'16:08:12 05/08/03 AEST'" -#: ../../library/time.rst:805 +#: ../../library/time.rst:818 msgid "" "On many Unix systems (including \\*BSD, Linux, Solaris, and Darwin), it is " "more convenient to use the system's zoneinfo (:manpage:`tzfile(5)`) " @@ -1417,7 +1446,7 @@ msgid "" "``'Australia/Melbourne'``, ``'Egypt'`` or ``'Europe/Amsterdam'``. ::" msgstr "" -#: ../../library/time.rst:813 +#: ../../library/time.rst:826 msgid "" ">>> os.environ['TZ'] = 'US/Eastern'\n" ">>> time.tzset()\n" @@ -1429,23 +1458,23 @@ msgid "" "('EET', 'EEST')" msgstr "" -#: ../../library/time.rst:826 +#: ../../library/time.rst:839 msgid "Clock ID Constants" msgstr "" -#: ../../library/time.rst:828 +#: ../../library/time.rst:841 msgid "" "These constants are used as parameters for :func:`clock_getres` and :func:" "`clock_gettime`." msgstr "" -#: ../../library/time.rst:833 +#: ../../library/time.rst:846 msgid "" "Identical to :data:`CLOCK_MONOTONIC`, except it also includes any time that " "the system is suspended." msgstr "" -#: ../../library/time.rst:836 +#: ../../library/time.rst:849 msgid "" "This allows applications to get a suspend-aware monotonic clock without " "having to deal with the complications of :data:`CLOCK_REALTIME`, which may " @@ -1453,87 +1482,87 @@ msgid "" "similar." msgstr "" -#: ../../library/time.rst:848 +#: ../../library/time.rst:861 msgid "" "The Solaris OS has a ``CLOCK_HIGHRES`` timer that attempts to use an optimal " "hardware source, and may give close to nanosecond resolution. " "``CLOCK_HIGHRES`` is the nonadjustable, high-resolution clock." msgstr "" -#: ../../library/time.rst:859 +#: ../../library/time.rst:872 msgid "" "Clock that cannot be set and represents monotonic time since some " "unspecified starting point." msgstr "" -#: ../../library/time.rst:869 +#: ../../library/time.rst:882 msgid "" "Similar to :data:`CLOCK_MONOTONIC`, but provides access to a raw hardware-" "based time that is not subject to NTP adjustments." msgstr "" -#: ../../library/time.rst:878 +#: ../../library/time.rst:891 msgid "" "Similar to :data:`CLOCK_MONOTONIC_RAW`, but reads a value cached by the " "system at context switch and hence has less accuracy." msgstr "" -#: ../../library/time.rst:888 ../../library/time.rst:897 +#: ../../library/time.rst:901 ../../library/time.rst:910 msgid "High-resolution per-process timer from the CPU." msgstr "" -#: ../../library/time.rst:905 +#: ../../library/time.rst:918 msgid "" "`International Atomic Time `_" msgstr "" -#: ../../library/time.rst:907 +#: ../../library/time.rst:920 msgid "" "The system must have a current leap second table in order for this to give " "the correct answer. PTP or NTP software can maintain a leap second table." msgstr "" -#: ../../library/time.rst:916 +#: ../../library/time.rst:929 msgid "Thread-specific CPU-time clock." msgstr "" -#: ../../library/time.rst:925 +#: ../../library/time.rst:938 msgid "" "Time whose absolute value is the time the system has been running and not " "suspended, providing accurate uptime measurement, both absolute and interval." msgstr "" -#: ../../library/time.rst:936 +#: ../../library/time.rst:949 msgid "" "Clock that increments monotonically, tracking the time since an arbitrary " "point, unaffected by frequency or time adjustments and not incremented while " "the system is asleep." msgstr "" -#: ../../library/time.rst:946 +#: ../../library/time.rst:959 msgid "" "Like :data:`CLOCK_UPTIME_RAW`, but the value is cached by the system at " "context switches and therefore has less accuracy." msgstr "" -#: ../../library/time.rst:953 +#: ../../library/time.rst:966 msgid "" "The following constant is the only parameter that can be sent to :func:" "`clock_settime`." msgstr "" -#: ../../library/time.rst:959 +#: ../../library/time.rst:972 msgid "" "System-wide real-time clock. Setting this clock requires appropriate " "privileges." msgstr "" -#: ../../library/time.rst:970 +#: ../../library/time.rst:983 msgid "Timezone Constants" msgstr "" -#: ../../library/time.rst:974 +#: ../../library/time.rst:987 msgid "" "The offset of the local DST timezone, in seconds west of UTC, if one is " "defined. This is negative if the local DST timezone is east of UTC (as in " @@ -1541,25 +1570,25 @@ msgid "" "nonzero. See note below." msgstr "" -#: ../../library/time.rst:980 +#: ../../library/time.rst:993 msgid "Nonzero if a DST timezone is defined. See note below." msgstr "" -#: ../../library/time.rst:984 +#: ../../library/time.rst:997 msgid "" "The offset of the local (non-DST) timezone, in seconds west of UTC (negative " "in most of Western Europe, positive in the US, zero in the UK). See note " "below." msgstr "" -#: ../../library/time.rst:989 +#: ../../library/time.rst:1002 msgid "" "A tuple of two strings: the first is the name of the local non-DST timezone, " "the second is the name of the local DST timezone. If no DST timezone is " "defined, the second string should not be used. See note below." msgstr "" -#: ../../library/time.rst:995 +#: ../../library/time.rst:1008 msgid "" "For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:" "`timezone`, and :data:`tzname`), the value is determined by the timezone " @@ -1569,40 +1598,40 @@ msgid "" "func:`localtime` to obtain timezone information." msgstr "" -#: ../../library/time.rst:1004 +#: ../../library/time.rst:1017 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/time.rst:1005 +#: ../../library/time.rst:1018 msgid "More object-oriented interface to dates and times." msgstr "" -#: ../../library/time.rst:1007 +#: ../../library/time.rst:1020 msgid "Module :mod:`locale`" msgstr ":mod:`locale` 模組" -#: ../../library/time.rst:1008 +#: ../../library/time.rst:1021 msgid "" "Internationalization services. The locale setting affects the " "interpretation of many format specifiers in :func:`strftime` and :func:" "`strptime`." msgstr "" -#: ../../library/time.rst:1011 +#: ../../library/time.rst:1024 msgid "Module :mod:`calendar`" msgstr ":mod:`calendar` 模組" -#: ../../library/time.rst:1012 +#: ../../library/time.rst:1025 msgid "" "General calendar-related functions. :func:`~calendar.timegm` is the " "inverse of :func:`gmtime` from this module." msgstr "" -#: ../../library/time.rst:1016 +#: ../../library/time.rst:1029 msgid "Footnotes" msgstr "註解" -#: ../../library/time.rst:1017 +#: ../../library/time.rst:1030 msgid "" "The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to " "the preferred hour/minute offset is not supported by all ANSI C libraries. " @@ -1642,22 +1671,22 @@ msgid "Daylight Saving Time" msgstr "Daylight Saving Time(日光節約時間)" #: ../../library/time.rst:319 ../../library/time.rst:354 -#: ../../library/time.rst:707 +#: ../../library/time.rst:720 msgid "benchmarking" msgstr "benchmarking(基準測試)" -#: ../../library/time.rst:354 ../../library/time.rst:707 +#: ../../library/time.rst:354 ../../library/time.rst:720 msgid "CPU time" msgstr "CPU time(CPU 時間)" -#: ../../library/time.rst:354 ../../library/time.rst:707 +#: ../../library/time.rst:354 ../../library/time.rst:720 msgid "processor time" msgstr "processor time(處理器時間)" -#: ../../library/time.rst:416 ../../library/time.rst:562 +#: ../../library/time.rst:416 ../../library/time.rst:575 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/time.rst:416 ../../library/time.rst:562 +#: ../../library/time.rst:416 ../../library/time.rst:575 msgid "datetime format" msgstr "datetime format(日期時間格式)" diff --git a/library/warnings.po b/library/warnings.po index 14bf51843b..914b791ce7 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-11-03 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -354,11 +354,39 @@ msgid "" "\"default\" action is applied (hence its name)." msgstr "" -#: ../../library/warnings.rst:184 +#: ../../library/warnings.rst:185 +msgid "Repeated Warning Suppression Criteria" +msgstr "" + +#: ../../library/warnings.rst:187 +msgid "" +"The filters that suppress repeated warnings apply the following criteria to " +"determine if a warning is considered a repeat:" +msgstr "" + +#: ../../library/warnings.rst:189 +msgid "" +"``\"default\"``: A warning is considered a repeat only if the (*message*, " +"*category*, *module*, *lineno*) are all the same." +msgstr "" + +#: ../../library/warnings.rst:190 +msgid "" +"``\"module\"``: A warning is considered a repeat if the (*message*, " +"*category*, *module*) are the same, ignoring the line number." +msgstr "" + +#: ../../library/warnings.rst:191 +msgid "" +"``\"once\"``: A warning is considered a repeat if the (*message*, " +"*category*) are the same, ignoring the module and line number." +msgstr "" + +#: ../../library/warnings.rst:197 msgid "Describing Warning Filters" msgstr "" -#: ../../library/warnings.rst:186 +#: ../../library/warnings.rst:199 msgid "" "The warnings filter is initialized by :option:`-W` options passed to the " "Python interpreter command line and the :envvar:`PYTHONWARNINGS` environment " @@ -368,17 +396,17 @@ msgid "" "after printing a message to :data:`sys.stderr`)." msgstr "" -#: ../../library/warnings.rst:193 +#: ../../library/warnings.rst:206 msgid "" "Individual warnings filters are specified as a sequence of fields separated " "by colons::" msgstr "" -#: ../../library/warnings.rst:196 +#: ../../library/warnings.rst:209 msgid "action:message:category:module:line" msgstr "action:message:category:module:line" -#: ../../library/warnings.rst:198 +#: ../../library/warnings.rst:211 msgid "" "The meaning of each of these fields is as described in :ref:`warning-" "filter`. When listing multiple filters on a single line (as for :envvar:" @@ -388,14 +416,14 @@ msgid "" "precedence over earlier ones)." msgstr "" -#: ../../library/warnings.rst:205 +#: ../../library/warnings.rst:218 msgid "" "Commonly used warning filters apply to either all warnings, warnings in a " "particular category, or warnings raised by particular modules or packages. " "Some examples::" msgstr "" -#: ../../library/warnings.rst:209 +#: ../../library/warnings.rst:222 msgid "" "default # Show all warnings (even those ignored by " "default)\n" @@ -408,24 +436,24 @@ msgid "" "error:::mymodule # Convert warnings to errors in \"mymodule\"" msgstr "" -#: ../../library/warnings.rst:221 +#: ../../library/warnings.rst:234 msgid "Default Warning Filter" msgstr "" -#: ../../library/warnings.rst:223 +#: ../../library/warnings.rst:236 msgid "" "By default, Python installs several warning filters, which can be overridden " "by the :option:`-W` command-line option, the :envvar:`PYTHONWARNINGS` " "environment variable and calls to :func:`filterwarnings`." msgstr "" -#: ../../library/warnings.rst:227 +#: ../../library/warnings.rst:240 msgid "" "In regular release builds, the default warning filter has the following " "entries (in order of precedence)::" msgstr "" -#: ../../library/warnings.rst:230 +#: ../../library/warnings.rst:243 msgid "" "default::DeprecationWarning:__main__\n" "ignore::DeprecationWarning\n" @@ -439,36 +467,36 @@ msgstr "" "ignore::ImportWarning\n" "ignore::ResourceWarning" -#: ../../library/warnings.rst:236 +#: ../../library/warnings.rst:249 msgid "" "In a :ref:`debug build `, the list of default warning filters " "is empty." msgstr "" -#: ../../library/warnings.rst:238 +#: ../../library/warnings.rst:251 msgid "" ":exc:`DeprecationWarning` is now ignored by default in addition to :exc:" "`PendingDeprecationWarning`." msgstr "" -#: ../../library/warnings.rst:242 +#: ../../library/warnings.rst:255 msgid "" ":exc:`DeprecationWarning` is once again shown by default when triggered " "directly by code in ``__main__``." msgstr "" -#: ../../library/warnings.rst:246 +#: ../../library/warnings.rst:259 msgid "" ":exc:`BytesWarning` no longer appears in the default filter list and is " "instead configured via :data:`sys.warnoptions` when :option:`-b` is " "specified twice." msgstr "" -#: ../../library/warnings.rst:255 +#: ../../library/warnings.rst:268 msgid "Overriding the default filter" msgstr "" -#: ../../library/warnings.rst:257 +#: ../../library/warnings.rst:270 msgid "" "Developers of applications written in Python may wish to hide *all* Python " "level warnings from their users by default, and only display them when " @@ -478,7 +506,7 @@ msgid "" "disabled::" msgstr "" -#: ../../library/warnings.rst:263 +#: ../../library/warnings.rst:276 msgid "" "import sys\n" "\n" @@ -492,14 +520,14 @@ msgstr "" " import warnings\n" " warnings.simplefilter(\"ignore\")" -#: ../../library/warnings.rst:269 +#: ../../library/warnings.rst:282 msgid "" "Developers of test runners for Python code are advised to instead ensure " "that *all* warnings are displayed by default for the code under test, using " "code like::" msgstr "" -#: ../../library/warnings.rst:273 +#: ../../library/warnings.rst:286 msgid "" "import sys\n" "\n" @@ -509,7 +537,7 @@ msgid "" " os.environ[\"PYTHONWARNINGS\"] = \"default\" # Also affect subprocesses" msgstr "" -#: ../../library/warnings.rst:280 +#: ../../library/warnings.rst:293 msgid "" "Finally, developers of interactive shells that run user code in a namespace " "other than ``__main__`` are advised to ensure that :exc:`DeprecationWarning` " @@ -517,7 +545,7 @@ msgid "" "``user_ns`` is the module used to execute code entered interactively)::" msgstr "" -#: ../../library/warnings.rst:285 +#: ../../library/warnings.rst:298 msgid "" "import warnings\n" "warnings.filterwarnings(\"default\", category=DeprecationWarning,\n" @@ -527,11 +555,11 @@ msgstr "" "warnings.filterwarnings(\"default\", category=DeprecationWarning,\n" " module=user_ns.get(\"__name__\"))" -#: ../../library/warnings.rst:293 +#: ../../library/warnings.rst:306 msgid "Temporarily Suppressing Warnings" msgstr "" -#: ../../library/warnings.rst:295 +#: ../../library/warnings.rst:308 msgid "" "If you are using code that you know will raise a warning, such as a " "deprecated function, but do not want to see the warning (even when warnings " @@ -539,7 +567,7 @@ msgid "" "to suppress the warning using the :class:`catch_warnings` context manager::" msgstr "" -#: ../../library/warnings.rst:300 +#: ../../library/warnings.rst:313 msgid "" "import warnings\n" "\n" @@ -559,7 +587,7 @@ msgstr "" " warnings.simplefilter(\"ignore\")\n" " fxn()" -#: ../../library/warnings.rst:309 +#: ../../library/warnings.rst:322 msgid "" "While within the context manager all warnings will simply be ignored. This " "allows you to use known-deprecated code without having to see the warning " @@ -569,11 +597,11 @@ msgid "" "context manager at the same time, the behavior is undefined." msgstr "" -#: ../../library/warnings.rst:321 +#: ../../library/warnings.rst:334 msgid "Testing Warnings" msgstr "" -#: ../../library/warnings.rst:323 +#: ../../library/warnings.rst:336 msgid "" "To test warnings raised by code, use the :class:`catch_warnings` context " "manager. With it you can temporarily mutate the warnings filter to " @@ -581,7 +609,7 @@ msgid "" "raised warnings to check::" msgstr "" -#: ../../library/warnings.rst:328 +#: ../../library/warnings.rst:341 msgid "" "import warnings\n" "\n" @@ -599,7 +627,7 @@ msgid "" " assert \"deprecated\" in str(w[-1].message)" msgstr "" -#: ../../library/warnings.rst:343 +#: ../../library/warnings.rst:356 msgid "" "One can also cause all warnings to be exceptions by using ``error`` instead " "of ``always``. One thing to be aware of is that if a warning has already " @@ -608,7 +636,7 @@ msgid "" "registry related to the warning has been cleared." msgstr "" -#: ../../library/warnings.rst:349 +#: ../../library/warnings.rst:362 msgid "" "Once the context manager exits, the warnings filter is restored to its state " "when the context was entered. This prevents tests from changing the warnings " @@ -619,7 +647,7 @@ msgid "" "manager at the same time, the behavior is undefined." msgstr "" -#: ../../library/warnings.rst:357 +#: ../../library/warnings.rst:370 msgid "" "When testing multiple operations that raise the same kind of warning, it is " "important to test them in a manner that confirms each operation is raising a " @@ -629,18 +657,18 @@ msgid "" "entries from the warnings list before each new operation)." msgstr "" -#: ../../library/warnings.rst:368 +#: ../../library/warnings.rst:381 msgid "Updating Code For New Versions of Dependencies" msgstr "" -#: ../../library/warnings.rst:370 +#: ../../library/warnings.rst:383 msgid "" "Warning categories that are primarily of interest to Python developers " "(rather than end users of applications written in Python) are ignored by " "default." msgstr "" -#: ../../library/warnings.rst:373 +#: ../../library/warnings.rst:386 msgid "" "Notably, this \"ignored by default\" list includes :exc:`DeprecationWarning` " "(for every module except ``__main__``), which means developers should make " @@ -649,14 +677,14 @@ msgid "" "(whether in the standard library or third party packages)." msgstr "" -#: ../../library/warnings.rst:379 +#: ../../library/warnings.rst:392 msgid "" "In the ideal case, the code will have a suitable test suite, and the test " "runner will take care of implicitly enabling all warnings when running tests " "(the test runner provided by the :mod:`unittest` module does this)." msgstr "" -#: ../../library/warnings.rst:383 +#: ../../library/warnings.rst:396 msgid "" "In less ideal cases, applications can be checked for use of deprecated " "interfaces by passing :option:`-Wd <-W>` to the Python interpreter (this is " @@ -668,11 +696,11 @@ msgid "" "what is possible." msgstr "" -#: ../../library/warnings.rst:396 +#: ../../library/warnings.rst:409 msgid "Available Functions" msgstr "" -#: ../../library/warnings.rst:401 +#: ../../library/warnings.rst:414 msgid "" "Issue a warning, or maybe ignore it or raise an exception. The *category* " "argument, if given, must be a :ref:`warning category class `. The entry is inserted at the front by default; if " @@ -806,7 +834,7 @@ msgid "" "everything." msgstr "" -#: ../../library/warnings.rst:511 +#: ../../library/warnings.rst:524 msgid "" "Insert a simple entry into the list of :ref:`warnings filter specifications " "`. The meaning of the function parameters is as for :func:" @@ -815,18 +843,18 @@ msgid "" "and line number match." msgstr "" -#: ../../library/warnings.rst:520 +#: ../../library/warnings.rst:533 msgid "" "Reset the warnings filter. This discards the effect of all previous calls " "to :func:`filterwarnings`, including that of the :option:`-W` command line " "options and calls to :func:`simplefilter`." msgstr "" -#: ../../library/warnings.rst:527 +#: ../../library/warnings.rst:540 msgid "Decorator to indicate that a class, function or overload is deprecated." msgstr "" -#: ../../library/warnings.rst:529 +#: ../../library/warnings.rst:542 msgid "" "When this decorator is applied to an object, deprecation warnings may be " "emitted at runtime when the object is used. :term:`static type checkers " @@ -834,11 +862,11 @@ msgid "" "deprecated object." msgstr "" -#: ../../library/warnings.rst:534 +#: ../../library/warnings.rst:547 msgid "Usage::" msgstr "" -#: ../../library/warnings.rst:536 +#: ../../library/warnings.rst:549 msgid "" "from warnings import deprecated\n" "from typing import overload\n" @@ -858,7 +886,7 @@ msgid "" "def g(x: str) -> int: ..." msgstr "" -#: ../../library/warnings.rst:553 +#: ../../library/warnings.rst:566 msgid "" "The warning specified by *category* will be emitted at runtime on use of " "deprecated objects. For functions, that happens on calls; for classes, on " @@ -870,7 +898,7 @@ msgid "" "*category* and *stacklevel* arguments." msgstr "" -#: ../../library/warnings.rst:564 +#: ../../library/warnings.rst:577 msgid "" "The deprecation message passed to the decorator is saved in the " "``__deprecated__`` attribute on the decorated object. If applied to an " @@ -879,15 +907,15 @@ msgid "" "by :func:`typing.get_overloads`." msgstr "" -#: ../../library/warnings.rst:571 +#: ../../library/warnings.rst:584 msgid "See :pep:`702`." msgstr "" -#: ../../library/warnings.rst:576 +#: ../../library/warnings.rst:589 msgid "Available Context Managers" msgstr "" -#: ../../library/warnings.rst:580 +#: ../../library/warnings.rst:593 msgid "" "A context manager that copies and, upon exit, restores the warnings filter " "and the :func:`showwarning` function. If the *record* argument is :const:" @@ -898,27 +926,27 @@ msgid "" "has attributes with the same names as the arguments to :func:`showwarning`." msgstr "" -#: ../../library/warnings.rst:589 +#: ../../library/warnings.rst:602 msgid "" "The *module* argument takes a module that will be used instead of the module " "returned when you import :mod:`warnings` whose filter will be protected. " "This argument exists primarily for testing the :mod:`warnings` module itself." msgstr "" -#: ../../library/warnings.rst:594 +#: ../../library/warnings.rst:607 msgid "" "If the *action* argument is not ``None``, the remaining arguments are passed " "to :func:`simplefilter` as if it were called immediately on entering the " "context." msgstr "" -#: ../../library/warnings.rst:598 +#: ../../library/warnings.rst:611 msgid "" "See :ref:`warning-filter` for the meaning of the *category* and *lineno* " "parameters." msgstr "" -#: ../../library/warnings.rst:603 +#: ../../library/warnings.rst:616 msgid "" "The :class:`catch_warnings` manager works by replacing and then later " "restoring the module's :func:`showwarning` function and internal list of " @@ -926,7 +954,7 @@ msgid "" "state and therefore is not thread-safe." msgstr "" -#: ../../library/warnings.rst:611 +#: ../../library/warnings.rst:624 msgid "Added the *action*, *category*, *lineno*, and *append* parameters." msgstr "新增 *action*、*category*、*lineno* 和 *append* 參數。" diff --git a/license.po b/license.po index de6467b90f..f56bcc5556 100644 --- a/license.po +++ b/license.po @@ -264,7 +264,6 @@ msgid "PSF LICENSE AGREEMENT FOR PYTHON |release|" msgstr "用於 PYTHON |release| 的 PSF 授權合約" #: ../../license.rst:94 -#, fuzzy msgid "" "1. This LICENSE AGREEMENT is between the Python Software Foundation " "(\"PSF\"), and\n" @@ -350,7 +349,7 @@ msgstr "" "derivative\n" " version, provided, however, that PSF's License Agreement and PSF's notice " "of\n" -" copyright, i.e., \"Copyright © 2001-2023 Python Software Foundation; All " +" copyright, i.e., \"Copyright © 2001-2024 Python Software Foundation; All " "Rights\n" " Reserved\" are retained in Python |release| alone or in any derivative " "version\n" @@ -1195,9 +1194,8 @@ msgid "UUencode and UUdecode functions" msgstr "UUencode 與 UUdecode 函式" #: ../../license.rst:479 -#, fuzzy msgid "The ``uu`` codec contains the following notice::" -msgstr ":mod:`uu` 模組包含以下聲明: ::" +msgstr "``uu`` 編解碼器包含以下聲明: ::" #: ../../license.rst:481 msgid "" @@ -2326,14 +2324,13 @@ msgstr "" #: ../../license.rst:1048 msgid "mimalloc" -msgstr "" +msgstr "mimalloc" #: ../../license.rst:1050 msgid "MIT License::" msgstr "" #: ../../license.rst:1052 -#, fuzzy msgid "" "Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen\n" "\n" @@ -2362,26 +2359,32 @@ msgid "" "THE\n" "SOFTWARE." msgstr "" -"Copyright (c) 2001-2006 Twisted Matrix Laboratories.\n" +"Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen\n" "\n" -"Permission is hereby granted, free of charge, to any person obtaining\n" -"a copy of this software and associated documentation files (the\n" -"\"Software\"), to deal in the Software without restriction, including\n" -"without limitation the rights to use, copy, modify, merge, publish,\n" -"distribute, sublicense, and/or sell copies of the Software, and to\n" -"permit persons to whom the Software is furnished to do so, subject to\n" -"the following conditions:\n" +"Permission is hereby granted, free of charge, to any person obtaining a " +"copy\n" +"of this software and associated documentation files (the \"Software\"), to " +"deal\n" +"in the Software without restriction, including without limitation the " +"rights\n" +"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n" +"copies of the Software, and to permit persons to whom the Software is\n" +"furnished to do so, subject to the following conditions:\n" "\n" -"The above copyright notice and this permission notice shall be\n" -"included in all copies or substantial portions of the Software.\n" +"The above copyright notice and this permission notice shall be included in " +"all\n" +"copies or substantial portions of the Software.\n" "\n" -"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" -"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" -"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" -"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" -"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" -"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" -"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS " +"OR\n" +"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" +"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n" +"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n" +"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING " +"FROM,\n" +"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN " +"THE\n" +"SOFTWARE." #: ../../license.rst:1074 msgid "asyncio" @@ -2453,7 +2456,6 @@ msgid "" msgstr "" #: ../../license.rst:1110 -#, fuzzy msgid "" "Copyright (c) 2019,2020 Jeffrey Roberson \n" "\n" @@ -2478,37 +2480,25 @@ msgid "" "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n" "THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." msgstr "" -"Copyright (c) 2008-2020 Stefan Krah. All rights reserved.\n" +"Copyright (c) 2019,2020 Jeffrey Roberson \n" "\n" "Redistribution and use in source and binary forms, with or without\n" "modification, are permitted provided that the following conditions\n" "are met:\n" -"\n" "1. Redistributions of source code must retain the above copyright\n" -" notice, this list of conditions and the following disclaimer.\n" -"\n" +" notice unmodified, this list of conditions, and the following\n" +" disclaimer.\n" "2. Redistributions in binary form must reproduce the above copyright\n" " notice, this list of conditions and the following disclaimer in the\n" " documentation and/or other materials provided with the distribution.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\n" -"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" -"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" -"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" -"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" -"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" -"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" -"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" -"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" -"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" -"SUCH DAMAGE." - -#~ msgid "Audioop" -#~ msgstr "Audioop" - -#~ msgid "" -#~ "The audioop module uses the code base in g771.c file of the SoX project. " -#~ "https://sourceforge.net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" -#~ msgstr "" -#~ "audioop 模組使用 SoX 專案的 g771.c 檔案中的程式碼。 https://sourceforge." -#~ "net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n" +"IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" +"OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" +"IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n" +"INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n" +"NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" +"DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n" +"THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" +"(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n" +"THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." diff --git a/reference/datamodel.po b/reference/datamodel.po index abda8ae6ec..ab96edc064 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2024-11-10 17:21+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-" @@ -795,7 +795,7 @@ msgstr "" #: ../../reference/datamodel.rst:659 msgid "Instance methods" -msgstr "" +msgstr "實例方法" #: ../../reference/datamodel.rst:666 msgid "" @@ -894,7 +894,7 @@ msgstr "" #: ../../reference/datamodel.rst:741 msgid "Generator functions" -msgstr "Generator(產生器)函式" +msgstr "產生器函式" #: ../../reference/datamodel.rst:747 msgid "" @@ -924,7 +924,7 @@ msgstr "" #: ../../reference/datamodel.rst:772 msgid "Asynchronous generator functions" -msgstr "" +msgstr "非同步產生器函式" #: ../../reference/datamodel.rst:778 msgid "" @@ -986,7 +986,7 @@ msgstr "" #: ../../reference/datamodel.rst:821 msgid "Built-in methods" -msgstr "" +msgstr "內建方法" #: ../../reference/datamodel.rst:828 msgid "" @@ -1014,7 +1014,7 @@ msgstr "" #: ../../reference/datamodel.rst:848 msgid "Class Instances" -msgstr "" +msgstr "類別實例" #: ../../reference/datamodel.rst:850 msgid "" @@ -1210,10 +1210,13 @@ msgstr "" #: ../../reference/datamodel.rst:1016 msgid "" "Setting :attr:`!__loader__` on a module while failing to set :attr:`!" -"__spec__.loader` is deprecated. In Python 3.14, :attr:`!__loader__` will " +"__spec__.loader` is deprecated. In Python 3.16, :attr:`!__loader__` will " "cease to be set or taken into consideration by the import system or the " "standard library." msgstr "" +"在模組上設定 :attr:`!__loader__` 而沒有設定 :attr:`!__spec__.loader` 的做法已" +"被棄用。在 Python 3.16 中,引入系統或標準函式庫將不再設定或考慮 :attr:`!" +"__loader__`。" #: ../../reference/datamodel.rst:1024 msgid "" @@ -1483,10 +1486,14 @@ msgid "" ">>> A.__subclasses__()\n" "[]" msgstr "" +">>> class A: pass\n" +">>> class B(A): pass\n" +">>> A.__subclasses__()\n" +"[]" #: ../../reference/datamodel.rst:1263 msgid "Class instances" -msgstr "" +msgstr "類別實例" #: ../../reference/datamodel.rst:1271 msgid "" @@ -1564,7 +1571,7 @@ msgstr "" #: ../../reference/datamodel.rst:1362 msgid "Code objects" -msgstr "" +msgstr "程式碼物件" #: ../../reference/datamodel.rst:1366 msgid "" @@ -1670,7 +1677,7 @@ msgstr "" #: ../../reference/datamodel.rst:1461 msgid "" "This attribute of code objects is deprecated, and may be removed in Python " -"3.14." +"3.15." msgstr "" #: ../../reference/datamodel.rst:1466 @@ -2292,37 +2299,39 @@ msgstr "" #: ../../reference/datamodel.rst:1988 msgid "" "This is typically used for debugging, so it is important that the " -"representation is information-rich and unambiguous." +"representation is information-rich and unambiguous. A default implementation " +"is provided by the :class:`object` class itself." msgstr "" -#: ../../reference/datamodel.rst:1999 +#: ../../reference/datamodel.rst:2000 msgid "" -"Called by :func:`str(object) ` and the built-in functions :func:" -"`format` and :func:`print` to compute the \"informal\" or nicely printable " -"string representation of an object. The return value must be a :ref:`string " -"` object." +"Called by :func:`str(object) `, the default :meth:`__format__` " +"implementation, and the built-in function :func:`print`, to compute the " +"\"informal\" or nicely printable string representation of an object. The " +"return value must be a :ref:`str ` object." msgstr "" -#: ../../reference/datamodel.rst:2004 +#: ../../reference/datamodel.rst:2005 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" -#: ../../reference/datamodel.rst:2008 +#: ../../reference/datamodel.rst:2009 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -#: ../../reference/datamodel.rst:2018 +#: ../../reference/datamodel.rst:2019 msgid "" "Called by :ref:`bytes ` to compute a byte-string representation " -"of an object. This should return a :class:`bytes` object." +"of an object. This should return a :class:`bytes` object. The :class:" +"`object` class itself does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:2029 +#: ../../reference/datamodel.rst:2031 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals ` and the :meth:`str.format` " @@ -2334,28 +2343,34 @@ msgid "" "formatting option syntax." msgstr "" -#: ../../reference/datamodel.rst:2039 +#: ../../reference/datamodel.rst:2041 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" -#: ../../reference/datamodel.rst:2041 +#: ../../reference/datamodel.rst:2043 msgid "The return value must be a string object." +msgstr "回傳值必須是個字串物件。" + +#: ../../reference/datamodel.rst:2045 +msgid "" +"The default implementation by the :class:`object` class should be given an " +"empty *format_spec* string. It delegates to :meth:`__str__`." msgstr "" -#: ../../reference/datamodel.rst:2043 +#: ../../reference/datamodel.rst:2048 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -#: ../../reference/datamodel.rst:2047 +#: ../../reference/datamodel.rst:2052 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" -#: ../../reference/datamodel.rst:2063 +#: ../../reference/datamodel.rst:2068 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " "between operator symbols and method names is as follows: ``x.__hash__``." msgstr "" -#: ../../reference/datamodel.rst:2155 +#: ../../reference/datamodel.rst:2166 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " @@ -2489,7 +2514,7 @@ msgid "" "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" -#: ../../reference/datamodel.rst:2164 +#: ../../reference/datamodel.rst:2175 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are " "\"salted\" with an unpredictable random value. Although they remain " @@ -2497,7 +2522,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../reference/datamodel.rst:2169 +#: ../../reference/datamodel.rst:2180 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully chosen inputs that exploit the worst case performance of a dict " @@ -2505,52 +2530,54 @@ msgid "" "advisories/ocert-2011-003.html for details." msgstr "" -#: ../../reference/datamodel.rst:2174 +#: ../../reference/datamodel.rst:2185 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" -#: ../../reference/datamodel.rst:2178 +#: ../../reference/datamodel.rst:2189 msgid "See also :envvar:`PYTHONHASHSEED`." msgstr "另請參閱 :envvar:`PYTHONHASHSEED`。" -#: ../../reference/datamodel.rst:2180 +#: ../../reference/datamodel.rst:2191 msgid "Hash randomization is enabled by default." msgstr "" -#: ../../reference/datamodel.rst:2188 +#: ../../reference/datamodel.rst:2199 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " "defined, :meth:`~object.__len__` is called, if it is defined, and the object " "is considered true if its result is nonzero. If a class defines neither :" -"meth:`!__len__` nor :meth:`!__bool__`, all its instances are considered true." +"meth:`!__len__` nor :meth:`!__bool__` (which is true of the :class:`object` " +"class itself), all its instances are considered true." msgstr "" -#: ../../reference/datamodel.rst:2199 +#: ../../reference/datamodel.rst:2210 msgid "Customizing attribute access" msgstr "" -#: ../../reference/datamodel.rst:2201 +#: ../../reference/datamodel.rst:2212 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" -#: ../../reference/datamodel.rst:2209 +#: ../../reference/datamodel.rst:2220 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " "*name* is not an instance attribute or an attribute in the class tree for " "``self``; or :meth:`__get__` of a *name* property raises :exc:" "`AttributeError`). This method should either return the (computed) " -"attribute value or raise an :exc:`AttributeError` exception." +"attribute value or raise an :exc:`AttributeError` exception. The :class:" +"`object` class itself does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:2216 +#: ../../reference/datamodel.rst:2228 msgid "" "Note that if the attribute is found through the normal mechanism, :meth:" "`__getattr__` is not called. (This is an intentional asymmetry between :" @@ -2563,7 +2590,7 @@ msgid "" "actually get total control over attribute access." msgstr "" -#: ../../reference/datamodel.rst:2229 +#: ../../reference/datamodel.rst:2241 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -2575,64 +2602,64 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" -#: ../../reference/datamodel.rst:2240 +#: ../../reference/datamodel.rst:2252 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or :ref:`built-in " "functions `. See :ref:`special-lookup`." msgstr "" -#: ../../reference/datamodel.rst:2245 ../../reference/datamodel.rst:2247 +#: ../../reference/datamodel.rst:2257 ../../reference/datamodel.rst:2259 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2254 +#: ../../reference/datamodel.rst:2266 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" -#: ../../reference/datamodel.rst:2258 +#: ../../reference/datamodel.rst:2270 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " "call the base class method with the same name, for example, ``object." "__setattr__(self, name, value)``." msgstr "" -#: ../../reference/datamodel.rst:2262 ../../reference/datamodel.rst:2264 +#: ../../reference/datamodel.rst:2274 ../../reference/datamodel.rst:2276 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -#: ../../reference/datamodel.rst:2271 +#: ../../reference/datamodel.rst:2283 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" -#: ../../reference/datamodel.rst:2274 ../../reference/datamodel.rst:2276 +#: ../../reference/datamodel.rst:2286 ../../reference/datamodel.rst:2288 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2283 +#: ../../reference/datamodel.rst:2295 msgid "" "Called when :func:`dir` is called on the object. An iterable must be " "returned. :func:`dir` converts the returned iterable to a list and sorts it." msgstr "" -#: ../../reference/datamodel.rst:2288 +#: ../../reference/datamodel.rst:2300 msgid "Customizing module attribute access" msgstr "" -#: ../../reference/datamodel.rst:2295 +#: ../../reference/datamodel.rst:2307 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " @@ -2644,21 +2671,21 @@ msgid "" "with the attribute name and the result is returned." msgstr "" -#: ../../reference/datamodel.rst:2304 +#: ../../reference/datamodel.rst:2316 msgid "" "The ``__dir__`` function should accept no arguments, and return an iterable " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" -#: ../../reference/datamodel.rst:2308 +#: ../../reference/datamodel.rst:2320 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" -#: ../../reference/datamodel.rst:2312 +#: ../../reference/datamodel.rst:2324 msgid "" "import sys\n" "from types import ModuleType\n" @@ -2686,7 +2713,7 @@ msgstr "" "\n" "sys.modules[__name__].__class__ = VerboseModule" -#: ../../reference/datamodel.rst:2326 +#: ../../reference/datamodel.rst:2338 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " @@ -2694,37 +2721,38 @@ msgid "" "module's globals dictionary) is unaffected." msgstr "" -#: ../../reference/datamodel.rst:2331 +#: ../../reference/datamodel.rst:2343 msgid "``__class__`` module attribute is now writable." -msgstr "" +msgstr "``__class__`` 模組屬性現在是可寫入的。" -#: ../../reference/datamodel.rst:2334 +#: ../../reference/datamodel.rst:2346 msgid "``__getattr__`` and ``__dir__`` module attributes." -msgstr "" +msgstr "``__getattr__`` 和 ``__dir__`` 模組屬性。" -#: ../../reference/datamodel.rst:2339 +#: ../../reference/datamodel.rst:2351 msgid ":pep:`562` - Module __getattr__ and __dir__" msgstr ":pep:`562` - 模組 __getattr__ 和 __dir__" -#: ../../reference/datamodel.rst:2340 +#: ../../reference/datamodel.rst:2352 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." msgstr "" -#: ../../reference/datamodel.rst:2346 +#: ../../reference/datamodel.rst:2358 msgid "Implementing Descriptors" -msgstr "" +msgstr "實作描述器" -#: ../../reference/datamodel.rst:2348 +#: ../../reference/datamodel.rst:2360 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " "descriptor must be in either the owner's class dictionary or in the class " "dictionary for one of its parents). In the examples below, \"the " "attribute\" refers to the attribute whose name is the key of the property in " -"the owner class' :attr:`~object.__dict__`." +"the owner class' :attr:`~object.__dict__`. The :class:`object` class itself " +"does not implement any of these protocols." msgstr "" -#: ../../reference/datamodel.rst:2358 +#: ../../reference/datamodel.rst:2370 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2733,13 +2761,13 @@ msgid "" "accessed through the *owner*." msgstr "" -#: ../../reference/datamodel.rst:2364 +#: ../../reference/datamodel.rst:2376 msgid "" "This method should return the computed attribute value or raise an :exc:" "`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:2367 +#: ../../reference/datamodel.rst:2379 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2749,31 +2777,31 @@ msgid "" "not." msgstr "" -#: ../../reference/datamodel.rst:2376 +#: ../../reference/datamodel.rst:2388 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" -#: ../../reference/datamodel.rst:2379 +#: ../../reference/datamodel.rst:2391 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" -#: ../../reference/datamodel.rst:2385 +#: ../../reference/datamodel.rst:2397 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" -#: ../../reference/datamodel.rst:2387 +#: ../../reference/datamodel.rst:2399 msgid "" "Instances of descriptors may also have the :attr:`!__objclass__` attribute " "present:" msgstr "" -#: ../../reference/datamodel.rst:2392 +#: ../../reference/datamodel.rst:2404 msgid "" "The attribute :attr:`!__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2784,11 +2812,11 @@ msgid "" "are implemented in C)." msgstr "" -#: ../../reference/datamodel.rst:2403 +#: ../../reference/datamodel.rst:2415 msgid "Invoking Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2405 +#: ../../reference/datamodel.rst:2417 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " @@ -2797,7 +2825,7 @@ msgid "" "is said to be a descriptor." msgstr "" -#: ../../reference/datamodel.rst:2411 +#: ../../reference/datamodel.rst:2423 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -2805,7 +2833,7 @@ msgid "" "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" -#: ../../reference/datamodel.rst:2416 +#: ../../reference/datamodel.rst:2428 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " @@ -2813,54 +2841,54 @@ msgid "" "depends on which descriptor methods were defined and how they were called." msgstr "" -#: ../../reference/datamodel.rst:2421 +#: ../../reference/datamodel.rst:2433 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" -#: ../../reference/datamodel.rst:2424 +#: ../../reference/datamodel.rst:2436 msgid "Direct Call" -msgstr "" +msgstr "直接呼叫" -#: ../../reference/datamodel.rst:2425 +#: ../../reference/datamodel.rst:2437 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" -#: ../../reference/datamodel.rst:2428 +#: ../../reference/datamodel.rst:2440 msgid "Instance Binding" msgstr "" -#: ../../reference/datamodel.rst:2429 +#: ../../reference/datamodel.rst:2441 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -#: ../../reference/datamodel.rst:2432 +#: ../../reference/datamodel.rst:2444 msgid "Class Binding" msgstr "" -#: ../../reference/datamodel.rst:2433 +#: ../../reference/datamodel.rst:2445 msgid "" "If binding to a class, ``A.x`` is transformed into the call: ``A." "__dict__['x'].__get__(None, A)``." msgstr "" -#: ../../reference/datamodel.rst:2436 +#: ../../reference/datamodel.rst:2448 msgid "Super Binding" msgstr "" -#: ../../reference/datamodel.rst:2437 +#: ../../reference/datamodel.rst:2449 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " "for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." "__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." msgstr "" -#: ../../reference/datamodel.rst:2474 +#: ../../reference/datamodel.rst:2486 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " @@ -2878,7 +2906,7 @@ msgid "" "instances." msgstr "" -#: ../../reference/datamodel.rst:2489 +#: ../../reference/datamodel.rst:2501 msgid "" "Python methods (including those decorated with :func:`@staticmethod " "` and :func:`@classmethod `) are implemented as " @@ -2887,30 +2915,30 @@ msgid "" "from other instances of the same class." msgstr "" -#: ../../reference/datamodel.rst:2495 +#: ../../reference/datamodel.rst:2507 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" -#: ../../reference/datamodel.rst:2502 +#: ../../reference/datamodel.rst:2514 msgid "__slots__" msgstr "__slots__" -#: ../../reference/datamodel.rst:2504 +#: ../../reference/datamodel.rst:2516 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " "and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " "explicitly declared in *__slots__* or available in a parent.)" msgstr "" -#: ../../reference/datamodel.rst:2508 +#: ../../reference/datamodel.rst:2520 msgid "" "The space saved over using :attr:`~object.__dict__` can be significant. " "Attribute lookup speed can be significantly improved as well." msgstr "" -#: ../../reference/datamodel.rst:2513 +#: ../../reference/datamodel.rst:2525 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " @@ -2918,18 +2946,18 @@ msgid "" "`~object.__dict__` and *__weakref__* for each instance." msgstr "" -#: ../../reference/datamodel.rst:2522 +#: ../../reference/datamodel.rst:2534 msgid "Notes on using *__slots__*:" msgstr "" -#: ../../reference/datamodel.rst:2524 +#: ../../reference/datamodel.rst:2536 msgid "" "When inheriting from a class without *__slots__*, the :attr:`~object." "__dict__` and *__weakref__* attribute of the instances will always be " "accessible." msgstr "" -#: ../../reference/datamodel.rst:2528 +#: ../../reference/datamodel.rst:2540 msgid "" "Without a :attr:`~object.__dict__` variable, instances cannot be assigned " "new variables not listed in the *__slots__* definition. Attempts to assign " @@ -2938,7 +2966,7 @@ msgid "" "sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2535 +#: ../../reference/datamodel.rst:2547 msgid "" "Without a *__weakref__* variable for each instance, classes defining " "*__slots__* do not support :mod:`weak references ` to its " @@ -2946,7 +2974,7 @@ msgid "" "to the sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2541 +#: ../../reference/datamodel.rst:2553 msgid "" "*__slots__* are implemented at the class level by creating :ref:`descriptors " "` for each variable name. As a result, class attributes cannot " @@ -2954,7 +2982,7 @@ msgid "" "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" -#: ../../reference/datamodel.rst:2547 +#: ../../reference/datamodel.rst:2559 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " @@ -2963,7 +2991,7 @@ msgid "" "only contain names of any *additional* slots)." msgstr "" -#: ../../reference/datamodel.rst:2553 +#: ../../reference/datamodel.rst:2565 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -2972,7 +3000,7 @@ msgid "" "prevent this." msgstr "" -#: ../../reference/datamodel.rst:2558 +#: ../../reference/datamodel.rst:2570 msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " @@ -2980,11 +3008,11 @@ msgid "" "`tuple`." msgstr "" -#: ../../reference/datamodel.rst:2563 +#: ../../reference/datamodel.rst:2575 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2565 +#: ../../reference/datamodel.rst:2577 msgid "" "If a :class:`dictionary ` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " @@ -2992,13 +3020,13 @@ msgid "" "func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" -#: ../../reference/datamodel.rst:2570 +#: ../../reference/datamodel.rst:2582 msgid "" ":attr:`~object.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2573 +#: ../../reference/datamodel.rst:2585 msgid "" ":ref:`Multiple inheritance ` with multiple slotted parent " "classes can be used, but only one parent is allowed to have attributes " @@ -3006,18 +3034,18 @@ msgid "" "raise :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2579 +#: ../../reference/datamodel.rst:2591 msgid "" "If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " "created for each of the iterator's values. However, the *__slots__* " "attribute will be an empty iterator." msgstr "" -#: ../../reference/datamodel.rst:2587 +#: ../../reference/datamodel.rst:2599 msgid "Customizing class creation" msgstr "" -#: ../../reference/datamodel.rst:2589 +#: ../../reference/datamodel.rst:2601 msgid "" "Whenever a class inherits from another class, :meth:`~object." "__init_subclass__` is called on the parent class. This way, it is possible " @@ -3027,14 +3055,14 @@ msgid "" "future subclasses of the class defining the method." msgstr "" -#: ../../reference/datamodel.rst:2598 +#: ../../reference/datamodel.rst:2610 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" -#: ../../reference/datamodel.rst:2602 +#: ../../reference/datamodel.rst:2614 msgid "" "Keyword arguments which are given to a new class are passed to the parent " "class's ``__init_subclass__``. For compatibility with other classes using " @@ -3042,7 +3070,7 @@ msgid "" "pass the others over to the base class, as in::" msgstr "" -#: ../../reference/datamodel.rst:2608 +#: ../../reference/datamodel.rst:2620 msgid "" "class Philosopher:\n" " def __init_subclass__(cls, /, default_name, **kwargs):\n" @@ -3060,13 +3088,13 @@ msgstr "" "class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" " pass" -#: ../../reference/datamodel.rst:2616 +#: ../../reference/datamodel.rst:2628 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" -#: ../../reference/datamodel.rst:2621 +#: ../../reference/datamodel.rst:2633 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " @@ -3074,19 +3102,19 @@ msgid "" "``type(cls)``." msgstr "" -#: ../../reference/datamodel.rst:2629 +#: ../../reference/datamodel.rst:2641 msgid "" "When a class is created, :meth:`type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:2634 +#: ../../reference/datamodel.rst:2646 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -#: ../../reference/datamodel.rst:2637 +#: ../../reference/datamodel.rst:2649 msgid "" "class A:\n" " x = C() # Automatically calls: x.__set_name__(A, 'x')" @@ -3094,14 +3122,14 @@ msgstr "" "class A:\n" " x = C() # 自動呼叫:x.__set_name__(A, 'x')" -#: ../../reference/datamodel.rst:2640 +#: ../../reference/datamodel.rst:2652 msgid "" "If the class variable is assigned after the class is created, :meth:" "`__set_name__` will not be called automatically. If needed, :meth:" "`__set_name__` can be called directly::" msgstr "" -#: ../../reference/datamodel.rst:2644 +#: ../../reference/datamodel.rst:2656 msgid "" "class A:\n" " pass\n" @@ -3111,22 +3139,22 @@ msgid "" "c.__set_name__(A, 'x') # Manually invoke the hook" msgstr "" -#: ../../reference/datamodel.rst:2651 +#: ../../reference/datamodel.rst:2663 msgid "See :ref:`class-object-creation` for more details." msgstr "更多細節請見 :ref:`class-object-creation`。" -#: ../../reference/datamodel.rst:2659 +#: ../../reference/datamodel.rst:2671 msgid "Metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2666 +#: ../../reference/datamodel.rst:2678 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" -#: ../../reference/datamodel.rst:2670 +#: ../../reference/datamodel.rst:2682 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " @@ -3134,7 +3162,7 @@ msgid "" "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" -#: ../../reference/datamodel.rst:2675 +#: ../../reference/datamodel.rst:2687 msgid "" "class Meta(type):\n" " pass\n" @@ -3154,41 +3182,41 @@ msgstr "" "class MySubclass(MyClass):\n" " pass" -#: ../../reference/datamodel.rst:2684 +#: ../../reference/datamodel.rst:2696 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" -#: ../../reference/datamodel.rst:2687 +#: ../../reference/datamodel.rst:2699 msgid "When a class definition is executed, the following steps occur:" msgstr "" -#: ../../reference/datamodel.rst:2689 +#: ../../reference/datamodel.rst:2701 msgid "MRO entries are resolved;" msgstr "" -#: ../../reference/datamodel.rst:2690 +#: ../../reference/datamodel.rst:2702 msgid "the appropriate metaclass is determined;" msgstr "" -#: ../../reference/datamodel.rst:2691 +#: ../../reference/datamodel.rst:2703 msgid "the class namespace is prepared;" msgstr "" -#: ../../reference/datamodel.rst:2692 +#: ../../reference/datamodel.rst:2704 msgid "the class body is executed;" msgstr "" -#: ../../reference/datamodel.rst:2693 +#: ../../reference/datamodel.rst:2705 msgid "the class object is created." msgstr "" -#: ../../reference/datamodel.rst:2697 +#: ../../reference/datamodel.rst:2709 msgid "Resolving MRO entries" msgstr "" -#: ../../reference/datamodel.rst:2701 +#: ../../reference/datamodel.rst:2713 msgid "" "If a base that appears in a class definition is not an instance of :class:" "`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " @@ -3200,59 +3228,59 @@ msgid "" "is ignored." msgstr "" -#: ../../reference/datamodel.rst:2712 +#: ../../reference/datamodel.rst:2724 msgid ":func:`types.resolve_bases`" msgstr ":func:`types.resolve_bases`" -#: ../../reference/datamodel.rst:2713 +#: ../../reference/datamodel.rst:2725 msgid "Dynamically resolve bases that are not instances of :class:`type`." msgstr "" -#: ../../reference/datamodel.rst:2715 +#: ../../reference/datamodel.rst:2727 msgid ":func:`types.get_original_bases`" msgstr ":func:`types.get_original_bases`" -#: ../../reference/datamodel.rst:2716 +#: ../../reference/datamodel.rst:2728 msgid "" "Retrieve a class's \"original bases\" prior to modifications by :meth:" "`~object.__mro_entries__`." msgstr "" -#: ../../reference/datamodel.rst:2719 +#: ../../reference/datamodel.rst:2731 msgid ":pep:`560`" msgstr ":pep:`560`" -#: ../../reference/datamodel.rst:2720 +#: ../../reference/datamodel.rst:2732 msgid "Core support for typing module and generic types." msgstr "" -#: ../../reference/datamodel.rst:2724 +#: ../../reference/datamodel.rst:2736 msgid "Determining the appropriate metaclass" msgstr "" -#: ../../reference/datamodel.rst:2728 +#: ../../reference/datamodel.rst:2740 msgid "" "The appropriate metaclass for a class definition is determined as follows:" msgstr "" -#: ../../reference/datamodel.rst:2730 +#: ../../reference/datamodel.rst:2742 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" -#: ../../reference/datamodel.rst:2731 +#: ../../reference/datamodel.rst:2743 msgid "" "if an explicit metaclass is given and it is *not* an instance of :func:" "`type`, then it is used directly as the metaclass;" msgstr "" -#: ../../reference/datamodel.rst:2733 +#: ../../reference/datamodel.rst:2745 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" -#: ../../reference/datamodel.rst:2736 +#: ../../reference/datamodel.rst:2748 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -3261,11 +3289,11 @@ msgid "" "that criterion, then the class definition will fail with ``TypeError``." msgstr "" -#: ../../reference/datamodel.rst:2746 +#: ../../reference/datamodel.rst:2758 msgid "Preparing the class namespace" msgstr "" -#: ../../reference/datamodel.rst:2751 +#: ../../reference/datamodel.rst:2763 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -3277,25 +3305,25 @@ msgid "" "copied into a new ``dict``." msgstr "" -#: ../../reference/datamodel.rst:2760 +#: ../../reference/datamodel.rst:2772 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" -#: ../../reference/datamodel.rst:2765 +#: ../../reference/datamodel.rst:2777 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/datamodel.rst:2766 +#: ../../reference/datamodel.rst:2778 msgid "Introduced the ``__prepare__`` namespace hook" msgstr "" -#: ../../reference/datamodel.rst:2770 +#: ../../reference/datamodel.rst:2782 msgid "Executing the class body" msgstr "" -#: ../../reference/datamodel.rst:2775 +#: ../../reference/datamodel.rst:2787 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -3304,7 +3332,7 @@ msgid "" "inside a function." msgstr "" -#: ../../reference/datamodel.rst:2781 +#: ../../reference/datamodel.rst:2793 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -3313,11 +3341,11 @@ msgid "" "reference described in the next section." msgstr "" -#: ../../reference/datamodel.rst:2790 +#: ../../reference/datamodel.rst:2802 msgid "Creating the class object" msgstr "" -#: ../../reference/datamodel.rst:2797 +#: ../../reference/datamodel.rst:2809 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " @@ -3325,7 +3353,7 @@ msgid "" "to ``__prepare__``)." msgstr "" -#: ../../reference/datamodel.rst:2802 +#: ../../reference/datamodel.rst:2814 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " @@ -3336,7 +3364,7 @@ msgid "" "is identified based on the first argument passed to the method." msgstr "" -#: ../../reference/datamodel.rst:2812 +#: ../../reference/datamodel.rst:2824 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -3345,39 +3373,39 @@ msgid "" "in Python 3.8." msgstr "" -#: ../../reference/datamodel.rst:2818 +#: ../../reference/datamodel.rst:2830 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" -#: ../../reference/datamodel.rst:2822 +#: ../../reference/datamodel.rst:2834 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -#: ../../reference/datamodel.rst:2824 +#: ../../reference/datamodel.rst:2836 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -#: ../../reference/datamodel.rst:2826 +#: ../../reference/datamodel.rst:2838 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -#: ../../reference/datamodel.rst:2829 +#: ../../reference/datamodel.rst:2841 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" -#: ../../reference/datamodel.rst:2833 +#: ../../reference/datamodel.rst:2845 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " @@ -3385,19 +3413,19 @@ msgid "" "becomes the :attr:`~type.__dict__` attribute of the class object." msgstr "" -#: ../../reference/datamodel.rst:2840 +#: ../../reference/datamodel.rst:2852 msgid ":pep:`3135` - New super" msgstr "" -#: ../../reference/datamodel.rst:2841 +#: ../../reference/datamodel.rst:2853 msgid "Describes the implicit ``__class__`` closure reference" msgstr "" -#: ../../reference/datamodel.rst:2845 +#: ../../reference/datamodel.rst:2857 msgid "Uses for metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2847 +#: ../../reference/datamodel.rst:2859 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " @@ -3405,17 +3433,17 @@ msgid "" "locking/synchronization." msgstr "" -#: ../../reference/datamodel.rst:2854 +#: ../../reference/datamodel.rst:2866 msgid "Customizing instance and subclass checks" msgstr "" -#: ../../reference/datamodel.rst:2856 +#: ../../reference/datamodel.rst:2868 msgid "" "The following methods are used to override the default behavior of the :func:" "`isinstance` and :func:`issubclass` built-in functions." msgstr "" -#: ../../reference/datamodel.rst:2859 +#: ../../reference/datamodel.rst:2871 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " @@ -3423,21 +3451,21 @@ msgid "" "other ABCs." msgstr "" -#: ../../reference/datamodel.rst:2866 +#: ../../reference/datamodel.rst:2878 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2873 +#: ../../reference/datamodel.rst:2885 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2878 +#: ../../reference/datamodel.rst:2890 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " @@ -3445,11 +3473,11 @@ msgid "" "only in this case the instance is itself a class." msgstr "" -#: ../../reference/datamodel.rst:2885 +#: ../../reference/datamodel.rst:2897 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: ../../reference/datamodel.rst:2886 +#: ../../reference/datamodel.rst:2898 msgid "" "Includes the specification for customizing :func:`isinstance` and :func:" "`issubclass` behavior through :meth:`~type.__instancecheck__` and :meth:" @@ -3458,11 +3486,11 @@ msgid "" "language." msgstr "" -#: ../../reference/datamodel.rst:2894 +#: ../../reference/datamodel.rst:2906 msgid "Emulating generic types" msgstr "" -#: ../../reference/datamodel.rst:2896 +#: ../../reference/datamodel.rst:2908 msgid "" "When using :term:`type annotations`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " @@ -3470,65 +3498,65 @@ msgid "" "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2903 +#: ../../reference/datamodel.rst:2915 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/datamodel.rst:2904 +#: ../../reference/datamodel.rst:2916 msgid "Introducing Python's framework for type annotations" msgstr "" -#: ../../reference/datamodel.rst:2906 +#: ../../reference/datamodel.rst:2918 msgid ":ref:`Generic Alias Types`" msgstr ":ref:`泛型別名型別 `" -#: ../../reference/datamodel.rst:2907 +#: ../../reference/datamodel.rst:2919 msgid "Documentation for objects representing parameterized generic classes" msgstr "" -#: ../../reference/datamodel.rst:2909 +#: ../../reference/datamodel.rst:2921 msgid "" ":ref:`Generics`, :ref:`user-defined generics` and :" "class:`typing.Generic`" msgstr "" -#: ../../reference/datamodel.rst:2910 +#: ../../reference/datamodel.rst:2922 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../reference/datamodel.rst:2913 +#: ../../reference/datamodel.rst:2925 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2918 +#: ../../reference/datamodel.rst:2930 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2921 +#: ../../reference/datamodel.rst:2933 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " "method. As such, there is no need for it to be decorated with :func:" "`@classmethod` when it is defined." msgstr "" -#: ../../reference/datamodel.rst:2927 +#: ../../reference/datamodel.rst:2939 msgid "The purpose of *__class_getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2929 +#: ../../reference/datamodel.rst:2941 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints` to these classes." msgstr "" -#: ../../reference/datamodel.rst:2933 +#: ../../reference/datamodel.rst:2945 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " @@ -3537,7 +3565,7 @@ msgid "" "own implementation of ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2939 +#: ../../reference/datamodel.rst:2951 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " @@ -3545,11 +3573,11 @@ msgid "" "purposes other than type hinting is discouraged." msgstr "" -#: ../../reference/datamodel.rst:2949 +#: ../../reference/datamodel.rst:2961 msgid "*__class_getitem__* versus *__getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2951 +#: ../../reference/datamodel.rst:2963 msgid "" "Usually, the :ref:`subscription` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -3559,14 +3587,14 @@ msgid "" "genericalias>` object if it is properly defined." msgstr "" -#: ../../reference/datamodel.rst:2958 +#: ../../reference/datamodel.rst:2970 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " "follows something like the following process to decide whether :meth:" "`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" msgstr "" -#: ../../reference/datamodel.rst:2963 +#: ../../reference/datamodel.rst:2975 msgid "" "from inspect import isclass\n" "\n" @@ -3592,7 +3620,7 @@ msgid "" " )" msgstr "" -#: ../../reference/datamodel.rst:2986 +#: ../../reference/datamodel.rst:2998 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " @@ -3602,7 +3630,7 @@ msgid "" "__class_getitem__` being called::" msgstr "" -#: ../../reference/datamodel.rst:2993 +#: ../../reference/datamodel.rst:3005 msgid "" ">>> # list has class \"type\" as its metaclass, like most classes:\n" ">>> type(list)\n" @@ -3617,14 +3645,14 @@ msgid "" "" msgstr "" -#: ../../reference/datamodel.rst:3005 +#: ../../reference/datamodel.rst:3017 msgid "" "However, if a class has a custom metaclass that defines :meth:`~object." "__getitem__`, subscribing the class may result in different behaviour. An " "example of this can be found in the :mod:`enum` module::" msgstr "" -#: ../../reference/datamodel.rst:3009 +#: ../../reference/datamodel.rst:3021 msgid "" ">>> from enum import Enum\n" ">>> class Menu(Enum):\n" @@ -3644,43 +3672,44 @@ msgid "" "" msgstr "" -#: ../../reference/datamodel.rst:3028 +#: ../../reference/datamodel.rst:3040 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:3029 +#: ../../reference/datamodel.rst:3041 msgid "" "Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" "`subscription` results in ``__class_getitem__()`` being " "called instead of :meth:`~object.__getitem__`" msgstr "" -#: ../../reference/datamodel.rst:3037 +#: ../../reference/datamodel.rst:3049 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:3044 +#: ../../reference/datamodel.rst:3056 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " -"arg1, ...)``." +"arg1, ...)``. The :class:`object` class itself does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:3051 +#: ../../reference/datamodel.rst:3064 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:3053 +#: ../../reference/datamodel.rst:3066 msgid "" -"The following methods can be defined to implement container objects. " -"Containers usually are :term:`sequences ` (such as :class:`lists " -"` or :class:`tuples `) or :term:`mappings ` (like :" -"class:`dictionaries `), but can represent other containers as well. " -"The first set of methods is used either to emulate a sequence or to emulate " -"a mapping; the difference is that for a sequence, the allowable keys should " -"be the integers *k* for which ``0 <= k < N`` where *N* is the length of the " -"sequence, or :class:`slice` objects, which define a range of items. It is " -"also recommended that mappings provide the methods :meth:`!keys`, :meth:`!" +"The following methods can be defined to implement container objects. None of " +"them are provided by the :class:`object` class itself. Containers usually " +"are :term:`sequences ` (such as :class:`lists ` or :class:" +"`tuples `) or :term:`mappings ` (like :term:`dictionaries " +"`), but can represent other containers as well. The first set " +"of methods is used either to emulate a sequence or to emulate a mapping; the " +"difference is that for a sequence, the allowable keys should be the integers " +"*k* for which ``0 <= k < N`` where *N* is the length of the sequence, or :" +"class:`slice` objects, which define a range of items. It is also " +"recommended that mappings provide the methods :meth:`!keys`, :meth:`!" "values`, :meth:`!items`, :meth:`!get`, :meth:`!clear`, :meth:`!setdefault`, :" "meth:`!pop`, :meth:`!popitem`, :meth:`!copy`, and :meth:`!update` behaving " "similar to those for Python's standard :class:`dictionary ` objects. " @@ -3706,7 +3735,7 @@ msgid "" "should iterate through the values." msgstr "" -#: ../../reference/datamodel.rst:3094 +#: ../../reference/datamodel.rst:3108 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -3714,7 +3743,7 @@ msgid "" "returns zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:3101 +#: ../../reference/datamodel.rst:3115 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " "length is larger than :data:`!sys.maxsize` some features (such as :func:" @@ -3723,7 +3752,7 @@ msgid "" "`~object.__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:3110 +#: ../../reference/datamodel.rst:3124 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " @@ -3733,28 +3762,28 @@ msgid "" "never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:3124 +#: ../../reference/datamodel.rst:3138 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:3126 +#: ../../reference/datamodel.rst:3140 msgid "a[1:2] = b" msgstr "a[1:2] = b" -#: ../../reference/datamodel.rst:3128 +#: ../../reference/datamodel.rst:3142 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:3130 +#: ../../reference/datamodel.rst:3144 msgid "a[slice(1, 2, None)] = b" msgstr "a[slice(1, 2, None)] = b" -#: ../../reference/datamodel.rst:3132 +#: ../../reference/datamodel.rst:3146 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:3137 +#: ../../reference/datamodel.rst:3151 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " "the accepted keys should be integers. Optionally, they may support :class:" @@ -3766,20 +3795,20 @@ msgid "" "`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:3149 +#: ../../reference/datamodel.rst:3163 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" -#: ../../reference/datamodel.rst:3154 +#: ../../reference/datamodel.rst:3168 msgid "" "When :ref:`subscripting` a *class*, the special class method :" "meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " "See :ref:`classgetitem-versus-getitem` for more details." msgstr "" -#: ../../reference/datamodel.rst:3162 +#: ../../reference/datamodel.rst:3176 msgid "" "Called to implement assignment to ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3788,7 +3817,7 @@ msgid "" "for improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:3171 +#: ../../reference/datamodel.rst:3185 msgid "" "Called to implement deletion of ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3797,13 +3826,13 @@ msgid "" "values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:3180 +#: ../../reference/datamodel.rst:3194 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:3186 +#: ../../reference/datamodel.rst:3200 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -3811,14 +3840,14 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:3194 +#: ../../reference/datamodel.rst:3208 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:3198 +#: ../../reference/datamodel.rst:3212 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " "built-in will fall back to using the sequence protocol (:meth:`__len__` and :" @@ -3827,7 +3856,7 @@ msgid "" "more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:3205 +#: ../../reference/datamodel.rst:3219 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -3835,14 +3864,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:3212 +#: ../../reference/datamodel.rst:3226 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:3216 +#: ../../reference/datamodel.rst:3230 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -3850,11 +3879,11 @@ msgid "" "reference `." msgstr "" -#: ../../reference/datamodel.rst:3225 +#: ../../reference/datamodel.rst:3239 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:3227 +#: ../../reference/datamodel.rst:3241 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -3862,7 +3891,7 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:3253 +#: ../../reference/datamodel.rst:3267 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3876,13 +3905,13 @@ msgid "" "function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:3264 +#: ../../reference/datamodel.rst:3278 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3287 +#: ../../reference/datamodel.rst:3301 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3895,13 +3924,13 @@ msgid "" "`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3299 +#: ../../reference/datamodel.rst:3313 msgid "" "Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " "coercion rules would become too complicated)." msgstr "" -#: ../../reference/datamodel.rst:3304 +#: ../../reference/datamodel.rst:3318 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -3910,7 +3939,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:3325 +#: ../../reference/datamodel.rst:3339 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -3928,19 +3957,19 @@ msgid "" "data model." msgstr "" -#: ../../reference/datamodel.rst:3348 +#: ../../reference/datamodel.rst:3362 msgid "" "Called to implement the unary arithmetic operations (``-``, ``+``, :func:" "`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:3361 +#: ../../reference/datamodel.rst:3375 msgid "" "Called to implement the built-in functions :func:`complex`, :func:`int` and :" "func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:3368 +#: ../../reference/datamodel.rst:3382 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -3949,14 +3978,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:3374 +#: ../../reference/datamodel.rst:3388 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:3386 +#: ../../reference/datamodel.rst:3400 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -3965,21 +3994,21 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:3392 +#: ../../reference/datamodel.rst:3406 msgid "" "The built-in function :func:`int` falls back to :meth:`__trunc__` if " "neither :meth:`__int__` nor :meth:`__index__` is defined." msgstr "" -#: ../../reference/datamodel.rst:3395 +#: ../../reference/datamodel.rst:3409 msgid "The delegation of :func:`int` to :meth:`__trunc__` is deprecated." msgstr "" -#: ../../reference/datamodel.rst:3402 +#: ../../reference/datamodel.rst:3416 msgid "With Statement Context Managers" msgstr "With 陳述式的情境管理器" -#: ../../reference/datamodel.rst:3404 +#: ../../reference/datamodel.rst:3418 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -3989,32 +4018,34 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:3415 +#: ../../reference/datamodel.rst:3429 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:3418 +#: ../../reference/datamodel.rst:3432 msgid "" -"For more information on context managers, see :ref:`typecontextmanager`." +"For more information on context managers, see :ref:`typecontextmanager`. " +"The :class:`object` class itself does not provide the context manager " +"methods." msgstr "" -#: ../../reference/datamodel.rst:3423 +#: ../../reference/datamodel.rst:3438 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:3430 +#: ../../reference/datamodel.rst:3445 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:3434 +#: ../../reference/datamodel.rst:3449 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -4022,27 +4053,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:3438 +#: ../../reference/datamodel.rst:3453 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:3444 +#: ../../reference/datamodel.rst:3459 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../reference/datamodel.rst:3445 +#: ../../reference/datamodel.rst:3460 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3452 +#: ../../reference/datamodel.rst:3467 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:3454 +#: ../../reference/datamodel.rst:3469 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -4050,7 +4081,7 @@ msgid "" "pattern, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:3461 +#: ../../reference/datamodel.rst:3476 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -4059,7 +4090,7 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:3467 +#: ../../reference/datamodel.rst:3482 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " @@ -4069,19 +4100,19 @@ msgid "" "exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:3477 +#: ../../reference/datamodel.rst:3492 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:3478 +#: ../../reference/datamodel.rst:3493 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:3484 +#: ../../reference/datamodel.rst:3499 msgid "Emulating buffer types" msgstr "" -#: ../../reference/datamodel.rst:3486 +#: ../../reference/datamodel.rst:3501 msgid "" "The :ref:`buffer protocol ` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " @@ -4089,13 +4120,13 @@ msgid "" "and third-party libraries may define additional buffer types." msgstr "" -#: ../../reference/datamodel.rst:3491 +#: ../../reference/datamodel.rst:3506 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" -#: ../../reference/datamodel.rst:3496 +#: ../../reference/datamodel.rst:3511 msgid "" "Called when a buffer is requested from *self* (for example, by the :class:" "`memoryview` constructor). The *flags* argument is an integer representing " @@ -4105,7 +4136,7 @@ msgid "" "`memoryview` object." msgstr "" -#: ../../reference/datamodel.rst:3505 +#: ../../reference/datamodel.rst:3520 msgid "" "Called when a buffer is no longer needed. The *buffer* argument is a :class:" "`memoryview` object that was previously returned by :meth:`~object." @@ -4114,28 +4145,28 @@ msgid "" "to perform any cleanup are not required to implement this method." msgstr "" -#: ../../reference/datamodel.rst:3516 +#: ../../reference/datamodel.rst:3531 msgid ":pep:`688` - Making the buffer protocol accessible in Python" msgstr "" -#: ../../reference/datamodel.rst:3517 +#: ../../reference/datamodel.rst:3532 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3519 +#: ../../reference/datamodel.rst:3534 msgid ":class:`collections.abc.Buffer`" msgstr ":class:`collections.abc.Buffer`" -#: ../../reference/datamodel.rst:3520 +#: ../../reference/datamodel.rst:3535 msgid "ABC for buffer types." msgstr "" -#: ../../reference/datamodel.rst:3525 +#: ../../reference/datamodel.rst:3540 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:3527 +#: ../../reference/datamodel.rst:3542 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -4143,7 +4174,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:3532 +#: ../../reference/datamodel.rst:3547 msgid "" ">>> class C:\n" "... pass\n" @@ -4165,7 +4196,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: object of type 'C' has no len()" -#: ../../reference/datamodel.rst:3542 +#: ../../reference/datamodel.rst:3557 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -4174,7 +4205,7 @@ msgid "" "invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:3549 +#: ../../reference/datamodel.rst:3564 msgid "" ">>> 1 .__hash__() == hash(1)\n" "True\n" @@ -4190,14 +4221,14 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: descriptor '__hash__' of 'int' object needs an argument" -#: ../../reference/datamodel.rst:3556 +#: ../../reference/datamodel.rst:3571 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:3560 +#: ../../reference/datamodel.rst:3575 msgid "" ">>> type(1).__hash__(1) == hash(1)\n" "True\n" @@ -4209,14 +4240,14 @@ msgstr "" ">>> type(int).__hash__(int) == hash(int)\n" "True" -#: ../../reference/datamodel.rst:3565 +#: ../../reference/datamodel.rst:3580 msgid "" "In addition to bypassing any instance attributes in the interest of " "correctness, implicit special method lookup generally also bypasses the :" "meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:3569 +#: ../../reference/datamodel.rst:3584 msgid "" ">>> class Meta(type):\n" "... def __getattribute__(*args):\n" @@ -4241,7 +4272,7 @@ msgid "" "10" msgstr "" -#: ../../reference/datamodel.rst:3591 +#: ../../reference/datamodel.rst:3606 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -4250,36 +4281,37 @@ msgid "" "consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:3602 +#: ../../reference/datamodel.rst:3617 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:3606 +#: ../../reference/datamodel.rst:3621 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:3608 +#: ../../reference/datamodel.rst:3623 msgid "" "An :term:`awaitable` object generally implements an :meth:`~object." "__await__` method. :term:`Coroutine objects ` returned from :" "keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:3614 +#: ../../reference/datamodel.rst:3629 msgid "" "The :term:`generator iterator` objects returned from generators decorated " "with :func:`types.coroutine` are also awaitable, but they do not implement :" "meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:3620 +#: ../../reference/datamodel.rst:3635 msgid "" "Must return an :term:`iterator`. Should be used to implement :term:" "`awaitable` objects. For instance, :class:`asyncio.Future` implements this " -"method to be compatible with the :keyword:`await` expression." +"method to be compatible with the :keyword:`await` expression. The :class:" +"`object` class itself is not awaitable and does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:3626 +#: ../../reference/datamodel.rst:3643 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " @@ -4287,15 +4319,15 @@ msgid "" "g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" -#: ../../reference/datamodel.rst:3634 +#: ../../reference/datamodel.rst:3651 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:3640 +#: ../../reference/datamodel.rst:3657 msgid "Coroutine Objects" -msgstr "" +msgstr "協程物件" -#: ../../reference/datamodel.rst:3642 +#: ../../reference/datamodel.rst:3659 msgid "" ":term:`Coroutine objects ` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " @@ -4306,18 +4338,18 @@ msgid "" "should not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" -#: ../../reference/datamodel.rst:3650 +#: ../../reference/datamodel.rst:3667 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:3654 +#: ../../reference/datamodel.rst:3671 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:3660 +#: ../../reference/datamodel.rst:3677 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " "is equivalent to advancing the iterator returned by :meth:`~object." @@ -4328,7 +4360,7 @@ msgid "" "value, described above." msgstr "" -#: ../../reference/datamodel.rst:3671 +#: ../../reference/datamodel.rst:3688 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " @@ -4339,13 +4371,13 @@ msgid "" "not caught in the coroutine, it propagates back to the caller." msgstr "" -#: ../../reference/datamodel.rst:3682 +#: ../../reference/datamodel.rst:3699 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: ../../reference/datamodel.rst:3687 +#: ../../reference/datamodel.rst:3704 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -4355,42 +4387,46 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:3695 +#: ../../reference/datamodel.rst:3712 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:3701 +#: ../../reference/datamodel.rst:3718 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:3703 +#: ../../reference/datamodel.rst:3720 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:3706 +#: ../../reference/datamodel.rst:3723 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:3710 +#: ../../reference/datamodel.rst:3725 ../../reference/datamodel.rst:3774 +msgid "The :class:`object` class itself does not provide these methods." +msgstr "" + +#: ../../reference/datamodel.rst:3730 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:3714 +#: ../../reference/datamodel.rst:3734 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:3717 +#: ../../reference/datamodel.rst:3737 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:3719 +#: ../../reference/datamodel.rst:3739 msgid "" "class Reader:\n" " async def readline(self):\n" @@ -4418,53 +4454,53 @@ msgstr "" " raise StopAsyncIteration\n" " return val" -#: ../../reference/datamodel.rst:3734 +#: ../../reference/datamodel.rst:3754 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator `." msgstr "" -#: ../../reference/datamodel.rst:3739 +#: ../../reference/datamodel.rst:3759 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " "asynchronous iterator object. Returning anything else will result in a :exc:" "`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:3747 +#: ../../reference/datamodel.rst:3767 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3749 +#: ../../reference/datamodel.rst:3769 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3752 +#: ../../reference/datamodel.rst:3772 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3756 +#: ../../reference/datamodel.rst:3778 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3761 +#: ../../reference/datamodel.rst:3783 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3764 +#: ../../reference/datamodel.rst:3786 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:3766 +#: ../../reference/datamodel.rst:3788 msgid "" "class AsyncContextManager:\n" " async def __aenter__(self):\n" @@ -4480,18 +4516,18 @@ msgstr "" " async def __aexit__(self, exc_type, exc, tb):\n" " await log('exiting context')" -#: ../../reference/datamodel.rst:3777 +#: ../../reference/datamodel.rst:3799 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:3778 +#: ../../reference/datamodel.rst:3800 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:3782 +#: ../../reference/datamodel.rst:3804 msgid "" "The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." "__reversed__`, :meth:`~object.__contains__`, :meth:`~object." @@ -4500,7 +4536,7 @@ msgid "" "by relying on the behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3789 +#: ../../reference/datamodel.rst:3811 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " @@ -4508,7 +4544,7 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3795 +#: ../../reference/datamodel.rst:3817 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method -- such as :meth:`~object.__add__` -- fails then the overall " @@ -4531,7 +4567,7 @@ msgstr "" #: ../../reference/datamodel.rst:1265 ../../reference/datamodel.rst:1292 #: ../../reference/datamodel.rst:1364 ../../reference/datamodel.rst:1472 #: ../../reference/datamodel.rst:1581 ../../reference/datamodel.rst:1691 -#: ../../reference/datamodel.rst:2105 ../../reference/datamodel.rst:3120 +#: ../../reference/datamodel.rst:2116 ../../reference/datamodel.rst:3134 msgid "object" msgstr "object(物件)" @@ -4543,12 +4579,12 @@ msgstr "data(資料)" #: ../../reference/datamodel.rst:343 ../../reference/datamodel.rst:427 #: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:799 #: ../../reference/datamodel.rst:1321 ../../reference/datamodel.rst:1774 -#: ../../reference/datamodel.rst:2016 ../../reference/datamodel.rst:2021 -#: ../../reference/datamodel.rst:2105 ../../reference/datamodel.rst:2661 -#: ../../reference/datamodel.rst:3090 ../../reference/datamodel.rst:3248 -#: ../../reference/datamodel.rst:3283 ../../reference/datamodel.rst:3297 -#: ../../reference/datamodel.rst:3346 ../../reference/datamodel.rst:3356 -#: ../../reference/datamodel.rst:3384 +#: ../../reference/datamodel.rst:2017 ../../reference/datamodel.rst:2023 +#: ../../reference/datamodel.rst:2116 ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:3104 ../../reference/datamodel.rst:3262 +#: ../../reference/datamodel.rst:3297 ../../reference/datamodel.rst:3311 +#: ../../reference/datamodel.rst:3360 ../../reference/datamodel.rst:3370 +#: ../../reference/datamodel.rst:3398 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -4557,7 +4593,7 @@ msgid "id" msgstr "id" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:126 -#: ../../reference/datamodel.rst:2661 +#: ../../reference/datamodel.rst:2673 msgid "type" msgstr "type(型別)" @@ -4681,12 +4717,12 @@ msgstr "number(數字)" msgid "Java" msgstr "Java" -#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3356 +#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3370 msgid "complex" msgstr "complex(複數)" #: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:427 -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:3104 msgid "len" msgstr "len" @@ -4719,8 +4755,8 @@ msgstr "immutable sequence(不可變序列)" msgid "immutable" msgstr "immutable(不可變)" -#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1991 -#: ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1992 +#: ../../reference/datamodel.rst:2023 msgid "string" msgstr "string(字串)" @@ -4756,7 +4792,7 @@ msgstr "singleton(單例)" msgid "empty" msgstr "empty(空的)" -#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:2016 +#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:2017 msgid "bytes" msgstr "bytes(位元組)" @@ -4779,7 +4815,7 @@ msgstr "assignment(賦值)" #: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:859 #: ../../reference/datamodel.rst:1728 ../../reference/datamodel.rst:1910 -#: ../../reference/datamodel.rst:3411 +#: ../../reference/datamodel.rst:3425 msgid "statement" msgstr "statement(陳述式)" @@ -4816,7 +4852,7 @@ msgid "mapping" msgstr "mapping(對映)" #: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:1126 -#: ../../reference/datamodel.rst:2105 +#: ../../reference/datamodel.rst:2116 msgid "dictionary" msgstr "dictionary(字典)" @@ -4839,7 +4875,7 @@ msgid "function" msgstr "function (函式)" #: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:1126 -#: ../../reference/datamodel.rst:1149 ../../reference/datamodel.rst:3042 +#: ../../reference/datamodel.rst:1149 ../../reference/datamodel.rst:3054 msgid "call" msgstr "call(呼叫)" @@ -4947,7 +4983,7 @@ msgstr "generator(產生器)" msgid "iterator" msgstr "itorator(疊代器)" -#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3598 +#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3613 msgid "coroutine" msgstr "coroutine(協程)" @@ -5013,7 +5049,7 @@ msgstr "__dict__ (模組屬性)" #: ../../reference/datamodel.rst:1126 ../../reference/datamodel.rst:1144 #: ../../reference/datamodel.rst:1265 ../../reference/datamodel.rst:1893 -#: ../../reference/datamodel.rst:2772 +#: ../../reference/datamodel.rst:2784 msgid "class" msgstr "class(類別)" @@ -5023,7 +5059,7 @@ msgid "class instance" msgstr "class instance(類別實例)" #: ../../reference/datamodel.rst:1126 ../../reference/datamodel.rst:1265 -#: ../../reference/datamodel.rst:3042 +#: ../../reference/datamodel.rst:3054 msgid "instance" msgstr "instance(實例)" @@ -5319,7 +5355,7 @@ msgstr "try" msgid "tb_next (traceback attribute)" msgstr "tb_next (traceback 屬性)" -#: ../../reference/datamodel.rst:1774 ../../reference/datamodel.rst:3120 +#: ../../reference/datamodel.rst:1774 ../../reference/datamodel.rst:3134 msgid "slice" msgstr "slice(切片)" @@ -5379,152 +5415,119 @@ msgstr "repr() (內建函式)" msgid "__repr__() (object method)" msgstr "__repr__() (物件方法)" -#: ../../reference/datamodel.rst:1991 +#: ../../reference/datamodel.rst:1992 msgid "__str__() (object method)" msgstr "__str__() (物件方法)" -#: ../../reference/datamodel.rst:1991 +#: ../../reference/datamodel.rst:1992 msgid "format() (built-in function)" msgstr "format() (內建函式)" -#: ../../reference/datamodel.rst:1991 +#: ../../reference/datamodel.rst:1992 msgid "print() (built-in function)" msgstr "print() (內建函式)" -#: ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:2023 msgid "__format__() (object method)" msgstr "__format__() (物件方法)" -#: ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:2023 msgid "conversion" msgstr "conversion" -#: ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:2023 msgid "print" msgstr "print" -#: ../../reference/datamodel.rst:2060 +#: ../../reference/datamodel.rst:2065 msgid "comparisons" msgstr "comparison(比較)" -#: ../../reference/datamodel.rst:2105 +#: ../../reference/datamodel.rst:2116 msgid "hash" msgstr "hash(雜湊)" -#: ../../reference/datamodel.rst:2186 +#: ../../reference/datamodel.rst:2197 msgid "__len__() (mapping object method)" msgstr "__len__() (對映物件方法)" -#: ../../reference/datamodel.rst:2290 +#: ../../reference/datamodel.rst:2302 msgid "__getattr__ (module attribute)" msgstr "__getattr__ (模組屬性)" -#: ../../reference/datamodel.rst:2290 +#: ../../reference/datamodel.rst:2302 msgid "__dir__ (module attribute)" msgstr "__dir__ (模組屬性)" -#: ../../reference/datamodel.rst:2290 +#: ../../reference/datamodel.rst:2302 msgid "__class__ (module attribute)" msgstr "__class__ (模組屬性)" -#: ../../reference/datamodel.rst:2661 +#: ../../reference/datamodel.rst:2673 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../reference/datamodel.rst:2661 +#: ../../reference/datamodel.rst:2673 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/datamodel.rst:2661 +#: ../../reference/datamodel.rst:2673 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/datamodel.rst:2725 +#: ../../reference/datamodel.rst:2737 msgid "metaclass hint" msgstr "metaclass hint(元類別提示)" -#: ../../reference/datamodel.rst:2748 +#: ../../reference/datamodel.rst:2760 msgid "__prepare__ (metaclass method)" msgstr "__prepare__ (元類別方法)" -#: ../../reference/datamodel.rst:2772 +#: ../../reference/datamodel.rst:2784 msgid "body" msgstr "body" -#: ../../reference/datamodel.rst:2792 +#: ../../reference/datamodel.rst:2804 msgid "__class__ (method cell)" msgstr "__class__ (方法 cell)" -#: ../../reference/datamodel.rst:2792 +#: ../../reference/datamodel.rst:2804 msgid "__classcell__ (class namespace entry)" msgstr "__classcell__ (類別命名空間項目)" -#: ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:3104 msgid "__bool__() (object method)" msgstr "__bool__() (物件方法)" -#: ../../reference/datamodel.rst:3248 ../../reference/datamodel.rst:3283 +#: ../../reference/datamodel.rst:3262 ../../reference/datamodel.rst:3297 msgid "divmod" msgstr "divmod" -#: ../../reference/datamodel.rst:3248 ../../reference/datamodel.rst:3283 -#: ../../reference/datamodel.rst:3297 +#: ../../reference/datamodel.rst:3262 ../../reference/datamodel.rst:3297 +#: ../../reference/datamodel.rst:3311 msgid "pow" msgstr "pow" -#: ../../reference/datamodel.rst:3346 +#: ../../reference/datamodel.rst:3360 msgid "abs" msgstr "abs" -#: ../../reference/datamodel.rst:3356 +#: ../../reference/datamodel.rst:3370 msgid "int" msgstr "int" -#: ../../reference/datamodel.rst:3356 +#: ../../reference/datamodel.rst:3370 msgid "float" msgstr "float" -#: ../../reference/datamodel.rst:3384 +#: ../../reference/datamodel.rst:3398 msgid "round" msgstr "round" -#: ../../reference/datamodel.rst:3411 +#: ../../reference/datamodel.rst:3425 msgid "with" msgstr "with" -#: ../../reference/datamodel.rst:3411 +#: ../../reference/datamodel.rst:3425 msgid "context manager" msgstr "context manager(情境管理器)" - -#~ msgid ":attr:`__name__`" -#~ msgstr ":attr:`__name__`" - -#~ msgid ":attr:`__doc__`" -#~ msgstr ":attr:`__doc__`" - -#~ msgid ":attr:`__file__`" -#~ msgstr ":attr:`__file__`" - -#~ msgid ":attr:`__annotations__`" -#~ msgstr ":attr:`__annotations__`" - -#~ msgid ":attr:`~definition.__name__`" -#~ msgstr ":attr:`~definition.__name__`" - -#~ msgid ":attr:`__module__`" -#~ msgstr ":attr:`__module__`" - -#~ msgid ":attr:`~object.__dict__`" -#~ msgstr ":attr:`~object.__dict__`" - -#~ msgid ":attr:`~class.__bases__`" -#~ msgstr ":attr:`~class.__bases__`" - -#~ msgid ":attr:`__type_params__`" -#~ msgstr ":attr:`__type_params__`" - -#~ msgid ":attr:`~class.__static_attributes__`" -#~ msgstr ":attr:`~class.__static_attributes__`" - -#~ msgid ":attr:`__firstlineno__`" -#~ msgstr ":attr:`__firstlineno__`" diff --git a/reference/expressions.po b/reference/expressions.po index 48e8693491..a6d34f67a1 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -786,7 +786,7 @@ msgstr "" #: ../../reference/expressions.rst:682 msgid "Asynchronous generator functions" -msgstr "" +msgstr "非同步產生器函式" #: ../../reference/expressions.rst:684 msgid "" @@ -2213,7 +2213,7 @@ msgstr "" #: ../../reference/expressions.rst:1995 msgid "Operator" -msgstr "" +msgstr "運算子" #: ../../reference/expressions.rst:1995 msgid "Description" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index 13344d6ba7..b4bf143460 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -11,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-14 00:14+0000\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: 2022-07-24 14:52+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -366,11 +365,11 @@ msgstr "" "Found an even number 8\n" "Found an odd number 9" -#: ../../tutorial/controlflow.rst:201 +#: ../../tutorial/controlflow.rst:202 msgid ":keyword:`!else` Clauses on Loops" msgstr "迴圈的 :keyword:`!else` 子句" -#: ../../tutorial/controlflow.rst:203 +#: ../../tutorial/controlflow.rst:204 msgid "" "In a :keyword:`!for` or :keyword:`!while` loop the :keyword:`!break` " "statement may be paired with an :keyword:`!else` clause. If the loop " @@ -378,20 +377,20 @@ msgid "" "clause executes." msgstr "" -#: ../../tutorial/controlflow.rst:207 +#: ../../tutorial/controlflow.rst:208 msgid "" "In a :keyword:`for` loop, the :keyword:`!else` clause is executed after the " "loop finishes its final iteration, that is, if no break occurred." msgstr "" "在 :keyword:`for` 迴圈中,:keyword:`!else` 子句會在迴圈完成最終的疊代後執行。" -#: ../../tutorial/controlflow.rst:210 +#: ../../tutorial/controlflow.rst:211 msgid "" "In a :keyword:`while` loop, it's executed after the loop's condition becomes " "false." msgstr "在 :keyword:`while` 迴圈中,它會在迴圈條件變為 false 後執行。" -#: ../../tutorial/controlflow.rst:212 +#: ../../tutorial/controlflow.rst:213 msgid "" "In either kind of loop, the :keyword:`!else` clause is **not** executed if " "the loop was terminated by a :keyword:`break`. Of course, other ways of " @@ -402,13 +401,13 @@ msgstr "" "else` 子句。當然其他提早結束迴圈的方式(例如 :keyword:`return` 或引發例外)也" "會跳過 :keyword:`else` 子句的執行。" -#: ../../tutorial/controlflow.rst:217 +#: ../../tutorial/controlflow.rst:218 msgid "" "This is exemplified in the following :keyword:`!for` loop, which searches " "for prime numbers::" msgstr "下面的 :keyword:`!for` 迴圈對此進行了舉例說明,該迴圈用以搜索質數: ::" -#: ../../tutorial/controlflow.rst:220 +#: ../../tutorial/controlflow.rst:221 msgid "" ">>> for n in range(2, 10):\n" "... for x in range(2, n):\n" @@ -429,7 +428,7 @@ msgid "" "9 equals 3 * 3" msgstr "" -#: ../../tutorial/controlflow.rst:238 +#: ../../tutorial/controlflow.rst:239 msgid "" "(Yes, this is the correct code. Look closely: the ``else`` clause belongs " "to the ``for`` loop, **not** the ``if`` statement.)" @@ -437,7 +436,7 @@ msgstr "" "(沒錯,這是正確的程式碼。請看仔細:``else`` 子句屬於 ``for`` 迴圈,**並非** " "``if`` 陳述式。)" -#: ../../tutorial/controlflow.rst:241 +#: ../../tutorial/controlflow.rst:242 msgid "" "One way to think of the else clause is to imagine it paired with the ``if`` " "inside the loop. As the loop executes, it will run a sequence like if/if/if/" @@ -446,7 +445,7 @@ msgid "" "true, the ``else`` clause outside the loop will execute." msgstr "" -#: ../../tutorial/controlflow.rst:247 +#: ../../tutorial/controlflow.rst:248 msgid "" "When used with a loop, the ``else`` clause has more in common with the " "``else`` clause of a :keyword:`try` statement than it does with that of " @@ -461,11 +460,11 @@ msgstr "" "``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見\\ :ref:`tut-" "handling`。" -#: ../../tutorial/controlflow.rst:256 +#: ../../tutorial/controlflow.rst:257 msgid ":keyword:`!pass` Statements" msgstr ":keyword:`!pass` 陳述式" -#: ../../tutorial/controlflow.rst:258 +#: ../../tutorial/controlflow.rst:259 msgid "" "The :keyword:`pass` statement does nothing. It can be used when a statement " "is required syntactically but the program requires no action. For example::" @@ -473,18 +472,18 @@ msgstr "" ":keyword:`pass` 陳述式不執行任何動作。它可用在語法上需要一個陳述式但程式不需" "要執行任何動作的時候。例如: ::" -#: ../../tutorial/controlflow.rst:261 +#: ../../tutorial/controlflow.rst:262 msgid "" ">>> while True:\n" "... pass # Busy-wait for keyboard interrupt (Ctrl+C)\n" "..." msgstr "" -#: ../../tutorial/controlflow.rst:265 +#: ../../tutorial/controlflow.rst:266 msgid "This is commonly used for creating minimal classes::" msgstr "這經常用於建立簡單的 class(類別): ::" -#: ../../tutorial/controlflow.rst:267 +#: ../../tutorial/controlflow.rst:268 msgid "" ">>> class MyEmptyClass:\n" "... pass\n" @@ -494,7 +493,7 @@ msgstr "" "... pass\n" "..." -#: ../../tutorial/controlflow.rst:271 +#: ../../tutorial/controlflow.rst:272 msgid "" "Another place :keyword:`pass` can be used is as a place-holder for a " "function or conditional body when you are working on new code, allowing you " @@ -504,18 +503,18 @@ msgstr "" ":keyword:`pass` 亦可作為一個函式或條件判斷主體的預留位置,在你撰寫新的程式碼" "時讓你保持在更抽象的思維層次。:keyword:`!pass` 會直接被忽略: ::" -#: ../../tutorial/controlflow.rst:275 +#: ../../tutorial/controlflow.rst:276 msgid "" ">>> def initlog(*args):\n" "... pass # Remember to implement this!\n" "..." msgstr "" -#: ../../tutorial/controlflow.rst:283 +#: ../../tutorial/controlflow.rst:284 msgid ":keyword:`!match` Statements" msgstr ":keyword:`!match` 陳述式" -#: ../../tutorial/controlflow.rst:285 +#: ../../tutorial/controlflow.rst:286 msgid "" "A :keyword:`match` statement takes an expression and compares its value to " "successive patterns given as one or more case blocks. This is superficially " @@ -531,14 +530,14 @@ msgstr "" "言中的模式匹配 (pattern matching) 更為相近。只有第一個匹配成功的模式會被執" "行,而它也可以將成分(序列元素或物件屬性)從值中提取到變數中。" -#: ../../tutorial/controlflow.rst:293 +#: ../../tutorial/controlflow.rst:294 msgid "" "The simplest form compares a subject value against one or more literals::" msgstr "" "最簡單的形式,是將一個主題值 (subject value) 與一個或多個字面值 (literal) 進" "行比較: ::" -#: ../../tutorial/controlflow.rst:295 +#: ../../tutorial/controlflow.rst:296 msgid "" "def http_error(status):\n" " match status:\n" @@ -562,7 +561,7 @@ msgstr "" " case _:\n" " return \"Something's wrong with the internet\"" -#: ../../tutorial/controlflow.rst:306 +#: ../../tutorial/controlflow.rst:307 msgid "" "Note the last block: the \"variable name\" ``_`` acts as a *wildcard* and " "never fails to match. If no case matches, none of the branches is executed." @@ -570,12 +569,12 @@ msgstr "" "請注意最後一段:「變數名稱」\\ ``_`` 是作為\\ *通用字元 (wildcard)*\\ 的角" "色,且永遠不會匹配失敗。如果沒有 case 匹配成功,則不會執行任何的分支。" -#: ../../tutorial/controlflow.rst:309 +#: ../../tutorial/controlflow.rst:310 msgid "" "You can combine several literals in a single pattern using ``|`` (\"or\")::" msgstr "你可以使用 ``|``\\ (「或」)來將多個字面值組合在單一模式中: ::" -#: ../../tutorial/controlflow.rst:311 +#: ../../tutorial/controlflow.rst:312 msgid "" "case 401 | 403 | 404:\n" " return \"Not allowed\"" @@ -583,14 +582,14 @@ msgstr "" "case 401 | 403 | 404:\n" " return \"Not allowed\"" -#: ../../tutorial/controlflow.rst:314 +#: ../../tutorial/controlflow.rst:315 msgid "" "Patterns can look like unpacking assignments, and can be used to bind " "variables::" msgstr "" "模式可以看起來像是拆解賦值 (unpacking assignment),且可以用來連結變數: ::" -#: ../../tutorial/controlflow.rst:317 +#: ../../tutorial/controlflow.rst:318 msgid "" "# point is an (x, y) tuple\n" "match point:\n" @@ -606,7 +605,7 @@ msgid "" " raise ValueError(\"Not a point\")" msgstr "" -#: ../../tutorial/controlflow.rst:330 +#: ../../tutorial/controlflow.rst:331 msgid "" "Study that one carefully! The first pattern has two literals, and can be " "thought of as an extension of the literal pattern shown above. But the next " @@ -620,7 +619,7 @@ msgstr "" "(bind)* 了來自主題 (``point``) 的一個值。第四個模式會擷取兩個值,這使得它在概" "念上類似於拆解賦值 ``(x, y) = point``。" -#: ../../tutorial/controlflow.rst:337 +#: ../../tutorial/controlflow.rst:338 msgid "" "If you are using classes to structure your data you can use the class name " "followed by an argument list resembling a constructor, but with the ability " @@ -629,7 +628,7 @@ msgstr "" "如果你要用 class 來結構化你的資料,你可以使用該 class 的名稱加上一個引數列" "表,類似一個建構式 (constructor),但它能夠將屬性擷取到變數中: ::" -#: ../../tutorial/controlflow.rst:341 +#: ../../tutorial/controlflow.rst:342 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -667,7 +666,7 @@ msgstr "" " case _:\n" " print(\"Not a point\")" -#: ../../tutorial/controlflow.rst:359 +#: ../../tutorial/controlflow.rst:360 msgid "" "You can use positional parameters with some builtin classes that provide an " "ordering for their attributes (e.g. dataclasses). You can also define a " @@ -681,7 +680,7 @@ msgstr "" "``__match_args__``,來定義模式中屬性們的特定位置。如果它被設定為 (\"x\", " "\"y\"),則以下的模式都是等價的(且都會將屬性 ``y`` 連結到變數 ``var``): ::" -#: ../../tutorial/controlflow.rst:365 +#: ../../tutorial/controlflow.rst:366 msgid "" "Point(1, var)\n" "Point(1, y=var)\n" @@ -693,7 +692,7 @@ msgstr "" "Point(x=1, y=var)\n" "Point(y=var, x=1)" -#: ../../tutorial/controlflow.rst:370 +#: ../../tutorial/controlflow.rst:371 msgid "" "A recommended way to read patterns is to look at them as an extended form of " "what you would put on the left of an assignment, to understand which " @@ -709,7 +708,7 @@ msgstr "" "的 ``x=`` 及 ``y=``)或 class 名稱(由它們後面的 \"(...)\" 被辨識,如上面的 " "``Point``)則永遠無法被賦值。" -#: ../../tutorial/controlflow.rst:377 +#: ../../tutorial/controlflow.rst:378 msgid "" "Patterns can be arbitrarily nested. For example, if we have a short list of " "Points, with ``__match_args__`` added, we could match it like this::" @@ -717,7 +716,7 @@ msgstr "" "模式可以任意地被巢套 (nested)。例如,如果我們有一個由某些點所組成的簡短 " "list,我們就可以像這樣加入 ``__match_args__`` 來對它進行匹配: ::" -#: ../../tutorial/controlflow.rst:380 +#: ../../tutorial/controlflow.rst:381 msgid "" "class Point:\n" " __match_args__ = ('x', 'y')\n" @@ -755,7 +754,7 @@ msgstr "" " case _:\n" " print(\"Something else\")" -#: ../../tutorial/controlflow.rst:398 +#: ../../tutorial/controlflow.rst:399 msgid "" "We can add an ``if`` clause to a pattern, known as a \"guard\". If the " "guard is false, ``match`` goes on to try the next case block. Note that " @@ -765,7 +764,7 @@ msgstr "" "則 ``match`` 會繼續嘗試下一個 case 區塊。請注意,值的擷取會發生在防護的評估之" "前: ::" -#: ../../tutorial/controlflow.rst:402 +#: ../../tutorial/controlflow.rst:403 msgid "" "match point:\n" " case Point(x, y) if x == y:\n" @@ -779,11 +778,11 @@ msgstr "" " case Point(x, y):\n" " print(f\"Not on the diagonal\")" -#: ../../tutorial/controlflow.rst:408 +#: ../../tutorial/controlflow.rst:409 msgid "Several other key features of this statement:" msgstr "此種陳述式的其他幾個重要特色:" -#: ../../tutorial/controlflow.rst:410 +#: ../../tutorial/controlflow.rst:411 msgid "" "Like unpacking assignments, tuple and list patterns have exactly the same " "meaning and actually match arbitrary sequences. An important exception is " @@ -792,7 +791,7 @@ msgstr "" "與拆解賦值的情況類似,tuple(元組)和 list 模式具有完全相同的意義,而且實際上" "可以匹配任意的序列。一個重要的例外,是它們不能匹配疊代器 (iterator) 或字串。" -#: ../../tutorial/controlflow.rst:414 +#: ../../tutorial/controlflow.rst:415 msgid "" "Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y, " "*rest)`` work similar to unpacking assignments. The name after ``*`` may " @@ -804,7 +803,7 @@ msgstr "" "``_``,所以 ``(x, y, *_)`` 會匹配一個至少兩項的序列,且不會連結那兩項以外的其" "餘項。" -#: ../../tutorial/controlflow.rst:419 +#: ../../tutorial/controlflow.rst:420 msgid "" "Mapping patterns: ``{\"bandwidth\": b, \"latency\": l}`` captures the " "``\"bandwidth\"`` and ``\"latency\"`` values from a dictionary. Unlike " @@ -816,15 +815,15 @@ msgstr "" "式不同,額外的鍵 (key) 會被忽略。一種像是 ``**rest`` 的拆解方式,也是可被支援" "的。(但 ``**_`` 則是多餘的做法,所以它並不被允許。)" -#: ../../tutorial/controlflow.rst:424 +#: ../../tutorial/controlflow.rst:425 msgid "Subpatterns may be captured using the ``as`` keyword::" msgstr "使用關鍵字 ``as`` 可以擷取子模式 (subpattern): ::" -#: ../../tutorial/controlflow.rst:426 +#: ../../tutorial/controlflow.rst:427 msgid "case (Point(x1, y1), Point(x2, y2) as p2): ..." msgstr "case (Point(x1, y1), Point(x2, y2) as p2): ..." -#: ../../tutorial/controlflow.rst:428 +#: ../../tutorial/controlflow.rst:429 msgid "" "will capture the second element of the input as ``p2`` (as long as the input " "is a sequence of two points)" @@ -832,7 +831,7 @@ msgstr "" "將會擷取輸入的第二個元素作為 ``p2``\\ (只要該輸入是一個由兩個點所組成的序" "列)。" -#: ../../tutorial/controlflow.rst:431 +#: ../../tutorial/controlflow.rst:432 msgid "" "Most literals are compared by equality, however the singletons ``True``, " "``False`` and ``None`` are compared by identity." @@ -840,7 +839,7 @@ msgstr "" "大部分的字面值是藉由相等性 (equality) 來比較,但是單例物件 (singleton) " "``True``、``False`` 和 ``None`` 是藉由標識值 (identity) 來比較。" -#: ../../tutorial/controlflow.rst:434 +#: ../../tutorial/controlflow.rst:435 msgid "" "Patterns may use named constants. These must be dotted names to prevent " "them from being interpreted as capture variable::" @@ -848,7 +847,7 @@ msgstr "" "模式可以使用附名常數 (named constant)。這些模式必須是點分隔名稱,以免它們被解" "釋為擷取變數: ::" -#: ../../tutorial/controlflow.rst:437 +#: ../../tutorial/controlflow.rst:438 msgid "" "from enum import Enum\n" "class Color(Enum):\n" @@ -882,24 +881,24 @@ msgstr "" " case Color.BLUE:\n" " print(\"I'm feeling the blues :(\")" -#: ../../tutorial/controlflow.rst:453 +#: ../../tutorial/controlflow.rst:454 msgid "" "For a more detailed explanation and additional examples, you can look into :" "pep:`636` which is written in a tutorial format." msgstr "" "關於更詳細的解釋和其他範例,你可以閱讀 :pep:`636`,它是以教學的格式編寫而成。" -#: ../../tutorial/controlflow.rst:459 +#: ../../tutorial/controlflow.rst:460 msgid "Defining Functions" msgstr "定義函式 (function)" -#: ../../tutorial/controlflow.rst:461 +#: ../../tutorial/controlflow.rst:462 msgid "" "We can create a function that writes the Fibonacci series to an arbitrary " "boundary::" msgstr "我們可以建立一個函式來產生費式數列到任何一個上界: ::" -#: ../../tutorial/controlflow.rst:464 +#: ../../tutorial/controlflow.rst:465 msgid "" ">>> def fib(n): # write Fibonacci series less than n\n" "... \"\"\"Print a Fibonacci series less than n.\"\"\"\n" @@ -914,7 +913,7 @@ msgid "" "0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597" msgstr "" -#: ../../tutorial/controlflow.rst:481 +#: ../../tutorial/controlflow.rst:482 msgid "" "The keyword :keyword:`def` introduces a function *definition*. It must be " "followed by the function name and the parenthesized list of formal " @@ -924,7 +923,7 @@ msgstr "" "關鍵字 :keyword:`def` 介紹一個函式的\\ *定義*。它之後必須連著該函式的名稱和置" "於括號之中的一串參數。自下一行起,所有縮排的陳述式成為該函式的主體。" -#: ../../tutorial/controlflow.rst:486 +#: ../../tutorial/controlflow.rst:487 msgid "" "The first statement of the function body can optionally be a string literal; " "this string literal is the function's documentation string, or :dfn:" @@ -940,7 +939,7 @@ msgstr "" "件,或讓使用者能以互動的方式在原始碼中瀏覽文件。在原始碼中加入 docstring 是個" "好慣例,應該養成這樣的習慣。" -#: ../../tutorial/controlflow.rst:493 +#: ../../tutorial/controlflow.rst:494 msgid "" "The *execution* of a function introduces a new symbol table used for the " "local variables of the function. More precisely, all variable assignments " @@ -961,7 +960,7 @@ msgstr "" "域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:" "`nonlocal` 陳述式中被定義)。" -#: ../../tutorial/controlflow.rst:504 +#: ../../tutorial/controlflow.rst:505 msgid "" "The actual parameters (arguments) to a function call are introduced in the " "local symbol table of the called function when it is called; thus, arguments " @@ -975,7 +974,7 @@ msgstr "" "永遠是一個物件的\\ *參照 (reference)*,而不是該物件的值)。 [#]_ 當一個函式呼" "叫別的函式或遞迴呼叫它自己時,在被呼叫的函式中會建立一個新的區域符號表。" -#: ../../tutorial/controlflow.rst:511 +#: ../../tutorial/controlflow.rst:512 msgid "" "A function definition associates the function name with the function object " "in the current symbol table. The interpreter recognizes the object pointed " @@ -986,7 +985,7 @@ msgstr "" "直譯器辨識為使用者自定函式 (user-defined function)。該值可以被指定給別的變數" "名,使該變數名也可以被當作函式使用。這是常見的重新命名方式: ::" -#: ../../tutorial/controlflow.rst:516 +#: ../../tutorial/controlflow.rst:517 msgid "" ">>> fib\n" "\n" @@ -1000,7 +999,7 @@ msgstr "" ">>> f(100)\n" "0 1 1 2 3 5 8 13 21 34 55 89" -#: ../../tutorial/controlflow.rst:522 +#: ../../tutorial/controlflow.rst:523 msgid "" "Coming from other languages, you might object that ``fib`` is not a function " "but a procedure since it doesn't return a value. In fact, even functions " @@ -1015,7 +1014,7 @@ msgstr "" "亦有一個固定的回傳值。這個值稱為 ``None``\\ (它是一個內建名稱)。在直譯器中" "單獨使用 ``None`` 時,通常不會被顯示。你可以使用 :func:`print` 來看到它: ::" -#: ../../tutorial/controlflow.rst:529 +#: ../../tutorial/controlflow.rst:530 msgid "" ">>> fib(0)\n" ">>> print(fib(0))\n" @@ -1025,13 +1024,13 @@ msgstr "" ">>> print(fib(0))\n" "None" -#: ../../tutorial/controlflow.rst:533 +#: ../../tutorial/controlflow.rst:534 msgid "" "It is simple to write a function that returns a list of the numbers of the " "Fibonacci series, instead of printing it::" msgstr "如果要寫一個函式回傳費式數列的 list 而不是直接印出它,這也很容易: ::" -#: ../../tutorial/controlflow.rst:536 +#: ../../tutorial/controlflow.rst:537 msgid "" ">>> def fib2(n): # return Fibonacci series up to n\n" "... \"\"\"Return a list containing the Fibonacci series up to n.\"\"\"\n" @@ -1047,11 +1046,11 @@ msgid "" "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]" msgstr "" -#: ../../tutorial/controlflow.rst:549 +#: ../../tutorial/controlflow.rst:550 msgid "This example, as usual, demonstrates some new Python features:" msgstr "這個例子一樣示範了一些新的 Python 特性:" -#: ../../tutorial/controlflow.rst:551 +#: ../../tutorial/controlflow.rst:552 msgid "" "The :keyword:`return` statement returns with a value from a function. :" "keyword:`!return` without an expression argument returns ``None``. Falling " @@ -1061,7 +1060,7 @@ msgstr "" "不外加一個運算式作為引數時會回傳 ``None``。一個函式執行到結束也會回傳 " "``None``。" -#: ../../tutorial/controlflow.rst:555 +#: ../../tutorial/controlflow.rst:556 msgid "" "The statement ``result.append(a)`` calls a *method* of the list object " "``result``. A method is a function that 'belongs' to an object and is named " @@ -1084,22 +1083,22 @@ msgstr "" "義在 list 物件中;它會在該 list 的末端加入一個新的元素。這個例子等同於 " "``result = result + [a]``,但更有效率。" -#: ../../tutorial/controlflow.rst:570 +#: ../../tutorial/controlflow.rst:571 msgid "More on Defining Functions" msgstr "深入了解函式定義" -#: ../../tutorial/controlflow.rst:572 +#: ../../tutorial/controlflow.rst:573 msgid "" "It is also possible to define functions with a variable number of arguments. " "There are three forms, which can be combined." msgstr "" "定義函式時使用的引數 (argument) 數量是可變的。總共有三種可以組合使用的形式。" -#: ../../tutorial/controlflow.rst:579 +#: ../../tutorial/controlflow.rst:580 msgid "Default Argument Values" msgstr "預設引數值" -#: ../../tutorial/controlflow.rst:581 +#: ../../tutorial/controlflow.rst:582 msgid "" "The most useful form is to specify a default value for one or more " "arguments. This creates a function that can be called with fewer arguments " @@ -1108,7 +1107,7 @@ msgstr "" "為一個或多個引數指定預設值是很有用的方式。函式建立後,可以用比定義時更少的引" "數呼叫該函式。例如: ::" -#: ../../tutorial/controlflow.rst:585 +#: ../../tutorial/controlflow.rst:586 msgid "" "def ask_ok(prompt, retries=4, reminder='Please try again!'):\n" " while True:\n" @@ -1134,22 +1133,22 @@ msgstr "" " raise ValueError('invalid user response')\n" " print(reminder)" -#: ../../tutorial/controlflow.rst:597 +#: ../../tutorial/controlflow.rst:598 msgid "This function can be called in several ways:" msgstr "該函式可以用以下幾種方式被呼叫:" -#: ../../tutorial/controlflow.rst:599 +#: ../../tutorial/controlflow.rst:600 msgid "" "giving only the mandatory argument: ``ask_ok('Do you really want to quit?')``" msgstr "只給必要引數:``ask_ok('Do you really want to quit?')``" -#: ../../tutorial/controlflow.rst:601 +#: ../../tutorial/controlflow.rst:602 msgid "" "giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', " "2)``" msgstr "給予一個選擇性引數:``ask_ok('OK to overwrite the file?', 2)``" -#: ../../tutorial/controlflow.rst:603 +#: ../../tutorial/controlflow.rst:604 msgid "" "or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come " "on, only yes or no!')``" @@ -1157,19 +1156,19 @@ msgstr "" "給予所有引數:``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or " "no!')``" -#: ../../tutorial/controlflow.rst:606 +#: ../../tutorial/controlflow.rst:607 msgid "" "This example also introduces the :keyword:`in` keyword. This tests whether " "or not a sequence contains a certain value." msgstr "此例也使用了關鍵字 :keyword:`in`,用於測試序列中是否包含某個特定值。" -#: ../../tutorial/controlflow.rst:609 +#: ../../tutorial/controlflow.rst:610 msgid "" "The default values are evaluated at the point of function definition in the " "*defining* scope, so that ::" msgstr "預設值是在函式定義當下,於\\ *定義時*\\ 的作用域中求值,所以: ::" -#: ../../tutorial/controlflow.rst:612 +#: ../../tutorial/controlflow.rst:613 msgid "" "i = 5\n" "\n" @@ -1187,11 +1186,11 @@ msgstr "" "i = 6\n" "f()" -#: ../../tutorial/controlflow.rst:620 +#: ../../tutorial/controlflow.rst:621 msgid "will print ``5``." msgstr "將會輸出 ``5``。" -#: ../../tutorial/controlflow.rst:622 +#: ../../tutorial/controlflow.rst:623 msgid "" "**Important warning:** The default value is evaluated only once. This makes " "a difference when the default is a mutable object such as a list, " @@ -1202,7 +1201,7 @@ msgstr "" "(字典)或許多類別實例時,會產生不同的結果。例如,以下函式於後續呼叫時會累積" "曾經傳遞的引數: ::" -#: ../../tutorial/controlflow.rst:627 +#: ../../tutorial/controlflow.rst:628 msgid "" "def f(a, L=[]):\n" " L.append(a)\n" @@ -1220,11 +1219,11 @@ msgstr "" "print(f(2))\n" "print(f(3))" -#: ../../tutorial/controlflow.rst:635 +#: ../../tutorial/controlflow.rst:636 msgid "This will print ::" msgstr "將會輸出: ::" -#: ../../tutorial/controlflow.rst:637 +#: ../../tutorial/controlflow.rst:638 msgid "" "[1]\n" "[1, 2]\n" @@ -1234,13 +1233,13 @@ msgstr "" "[1, 2]\n" "[1, 2, 3]" -#: ../../tutorial/controlflow.rst:641 +#: ../../tutorial/controlflow.rst:642 msgid "" "If you don't want the default to be shared between subsequent calls, you can " "write the function like this instead::" msgstr "如果不想在後續呼叫之間共用預設值,應以如下方式編寫函式:" -#: ../../tutorial/controlflow.rst:644 +#: ../../tutorial/controlflow.rst:645 msgid "" "def f(a, L=None):\n" " if L is None:\n" @@ -1254,11 +1253,11 @@ msgstr "" " L.append(a)\n" " return L" -#: ../../tutorial/controlflow.rst:654 +#: ../../tutorial/controlflow.rst:655 msgid "Keyword Arguments" msgstr "關鍵字引數" -#: ../../tutorial/controlflow.rst:656 +#: ../../tutorial/controlflow.rst:657 msgid "" "Functions can also be called using :term:`keyword arguments ` of the form ``kwarg=value``. For instance, the following " @@ -1267,7 +1266,7 @@ msgstr "" "函式也可以使用\\ :term:`關鍵字引數 `,以 ``kwarg=value`` 的" "形式呼叫。舉例來說,以下函式: ::" -#: ../../tutorial/controlflow.rst:659 +#: ../../tutorial/controlflow.rst:660 msgid "" "def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):\n" " print(\"-- This parrot wouldn't\", action, end=' ')\n" @@ -1281,7 +1280,7 @@ msgstr "" " print(\"-- Lovely plumage, the\", type)\n" " print(\"-- It's\", state, \"!\")" -#: ../../tutorial/controlflow.rst:665 +#: ../../tutorial/controlflow.rst:666 msgid "" "accepts one required argument (``voltage``) and three optional arguments " "(``state``, ``action``, and ``type``). This function can be called in any " @@ -1290,7 +1289,7 @@ msgstr "" "接受一個必要引數 (``voltage``) 和三個選擇性引數 (``state``,``action``,和 " "``type``)。該函式可用下列任一方式呼叫: ::" -#: ../../tutorial/controlflow.rst:669 +#: ../../tutorial/controlflow.rst:670 msgid "" "parrot(1000) # 1 positional " "argument\n" @@ -1303,11 +1302,11 @@ msgid "" "keyword" msgstr "" -#: ../../tutorial/controlflow.rst:676 +#: ../../tutorial/controlflow.rst:677 msgid "but all the following calls would be invalid::" msgstr "但以下呼叫方式都無效: ::" -#: ../../tutorial/controlflow.rst:678 +#: ../../tutorial/controlflow.rst:679 msgid "" "parrot() # required argument missing\n" "parrot(voltage=5.0, 'dead') # non-keyword argument after a keyword " @@ -1316,7 +1315,7 @@ msgid "" "parrot(actor='John Cleese') # unknown keyword argument" msgstr "" -#: ../../tutorial/controlflow.rst:683 +#: ../../tutorial/controlflow.rst:684 msgid "" "In a function call, keyword arguments must follow positional arguments. All " "the keyword arguments passed must match one of the arguments accepted by the " @@ -1332,7 +1331,7 @@ msgstr "" "則也包括必要引數,(\\ ``parrot(voltage=1000)`` 也有效)。一個引數不可多次被" "賦值,下面就是一個因此限制而無效的例子: ::" -#: ../../tutorial/controlflow.rst:691 +#: ../../tutorial/controlflow.rst:692 msgid "" ">>> def function(a):\n" "... pass\n" @@ -1350,7 +1349,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: function() got multiple values for argument 'a'" -#: ../../tutorial/controlflow.rst:699 +#: ../../tutorial/controlflow.rst:700 msgid "" "When a final formal parameter of the form ``**name`` is present, it receives " "a dictionary (see :ref:`typesmapping`) containing all keyword arguments " @@ -1366,7 +1365,7 @@ msgstr "" "個 :ref:`tuple `,該 tuple 包含一般參數以外的位置引數(\\ " "``*name`` 必須出現在 ``**name`` 前面)。例如,若我們定義這樣的函式: ::" -#: ../../tutorial/controlflow.rst:707 +#: ../../tutorial/controlflow.rst:708 msgid "" "def cheeseshop(kind, *arguments, **keywords):\n" " print(\"-- Do you have any\", kind, \"?\")\n" @@ -1386,11 +1385,11 @@ msgstr "" " for kw in keywords:\n" " print(kw, \":\", keywords[kw])" -#: ../../tutorial/controlflow.rst:716 +#: ../../tutorial/controlflow.rst:717 msgid "It could be called like this::" msgstr "它可以被如此呼叫: ::" -#: ../../tutorial/controlflow.rst:718 +#: ../../tutorial/controlflow.rst:719 msgid "" "cheeseshop(\"Limburger\", \"It's very runny, sir.\",\n" " \"It's really very, VERY runny, sir.\",\n" @@ -1404,11 +1403,11 @@ msgstr "" " client=\"John Cleese\",\n" " sketch=\"Cheese Shop Sketch\")" -#: ../../tutorial/controlflow.rst:724 +#: ../../tutorial/controlflow.rst:725 msgid "and of course it would print:" msgstr "輸出結果如下: ::" -#: ../../tutorial/controlflow.rst:726 +#: ../../tutorial/controlflow.rst:727 msgid "" "-- Do you have any Limburger ?\n" "-- I'm sorry, we're all out of Limburger\n" @@ -1428,17 +1427,17 @@ msgstr "" "client : John Cleese\n" "sketch : Cheese Shop Sketch" -#: ../../tutorial/controlflow.rst:737 +#: ../../tutorial/controlflow.rst:738 msgid "" "Note that the order in which the keyword arguments are printed is guaranteed " "to match the order in which they were provided in the function call." msgstr "注意,關鍵字引數的輸出順序與呼叫函式時被提供的順序必定一致。" -#: ../../tutorial/controlflow.rst:741 +#: ../../tutorial/controlflow.rst:742 msgid "Special parameters" msgstr "特殊參數" -#: ../../tutorial/controlflow.rst:743 +#: ../../tutorial/controlflow.rst:744 msgid "" "By default, arguments may be passed to a Python function either by position " "or explicitly by keyword. For readability and performance, it makes sense to " @@ -1450,11 +1449,11 @@ msgstr "" "及效能,限制引數的傳遞方式是合理的,如此,開發者只需查看函式定義,即可確定各" "項目是按位置,按位置或關鍵字,還是按關鍵字傳遞。" -#: ../../tutorial/controlflow.rst:749 +#: ../../tutorial/controlflow.rst:750 msgid "A function definition may look like:" msgstr "函式定義可能如以下樣式:" -#: ../../tutorial/controlflow.rst:751 +#: ../../tutorial/controlflow.rst:752 msgid "" "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):\n" " ----------- ---------- ----------\n" @@ -1470,7 +1469,7 @@ msgstr "" " | - Keyword only\n" " -- Positional only" -#: ../../tutorial/controlflow.rst:760 +#: ../../tutorial/controlflow.rst:761 msgid "" "where ``/`` and ``*`` are optional. If used, these symbols indicate the kind " "of parameter by how the arguments may be passed to the function: positional-" @@ -1481,22 +1480,22 @@ msgstr "" "類:僅限位置、位置或關鍵字、僅限關鍵字。關鍵字參數也稱為附名參數 (named " "parameters)。" -#: ../../tutorial/controlflow.rst:767 +#: ../../tutorial/controlflow.rst:768 msgid "Positional-or-Keyword Arguments" msgstr "位置或關鍵字引數 (Positional-or-Keyword Arguments)" -#: ../../tutorial/controlflow.rst:769 +#: ../../tutorial/controlflow.rst:770 msgid "" "If ``/`` and ``*`` are not present in the function definition, arguments may " "be passed to a function by position or by keyword." msgstr "" "若函式定義中未使用 ``/`` 和 ``*`` 時,引數可以按位置或關鍵字傳遞給函式。" -#: ../../tutorial/controlflow.rst:774 +#: ../../tutorial/controlflow.rst:775 msgid "Positional-Only Parameters" msgstr "僅限位置參數 (Positional-Only Parameters)" -#: ../../tutorial/controlflow.rst:776 +#: ../../tutorial/controlflow.rst:777 msgid "" "Looking at this in a bit more detail, it is possible to mark certain " "parameters as *positional-only*. If *positional-only*, the parameters' order " @@ -1511,17 +1510,17 @@ msgstr "" "``\\ (斜線)之前。``/`` 用於在邏輯上分開僅限位置參數與其餘參數。如果函式定義" "中沒有 ``/``,則表示沒有任何僅限位置參數。" -#: ../../tutorial/controlflow.rst:784 +#: ../../tutorial/controlflow.rst:785 msgid "" "Parameters following the ``/`` may be *positional-or-keyword* or *keyword-" "only*." msgstr "``/`` 後面的參數可以是\\ *位置或關鍵字*\\ 或\\ *僅限關鍵字*\\ 參數。" -#: ../../tutorial/controlflow.rst:788 +#: ../../tutorial/controlflow.rst:789 msgid "Keyword-Only Arguments" msgstr "僅限關鍵字引數 (Keyword-Only Arguments)" -#: ../../tutorial/controlflow.rst:790 +#: ../../tutorial/controlflow.rst:791 msgid "" "To mark parameters as *keyword-only*, indicating the parameters must be " "passed by keyword argument, place an ``*`` in the arguments list just before " @@ -1530,17 +1529,17 @@ msgstr "" "要把參數標記為\\ *僅限關鍵字*,表明參數必須以關鍵字引數傳遞,必須在引數列表中" "第一個\\ *僅限關鍵字*\\ 參數前放上 ``*``。" -#: ../../tutorial/controlflow.rst:796 +#: ../../tutorial/controlflow.rst:797 msgid "Function Examples" msgstr "函式範例" -#: ../../tutorial/controlflow.rst:798 +#: ../../tutorial/controlflow.rst:799 msgid "" "Consider the following example function definitions paying close attention " "to the markers ``/`` and ``*``::" msgstr "請看以下的函式定義範例,注意 ``/`` 和 ``*`` 記號: ::" -#: ../../tutorial/controlflow.rst:801 +#: ../../tutorial/controlflow.rst:802 msgid "" ">>> def standard_arg(arg):\n" "... print(arg)\n" @@ -1566,7 +1565,7 @@ msgstr "" ">>> def combined_example(pos_only, /, standard, *, kwd_only):\n" "... print(pos_only, standard, kwd_only)" -#: ../../tutorial/controlflow.rst:814 +#: ../../tutorial/controlflow.rst:815 msgid "" "The first function definition, ``standard_arg``, the most familiar form, " "places no restrictions on the calling convention and arguments may be passed " @@ -1575,7 +1574,7 @@ msgstr "" "第一個函式定義 ``standard_arg`` 是我們最熟悉的形式,對呼叫方式沒有任何限制," "可以按位置或關鍵字傳遞引數: ::" -#: ../../tutorial/controlflow.rst:818 +#: ../../tutorial/controlflow.rst:819 msgid "" ">>> standard_arg(2)\n" "2\n" @@ -1589,14 +1588,14 @@ msgstr "" ">>> standard_arg(arg=2)\n" "2" -#: ../../tutorial/controlflow.rst:824 +#: ../../tutorial/controlflow.rst:825 msgid "" "The second function ``pos_only_arg`` is restricted to only use positional " "parameters as there is a ``/`` in the function definition::" msgstr "" "第二個函式 ``pos_only_arg`` 的函式定義中有 ``/``,因此僅限使用位置參數: ::" -#: ../../tutorial/controlflow.rst:827 +#: ../../tutorial/controlflow.rst:828 msgid "" ">>> pos_only_arg(1)\n" "1\n" @@ -1616,14 +1615,14 @@ msgstr "" "TypeError: pos_only_arg() got some positional-only arguments passed as " "keyword arguments: 'arg'" -#: ../../tutorial/controlflow.rst:835 +#: ../../tutorial/controlflow.rst:836 msgid "" "The third function ``kwd_only_arg`` only allows keyword arguments as " "indicated by a ``*`` in the function definition::" msgstr "" "第三個函式 ``kwd_only_arg`` 的函式定義透過 ``*`` 表明僅限關鍵字引數: ::" -#: ../../tutorial/controlflow.rst:838 +#: ../../tutorial/controlflow.rst:839 msgid "" ">>> kwd_only_arg(3)\n" "Traceback (most recent call last):\n" @@ -1641,13 +1640,13 @@ msgstr "" ">>> kwd_only_arg(arg=3)\n" "3" -#: ../../tutorial/controlflow.rst:846 +#: ../../tutorial/controlflow.rst:847 msgid "" "And the last uses all three calling conventions in the same function " "definition::" msgstr "最後一個函式在同一個函式定義中,使用了全部三種呼叫方式: ::" -#: ../../tutorial/controlflow.rst:849 +#: ../../tutorial/controlflow.rst:850 msgid "" ">>> combined_example(1, 2, 3)\n" "Traceback (most recent call last):\n" @@ -1683,7 +1682,7 @@ msgstr "" "TypeError: combined_example() got some positional-only arguments passed as " "keyword arguments: 'pos_only'" -#: ../../tutorial/controlflow.rst:866 +#: ../../tutorial/controlflow.rst:867 msgid "" "Finally, consider this function definition which has a potential collision " "between the positional argument ``name`` and ``**kwds`` which has ``name`` " @@ -1692,7 +1691,7 @@ msgstr "" "最後,請看這個函式定義,如果 ``**kwds`` 內有 ``name`` 這個鍵,可能與位置引數 " "``name`` 產生潛在衝突: ::" -#: ../../tutorial/controlflow.rst:868 +#: ../../tutorial/controlflow.rst:869 msgid "" "def foo(name, **kwds):\n" " return 'name' in kwds" @@ -1700,7 +1699,7 @@ msgstr "" "def foo(name, **kwds):\n" " return 'name' in kwds" -#: ../../tutorial/controlflow.rst:871 +#: ../../tutorial/controlflow.rst:872 msgid "" "There is no possible call that will make it return ``True`` as the keyword " "``'name'`` will always bind to the first parameter. For example::" @@ -1708,7 +1707,7 @@ msgstr "" "呼叫該函式不可能回傳 ``True``,因為關鍵字 ``'name'`` 永遠是連結在第一個參數。" "例如: ::" -#: ../../tutorial/controlflow.rst:874 +#: ../../tutorial/controlflow.rst:875 msgid "" ">>> foo(1, **{'name': 2})\n" "Traceback (most recent call last):\n" @@ -1722,7 +1721,7 @@ msgstr "" "TypeError: foo() got multiple values for argument 'name'\n" ">>>" -#: ../../tutorial/controlflow.rst:880 +#: ../../tutorial/controlflow.rst:881 msgid "" "But using ``/`` (positional only arguments), it is possible since it allows " "``name`` as a positional argument and ``'name'`` as a key in the keyword " @@ -1731,7 +1730,7 @@ msgstr "" "使用 ``/``\\ (僅限位置引數)後,就可以了。函式定義會允許 ``name`` 當作位置引" "數,而 ``'name'`` 也可以當作關鍵字引數中的鍵: ::" -#: ../../tutorial/controlflow.rst:882 +#: ../../tutorial/controlflow.rst:883 msgid "" ">>> def foo(name, /, **kwds):\n" "... return 'name' in kwds\n" @@ -1745,31 +1744,31 @@ msgstr "" ">>> foo(1, **{'name': 2})\n" "True" -#: ../../tutorial/controlflow.rst:888 +#: ../../tutorial/controlflow.rst:889 msgid "" "In other words, the names of positional-only parameters can be used in " "``**kwds`` without ambiguity." msgstr "換句話說,僅限位置參數的名稱可以在 ``**kwds`` 中使用,而不產生歧義。" -#: ../../tutorial/controlflow.rst:893 +#: ../../tutorial/controlflow.rst:894 msgid "Recap" msgstr "回顧" -#: ../../tutorial/controlflow.rst:895 +#: ../../tutorial/controlflow.rst:896 msgid "" "The use case will determine which parameters to use in the function " "definition::" msgstr "此用例決定哪些參數可以用於函式定義: ::" -#: ../../tutorial/controlflow.rst:897 +#: ../../tutorial/controlflow.rst:898 msgid "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" msgstr "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" -#: ../../tutorial/controlflow.rst:899 +#: ../../tutorial/controlflow.rst:900 msgid "As guidance:" msgstr "說明:" -#: ../../tutorial/controlflow.rst:901 +#: ../../tutorial/controlflow.rst:902 msgid "" "Use positional-only if you want the name of the parameters to not be " "available to the user. This is useful when parameter names have no real " @@ -1781,7 +1780,7 @@ msgstr "" "想控制引數在函式呼叫的排列順序,或同時使用位置參數和任意關鍵字時,這種方式很" "有用。" -#: ../../tutorial/controlflow.rst:906 +#: ../../tutorial/controlflow.rst:907 msgid "" "Use keyword-only when names have meaning and the function definition is more " "understandable by being explicit with names or you want to prevent users " @@ -1790,7 +1789,7 @@ msgstr "" "當參數名稱有意義,且明確的名稱可讓函式定義更易理解,或是你不希望使用者依賴引" "數被傳遞時的位置時,請使用僅限關鍵字。" -#: ../../tutorial/controlflow.rst:909 +#: ../../tutorial/controlflow.rst:910 msgid "" "For an API, use positional-only to prevent breaking API changes if the " "parameter's name is modified in the future." @@ -1798,11 +1797,11 @@ msgstr "" "對於應用程式介面 (API),使用僅限位置,以防止未來參數名稱被修改時造成 API 的中" "斷性變更。" -#: ../../tutorial/controlflow.rst:915 +#: ../../tutorial/controlflow.rst:916 msgid "Arbitrary Argument Lists" msgstr "任意引數列表 (Arbitrary Argument Lists)" -#: ../../tutorial/controlflow.rst:920 +#: ../../tutorial/controlflow.rst:921 msgid "" "Finally, the least frequently used option is to specify that a function can " "be called with an arbitrary number of arguments. These arguments will be " @@ -1813,7 +1812,7 @@ msgstr "" "數會被包裝進一個 tuple 中(詳見 :ref:`tut-tuples`\\ )。在可變數量的引數之" "前,可能有零個或多個普通引數: ::" -#: ../../tutorial/controlflow.rst:925 +#: ../../tutorial/controlflow.rst:926 msgid "" "def write_multiple_items(file, separator, *args):\n" " file.write(separator.join(args))" @@ -1821,7 +1820,7 @@ msgstr "" "def write_multiple_items(file, separator, *args):\n" " file.write(separator.join(args))" -#: ../../tutorial/controlflow.rst:929 +#: ../../tutorial/controlflow.rst:930 msgid "" "Normally, these *variadic* arguments will be last in the list of formal " "parameters, because they scoop up all remaining input arguments that are " @@ -1835,7 +1834,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:935 +#: ../../tutorial/controlflow.rst:936 msgid "" ">>> def concat(*args, sep=\"/\"):\n" "... return sep.join(args)\n" @@ -1853,11 +1852,11 @@ msgstr "" ">>> concat(\"earth\", \"mars\", \"venus\", sep=\".\")\n" "'earth.mars.venus'" -#: ../../tutorial/controlflow.rst:946 +#: ../../tutorial/controlflow.rst:947 msgid "Unpacking Argument Lists" msgstr "拆解引數列表(Unpacking Argument Lists)" -#: ../../tutorial/controlflow.rst:948 +#: ../../tutorial/controlflow.rst:949 msgid "" "The reverse situation occurs when the arguments are already in a list or " "tuple but need to be unpacked for a function call requiring separate " @@ -1871,7 +1870,7 @@ msgstr "" "的 *start* 和 *stop* 引數。如果這些引數不是分開的,則要在呼叫函式時,用 " "``*`` 運算子把引數們從 list 或 tuple 中拆解出來: ::" -#: ../../tutorial/controlflow.rst:955 +#: ../../tutorial/controlflow.rst:956 msgid "" ">>> list(range(3, 6)) # normal call with separate arguments\n" "[3, 4, 5]\n" @@ -1881,13 +1880,13 @@ msgid "" "[3, 4, 5]" msgstr "" -#: ../../tutorial/controlflow.rst:964 +#: ../../tutorial/controlflow.rst:965 msgid "" "In the same fashion, dictionaries can deliver keyword arguments with the " "``**``\\ -operator::" msgstr "同樣地,dictionary(字典)可以用 ``**`` 運算子傳遞關鍵字引數: ::" -#: ../../tutorial/controlflow.rst:967 +#: ../../tutorial/controlflow.rst:968 msgid "" ">>> def parrot(voltage, state='a stiff', action='voom'):\n" "... print(\"-- This parrot wouldn't\", action, end=' ')\n" @@ -1911,11 +1910,11 @@ msgstr "" "-- This parrot wouldn't VOOM if you put four million volts through it. E's " "bleedin' demised !" -#: ../../tutorial/controlflow.rst:980 +#: ../../tutorial/controlflow.rst:981 msgid "Lambda Expressions" msgstr "Lambda 運算式" -#: ../../tutorial/controlflow.rst:982 +#: ../../tutorial/controlflow.rst:983 msgid "" "Small anonymous functions can be created with the :keyword:`lambda` keyword. " "This function returns the sum of its two arguments: ``lambda a, b: a+b``. " @@ -1930,7 +1929,7 @@ msgstr "" "能是單一運算式。在語義上,它就是一個普通函式定義的語法糖 (syntactic sugar)。" "與巢狀函式定義一樣,lambda 函式可以從包含它的作用域中引用變數: ::" -#: ../../tutorial/controlflow.rst:990 +#: ../../tutorial/controlflow.rst:991 msgid "" ">>> def make_incrementor(n):\n" "... return lambda x: x + n\n" @@ -1950,7 +1949,7 @@ msgstr "" ">>> f(1)\n" "43" -#: ../../tutorial/controlflow.rst:999 +#: ../../tutorial/controlflow.rst:1000 msgid "" "The above example uses a lambda expression to return a function. Another " "use is to pass a small function as an argument::" @@ -1958,7 +1957,7 @@ msgstr "" "上面的例子用 lambda 運算式回傳了一個函式。另外的用法是傳遞一個小函式當作引" "數: ::" -#: ../../tutorial/controlflow.rst:1002 +#: ../../tutorial/controlflow.rst:1003 msgid "" ">>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]\n" ">>> pairs.sort(key=lambda pair: pair[1])\n" @@ -1970,17 +1969,17 @@ msgstr "" ">>> pairs\n" "[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]" -#: ../../tutorial/controlflow.rst:1011 +#: ../../tutorial/controlflow.rst:1012 msgid "Documentation Strings" msgstr "說明文件字串 (Documentation Strings)" -#: ../../tutorial/controlflow.rst:1018 +#: ../../tutorial/controlflow.rst:1019 msgid "" "Here are some conventions about the content and formatting of documentation " "strings." msgstr "以下是關於說明文件字串內容和格式的慣例。" -#: ../../tutorial/controlflow.rst:1021 +#: ../../tutorial/controlflow.rst:1022 msgid "" "The first line should always be a short, concise summary of the object's " "purpose. For brevity, it should not explicitly state the object's name or " @@ -1992,7 +1991,7 @@ msgstr "" "的名稱或型別,因為有其他方法可以達到相同目的(除非該名稱剛好是一個描述函式運" "算的動詞)。這一行應以大寫字母開頭,以句號結尾。" -#: ../../tutorial/controlflow.rst:1027 +#: ../../tutorial/controlflow.rst:1028 msgid "" "If there are more lines in the documentation string, the second line should " "be blank, visually separating the summary from the rest of the description. " @@ -2002,7 +2001,7 @@ msgstr "" "文件字串為多行時,第二行應為空白行,在視覺上將摘要與其餘描述分開。後面幾行可" "包含一或多個段落,描述此物件的呼叫慣例、副作用等。" -#: ../../tutorial/controlflow.rst:1032 +#: ../../tutorial/controlflow.rst:1033 msgid "" "The Python parser does not strip indentation from multi-line string literals " "in Python, so tools that process documentation have to strip indentation if " @@ -2024,11 +2023,11 @@ msgstr "" "出現了,這些行的全部前導空白字元都應被去除。展開 tab 鍵後(通常為八個空格)," "應測試空白字元量是否等價。" -#: ../../tutorial/controlflow.rst:1044 +#: ../../tutorial/controlflow.rst:1045 msgid "Here is an example of a multi-line docstring::" msgstr "下面是多行說明字串的一個範例: ::" -#: ../../tutorial/controlflow.rst:1046 +#: ../../tutorial/controlflow.rst:1047 msgid "" ">>> def my_function():\n" "... \"\"\"Do nothing, but document it.\n" @@ -2043,11 +2042,11 @@ msgid "" " No, really, it doesn't do anything." msgstr "" -#: ../../tutorial/controlflow.rst:1062 +#: ../../tutorial/controlflow.rst:1063 msgid "Function Annotations" msgstr "函式註釋 (Function Annotations)" -#: ../../tutorial/controlflow.rst:1070 +#: ../../tutorial/controlflow.rst:1071 msgid "" ":ref:`Function annotations ` are completely optional metadata " "information about the types used by user-defined functions (see :pep:`3107` " @@ -2056,7 +2055,7 @@ msgstr "" ":ref:`函式註釋 `\\ 是選擇性的元資料(metadata)資訊,描述使用者定義" "函式所使用的型別(更多資訊詳見 :pep:`3107` 和 :pep:`484`\\ )。" -#: ../../tutorial/controlflow.rst:1074 +#: ../../tutorial/controlflow.rst:1075 msgid "" ":term:`Annotations ` are stored in the :attr:`!" "__annotations__` attribute of the function as a dictionary and have no " @@ -2074,7 +2073,7 @@ msgstr "" ">`` 文字接著一個運算式。以下範例註釋了一個必要引數、一個選擇性引數,以及回傳" "值: ::" -#: ../../tutorial/controlflow.rst:1083 +#: ../../tutorial/controlflow.rst:1084 msgid "" ">>> def f(ham: str, eggs: str = 'eggs') -> str:\n" "... print(\"Annotations:\", f.__annotations__)\n" @@ -2098,11 +2097,11 @@ msgstr "" "Arguments: spam eggs\n" "'spam and eggs'" -#: ../../tutorial/controlflow.rst:1096 +#: ../../tutorial/controlflow.rst:1097 msgid "Intermezzo: Coding Style" msgstr "間奏曲:程式碼風格 (Coding Style)" -#: ../../tutorial/controlflow.rst:1101 +#: ../../tutorial/controlflow.rst:1102 msgid "" "Now that you are about to write longer, more complex pieces of Python, it is " "a good time to talk about *coding style*. Most languages can be written (or " @@ -2115,7 +2114,7 @@ msgstr "" "式比其他的更具可讀性。能讓其他人輕鬆閱讀你的程式碼永遠是一個好主意,而使用優" "良的編碼樣式對此有極大的幫助。" -#: ../../tutorial/controlflow.rst:1107 +#: ../../tutorial/controlflow.rst:1108 msgid "" "For Python, :pep:`8` has emerged as the style guide that most projects " "adhere to; it promotes a very readable and eye-pleasing coding style. Every " @@ -2125,11 +2124,11 @@ msgstr "" "對於 Python,大多數的專案都遵循 :pep:`8` 的樣式指南;它推行的編碼樣式相當可讀" "且賞心悅目。每個 Python 開發者都應該花點時間研讀;這裡是該指南的核心重點:" -#: ../../tutorial/controlflow.rst:1112 +#: ../../tutorial/controlflow.rst:1113 msgid "Use 4-space indentation, and no tabs." msgstr "用 4 個空格縮排,不要用 tab 鍵。" -#: ../../tutorial/controlflow.rst:1114 +#: ../../tutorial/controlflow.rst:1115 msgid "" "4 spaces are a good compromise between small indentation (allows greater " "nesting depth) and large indentation (easier to read). Tabs introduce " @@ -2138,11 +2137,11 @@ msgstr "" "4 個空格是小縮排(容許更大的巢套深度)和大縮排(較易閱讀)之間的折衷方案。" "Tab 鍵會造成混亂,最好別用。" -#: ../../tutorial/controlflow.rst:1118 +#: ../../tutorial/controlflow.rst:1119 msgid "Wrap lines so that they don't exceed 79 characters." msgstr "換行,使一行不超過 79 個字元。" -#: ../../tutorial/controlflow.rst:1120 +#: ../../tutorial/controlflow.rst:1121 msgid "" "This helps users with small displays and makes it possible to have several " "code files side-by-side on larger displays." @@ -2150,21 +2149,21 @@ msgstr "" "換行能讓使用小顯示器的使用者方便閱讀,也可以在較大顯示器上並排陳列多個程式碼" "檔案。" -#: ../../tutorial/controlflow.rst:1123 +#: ../../tutorial/controlflow.rst:1124 msgid "" "Use blank lines to separate functions and classes, and larger blocks of code " "inside functions." msgstr "用空行分隔函式和 class(類別),及函式內較大塊的程式碼。" -#: ../../tutorial/controlflow.rst:1126 +#: ../../tutorial/controlflow.rst:1127 msgid "When possible, put comments on a line of their own." msgstr "如果可以,把註解放在單獨一行。" -#: ../../tutorial/controlflow.rst:1128 +#: ../../tutorial/controlflow.rst:1129 msgid "Use docstrings." msgstr "使用說明字串。" -#: ../../tutorial/controlflow.rst:1130 +#: ../../tutorial/controlflow.rst:1131 msgid "" "Use spaces around operators and after commas, but not directly inside " "bracketing constructs: ``a = f(1, 2) + g(3, 4)``." @@ -2172,7 +2171,7 @@ msgstr "" "運算子前後、逗號後要加空格,但不要直接放在括號內側:``a = f(1, 2) + g(3, " "4)``。" -#: ../../tutorial/controlflow.rst:1133 +#: ../../tutorial/controlflow.rst:1134 msgid "" "Name your classes and functions consistently; the convention is to use " "``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for " @@ -2184,7 +2183,7 @@ msgstr "" "底線)。永遠用 ``self`` 作為 method 第一個引數的名稱(關於 class 和 method," "詳見 :ref:`tut-firstclasses`\\ )。" -#: ../../tutorial/controlflow.rst:1138 +#: ../../tutorial/controlflow.rst:1139 msgid "" "Don't use fancy encodings if your code is meant to be used in international " "environments. Python's default, UTF-8, or even plain ASCII work best in any " @@ -2193,7 +2192,7 @@ msgstr "" "若程式碼是為了用於國際環境時,不要用花俏的編碼。Python 預設的 UTF-8 或甚至普" "通的 ASCII,就可以勝任各種情況。" -#: ../../tutorial/controlflow.rst:1142 +#: ../../tutorial/controlflow.rst:1143 msgid "" "Likewise, don't use non-ASCII characters in identifiers if there is only the " "slightest chance people speaking a different language will read or maintain " @@ -2202,11 +2201,11 @@ msgstr "" "同樣地,若不同語言使用者閱讀或維護程式碼的可能性微乎其微,就不要在命名時使用" "非 ASCII 字元。" -#: ../../tutorial/controlflow.rst:1148 +#: ../../tutorial/controlflow.rst:1149 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/controlflow.rst:1149 +#: ../../tutorial/controlflow.rst:1150 msgid "" "Actually, *call by object reference* would be a better description, since if " "a mutable object is passed, the caller will see any changes the callee makes " @@ -2224,55 +2223,55 @@ msgstr "statement(陳述式)" msgid "for" msgstr "for" -#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 +#: ../../tutorial/controlflow.rst:477 ../../tutorial/controlflow.rst:1014 msgid "documentation strings" msgstr "ddocumentation strings(說明字串)" -#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 +#: ../../tutorial/controlflow.rst:477 ../../tutorial/controlflow.rst:1014 msgid "docstrings" msgstr "docstrings(說明字串)" -#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 +#: ../../tutorial/controlflow.rst:477 ../../tutorial/controlflow.rst:1014 msgid "strings, documentation" msgstr "strings(字串), documentation(說明文件)" -#: ../../tutorial/controlflow.rst:917 +#: ../../tutorial/controlflow.rst:918 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../tutorial/controlflow.rst:917 ../../tutorial/controlflow.rst:961 +#: ../../tutorial/controlflow.rst:918 ../../tutorial/controlflow.rst:962 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../tutorial/controlflow.rst:961 +#: ../../tutorial/controlflow.rst:962 msgid "**" msgstr "**" -#: ../../tutorial/controlflow.rst:1065 +#: ../../tutorial/controlflow.rst:1066 msgid "function" msgstr "function(函式)" -#: ../../tutorial/controlflow.rst:1065 +#: ../../tutorial/controlflow.rst:1066 msgid "annotations" msgstr "annotations(註釋)" -#: ../../tutorial/controlflow.rst:1065 +#: ../../tutorial/controlflow.rst:1066 msgid "->" msgstr "->" -#: ../../tutorial/controlflow.rst:1065 +#: ../../tutorial/controlflow.rst:1066 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../tutorial/controlflow.rst:1065 +#: ../../tutorial/controlflow.rst:1066 msgid ": (colon)" msgstr ": (冒號)" -#: ../../tutorial/controlflow.rst:1099 +#: ../../tutorial/controlflow.rst:1100 msgid "coding" msgstr "coding(程式編寫)" -#: ../../tutorial/controlflow.rst:1099 +#: ../../tutorial/controlflow.rst:1100 msgid "style" msgstr "style(風格)" diff --git a/tutorial/datastructures.po b/tutorial/datastructures.po index 27fcb13025..2974c0a980 100644 --- a/tutorial/datastructures.po +++ b/tutorial/datastructures.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: 2024-01-22 21:43+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -49,16 +49,16 @@ msgstr "" "method:" #: ../../tutorial/datastructures.rst:22 -msgid "" -"Add an item to the end of the list. Equivalent to ``a[len(a):] = [x]``." -msgstr "將一個新的項目加到 list 的尾端。等同於 ``a[len(a):] = [x]``。" +msgid "Add an item to the end of the list. Similar to ``a[len(a):] = [x]``." +msgstr "將一個新的項目加到 list 的尾端。與 ``a[len(a):] = [x]`` 類似。" #: ../../tutorial/datastructures.rst:28 msgid "" -"Extend the list by appending all the items from the iterable. Equivalent to " +"Extend the list by appending all the items from the iterable. Similar to " "``a[len(a):] = iterable``." msgstr "" -"將 iterable(可疊代物件)接到 list 的尾端。等同於 ``a[len(a):] = iterable``。" +"將 iterable(可疊代物件)接到 list 的尾端。與 ``a[len(a):] = iterable`` 類" +"似。" #: ../../tutorial/datastructures.rst:35 msgid "" @@ -90,8 +90,8 @@ msgstr "" "exc:`IndexError` 例外。" #: ../../tutorial/datastructures.rst:59 -msgid "Remove all items from the list. Equivalent to ``del a[:]``." -msgstr "刪除 list 中所有項目。這等同於 ``del a[:]``。" +msgid "Remove all items from the list. Similar to ``del a[:]``." +msgstr "刪除 list 中所有項目。與 ``del a[:]`` 類似。" #: ../../tutorial/datastructures.rst:65 msgid "" @@ -129,8 +129,8 @@ msgid "Reverse the elements of the list in place." msgstr "將 list 中的項目前後順序反過來。" #: ../../tutorial/datastructures.rst:96 -msgid "Return a shallow copy of the list. Equivalent to ``a[:]``." -msgstr "回傳一個淺複製 (shallow copy) 的 list。等同於 ``a[:]``。" +msgid "Return a shallow copy of the list. Similar to ``a[:]``." +msgstr "回傳一個淺複製 (shallow copy) 的 list。與 ``a[:]`` 類似。" #: ../../tutorial/datastructures.rst:99 msgid "An example that uses most of the list methods::" diff --git a/tutorial/errors.po b/tutorial/errors.po index fd65d5efcd..37d81af4bb 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-27 00:14+0000\n" "PO-Revision-Date: 2022-10-24 14:54+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -62,7 +62,6 @@ msgstr "" "SyntaxError: invalid syntax" #: ../../tutorial/errors.rst:26 -#, fuzzy msgid "" "The parser repeats the offending line and displays little 'arrow's pointing " "at the token in the line where the error was detected. The error may be " @@ -72,10 +71,9 @@ msgid "" "you know where to look in case the input came from a script." msgstr "" "剖析器 (parser) 會重複犯錯的那一行,並用一個小「箭頭」指向該行檢測到的第一個" -"錯誤點。錯誤是由箭頭\\ *之前*\\ 的標記 (token) 導致的(或至少是在這裡檢測到" -"的):此例中,錯誤是在 :func:`print` 函式中被檢測到,因為在它前面少了一個冒" -"號 (``':'``)。檔案名稱和行號會被印出來,所以如果訊息是來自腳本時,就可以知道" -"去哪裡找問題。" +"錯誤點。錯誤是由箭頭\\ *之前*\\ 的標記 (token) 導致的。此例中,錯誤是在 :" +"func:`print` 函式中被檢測到,因為在它前面少了一個冒號 (``':'``)。檔案名稱和列" +"號會被印出來,所以如果訊息是來自腳本時,就可以知道去哪裡找問題。" #: ../../tutorial/errors.rst:37 msgid "Exceptions" @@ -219,8 +217,8 @@ msgid "" "First, the *try clause* (the statement(s) between the :keyword:`try` and :" "keyword:`except` keywords) is executed." msgstr "" -"首先,執行 *try 子句*\\ (\\ :keyword:`try` 和 :keyword:`except` 關鍵字之間的" -"陳述式)。" +"首先,執行 *try 子句*\\ (:keyword:`try` 和 :keyword:`except` 關鍵字之間的陳" +"述式)。" #: ../../tutorial/errors.rst:107 msgid "" @@ -939,7 +937,7 @@ msgid "" "executing finally clause\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -" divide(\"2\", \"0\")\n" +" divide(\"2\", \"1\")\n" " ~~~~~~^^^^^^^^^^\n" " File \"\", line 3, in divide\n" " result = x / y\n" @@ -966,7 +964,7 @@ msgstr "" "executing finally clause\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -" divide(\"2\", \"0\")\n" +" divide(\"2\", \"1\")\n" " ~~~~~~^^^^^^^^^^\n" " File \"\", line 3, in divide\n" " result = x / y\n" diff --git a/tutorial/inputoutput.po b/tutorial/inputoutput.po index 3fbc7a6674..860e9deca2 100644 --- a/tutorial/inputoutput.po +++ b/tutorial/inputoutput.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: 2022-10-05 10:26+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -197,11 +197,11 @@ msgstr "" "值替代為字串的另一種方法。該方法使用 ``$x`` 佔位符號,並以 dictionary 的值進" "行取代,但對格式的控制明顯較少。" -#: ../../tutorial/inputoutput.rst:107 +#: ../../tutorial/inputoutput.rst:114 msgid "Formatted String Literals" msgstr "格式化的字串文本 (Formatted String Literals)" -#: ../../tutorial/inputoutput.rst:109 +#: ../../tutorial/inputoutput.rst:116 msgid "" ":ref:`Formatted string literals ` (also called f-strings for " "short) let you include the value of Python expressions inside a string by " @@ -212,7 +212,7 @@ msgstr "" "``f`` 或 ``F``,並將運算式編寫為 ``{expression}``,讓你可以在字串內加入 " "Python 運算式的值。" -#: ../../tutorial/inputoutput.rst:114 +#: ../../tutorial/inputoutput.rst:121 msgid "" "An optional format specifier can follow the expression. This allows greater " "control over how the value is formatted. The following example rounds pi to " @@ -221,7 +221,7 @@ msgstr "" "格式說明符 (format specifier) 是選擇性的,寫在運算式後面,可以更好地控制值的" "格式化方式。以下範例將 pi 捨入到小數點後三位: ::" -#: ../../tutorial/inputoutput.rst:118 +#: ../../tutorial/inputoutput.rst:125 msgid "" ">>> import math\n" ">>> print(f'The value of pi is approximately {math.pi:.3f}.')\n" @@ -231,7 +231,7 @@ msgstr "" ">>> print(f'The value of pi is approximately {math.pi:.3f}.')\n" "The value of pi is approximately 3.142." -#: ../../tutorial/inputoutput.rst:122 +#: ../../tutorial/inputoutput.rst:129 msgid "" "Passing an integer after the ``':'`` will cause that field to be a minimum " "number of characters wide. This is useful for making columns line up. ::" @@ -239,7 +239,7 @@ msgstr "" "在 ``':'`` 後傳遞一個整數,可以設定該欄位至少為幾個字元寬,常用於將每一欄對" "齊。 ::" -#: ../../tutorial/inputoutput.rst:125 +#: ../../tutorial/inputoutput.rst:132 msgid "" ">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 7678}\n" ">>> for name, phone in table.items():\n" @@ -257,7 +257,7 @@ msgstr "" "Jack ==> 4098\n" "Dcab ==> 7678" -#: ../../tutorial/inputoutput.rst:133 +#: ../../tutorial/inputoutput.rst:140 msgid "" "Other modifiers can be used to convert the value before it is formatted. ``'!" "a'`` applies :func:`ascii`, ``'!s'`` applies :func:`str`, and ``'!r'`` " @@ -266,7 +266,7 @@ msgstr "" "還有一些修飾符號可以在格式化前先將值轉換過。``'!a'`` 會套用 :func:`ascii`," "``'!s'`` 會套用 :func:`str`,``'!r'`` 會套用 :func:`repr`: ::" -#: ../../tutorial/inputoutput.rst:137 +#: ../../tutorial/inputoutput.rst:144 msgid "" ">>> animals = 'eels'\n" ">>> print(f'My hovercraft is full of {animals}.')\n" @@ -280,7 +280,7 @@ msgstr "" ">>> print(f'My hovercraft is full of {animals!r}.')\n" "My hovercraft is full of 'eels'." -#: ../../tutorial/inputoutput.rst:143 +#: ../../tutorial/inputoutput.rst:150 msgid "" "The ``=`` specifier can be used to expand an expression to the text of the " "expression, an equal sign, then the representation of the evaluated " @@ -289,7 +289,7 @@ msgstr "" "``=`` 說明符可用於將一個運算式擴充為該運算式的文字、一個等號、以及對該運算式" "求值 (evaluate) 後的表示法:" -#: ../../tutorial/inputoutput.rst:152 +#: ../../tutorial/inputoutput.rst:159 msgid "" "See :ref:`self-documenting expressions ` for more " "information on the ``=`` specifier. For a reference on these format " @@ -299,15 +299,15 @@ msgstr "" "expressions) `。若要參考這些格式化字串的規格,詳見 :ref:" "`formatspec` 參考指南。" -#: ../../tutorial/inputoutput.rst:159 +#: ../../tutorial/inputoutput.rst:166 msgid "The String format() Method" msgstr "字串的 format() method" -#: ../../tutorial/inputoutput.rst:161 +#: ../../tutorial/inputoutput.rst:168 msgid "Basic usage of the :meth:`str.format` method looks like this::" msgstr ":meth:`str.format` method 的基本用法如下: ::" -#: ../../tutorial/inputoutput.rst:163 +#: ../../tutorial/inputoutput.rst:170 msgid "" ">>> print('We are the {} who say \"{}!\"'.format('knights', 'Ni'))\n" "We are the knights who say \"Ni!\"" @@ -315,7 +315,7 @@ msgstr "" ">>> print('We are the {} who say \"{}!\"'.format('knights', 'Ni'))\n" "We are the knights who say \"Ni!\"" -#: ../../tutorial/inputoutput.rst:166 +#: ../../tutorial/inputoutput.rst:173 msgid "" "The brackets and characters within them (called format fields) are replaced " "with the objects passed into the :meth:`str.format` method. A number in the " @@ -326,7 +326,7 @@ msgstr "" "的物件。大括號中的數字表示該物件在傳遞給 :meth:`str.format` method 時所在的位" "置。 ::" -#: ../../tutorial/inputoutput.rst:171 +#: ../../tutorial/inputoutput.rst:178 msgid "" ">>> print('{0} and {1}'.format('spam', 'eggs'))\n" "spam and eggs\n" @@ -338,7 +338,7 @@ msgstr "" ">>> print('{1} and {0}'.format('spam', 'eggs'))\n" "eggs and spam" -#: ../../tutorial/inputoutput.rst:176 +#: ../../tutorial/inputoutput.rst:183 msgid "" "If keyword arguments are used in the :meth:`str.format` method, their values " "are referred to by using the name of the argument. ::" @@ -346,7 +346,7 @@ msgstr "" "如果在 :meth:`str.format` method 中使用關鍵字引數,可以使用引數名稱去引用它們" "的值。 ::" -#: ../../tutorial/inputoutput.rst:179 +#: ../../tutorial/inputoutput.rst:186 msgid "" ">>> print('This {food} is {adjective}.'.format(\n" "... food='spam', adjective='absolutely horrible'))\n" @@ -356,11 +356,11 @@ msgstr "" "... food='spam', adjective='absolutely horrible'))\n" "This spam is absolutely horrible." -#: ../../tutorial/inputoutput.rst:183 +#: ../../tutorial/inputoutput.rst:190 msgid "Positional and keyword arguments can be arbitrarily combined::" msgstr "位置引數和關鍵字引數可以任意組合: ::" -#: ../../tutorial/inputoutput.rst:185 +#: ../../tutorial/inputoutput.rst:192 msgid "" ">>> print('The story of {0}, {1}, and {other}.'.format('Bill', 'Manfred',\n" "... other='Georg'))\n" @@ -370,7 +370,7 @@ msgstr "" "... other='Georg'))\n" "The story of Bill, Manfred, and Georg." -#: ../../tutorial/inputoutput.rst:189 +#: ../../tutorial/inputoutput.rst:196 msgid "" "If you have a really long format string that you don't want to split up, it " "would be nice if you could reference the variables to be formatted by name " @@ -381,7 +381,7 @@ msgstr "" "數。這項操作可以透過傳遞字典 (dict),並用方括號 ``'[]'`` 使用鍵 (key) 來輕鬆" "完成。 ::" -#: ../../tutorial/inputoutput.rst:194 +#: ../../tutorial/inputoutput.rst:201 msgid "" ">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" ">>> print('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; '\n" @@ -393,14 +393,14 @@ msgstr "" "... 'Dcab: {0[Dcab]:d}'.format(table))\n" "Jack: 4098; Sjoerd: 4127; Dcab: 8637678" -#: ../../tutorial/inputoutput.rst:199 +#: ../../tutorial/inputoutput.rst:206 msgid "" "This could also be done by passing the ``table`` dictionary as keyword " "arguments with the ``**`` notation. ::" msgstr "" "用 '**' 符號,把 ``table`` 字典當作關鍵字引數來傳遞,也有一樣的結果。 ::" -#: ../../tutorial/inputoutput.rst:202 +#: ../../tutorial/inputoutput.rst:209 msgid "" ">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" ">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'." @@ -412,7 +412,7 @@ msgstr "" "format(**table))\n" "Jack: 4098; Sjoerd: 4127; Dcab: 8637678" -#: ../../tutorial/inputoutput.rst:206 +#: ../../tutorial/inputoutput.rst:213 msgid "" "This is particularly useful in combination with the built-in function :func:" "`vars`, which returns a dictionary containing all local variables::" @@ -420,7 +420,7 @@ msgstr "" "與內建函式 :func:`vars` 組合使用時,這種方式特別實用。該函式可以回傳一個包含" "所有區域變數的 dictionary: ::" -#: ../../tutorial/inputoutput.rst:209 +#: ../../tutorial/inputoutput.rst:216 msgid "" ">>> table = {k: str(v) for k, v in vars().items()}\n" ">>> message = \" \".join([f'{k}: ' + '{' + k +'};' for k in table.keys()])\n" @@ -432,13 +432,13 @@ msgstr "" ">>> print(message.format(**table))\n" "__name__: __main__; __doc__: None; __package__: None; __loader__: ..." -#: ../../tutorial/inputoutput.rst:214 +#: ../../tutorial/inputoutput.rst:221 msgid "" "As an example, the following lines produce a tidily aligned set of columns " "giving integers and their squares and cubes::" msgstr "例如,下面的程式碼產生一組排列整齊的欄,列出整數及其平方與立方: ::" -#: ../../tutorial/inputoutput.rst:217 +#: ../../tutorial/inputoutput.rst:224 msgid "" ">>> for x in range(1, 11):\n" "... print('{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x))\n" @@ -468,7 +468,7 @@ msgstr "" " 9 81 729\n" "10 100 1000" -#: ../../tutorial/inputoutput.rst:231 +#: ../../tutorial/inputoutput.rst:238 msgid "" "For a complete overview of string formatting with :meth:`str.format`, see :" "ref:`formatstrings`." @@ -476,15 +476,15 @@ msgstr "" "關於使用 :meth:`str.format` 進行字串格式化的完整概述,請見\\ :ref:" "`formatstrings`。" -#: ../../tutorial/inputoutput.rst:236 +#: ../../tutorial/inputoutput.rst:243 msgid "Manual String Formatting" msgstr "手動格式化字串" -#: ../../tutorial/inputoutput.rst:238 +#: ../../tutorial/inputoutput.rst:245 msgid "Here's the same table of squares and cubes, formatted manually::" msgstr "下面是以手動格式化完成的同一個平方及立方的表: ::" -#: ../../tutorial/inputoutput.rst:240 +#: ../../tutorial/inputoutput.rst:247 msgid "" ">>> for x in range(1, 11):\n" "... print(repr(x).rjust(2), repr(x*x).rjust(3), end=' ')\n" @@ -518,7 +518,7 @@ msgstr "" " 9 81 729\n" "10 100 1000" -#: ../../tutorial/inputoutput.rst:256 +#: ../../tutorial/inputoutput.rst:263 msgid "" "(Note that the one space between each column was added by the way :func:" "`print` works: it always adds spaces between its arguments.)" @@ -526,7 +526,7 @@ msgstr "" "(請注意,使用 :func:`print` 讓每欄之間加入一個空格的方法:這種方法總是在其引" "數間加入空格。)" -#: ../../tutorial/inputoutput.rst:259 +#: ../../tutorial/inputoutput.rst:266 msgid "" "The :meth:`str.rjust` method of string objects right-justifies a string in a " "field of a given width by padding it with spaces on the left. There are " @@ -544,7 +544,7 @@ msgstr "" "好,那種情況會讓值變得不正確。(如果你真的想截斷字串,可以加入像 ``x.ljust(n)" "[:n]`` 這樣的切片運算。)" -#: ../../tutorial/inputoutput.rst:268 +#: ../../tutorial/inputoutput.rst:275 msgid "" "There is another method, :meth:`str.zfill`, which pads a numeric string on " "the left with zeros. It understands about plus and minus signs::" @@ -552,7 +552,7 @@ msgstr "" "另一種 method 是 :meth:`str.zfill`,可在數值字串的左邊填補零,且能識別正負" "號: ::" -#: ../../tutorial/inputoutput.rst:271 +#: ../../tutorial/inputoutput.rst:278 msgid "" ">>> '12'.zfill(5)\n" "'00012'\n" @@ -568,11 +568,11 @@ msgstr "" ">>> '3.14159265359'.zfill(5)\n" "'3.14159265359'" -#: ../../tutorial/inputoutput.rst:280 +#: ../../tutorial/inputoutput.rst:287 msgid "Old string formatting" msgstr "格式化字串的舊方法" -#: ../../tutorial/inputoutput.rst:282 +#: ../../tutorial/inputoutput.rst:289 msgid "" "The % operator (modulo) can also be used for string formatting. Given " "``format % values`` (where *format* is a string), ``%`` conversion " @@ -584,7 +584,7 @@ msgstr "" "*format* 是個字串),*format* 內的 ``%`` 轉換規格會被 *values* 的零個或多個元" "素所取代。此運算常被稱為字串插值 (string interpolation)。例如: ::" -#: ../../tutorial/inputoutput.rst:289 +#: ../../tutorial/inputoutput.rst:296 msgid "" ">>> import math\n" ">>> print('The value of pi is approximately %5.3f.' % math.pi)\n" @@ -594,16 +594,16 @@ msgstr "" ">>> print('The value of pi is approximately %5.3f.' % math.pi)\n" "The value of pi is approximately 3.142." -#: ../../tutorial/inputoutput.rst:293 +#: ../../tutorial/inputoutput.rst:300 msgid "" "More information can be found in the :ref:`old-string-formatting` section." msgstr "更多資訊請見 :ref:`old-string-formatting`\\ 小節。" -#: ../../tutorial/inputoutput.rst:299 +#: ../../tutorial/inputoutput.rst:306 msgid "Reading and Writing Files" msgstr "讀寫檔案" -#: ../../tutorial/inputoutput.rst:305 +#: ../../tutorial/inputoutput.rst:312 msgid "" ":func:`open` returns a :term:`file object`, and is most commonly used with " "two positional arguments and one keyword argument: ``open(filename, mode, " @@ -612,11 +612,11 @@ msgstr "" ":func:`open` 回傳一個 :term:`file object`,而它最常使用的兩個位置引數和一個關" "鍵字引數是:``open(filename, mode, encoding=None)``" -#: ../../tutorial/inputoutput.rst:311 +#: ../../tutorial/inputoutput.rst:318 msgid ">>> f = open('workfile', 'w', encoding=\"utf-8\")" msgstr ">>> f = open('workfile', 'w', encoding=\"utf-8\")" -#: ../../tutorial/inputoutput.rst:318 +#: ../../tutorial/inputoutput.rst:325 msgid "" "The first argument is a string containing the filename. The second argument " "is another string containing a few characters describing the way in which " @@ -633,7 +633,7 @@ msgstr "" "內容為目的開啟檔案,任何寫入檔案的資料會自動被加入到檔案的結尾。``'r+'`` 可以" "開啟檔案並進行讀取和寫入。*mode* 引數是選擇性的,若省略時會預設為 ``'r'``。" -#: ../../tutorial/inputoutput.rst:327 +#: ../../tutorial/inputoutput.rst:334 msgid "" "Normally, files are opened in :dfn:`text mode`, that means, you read and " "write strings from and to the file, which are encoded in a specific " @@ -651,7 +651,7 @@ msgstr "" "mode`\\ (二進制模式)開啟檔案,二進制模式資料以 :class:`bytes` 物件的形式被" "讀寫。以二進制模式開啟檔案時不可以指定 *encoding*。" -#: ../../tutorial/inputoutput.rst:337 +#: ../../tutorial/inputoutput.rst:344 msgid "" "In text mode, the default when reading is to convert platform-specific line " "endings (``\\n`` on Unix, ``\\r\\n`` on Windows) to just ``\\n``. When " @@ -667,7 +667,7 @@ msgstr "" "文字檔案來說沒有問題,但會毀壞像是 :file:`JPEG` 或 :file:`EXE` 檔案中的二進制" "資料。在讀寫此類檔案時,注意一定要使用二進制模式。" -#: ../../tutorial/inputoutput.rst:345 +#: ../../tutorial/inputoutput.rst:352 msgid "" "It is good practice to use the :keyword:`with` keyword when dealing with " "file objects. The advantage is that the file is properly closed after its " @@ -679,7 +679,7 @@ msgstr "" "束後,即使在某個時刻引發了例外,檔案仍會正確地被關閉。使用 :keyword:`!with` " "也比寫等效的 :keyword:`try`\\ -\\ :keyword:`finally` 區塊,來得簡短許多: ::" -#: ../../tutorial/inputoutput.rst:351 +#: ../../tutorial/inputoutput.rst:358 msgid "" ">>> with open('workfile', encoding=\"utf-8\") as f:\n" "... read_data = f.read()\n" @@ -695,7 +695,7 @@ msgstr "" ">>> f.closed\n" "True" -#: ../../tutorial/inputoutput.rst:358 +#: ../../tutorial/inputoutput.rst:365 msgid "" "If you're not using the :keyword:`with` keyword, then you should call ``f." "close()`` to close the file and immediately free up any system resources " @@ -704,7 +704,7 @@ msgstr "" "如果你沒有使用 :keyword:`with` 關鍵字,則應呼叫 ``f.close()`` 關閉檔案,可以" "立即釋放被它所使用的系統資源。" -#: ../../tutorial/inputoutput.rst:363 +#: ../../tutorial/inputoutput.rst:370 msgid "" "Calling ``f.write()`` without using the :keyword:`!with` keyword or calling " "``f.close()`` **might** result in the arguments of ``f.write()`` not being " @@ -714,7 +714,7 @@ msgstr "" "即使程式成功退出,也\\ **可能**\\ 導致 ``f.write()`` 的引數沒有被完全寫入硬" "碟。" -#: ../../tutorial/inputoutput.rst:371 +#: ../../tutorial/inputoutput.rst:378 msgid "" "After a file object is closed, either by a :keyword:`with` statement or by " "calling ``f.close()``, attempts to use the file object will automatically " @@ -723,7 +723,7 @@ msgstr "" "不論是透過 :keyword:`with` 陳述式,或呼叫 ``f.close()`` 關閉一個檔案物件之" "後,嘗試使用該檔案物件將會自動失效。 ::" -#: ../../tutorial/inputoutput.rst:375 +#: ../../tutorial/inputoutput.rst:382 msgid "" ">>> f.close()\n" ">>> f.read()\n" @@ -737,17 +737,17 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: I/O operation on closed file." -#: ../../tutorial/inputoutput.rst:385 +#: ../../tutorial/inputoutput.rst:392 msgid "Methods of File Objects" msgstr "檔案物件的 method" -#: ../../tutorial/inputoutput.rst:387 +#: ../../tutorial/inputoutput.rst:394 msgid "" "The rest of the examples in this section will assume that a file object " "called ``f`` has already been created." msgstr "本節其餘的範例皆假設一個名為 ``f`` 的檔案物件已被建立。" -#: ../../tutorial/inputoutput.rst:390 +#: ../../tutorial/inputoutput.rst:397 msgid "" "To read a file's contents, call ``f.read(size)``, which reads some quantity " "of data and returns it as a string (in text mode) or bytes object (in binary " @@ -765,7 +765,7 @@ msgstr "" "字模式)或 *size* 數量的位元組串(二進制模式)會被讀取及回傳。如果之前已經到" "達檔案的末端,``f.read()`` 會回傳空字串(``''``)。 ::" -#: ../../tutorial/inputoutput.rst:399 +#: ../../tutorial/inputoutput.rst:406 msgid "" ">>> f.read()\n" "'This is the entire file.\\n'\n" @@ -777,7 +777,7 @@ msgstr "" ">>> f.read()\n" "''" -#: ../../tutorial/inputoutput.rst:404 +#: ../../tutorial/inputoutput.rst:411 msgid "" "``f.readline()`` reads a single line from the file; a newline character " "(``\\n``) is left at the end of the string, and is only omitted on the last " @@ -791,7 +791,7 @@ msgstr "" "傳值清晰明確;只要 ``f.readline()`` 回傳一個空字串,就表示已經到達了檔案末" "端,而空白行的表示法是 ``'\\n'``,也就是只含一個換行字元的字串。 ::" -#: ../../tutorial/inputoutput.rst:411 +#: ../../tutorial/inputoutput.rst:418 msgid "" ">>> f.readline()\n" "'This is the first line of the file.\\n'\n" @@ -807,7 +807,7 @@ msgstr "" ">>> f.readline()\n" "''" -#: ../../tutorial/inputoutput.rst:418 +#: ../../tutorial/inputoutput.rst:425 msgid "" "For reading lines from a file, you can loop over the file object. This is " "memory efficient, fast, and leads to simple code::" @@ -815,7 +815,7 @@ msgstr "" "想從檔案中讀取多行時,可以對檔案物件進行迴圈。這種方法能有效地使用記憶體、快" "速,且程式碼簡潔: ::" -#: ../../tutorial/inputoutput.rst:421 +#: ../../tutorial/inputoutput.rst:428 msgid "" ">>> for line in f:\n" "... print(line, end='')\n" @@ -829,7 +829,7 @@ msgstr "" "This is the first line of the file.\n" "Second line of the file" -#: ../../tutorial/inputoutput.rst:427 +#: ../../tutorial/inputoutput.rst:434 msgid "" "If you want to read all the lines of a file in a list you can also use " "``list(f)`` or ``f.readlines()``." @@ -837,14 +837,14 @@ msgstr "" "如果你想把一個檔案的所有行讀進一個 list 裡,可以用 ``list(f)`` 或 ``f." "readlines()``。" -#: ../../tutorial/inputoutput.rst:430 +#: ../../tutorial/inputoutput.rst:437 msgid "" "``f.write(string)`` writes the contents of *string* to the file, returning " "the number of characters written. ::" msgstr "" "``f.write(string)`` 把 *string* 的內容寫入檔案,並回傳寫入的字元數。 ::" -#: ../../tutorial/inputoutput.rst:433 +#: ../../tutorial/inputoutput.rst:440 msgid "" ">>> f.write('This is a test\\n')\n" "15" @@ -852,7 +852,7 @@ msgstr "" ">>> f.write('This is a test\\n')\n" "15" -#: ../../tutorial/inputoutput.rst:436 +#: ../../tutorial/inputoutput.rst:443 msgid "" "Other types of objects need to be converted -- either to a string (in text " "mode) or a bytes object (in binary mode) -- before writing them::" @@ -860,7 +860,7 @@ msgstr "" "寫入其他類型的物件之前,要先把它們轉換為字串(文字模式)或位元組串物件(二進" "制模式): ::" -#: ../../tutorial/inputoutput.rst:439 +#: ../../tutorial/inputoutput.rst:446 msgid "" ">>> value = ('the answer', 42)\n" ">>> s = str(value) # convert the tuple to string\n" @@ -872,7 +872,7 @@ msgstr "" ">>> f.write(s)\n" "18" -#: ../../tutorial/inputoutput.rst:444 +#: ../../tutorial/inputoutput.rst:451 msgid "" "``f.tell()`` returns an integer giving the file object's current position in " "the file represented as number of bytes from the beginning of the file when " @@ -881,7 +881,7 @@ msgstr "" "``f.tell()`` 回傳一個整數,它給出檔案物件在檔案中的當前位置,在二進制模式下表" "示為檔案開始至今的位元組數,在文字模式下表示為一個意義不明的數字。" -#: ../../tutorial/inputoutput.rst:448 +#: ../../tutorial/inputoutput.rst:455 msgid "" "To change the file object's position, use ``f.seek(offset, whence)``. The " "position is computed from adding *offset* to a reference point; the " @@ -896,7 +896,7 @@ msgstr "" "為 0 時,表示使用檔案開頭,1 表示使用當前的檔案位置,2 表示使用檔案末端作為參" "考點。*whence* 可省略,其預設值為 0,即以檔案開頭作為參考點。 ::" -#: ../../tutorial/inputoutput.rst:455 +#: ../../tutorial/inputoutput.rst:462 msgid "" ">>> f = open('workfile', 'rb+')\n" ">>> f.write(b'0123456789abcdef')\n" @@ -922,7 +922,7 @@ msgstr "" ">>> f.read(1)\n" "b'd'" -#: ../../tutorial/inputoutput.rst:467 +#: ../../tutorial/inputoutput.rst:474 msgid "" "In text files (those opened without a ``b`` in the mode string), only seeks " "relative to the beginning of the file are allowed (the exception being " @@ -935,7 +935,7 @@ msgstr "" "的值,或是 0,才是有效的 *offset* 值。其他任何 *offset* 值都會產生未定義的行" "為。" -#: ../../tutorial/inputoutput.rst:473 +#: ../../tutorial/inputoutput.rst:480 msgid "" "File objects have some additional methods, such as :meth:`~io.IOBase.isatty` " "and :meth:`~io.IOBase.truncate` which are less frequently used; consult the " @@ -944,11 +944,11 @@ msgstr "" "檔案物件還有一些附加的 method,像是較不常使用的 :meth:`~io.IOBase.isatty` " "和 :meth:`~io.IOBase.truncate`;檔案物件的完整指南詳見程式庫參考手冊。" -#: ../../tutorial/inputoutput.rst:481 +#: ../../tutorial/inputoutput.rst:488 msgid "Saving structured data with :mod:`json`" msgstr "使用 :mod:`json` 儲存結構化資料" -#: ../../tutorial/inputoutput.rst:485 +#: ../../tutorial/inputoutput.rst:492 msgid "" "Strings can easily be written to and read from a file. Numbers take a bit " "more effort, since the :meth:`~io.TextIOBase.read` method only returns " @@ -963,7 +963,7 @@ msgstr "" "dictionary(字典)等複雜的資料類型時,手動剖析 (parsing) 和序列化 " "(serializing) 就變得複雜。" -#: ../../tutorial/inputoutput.rst:492 +#: ../../tutorial/inputoutput.rst:499 msgid "" "Rather than having users constantly writing and debugging code to save " "complicated data types to files, Python allows you to use the popular data " @@ -982,7 +982,7 @@ msgstr "" "則稱為 :dfn:`deserializing`\\ (反序列化)。在序列化和反序列化之間,表示物件" "的字串可以被儲存在檔案或資料中,或通過網路連接發送到遠端的機器。" -#: ../../tutorial/inputoutput.rst:503 +#: ../../tutorial/inputoutput.rst:510 msgid "" "The JSON format is commonly used by modern applications to allow for data " "exchange. Many programmers are already familiar with it, which makes it a " @@ -991,14 +991,14 @@ msgstr "" "JSON 格式經常地使用於現代應用程式的資料交換。許多程序設計師早已對它耳熟能詳," "使它成為提升互操作性 (interoperability) 的好選擇。" -#: ../../tutorial/inputoutput.rst:507 +#: ../../tutorial/inputoutput.rst:514 msgid "" "If you have an object ``x``, you can view its JSON string representation " "with a simple line of code::" msgstr "" "如果你有一個物件 ``x``,只需一行簡單的程式碼即可檢視它的 JSON 字串表示法: ::" -#: ../../tutorial/inputoutput.rst:510 +#: ../../tutorial/inputoutput.rst:517 msgid "" ">>> import json\n" ">>> x = [1, 'simple', 'list']\n" @@ -1010,7 +1010,7 @@ msgstr "" ">>> json.dumps(x)\n" "'[1, \"simple\", \"list\"]'" -#: ../../tutorial/inputoutput.rst:515 +#: ../../tutorial/inputoutput.rst:522 msgid "" "Another variant of the :func:`~json.dumps` function, called :func:`~json." "dump`, simply serializes the object to a :term:`text file`. So if ``f`` is " @@ -1020,11 +1020,11 @@ msgstr "" "列化為 :term:`text file`。因此,如果 ``f`` 是一個為了寫入而開啟的 :term:" "`text file` 物件,我們可以這樣做: ::" -#: ../../tutorial/inputoutput.rst:519 +#: ../../tutorial/inputoutput.rst:526 msgid "json.dump(x, f)" msgstr "json.dump(x, f)" -#: ../../tutorial/inputoutput.rst:521 +#: ../../tutorial/inputoutput.rst:528 msgid "" "To decode the object again, if ``f`` is a :term:`binary file` or :term:`text " "file` object which has been opened for reading::" @@ -1032,11 +1032,11 @@ msgstr "" "若 ``f`` 是一個已開啟、可讀取的 :term:`binary file` 或 :term:`text file` 物" "件,要再次解碼物件的話: ::" -#: ../../tutorial/inputoutput.rst:524 +#: ../../tutorial/inputoutput.rst:531 msgid "x = json.load(f)" msgstr "x = json.load(f)" -#: ../../tutorial/inputoutput.rst:527 +#: ../../tutorial/inputoutput.rst:534 msgid "" "JSON files must be encoded in UTF-8. Use ``encoding=\"utf-8\"`` when opening " "JSON file as a :term:`text file` for both of reading and writing." @@ -1044,7 +1044,7 @@ msgstr "" "JSON 檔案必須以 UTF-8 格式編碼。在開啟 JSON 檔案以作為一個可讀取與寫入的 :" "term:`text file` 時,要用 ``encoding=\"utf-8\"``。" -#: ../../tutorial/inputoutput.rst:530 +#: ../../tutorial/inputoutput.rst:537 msgid "" "This simple serialization technique can handle lists and dictionaries, but " "serializing arbitrary class instances in JSON requires a bit of extra " @@ -1055,11 +1055,11 @@ msgstr "" "class(類別)實例,則需要一些額外的工作。:mod:`json` 模組的參考資料包含對此的" "說明。" -#: ../../tutorial/inputoutput.rst:536 +#: ../../tutorial/inputoutput.rst:543 msgid ":mod:`pickle` - the pickle module" msgstr ":mod:`pickle` - pickle 模組" -#: ../../tutorial/inputoutput.rst:538 +#: ../../tutorial/inputoutput.rst:545 msgid "" "Contrary to :ref:`JSON `, *pickle* is a protocol which allows the " "serialization of arbitrarily complex Python objects. As such, it is " @@ -1073,26 +1073,54 @@ msgstr "" "通。在預設情況,它也是不安全的:如果資料是由手段高明的攻擊者精心設計,將這段" "來自於不受信任來源的 pickle 資料反序列化,可以執行任意的程式碼。" -#: ../../tutorial/inputoutput.rst:301 +#: ../../tutorial/inputoutput.rst:103 +msgid "formatted string literal" +msgstr "formatted string literal(格式化的字串常數)" + +#: ../../tutorial/inputoutput.rst:103 +msgid "interpolated string literal" +msgstr "interpolated string literal(內插字串常數)" + +#: ../../tutorial/inputoutput.rst:103 +msgid "string" +msgstr "string(字串)" + +#: ../../tutorial/inputoutput.rst:103 +msgid "formatted literal" +msgstr "formatted literal(格式化的文本)" + +#: ../../tutorial/inputoutput.rst:103 +msgid "interpolated literal" +msgstr "interpolated literal(插值常數)" + +#: ../../tutorial/inputoutput.rst:103 +msgid "f-string" +msgstr "f-string(f 字串)" + +#: ../../tutorial/inputoutput.rst:103 +msgid "fstring" +msgstr "fstring(f 字串)" + +#: ../../tutorial/inputoutput.rst:308 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../tutorial/inputoutput.rst:301 +#: ../../tutorial/inputoutput.rst:308 msgid "open" msgstr "open" -#: ../../tutorial/inputoutput.rst:301 +#: ../../tutorial/inputoutput.rst:308 msgid "object" msgstr "object(物件)" -#: ../../tutorial/inputoutput.rst:301 +#: ../../tutorial/inputoutput.rst:308 msgid "file" msgstr "file(檔案)" -#: ../../tutorial/inputoutput.rst:483 +#: ../../tutorial/inputoutput.rst:490 msgid "module" msgstr "module(模組)" -#: ../../tutorial/inputoutput.rst:483 +#: ../../tutorial/inputoutput.rst:490 msgid "json" msgstr "json" diff --git a/using/configure.po b/using/configure.po index a3a919df74..080a472bd9 100644 --- a/using/configure.po +++ b/using/configure.po @@ -479,7 +479,7 @@ msgstr "" #: ../../using/configure.rst:271 msgid "Object:" -msgstr "" +msgstr "物件:" #: ../../using/configure.rst:273 msgid "incref and decref;" @@ -2018,7 +2018,7 @@ msgstr "" #: ../../using/configure.rst:1438 msgid "Footnotes" -msgstr "" +msgstr "註腳" #: ../../using/configure.rst:1439 msgid "" diff --git a/using/ios.po b/using/ios.po index f2c2df9111..080e6a1879 100644 --- a/using/ios.po +++ b/using/ios.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -19,15 +18,15 @@ msgstr "" #: ../../using/ios.rst:5 msgid "Using Python on iOS" -msgstr "" +msgstr "在 iOS 上使用 Python" #: ../../using/ios.rst:0 msgid "Authors" -msgstr "" +msgstr "作者" #: ../../using/ios.rst:8 msgid "Russell Keith-Magee (2024-03)" -msgstr "" +msgstr "Russell Keith-Magee (2024-03)" #: ../../using/ios.rst:10 msgid "" @@ -318,7 +317,7 @@ msgstr "" #: ../../using/ios.rst:200 msgid "Build Options" -msgstr "" +msgstr "建置選項" #: ../../using/ios.rst:202 msgid "User Script Sandboxing: No" diff --git a/using/mac.po b/using/mac.po index 79ab0b1827..8d8653a3f1 100644 --- a/using/mac.po +++ b/using/mac.po @@ -403,7 +403,7 @@ msgstr "" #: ../../using/mac.rst:262 msgid "(Experimental)" -msgstr "" +msgstr "(實驗性的)" #: ../../using/mac.rst:266 msgid "" diff --git a/using/unix.po b/using/unix.po index ebbda0b865..e787864dc8 100644 --- a/using/unix.po +++ b/using/unix.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2023-03-27 12:40+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,21 +35,21 @@ msgstr "在 Linux 上" msgid "" "Python comes preinstalled on most Linux distributions, and is available as a " "package on all others. However there are certain features you might want to " -"use that are not available on your distro's package. You can easily compile " -"the latest version of Python from source." +"use that are not available on your distro's package. You can compile the " +"latest version of Python from source." msgstr "" "在大多數 Linux 發行版上會預先安裝 Python,並作為一個套件提供給所有其他使用" "者。但是發行版提供的套件可能沒有你想要使用的某些功能,這時你可以選擇從原始碼" -"編譯最新版本的 Python,做法相當容易。" +"編譯最新版本的 Python。" #: ../../using/unix.rst:23 msgid "" -"In the event that Python doesn't come preinstalled and isn't in the " -"repositories as well, you can easily make packages for your own distro. " -"Have a look at the following links:" +"In the event that the latest version of Python doesn't come preinstalled and " +"isn't in the repositories as well, you can make packages for your own " +"distro. Have a look at the following links:" msgstr "" -"如果 Python 沒有預先安裝,並且不在發行版提供的儲存庫 (repository) 中,你可以" -"輕鬆地為自己使用的發行版建立套件。參閱以下連結:" +"如果最新版的 Python 沒有預先安裝,並且不在發行版提供的儲存庫 (repository) " +"中,你可以輕鬆地為自己使用的發行版建立套件。參閱以下連結:" #: ../../using/unix.rst:29 msgid "https://www.debian.org/doc/manuals/maint-guide/first.en.html" diff --git a/using/windows.po b/using/windows.po index a61e7c9881..8ff3e1e9ed 100644 --- a/using/windows.po +++ b/using/windows.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+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-" @@ -688,7 +688,7 @@ msgstr "" #: ../../using/windows.rst:315 ../../using/windows.rst:501 msgid "(Experimental)" -msgstr "" +msgstr "(實驗性的)" #: ../../using/windows.rst:319 ../../using/windows.rst:505 msgid "" @@ -1517,8 +1517,8 @@ msgstr "" #: ../../using/windows.rst:840 msgid "" -"The Company is matched on the full string, case-insenitive. The Tag is " -"matched oneither the full string, or a prefix, provided the next character " +"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 " "is a dot or a hyphen. This allows ``-V:3.1`` to match ``3.1-32``, but not " "``3.10``. Tags are sorted using numerical ordering (``3.10`` is newer than " "``3.1``), but are compared using text (``-V:3.01`` does not match ``3.1``)." diff --git a/whatsnew/2.2.po b/whatsnew/2.2.po index 440d72550b..a20f58263f 100644 --- a/whatsnew/2.2.po +++ b/whatsnew/2.2.po @@ -151,7 +151,7 @@ msgstr "" #: ../../whatsnew/2.2.rst:100 msgid "Old and New Classes" -msgstr "" +msgstr "舊的和新的類別" #: ../../whatsnew/2.2.rst:102 msgid "" @@ -180,6 +180,10 @@ msgid "" " ...\n" " ..." msgstr "" +"class C(object):\n" +" def __init__ (self):\n" +" ...\n" +" ..." #: ../../whatsnew/2.2.rst:121 msgid "" @@ -205,6 +209,10 @@ msgid "" ">>> int('123')\n" "123" msgstr "" +">>> int\n" +"\n" +">>> int('123')\n" +"123" #: ../../whatsnew/2.2.rst:136 msgid "" @@ -221,6 +229,11 @@ msgid "" " return fcntl.lockf(self.fileno(), operation,\n" " length, start, whence)" msgstr "" +"class LockableFile(file):\n" +" def lock (self, operation, length=0, start=0, whence=0):\n" +" import fcntl\n" +" return fcntl.lockf(self.fileno(), operation,\n" +" length, start, whence)" #: ../../whatsnew/2.2.rst:146 msgid "" @@ -232,7 +245,7 @@ msgstr "" #: ../../whatsnew/2.2.rst:153 msgid "Descriptors" -msgstr "" +msgstr "描述器" #: ../../whatsnew/2.2.rst:155 msgid "" @@ -295,6 +308,8 @@ msgid "" "descriptor = obj.__class__.x\n" "descriptor.__get__(obj)" msgstr "" +"descriptor = obj.__class__.x\n" +"descriptor.__get__(obj)" #: ../../whatsnew/2.2.rst:189 msgid "" @@ -658,6 +673,8 @@ msgid "" "def __getitem__(self, index):\n" " return " msgstr "" +"def __getitem__(self, index):\n" +" return " #: ../../whatsnew/2.2.rst:433 msgid "" @@ -721,6 +738,21 @@ msgid "" "StopIteration\n" ">>>" msgstr "" +">>> L = [1,2,3]\n" +">>> i = iter(L)\n" +">>> print i\n" +"\n" +">>> i.next()\n" +"1\n" +">>> i.next()\n" +"2\n" +">>> i.next()\n" +"3\n" +">>> i.next()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +"StopIteration\n" +">>>" #: ../../whatsnew/2.2.rst:479 msgid "" @@ -742,6 +774,11 @@ msgid "" ">>> a,b,c\n" "(1, 2, 3)" msgstr "" +">>> L = [1,2,3]\n" +">>> i = iter(L)\n" +">>> a,b,c = i\n" +">>> a,b,c\n" +"(1, 2, 3)" #: ../../whatsnew/2.2.rst:493 msgid "" @@ -769,6 +806,22 @@ msgid "" "Dec 12\n" "Oct 10" msgstr "" +">>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n" +"... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n" +">>> for key in m: print key, m[key]\n" +"...\n" +"Mar 3\n" +"Feb 2\n" +"Aug 8\n" +"Sep 9\n" +"May 5\n" +"Jun 6\n" +"Jul 7\n" +"Jan 1\n" +"Apr 4\n" +"Nov 11\n" +"Dec 12\n" +"Oct 10" #: ../../whatsnew/2.2.rst:513 msgid "" @@ -815,7 +868,7 @@ msgstr "" #: ../../whatsnew/2.2.rst:543 msgid "PEP 255: Simple Generators" -msgstr "" +msgstr "PEP 255:簡單產生器" #: ../../whatsnew/2.2.rst:545 msgid "" @@ -846,6 +899,9 @@ msgid "" " for i in range(N):\n" " yield i" msgstr "" +"def generate_ints(N):\n" +" for i in range(N):\n" +" yield i" #: ../../whatsnew/2.2.rst:563 msgid "" @@ -895,6 +951,20 @@ msgid "" " File \"\", line 2, in generate_ints\n" "StopIteration" msgstr "" +">>> gen = generate_ints(3)\n" +">>> gen\n" +"\n" +">>> gen.next()\n" +"0\n" +">>> gen.next()\n" +"1\n" +">>> gen.next()\n" +"2\n" +">>> gen.next()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +" File \"\", line 2, in generate_ints\n" +"StopIteration" #: ../../whatsnew/2.2.rst:601 msgid "" @@ -962,6 +1032,8 @@ msgid "" "sentence := \"Store it in the neighboring harbor\"\n" "if (i := find(\"or\", sentence)) > 5 then write(i)" msgstr "" +"sentence := \"Store it in the neighboring harbor\"\n" +"if (i := find(\"or\", sentence)) > 5 then write(i)" #: ../../whatsnew/2.2.rst:645 msgid "" @@ -986,7 +1058,7 @@ msgstr "" #: ../../whatsnew/2.2.rst:662 msgid ":pep:`255` - Simple Generators" -msgstr "" +msgstr ":pep:`255` - 簡單產生器" #: ../../whatsnew/2.2.rst:663 msgid "" @@ -1030,6 +1102,10 @@ msgid "" ">>> 2 ** 64\n" "18446744073709551616L" msgstr "" +">>> 1234567890123\n" +"1234567890123L\n" +">>> 2 ** 64\n" +"18446744073709551616L" #: ../../whatsnew/2.2.rst:695 msgid "" @@ -1266,6 +1342,12 @@ msgid "" " return g(value-1) + 1\n" " ..." msgstr "" +"def f():\n" +" ...\n" +" def g(value):\n" +" ...\n" +" return g(value-1) + 1\n" +" ..." #: ../../whatsnew/2.2.rst:863 msgid "" @@ -1344,6 +1426,12 @@ msgid "" " def g():\n" " return x" msgstr "" +"x = 1\n" +"def f():\n" +" # 下一行為語法錯誤\n" +" exec 'x=2'\n" +" def g():\n" +" return x" #: ../../whatsnew/2.2.rst:917 msgid "" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 829ac57ea5..5a4af094ce 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2024-11-10 17:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1711,7 +1711,7 @@ msgid "Deprecated" msgstr "已棄用" #: ../../whatsnew/3.12.rst:1145 -#: ../../deprecations/pending-removal-in-3.14.rst:11 +#: ../../deprecations/pending-removal-in-3.14.rst:4 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " @@ -1730,32 +1730,32 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1154 -#: ../../deprecations/pending-removal-in-3.14.rst:20 +#: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" #: ../../whatsnew/3.12.rst:1155 -#: ../../deprecations/pending-removal-in-3.14.rst:21 +#: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" #: ../../whatsnew/3.12.rst:1156 -#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" #: ../../whatsnew/3.12.rst:1157 -#: ../../deprecations/pending-removal-in-3.14.rst:23 +#: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" #: ../../whatsnew/3.12.rst:1158 -#: ../../deprecations/pending-removal-in-3.14.rst:24 +#: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" #: ../../whatsnew/3.12.rst:1160 -#: ../../deprecations/pending-removal-in-3.14.rst:26 +#: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" @@ -1763,7 +1763,8 @@ msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" #: ../../whatsnew/3.12.rst:1163 -#: ../../deprecations/pending-removal-in-3.14.rst:29 +#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" @@ -1776,7 +1777,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1171 -#: ../../deprecations/pending-removal-in-3.14.rst:37 +#: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" "`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." @@ -1789,7 +1790,7 @@ msgstr "" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../whatsnew/3.12.rst:1177 -#: ../../deprecations/pending-removal-in-3.14.rst:43 +#: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " "now emits a :exc:`DeprecationWarning` if there is no current event loop set " @@ -1844,37 +1845,37 @@ msgid "" msgstr ":mod:`importlib.abc`:棄用下列類別,預定於 Python 3.14 中移除:" #: ../../whatsnew/3.12.rst:1205 -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" #: ../../whatsnew/3.12.rst:1206 -#: ../../deprecations/pending-removal-in-3.14.rst:60 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" #: ../../whatsnew/3.12.rst:1207 -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" #: ../../whatsnew/3.12.rst:1209 -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" #: ../../whatsnew/3.12.rst:1211 -#: ../../deprecations/pending-removal-in-3.14.rst:65 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" #: ../../whatsnew/3.12.rst:1212 -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" #: ../../whatsnew/3.12.rst:1214 -#: ../../deprecations/pending-removal-in-3.14.rst:68 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" @@ -1958,7 +1959,7 @@ msgstr "" "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" #: ../../whatsnew/3.12.rst:1267 -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" @@ -1994,7 +1995,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1290 -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" @@ -2058,9 +2059,12 @@ msgstr "" msgid "" "Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in " "Python 3.10 via :pep:`626`, but it only got a proper :exc:" -"`DeprecationWarning` in 3.12, therefore it will be removed in 3.14. " -"(Contributed by Nikita Sobolev in :gh:`101866`.)" +"`DeprecationWarning` in 3.12. May be removed in 3.15. (Contributed by Nikita " +"Sobolev in :gh:`101866`.)" msgstr "" +"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已在 :pep:" +"`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。可能在 " +"3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.13.rst:2 msgid "Pending Removal in Python 3.13" @@ -2241,23 +2245,7 @@ msgstr "" msgid "Pending Removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" -#: ../../deprecations/pending-removal-in-3.14.rst:4 -#: ../../deprecations/pending-removal-in-3.15.rst:4 -msgid "The import system:" -msgstr "引入系統 (import system):" - -#: ../../deprecations/pending-removal-in-3.14.rst:6 -msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader ` is deprecated. In " -"Python 3.14, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." -msgstr "" -"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " -"` 的做法已被棄用。在 Python 3.14 中," -"引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__` 。" - -#: ../../deprecations/pending-removal-in-3.14.rst:16 +#: ../../deprecations/pending-removal-in-3.14.rst:9 msgid "" ":mod:`ast`: The following features have been deprecated in documentation " "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " @@ -2266,7 +2254,7 @@ msgstr "" ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" "於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" -#: ../../deprecations/pending-removal-in-3.14.rst:31 +#: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" "The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" "`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" @@ -2278,7 +2266,7 @@ msgstr "" "AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " "Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:48 +#: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -2290,7 +2278,7 @@ msgstr "" "改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " "Shantanu Jain 於 :gh:`91896` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -2298,11 +2286,11 @@ msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:50 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:70 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -2313,7 +2301,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:76 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -2330,7 +2318,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -2338,7 +2326,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -2348,23 +2336,23 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:100 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -2374,27 +2362,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:106 -msgid "" -"date and datetime adapter, date and timestamp converter: see the :mod:" -"`sqlite3` documentation for suggested replacement recipes." -msgstr "" -"date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" -"參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" - -#: ../../deprecations/pending-removal-in-3.14.rst:109 -msgid "" -":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " -"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " -"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " -"in 3.14. (Contributed by Nikita Sobolev in :gh:`101866`.)" -msgstr "" -":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:116 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -2402,7 +2370,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:119 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -2416,6 +2384,11 @@ msgstr "" msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" +#: ../../deprecations/pending-removal-in-3.15.rst:4 +#: ../../deprecations/pending-removal-in-3.16.rst:4 +msgid "The import system:" +msgstr "引入系統 (import system):" + #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" "Setting :attr:`~module.__cached__` on a module while failing to set :attr:" @@ -2528,8 +2501,24 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" +#: ../../deprecations/pending-removal-in-3.15.rst:62 +msgid ":mod:`types`:" +msgstr ":mod:`types`:" + #: ../../deprecations/pending-removal-in-3.15.rst:64 msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" +":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.15.rst:73 +msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " "has been deprecated since Python 3.13. Use the class-based syntax or the " @@ -2539,7 +2528,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:70 +#: ../../deprecations/pending-removal-in-3.15.rst:79 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -2549,11 +2538,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:75 +#: ../../deprecations/pending-removal-in-3.15.rst:84 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:77 +#: ../../deprecations/pending-removal-in-3.15.rst:86 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -2564,32 +2553,25 @@ msgstr "" "getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 -msgid "Pending Removal in Python 3.16" +msgid "Pending removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" -#: ../../deprecations/pending-removal-in-3.16.rst:4 -#: ../../deprecations/pending-removal-in-future.rst:12 -msgid ":mod:`builtins`:" -msgstr ":mod:`builtins`:" - #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " -"deprecated since Python 3.12, as it produces surprising and unintuitive " -"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " -"of a Boolean. In the rare case that you need the bitwise inversion of the " -"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" -"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" -"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" -"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " -"``~int(x)`` (``~int(x)``)。" +"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " +"` 的做法將於 Python 3.16 被棄用。在 " +"Python 3.16 中,引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__`。" -#: ../../deprecations/pending-removal-in-3.16.rst:13 +#: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../deprecations/pending-removal-in-3.16.rst:15 +#: ../../deprecations/pending-removal-in-3.16.rst:13 msgid "" "The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " "documentation since Python 3.3 and at runtime since Python 3.13. Use the " @@ -2600,10 +2582,35 @@ msgstr "" "來取代 Unicode 字元。" #: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:26 +#: ../../deprecations/pending-removal-in-future.rst:12 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:35 msgid ":mod:`shutil`:" msgstr ":mod:`shutil`:" -#: ../../deprecations/pending-removal-in-3.16.rst:23 +#: ../../deprecations/pending-removal-in-3.16.rst:37 msgid "" "The :class:`!ExecError` exception has been deprecated since Python 3.14. It " "has not been used by any function in :mod:`!shutil` since Python 3.4, and is " @@ -2612,11 +2619,11 @@ msgstr "" "自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" "未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" -#: ../../deprecations/pending-removal-in-3.16.rst:28 +#: ../../deprecations/pending-removal-in-3.16.rst:42 msgid ":mod:`symtable`:" msgstr ":mod:`symtable`:" -#: ../../deprecations/pending-removal-in-3.16.rst:30 +#: ../../deprecations/pending-removal-in-3.16.rst:44 msgid "" "The :meth:`Class.get_methods ` method has been " "deprecated since Python 3.14." @@ -2624,11 +2631,11 @@ msgstr "" "自 Python 3.14 起,:meth:`Class.get_methods ` 方" "法已被棄用。" -#: ../../deprecations/pending-removal-in-3.16.rst:33 +#: ../../deprecations/pending-removal-in-3.16.rst:47 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../deprecations/pending-removal-in-3.16.rst:35 +#: ../../deprecations/pending-removal-in-3.16.rst:49 msgid "" "The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " "since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " @@ -2637,11 +2644,11 @@ msgstr "" "自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" -#: ../../deprecations/pending-removal-in-3.16.rst:39 +#: ../../deprecations/pending-removal-in-3.16.rst:53 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../deprecations/pending-removal-in-3.16.rst:41 +#: ../../deprecations/pending-removal-in-3.16.rst:55 msgid "" "The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " "deprecated since Python 3.13." @@ -4279,7 +4286,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:1970 msgid "``sys.getunicodeinternedsize`` This returns the total number of unicode" -msgstr "" +msgstr "``sys.getunicodeinternedsize`` 這會回傳 unicode 的總數" #: ../../whatsnew/3.12.rst:1971 msgid "" @@ -5016,16 +5023,24 @@ msgstr "" "data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 -msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." -msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" +msgid "" +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." +"exec_prefix` instead." +msgstr "" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" +"`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 -msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." -msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" +msgid "" +":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " +"instead." +msgstr "" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." +"prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." @@ -5228,105 +5243,3 @@ msgid "" msgstr "" "移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner 於 :gh:" "`85858` 中貢獻。)" - -#~ msgid "" -#~ ":mod:`platform`: :func:`~platform.java_ver` is deprecated and will be " -#~ "removed in 3.15. It was largely untested, had a confusing API, and was " -#~ "only useful for Jython support. (Contributed by Nikita Sobolev in :gh:" -#~ "`116349`.)" -#~ msgstr "" -#~ ":mod:`platform`::func:`~platform.java_ver` 已被棄用並將在 3.15 中移除。它" -#~ "幾乎沒有被測試過,API 令人困惑並且只對 Jython 支援有用。 (由 Nikita " -#~ "Sobolev 於 :gh:`116349` 貢獻。)" - -#~ msgid "" -#~ ":mod:`threading`: Passing any arguments to :func:`threading.RLock` is now " -#~ "deprecated. C version allows any numbers of args and kwargs, but they are " -#~ "just ignored. Python version does not allow any arguments. All arguments " -#~ "will be removed from :func:`threading.RLock` in Python 3.15. (Contributed " -#~ "by Nikita Sobolev in :gh:`102029`.)" -#~ msgstr "" -#~ ":mod:`threading`:對 :func:`threading.RLock` 傳遞任何引數現在已被棄用。C " -#~ "版本允許任意數量的引數和關鍵字引數,但它們會被忽略。Python 版本不允許任何" -#~ "引數。所有引數將在 Python 3.15 中從 :func:`threading.RLock` 中移除。 (由 " -#~ "Nikita Sobolev 於 :gh:`102029` 貢獻。)" - -#~ msgid ":class:`typing.NamedTuple`:" -#~ msgstr ":class:`typing.NamedTuple`:" - -#~ msgid "" -#~ "When using the functional syntax to create a :class:`!NamedTuple` class, " -#~ "failing to pass a value to the *fields* parameter (``NT = " -#~ "NamedTuple(\"NT\")``) is deprecated. Passing ``None`` to the *fields* " -#~ "parameter (``NT = NamedTuple(\"NT\", None)``) is also deprecated. Both " -#~ "will be disallowed in Python 3.15. To create a :class:`!NamedTuple` class " -#~ "with 0 fields, use ``class NT(NamedTuple): pass`` or ``NT = " -#~ "NamedTuple(\"NT\", [])``." -#~ msgstr "" -#~ "當使用函式語法來建立 :class:`!NamedTuple` 類別時,沒將值傳遞給 *fields* 參" -#~ "數的方式 (``NT = NamedTuple(\"NT\")``) 已被棄用,將 ``None`` 傳遞給 " -#~ "*fields* 參數(``NT = NamedTuple(\"NT\", None)``)也已被棄用。這兩者將在 " -#~ "Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:`!NamedTuple` 類別,請" -#~ "使用 ``class NT(NamedTuple): pass`` 或 ``NT = NamedTuple(\"NT\", [])``。" - -#~ msgid "" -#~ ":class:`typing.TypedDict`: When using the functional syntax to create a :" -#~ "class:`!TypedDict` class, failing to pass a value to the *fields* " -#~ "parameter (``TD = TypedDict(\"TD\")``) is deprecated. Passing ``None`` to " -#~ "the *fields* parameter (``TD = TypedDict(\"TD\", None)``) is also " -#~ "deprecated. Both will be disallowed in Python 3.15. To create a :class:`!" -#~ "TypedDict` class with 0 fields, use ``class TD(TypedDict): pass`` or ``TD " -#~ "= TypedDict(\"TD\", {})``." -#~ msgstr "" -#~ ":class:`typing.TypedDict`:當使用函式語法來建立 :class:`!TypedDict` 類別" -#~ "時,沒將值傳遞給 *fields* 參數的方式(``TD = TypedDict(\"TD\")``)已被棄" -#~ "用,將 ``None`` 傳遞給 *fields* 參數(``TD = TypedDict(\"TD\", None)``)也" -#~ "已被棄用。這兩者將在 Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:" -#~ "`!TypedDict` 類別,請使用 ``class TD(TypedDict): pass`` 或 ``TD = " -#~ "TypedDict(\"TD\", {})``。" - -#~ msgid "" -#~ ":mod:`array`: :class:`array.array` ``'u'`` type (:c:type:`wchar_t`): use " -#~ "the ``'w'`` type instead (``Py_UCS4``)." -#~ msgstr "" -#~ ":mod:`array`::class:`array.array` ``'u'`` 型別 (:c:type:`wchar_t`):請改" -#~ "用 ``'w'`` 型別 (``Py_UCS4``)。" - -#~ msgid ":mod:`builtins`: ``~bool``, bitwise inversion on bool." -#~ msgstr ":mod:`builtins`:``~bool``,對 bool 進行位元反轉。" - -#~ msgid "" -#~ ":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " -#~ "lack of interest. (Contributed by Bénédikt Tran in :gh:`119698`.)" -#~ msgstr "" -#~ ":mod:`symtable`:由於並沒有太多關注,已棄用 :meth:`symtable.Class." -#~ "get_methods`。 (由 Bénédikt Tran 於 :gh:`119698` 貢獻。)" - -#~ msgid "" -#~ ":c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead." -#~ msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`PyWeakref_GetRef`。" - -#~ msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." -#~ msgstr ":c:type:`!Py_UNICODE_WIDE` type:請改用 :c:type:`wchar_t`。" - -#~ msgid "Notable changes in 3.12.4" -#~ msgstr "3.12.4 中的顯著變更" - -#~ msgid "ipaddress" -#~ msgstr "ipaddress" - -#~ msgid "" -#~ "Fixed ``is_global`` and ``is_private`` behavior in ``IPv4Address``, " -#~ "``IPv6Address``, ``IPv4Network`` and ``IPv6Network``." -#~ msgstr "" -#~ "修正 ``IPv4Address``、``IPv6Address``、``IPv4Network`` 和 ``IPv6Network`` " -#~ "中的 ``is_global`` 和 ``is_private`` 行為。" - -#~ msgid "Notable changes in 3.12.5" -#~ msgstr "3.12.5 中的顯著變更" - -#~ msgid "email" -#~ msgstr "email" - -#~ msgid "Notable changes in 3.12.6" -#~ msgstr "3.12.6 中的顯著變更" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index f41fa1d4c1..bbc57bb4aa 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2024-11-10 17:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -437,7 +437,8 @@ msgid "" " ^^^^^^^^^^^^^^\n" "AttributeError: module 'random' has no attribute 'randint' (consider " "renaming '/home/me/random.py' since it has the same name as the standard " -"library module named 'random' and the import system gives it precedence)" +"library module named 'random' and prevents importing that standard library " +"module)" msgstr "" "$ python random.py\n" "Traceback (most recent call last):\n" @@ -448,7 +449,8 @@ msgstr "" " ^^^^^^^^^^^^^^\n" "AttributeError: module 'random' has no attribute 'randint' (consider " "renaming '/home/me/random.py' since it has the same name as the standard " -"library module named 'random' and the import system gives it precedence)" +"library module named 'random' and prevents importing that standard library " +"module)" #: ../../whatsnew/3.13.rst:279 msgid "" @@ -467,8 +469,8 @@ msgid "" " np.array([1, 2, 3])\n" " ^^^^^^^^\n" "AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/" -"home/me/numpy.py' if it has the same name as a third-party module you " -"intended to import)" +"home/me/numpy.py' if it has the same name as a library you intended to " +"import)" msgstr "" "$ python numpy.py\n" "Traceback (most recent call last):\n" @@ -478,8 +480,7 @@ msgstr "" " np.array([1, 2, 3])\n" " ^^^^^^^^\n" "AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/" -"home/me/numpy.py' if it has the same name as a third-party module you " -"intended to import)" +"home/me/numpy.py' if it has the same name as a library you intended to " #: ../../whatsnew/3.13.rst:294 msgid "(Contributed by Shantanu Jain in :gh:`95754`.)" @@ -2592,7 +2593,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1758 -#: ../../deprecations/pending-removal-in-3.16.rst:13 +#: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr ":mod:`array`:" @@ -2759,7 +2760,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1862 -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" @@ -2790,7 +2791,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1884 -#: ../../deprecations/pending-removal-in-3.16.rst:33 +#: ../../deprecations/pending-removal-in-3.16.rst:47 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" @@ -2802,7 +2803,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1891 -#: ../../deprecations/pending-removal-in-3.16.rst:39 +#: ../../deprecations/pending-removal-in-3.16.rst:53 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" @@ -2824,7 +2825,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1903 -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" @@ -2866,7 +2867,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1936 -#: ../../deprecations/pending-removal-in-3.15.rst:75 +#: ../../deprecations/pending-removal-in-3.15.rst:84 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" @@ -2884,22 +2885,6 @@ msgid "Pending Removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/pending-removal-in-3.14.rst:4 -#: ../../deprecations/pending-removal-in-3.15.rst:4 -msgid "The import system:" -msgstr "引入系統 (import system):" - -#: ../../deprecations/pending-removal-in-3.14.rst:6 -msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader ` is deprecated. In " -"Python 3.14, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." -msgstr "" -"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " -"` 的做法已被棄用。在 Python 3.14 中," -"引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__` 。" - -#: ../../deprecations/pending-removal-in-3.14.rst:11 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " @@ -2909,7 +2894,7 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:16 +#: ../../deprecations/pending-removal-in-3.14.rst:9 msgid "" ":mod:`ast`: The following features have been deprecated in documentation " "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " @@ -2918,38 +2903,39 @@ msgstr "" ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" "於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" -#: ../../deprecations/pending-removal-in-3.14.rst:20 +#: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../deprecations/pending-removal-in-3.14.rst:21 +#: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../deprecations/pending-removal-in-3.14.rst:23 +#: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../deprecations/pending-removal-in-3.14.rst:24 +#: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../deprecations/pending-removal-in-3.14.rst:26 +#: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:29 +#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../deprecations/pending-removal-in-3.14.rst:31 +#: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" "The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" "`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" @@ -2961,7 +2947,7 @@ msgstr "" "AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " "Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:37 +#: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" "`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." @@ -2973,7 +2959,7 @@ msgstr "" "AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:43 +#: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " "now emits a :exc:`DeprecationWarning` if there is no current event loop set " @@ -2984,7 +2970,7 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:48 +#: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -2996,7 +2982,7 @@ msgstr "" "改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " "Shantanu Jain 於 :gh:`91896` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -3004,39 +2990,39 @@ msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:50 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:60 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:65 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:68 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:70 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -3047,7 +3033,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:76 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -3064,7 +3050,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -3072,7 +3058,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -3082,23 +3068,23 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:100 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -3108,27 +3094,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:106 -msgid "" -"date and datetime adapter, date and timestamp converter: see the :mod:" -"`sqlite3` documentation for suggested replacement recipes." -msgstr "" -"date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" -"參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" - -#: ../../deprecations/pending-removal-in-3.14.rst:109 -msgid "" -":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " -"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " -"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " -"in 3.14. (Contributed by Nikita Sobolev in :gh:`101866`.)" -msgstr "" -":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:116 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -3136,7 +3102,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:119 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -3150,6 +3116,11 @@ msgstr "" msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" +#: ../../deprecations/pending-removal-in-3.15.rst:4 +#: ../../deprecations/pending-removal-in-3.16.rst:4 +msgid "The import system:" +msgstr "引入系統 (import system):" + #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" "Setting :attr:`~module.__cached__` on a module while failing to set :attr:" @@ -3246,8 +3217,24 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" +#: ../../deprecations/pending-removal-in-3.15.rst:62 +msgid ":mod:`types`:" +msgstr ":mod:`types`:" + #: ../../deprecations/pending-removal-in-3.15.rst:64 msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" +":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.15.rst:73 +msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " "has been deprecated since Python 3.13. Use the class-based syntax or the " @@ -3257,7 +3244,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:70 +#: ../../deprecations/pending-removal-in-3.15.rst:79 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -3267,7 +3254,7 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:77 +#: ../../deprecations/pending-removal-in-3.15.rst:86 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -3278,15 +3265,43 @@ msgstr "" "getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 -msgid "Pending Removal in Python 3.16" +msgid "Pending removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" -#: ../../deprecations/pending-removal-in-3.16.rst:4 +#: ../../deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." +msgstr "" +"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " +"` 的做法將於 Python 3.16 被棄用。在 " +"Python 3.16 中,引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__`。" + +#: ../../deprecations/pending-removal-in-3.16.rst:13 +msgid "" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." +msgstr "" +"自 Python 3.3 起,``'u'`` 格式碼 (:c:type:`wchar_t`) 在文件中已被棄用,自 " +"Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " +"來取代 Unicode 字元。" + +#: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:26 #: ../../deprecations/pending-removal-in-future.rst:12 msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" -#: ../../deprecations/pending-removal-in-3.16.rst:6 +#: ../../deprecations/pending-removal-in-3.16.rst:28 msgid "" "Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " "deprecated since Python 3.12, as it produces surprising and unintuitive " @@ -3299,21 +3314,11 @@ msgstr "" "邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " "``~int(x)`` (``~int(x)``)。" -#: ../../deprecations/pending-removal-in-3.16.rst:15 -msgid "" -"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " -"documentation since Python 3.3 and at runtime since Python 3.13. Use the " -"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." -msgstr "" -"自 Python 3.3 起,``'u'`` 格式碼 (:c:type:`wchar_t`) 在文件中已被棄用,自 " -"Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " -"來取代 Unicode 字元。" - -#: ../../deprecations/pending-removal-in-3.16.rst:21 +#: ../../deprecations/pending-removal-in-3.16.rst:35 msgid ":mod:`shutil`:" msgstr ":mod:`shutil`:" -#: ../../deprecations/pending-removal-in-3.16.rst:23 +#: ../../deprecations/pending-removal-in-3.16.rst:37 msgid "" "The :class:`!ExecError` exception has been deprecated since Python 3.14. It " "has not been used by any function in :mod:`!shutil` since Python 3.4, and is " @@ -3322,11 +3327,11 @@ msgstr "" "自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" "未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" -#: ../../deprecations/pending-removal-in-3.16.rst:28 +#: ../../deprecations/pending-removal-in-3.16.rst:42 msgid ":mod:`symtable`:" msgstr ":mod:`symtable`:" -#: ../../deprecations/pending-removal-in-3.16.rst:30 +#: ../../deprecations/pending-removal-in-3.16.rst:44 msgid "" "The :meth:`Class.get_methods ` method has been " "deprecated since Python 3.14." @@ -3334,7 +3339,7 @@ msgstr "" "自 Python 3.14 起,:meth:`Class.get_methods ` 方" "法已被棄用。" -#: ../../deprecations/pending-removal-in-3.16.rst:35 +#: ../../deprecations/pending-removal-in-3.16.rst:49 msgid "" "The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " "since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " @@ -3343,7 +3348,7 @@ msgstr "" "自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" -#: ../../deprecations/pending-removal-in-3.16.rst:41 +#: ../../deprecations/pending-removal-in-3.16.rst:55 msgid "" "The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " "deprecated since Python 3.13." @@ -4570,7 +4575,6 @@ msgstr "" "data:`!warnings.filters`。" #: ../../whatsnew/3.13.rst:2418 -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" @@ -4580,7 +4584,6 @@ msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" #: ../../whatsnew/3.13.rst:2422 -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" @@ -4867,6 +4870,22 @@ msgstr "" msgid "Python initialization functions:" msgstr "Python 初始化函式:" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 +msgid "" +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." +"exec_prefix` instead." +msgstr "" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" +"`sys.exec_prefix`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid "" +":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " +"instead." +msgstr "" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." +"prefix`。" + #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" "The following APIs are deprecated and will be removed, although there is " @@ -5349,3 +5368,10 @@ msgid "" "interpreter, before ``site.py`` is executed. (Contributed by Łukasz Langa " "in :gh:`110769`.)" msgstr "" + +#~ msgid "" +#~ "date and datetime adapter, date and timestamp converter: see the :mod:" +#~ "`sqlite3` documentation for suggested replacement recipes." +#~ msgstr "" +#~ "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 " +#~ "(converter):請參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。"