From c4c0d587365c87623e027809ce8c1b0d5eeac64b Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2024 02:06:26 +0800 Subject: [PATCH] Sync with CPython 3.13 (#1002) --- c-api/frame.po | 43 ++- c-api/init.po | 719 +++++++++++++++++++------------------ c-api/init_config.po | 227 ++++++------ c-api/object.po | 33 +- c-api/stable.po | 74 ++-- c-api/sys.po | 6 +- c-api/type.po | 10 +- howto/gdb_helpers.po | 18 +- library/ast.po | 10 +- library/collections.po | 21 +- library/dis.po | 313 ++++++++-------- library/http.cookies.po | 8 +- library/itertools.po | 16 +- library/string.po | 299 ++++++++------- library/token.po | 18 +- library/traceback.po | 171 ++++----- library/xmlrpc.po | 10 +- reference/simple_stmts.po | 113 +++--- tutorial/datastructures.po | 98 ++++- using/ios.po | 108 +++++- whatsnew/2.6.po | 433 ++++++++++++++++++++-- whatsnew/2.7.po | 160 ++++++++- whatsnew/3.0.po | 184 +++++----- whatsnew/3.12.po | 2 +- whatsnew/3.13.po | 2 +- whatsnew/3.6.po | 4 +- whatsnew/3.7.po | 2 +- 27 files changed, 1955 insertions(+), 1147 deletions(-) diff --git a/c-api/frame.po b/c-api/frame.po index 1616a3cc27..da34208fb5 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -6,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-12-12 00:15+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-" @@ -154,34 +154,61 @@ msgid "" msgstr "" #: ../../c-api/frame.rst:134 -msgid "As part of :pep:`667`, return a proxy object for optimized scopes." +msgid "" +"As part of :pep:`667`, return an instance of :c:var:" +"`PyFrameLocalsProxy_Type`." msgstr "" #: ../../c-api/frame.rst:140 msgid "Return the line number that *frame* is currently executing." msgstr "" -#: ../../c-api/frame.rst:145 +#: ../../c-api/frame.rst:144 +msgid "Frame Locals Proxies" +msgstr "" + +#: ../../c-api/frame.rst:148 +msgid "" +"The :attr:`~frame.f_locals` attribute on a :ref:`frame object ` is an instance of a \"frame-locals proxy\". The proxy object " +"exposes a write-through view of the underlying locals dictionary for the " +"frame. This ensures that the variables exposed by ``f_locals`` are always up " +"to date with the live local variables in the frame itself." +msgstr "" + +#: ../../c-api/frame.rst:154 +msgid "See :pep:`667` for more information." +msgstr "" + +#: ../../c-api/frame.rst:158 +msgid "The type of frame :func:`locals` proxy objects." +msgstr "" + +#: ../../c-api/frame.rst:162 +msgid "Return non-zero if *obj* is a frame :func:`locals` proxy." +msgstr "" + +#: ../../c-api/frame.rst:165 msgid "Internal Frames" msgstr "" -#: ../../c-api/frame.rst:147 +#: ../../c-api/frame.rst:167 msgid "Unless using :pep:`523`, you will not need this." msgstr "" -#: ../../c-api/frame.rst:151 +#: ../../c-api/frame.rst:171 msgid "The interpreter's internal frame representation." msgstr "" -#: ../../c-api/frame.rst:157 +#: ../../c-api/frame.rst:177 msgid "Return a :term:`strong reference` to the code object for the frame." msgstr "" -#: ../../c-api/frame.rst:164 +#: ../../c-api/frame.rst:184 msgid "Return the byte offset into the last executed instruction." msgstr "" -#: ../../c-api/frame.rst:171 +#: ../../c-api/frame.rst:191 msgid "" "Return the currently executing line number, or -1 if there is no line number." msgstr "" diff --git a/c-api/init.po b/c-api/init.po index 5809d4bf46..e1c8407423 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-25 00:14+0000\n" +"POT-Creation-Date: 2024-12-12 00:15+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-" @@ -814,17 +814,28 @@ msgid "" msgstr "" #: ../../c-api/init.rst:562 +msgid "" +"Register an :mod:`atexit` callback for the target interpreter *interp*. This " +"is similar to :c:func:`Py_AtExit`, but takes an explicit interpreter and " +"data pointer for the callback." +msgstr "" + +#: ../../c-api/init.rst:566 +msgid "The :term:`GIL` must be held for *interp*." +msgstr "" + +#: ../../c-api/init.rst:571 msgid "Process-wide parameters" msgstr "" -#: ../../c-api/init.rst:572 +#: ../../c-api/init.rst:581 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "program_name` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:576 +#: ../../c-api/init.rst:585 msgid "" "This function should be called before :c:func:`Py_Initialize` is called for " "the first time, if it is called at all. It tells the interpreter the value " @@ -838,37 +849,37 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:587 ../../c-api/init.rst:829 ../../c-api/init.rst:865 -#: ../../c-api/init.rst:891 +#: ../../c-api/init.rst:596 ../../c-api/init.rst:838 ../../c-api/init.rst:874 +#: ../../c-api/init.rst:900 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" "`wchar_*` string." msgstr "" -#: ../../c-api/init.rst:595 +#: ../../c-api/init.rst:604 msgid "" "Return the program name set with :c:member:`PyConfig.program_name`, or the " "default. The returned string points into static storage; the caller should " "not modify its value." msgstr "" -#: ../../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 +#: ../../c-api/init.rst:608 ../../c-api/init.rst:630 ../../c-api/init.rst:676 +#: ../../c-api/init.rst:698 ../../c-api/init.rst:724 ../../c-api/init.rst:912 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:670 -#: ../../c-api/init.rst:692 ../../c-api/init.rst:720 ../../c-api/init.rst:906 +#: ../../c-api/init.rst:611 ../../c-api/init.rst:633 ../../c-api/init.rst:679 +#: ../../c-api/init.rst:701 ../../c-api/init.rst:729 ../../c-api/init.rst:915 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:695 +#: ../../c-api/init.rst:614 ../../c-api/init.rst:704 msgid "Get :data:`sys.executable` instead." msgstr "" -#: ../../c-api/init.rst:611 +#: ../../c-api/init.rst:620 msgid "" "Return the *prefix* for installed platform-independent files. This is " "derived through a number of complicated rules from the program name set " @@ -882,13 +893,13 @@ msgid "" "See also the next function." msgstr "" -#: ../../c-api/init.rst:627 +#: ../../c-api/init.rst:636 msgid "" "Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if :ref:`virtual " "environments ` need to be handled." msgstr "" -#: ../../c-api/init.rst:634 +#: ../../c-api/init.rst:643 msgid "" "Return the *exec-prefix* for installed platform-*dependent* files. This is " "derived through a number of complicated rules from the program name set " @@ -902,7 +913,7 @@ msgid "" "useful on Unix." msgstr "" -#: ../../c-api/init.rst:645 +#: ../../c-api/init.rst:654 msgid "" "Background: The exec-prefix differs from the prefix when platform dependent " "files (such as executables and shared libraries) are installed in a " @@ -911,7 +922,7 @@ msgid "" "independent may be installed in :file:`/usr/local`." msgstr "" -#: ../../c-api/init.rst:651 +#: ../../c-api/init.rst:660 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 " @@ -925,7 +936,7 @@ msgid "" "independent from the Python version by which they were compiled!)." msgstr "" -#: ../../c-api/init.rst:662 +#: ../../c-api/init.rst:671 msgid "" "System administrators will know how to configure the :program:`mount` or :" "program:`automount` programs to share :file:`/usr/local` between platforms " @@ -933,13 +944,13 @@ msgid "" "platform." msgstr "" -#: ../../c-api/init.rst:673 +#: ../../c-api/init.rst:682 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:683 +#: ../../c-api/init.rst:692 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 " @@ -948,7 +959,7 @@ msgid "" "available to Python code as ``sys.executable``." msgstr "" -#: ../../c-api/init.rst:705 +#: ../../c-api/init.rst:714 msgid "" "Return the default module search path; this is computed from the program " "name (set by :c:member:`PyConfig.program_name`) and some environment " @@ -961,21 +972,21 @@ msgid "" "for loading modules." msgstr "" -#: ../../c-api/init.rst:723 +#: ../../c-api/init.rst:732 msgid "Get :data:`sys.path` instead." msgstr "" -#: ../../c-api/init.rst:729 +#: ../../c-api/init.rst:738 msgid "" "Return the version of this Python interpreter. This is a string that looks " "something like ::" msgstr "" -#: ../../c-api/init.rst:732 +#: ../../c-api/init.rst:741 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:736 +#: ../../c-api/init.rst:745 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 " @@ -984,11 +995,11 @@ msgid "" "version`." msgstr "" -#: ../../c-api/init.rst:741 +#: ../../c-api/init.rst:750 msgid "See also the :c:var:`Py_Version` constant." msgstr "" -#: ../../c-api/init.rst:748 +#: ../../c-api/init.rst:757 msgid "" "Return the platform identifier for the current platform. On Unix, this is " "formed from the \"official\" name of the operating system, converted to " @@ -999,50 +1010,50 @@ msgid "" "available to Python code as ``sys.platform``." msgstr "" -#: ../../c-api/init.rst:759 +#: ../../c-api/init.rst:768 msgid "" "Return the official copyright string for the current Python version, for " "example" msgstr "" -#: ../../c-api/init.rst:761 +#: ../../c-api/init.rst:770 msgid "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" msgstr "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" -#: ../../c-api/init.rst:765 +#: ../../c-api/init.rst:774 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:771 +#: ../../c-api/init.rst:780 msgid "" "Return an indication of the compiler used to build the current Python " "version, in square brackets, for example::" msgstr "" -#: ../../c-api/init.rst:774 +#: ../../c-api/init.rst:783 msgid "\"[GCC 2.7.2.2]\"" msgstr "\"[GCC 2.7.2.2]\"" -#: ../../c-api/init.rst:778 ../../c-api/init.rst:792 +#: ../../c-api/init.rst:787 ../../c-api/init.rst:801 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:785 +#: ../../c-api/init.rst:794 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:788 +#: ../../c-api/init.rst:797 msgid "\"#67, Aug 1 1997, 22:34:28\"" msgstr "\"#67, Aug 1 1997, 22:34:28\"" -#: ../../c-api/init.rst:804 +#: ../../c-api/init.rst:813 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " @@ -1050,7 +1061,7 @@ msgid "" "config>`." msgstr "" -#: ../../c-api/init.rst:809 +#: ../../c-api/init.rst:818 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 " @@ -1061,84 +1072,84 @@ msgid "" "fatal condition is signalled using :c:func:`Py_FatalError`." msgstr "" -#: ../../c-api/init.rst:817 +#: ../../c-api/init.rst:826 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:821 +#: ../../c-api/init.rst:830 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:824 +#: ../../c-api/init.rst:833 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:832 ../../c-api/init.rst:868 +#: ../../c-api/init.rst:841 ../../c-api/init.rst:877 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:836 +#: ../../c-api/init.rst:845 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:841 +#: ../../c-api/init.rst:850 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:845 +#: ../../c-api/init.rst:854 msgid "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" msgstr "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" -#: ../../c-api/init.rst:857 +#: ../../c-api/init.rst:866 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:861 +#: ../../c-api/init.rst:870 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:871 +#: ../../c-api/init.rst:880 msgid "The *updatepath* value depends on :option:`-I`." msgstr "" -#: ../../c-api/init.rst:878 +#: ../../c-api/init.rst:887 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:882 +#: ../../c-api/init.rst:891 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:886 +#: ../../c-api/init.rst:895 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 " @@ -1146,24 +1157,24 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:899 +#: ../../c-api/init.rst:908 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:909 +#: ../../c-api/init.rst:918 msgid "" "Get :c:member:`PyConfig.home` or :envvar:`PYTHONHOME` environment variable " "instead." msgstr "改為取得 :c:member:`PyConfig.home` 或 :envvar:`PYTHONHOME` 環境變數。" -#: ../../c-api/init.rst:917 +#: ../../c-api/init.rst:926 msgid "Thread State and the Global Interpreter Lock" msgstr "" -#: ../../c-api/init.rst:924 +#: ../../c-api/init.rst:933 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 " @@ -1175,7 +1186,7 @@ msgid "" "once instead of twice." msgstr "" -#: ../../c-api/init.rst:934 +#: ../../c-api/init.rst:943 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 " @@ -1185,7 +1196,7 @@ msgid "" "a file, so that other Python threads can run in the meantime." msgstr "" -#: ../../c-api/init.rst:944 +#: ../../c-api/init.rst:953 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " "inside a data structure called :c:type:`PyThreadState`. There's also one " @@ -1193,17 +1204,17 @@ msgid "" "retrieved using :c:func:`PyThreadState_Get`." msgstr "" -#: ../../c-api/init.rst:950 +#: ../../c-api/init.rst:959 msgid "Releasing the GIL from extension code" msgstr "" -#: ../../c-api/init.rst:952 +#: ../../c-api/init.rst:961 msgid "" "Most extension code manipulating the :term:`GIL` has the following simple " "structure::" msgstr "" -#: ../../c-api/init.rst:955 +#: ../../c-api/init.rst:964 msgid "" "Save the thread state in a local variable.\n" "Release the global interpreter lock.\n" @@ -1212,29 +1223,29 @@ msgid "" "Restore the thread state from the local variable." msgstr "" -#: ../../c-api/init.rst:961 +#: ../../c-api/init.rst:970 msgid "This is so common that a pair of macros exists to simplify it::" msgstr "" -#: ../../c-api/init.rst:963 +#: ../../c-api/init.rst:972 msgid "" "Py_BEGIN_ALLOW_THREADS\n" "... Do some blocking I/O operation ...\n" "Py_END_ALLOW_THREADS" msgstr "" -#: ../../c-api/init.rst:971 +#: ../../c-api/init.rst:980 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:975 +#: ../../c-api/init.rst:984 msgid "The block above expands to the following code::" msgstr "" -#: ../../c-api/init.rst:977 +#: ../../c-api/init.rst:986 msgid "" "PyThreadState *_save;\n" "\n" @@ -1243,7 +1254,7 @@ msgid "" "PyEval_RestoreThread(_save);" msgstr "" -#: ../../c-api/init.rst:987 +#: ../../c-api/init.rst:996 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 " @@ -1254,7 +1265,7 @@ msgid "" "state, the lock must be acquired before storing the thread state pointer." msgstr "" -#: ../../c-api/init.rst:996 +#: ../../c-api/init.rst:1005 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 " @@ -1264,11 +1275,11 @@ msgid "" "compressing or hashing data." msgstr "" -#: ../../c-api/init.rst:1007 +#: ../../c-api/init.rst:1016 msgid "Non-Python created threads" msgstr "" -#: ../../c-api/init.rst:1009 +#: ../../c-api/init.rst:1018 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 " @@ -1278,7 +1289,7 @@ msgid "" "for them." msgstr "" -#: ../../c-api/init.rst:1016 +#: ../../c-api/init.rst:1025 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 " @@ -1289,14 +1300,14 @@ msgid "" "finally free the thread state data structure." msgstr "" -#: ../../c-api/init.rst:1024 +#: ../../c-api/init.rst:1033 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:1028 +#: ../../c-api/init.rst:1037 msgid "" "PyGILState_STATE gstate;\n" "gstate = PyGILState_Ensure();\n" @@ -1309,7 +1320,7 @@ msgid "" "PyGILState_Release(gstate);" msgstr "" -#: ../../c-api/init.rst:1038 +#: ../../c-api/init.rst:1047 msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " @@ -1318,11 +1329,11 @@ msgid "" "``PyGILState_*`` API is unsupported." msgstr "" -#: ../../c-api/init.rst:1048 +#: ../../c-api/init.rst:1057 msgid "Cautions about fork()" msgstr "" -#: ../../c-api/init.rst:1050 +#: ../../c-api/init.rst:1059 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 " @@ -1331,7 +1342,7 @@ msgid "" "CPython's runtime." msgstr "" -#: ../../c-api/init.rst:1056 +#: ../../c-api/init.rst:1065 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` " @@ -1348,7 +1359,7 @@ msgid "" "locks, but is not always able to." msgstr "" -#: ../../c-api/init.rst:1071 +#: ../../c-api/init.rst:1080 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 " @@ -1361,17 +1372,17 @@ msgid "" "called immediately after." msgstr "" -#: ../../c-api/init.rst:1084 +#: ../../c-api/init.rst:1093 msgid "High-level API" msgstr "高階 API" -#: ../../c-api/init.rst:1086 +#: ../../c-api/init.rst:1095 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:1091 +#: ../../c-api/init.rst:1100 msgid "" "This data structure represents the state shared by a number of cooperating " "threads. Threads belonging to the same interpreter share their module " @@ -1379,7 +1390,7 @@ msgid "" "in this structure." msgstr "" -#: ../../c-api/init.rst:1096 +#: ../../c-api/init.rst:1105 msgid "" "Threads belonging to different interpreters initially share nothing, except " "process state like available memory, open file descriptors and such. The " @@ -1387,41 +1398,41 @@ msgid "" "which interpreter they belong." msgstr "" -#: ../../c-api/init.rst:1104 +#: ../../c-api/init.rst:1113 msgid "" "This data structure represents the state of a single thread. The only " "public data member is:" msgstr "" -#: ../../c-api/init.rst:1109 +#: ../../c-api/init.rst:1118 msgid "This thread's interpreter state." msgstr "" -#: ../../c-api/init.rst:1120 +#: ../../c-api/init.rst:1129 msgid "Deprecated function which does nothing." msgstr "" -#: ../../c-api/init.rst:1122 +#: ../../c-api/init.rst:1131 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" -#: ../../c-api/init.rst:1124 +#: ../../c-api/init.rst:1133 msgid "The function now does nothing." msgstr "此函式現在不會做任何事情。" -#: ../../c-api/init.rst:1127 +#: ../../c-api/init.rst:1136 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:1131 +#: ../../c-api/init.rst:1140 msgid "" "This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -#: ../../c-api/init.rst:1141 +#: ../../c-api/init.rst:1150 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 " @@ -1429,7 +1440,7 @@ msgid "" "acquired it." msgstr "" -#: ../../c-api/init.rst:1149 +#: ../../c-api/init.rst:1158 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 " @@ -1437,8 +1448,8 @@ msgid "" "ensues." msgstr "" -#: ../../c-api/init.rst:1155 ../../c-api/init.rst:1214 -#: ../../c-api/init.rst:1499 +#: ../../c-api/init.rst:1164 ../../c-api/init.rst:1223 +#: ../../c-api/init.rst:1508 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 " @@ -1447,44 +1458,44 @@ msgid "" "avoid unwanted termination." msgstr "" -#: ../../c-api/init.rst:1163 +#: ../../c-api/init.rst:1172 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:1167 +#: ../../c-api/init.rst:1176 msgid "See also :c:func:`PyThreadState_GetUnchecked`." msgstr "也請見 :c:func:`PyThreadState_GetUnchecked`。" -#: ../../c-api/init.rst:1172 +#: ../../c-api/init.rst:1181 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:1176 +#: ../../c-api/init.rst:1185 msgid "" "In Python 3.5 to 3.12, the function was private and known as " "``_PyThreadState_UncheckedGet()``." msgstr "" -#: ../../c-api/init.rst:1183 +#: ../../c-api/init.rst:1192 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:1188 +#: ../../c-api/init.rst:1197 msgid "" "The following functions use thread-local storage, and are not compatible " "with sub-interpreters:" msgstr "" -#: ../../c-api/init.rst:1193 +#: ../../c-api/init.rst:1202 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 " @@ -1497,7 +1508,7 @@ msgid "" "is acceptable." msgstr "" -#: ../../c-api/init.rst:1203 +#: ../../c-api/init.rst:1212 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:" @@ -1507,13 +1518,13 @@ msgid "" "func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1210 +#: ../../c-api/init.rst:1219 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:1222 +#: ../../c-api/init.rst:1231 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:" @@ -1521,13 +1532,13 @@ msgid "" "caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:1227 +#: ../../c-api/init.rst:1236 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:1233 +#: ../../c-api/init.rst:1242 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 " @@ -1535,7 +1546,7 @@ msgid "" "made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1241 +#: ../../c-api/init.rst:1250 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 " @@ -1546,13 +1557,13 @@ msgid "" "otherwise behave differently." msgstr "" -#: ../../c-api/init.rst:1253 +#: ../../c-api/init.rst:1262 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:1259 +#: ../../c-api/init.rst:1268 msgid "" "This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" "``. Note that it contains an opening brace; it must be matched with a " @@ -1560,7 +1571,7 @@ msgid "" "discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1267 +#: ../../c-api/init.rst:1276 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " "contains a closing brace; it must be matched with an earlier :c:macro:" @@ -1568,40 +1579,40 @@ msgid "" "macro." msgstr "" -#: ../../c-api/init.rst:1275 +#: ../../c-api/init.rst:1284 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:1281 +#: ../../c-api/init.rst:1290 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:1287 +#: ../../c-api/init.rst:1296 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1289 +#: ../../c-api/init.rst:1298 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1291 +#: ../../c-api/init.rst:1300 msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:1297 +#: ../../c-api/init.rst:1306 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:1301 +#: ../../c-api/init.rst:1310 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_New`` with no arguments." @@ -1609,13 +1620,13 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_New``。" -#: ../../c-api/init.rst:1306 +#: ../../c-api/init.rst:1315 msgid "" "Reset all information in an interpreter state object. The global " "interpreter lock must be held." msgstr "" -#: ../../c-api/init.rst:1309 +#: ../../c-api/init.rst:1318 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_Clear`` with no arguments." @@ -1623,44 +1634,44 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1314 +#: ../../c-api/init.rst:1323 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:1321 +#: ../../c-api/init.rst:1330 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:1328 +#: ../../c-api/init.rst:1337 msgid "" "Reset all information in a thread state object. The global interpreter lock " "must be held." msgstr "" -#: ../../c-api/init.rst:1331 +#: ../../c-api/init.rst:1340 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:1344 msgid "The :c:member:`PyThreadState.on_delete` callback was removed." msgstr ":c:member:`PyThreadState.on_delete` 回呼已被移除。" -#: ../../c-api/init.rst:1341 +#: ../../c-api/init.rst:1350 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:1348 +#: ../../c-api/init.rst:1357 msgid "" "Destroy the current thread state and release the global interpreter lock. " "Like :c:func:`PyThreadState_Delete`, the global interpreter lock must be " @@ -1668,119 +1679,119 @@ msgid "" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1356 +#: ../../c-api/init.rst:1365 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1358 +#: ../../c-api/init.rst:1367 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1361 +#: ../../c-api/init.rst:1370 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1363 ../../c-api/init.rst:1372 -#: ../../c-api/init.rst:1381 +#: ../../c-api/init.rst:1372 ../../c-api/init.rst:1381 +#: ../../c-api/init.rst:1390 msgid "*tstate* must not be ``NULL``." msgstr "*tstate* 不可為 ``NULL``。" -#: ../../c-api/init.rst:1370 +#: ../../c-api/init.rst:1379 msgid "" "Get the unique thread state identifier of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1379 +#: ../../c-api/init.rst:1388 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1388 +#: ../../c-api/init.rst:1397 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1390 +#: ../../c-api/init.rst:1399 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1397 +#: ../../c-api/init.rst:1406 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1400 +#: ../../c-api/init.rst:1409 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1408 +#: ../../c-api/init.rst:1417 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1410 +#: ../../c-api/init.rst:1419 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:1413 ../../c-api/init.rst:1423 +#: ../../c-api/init.rst:1422 ../../c-api/init.rst:1432 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/init.rst:1420 +#: ../../c-api/init.rst:1429 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:1430 +#: ../../c-api/init.rst:1439 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:1434 +#: ../../c-api/init.rst:1443 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:1441 +#: ../../c-api/init.rst:1450 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1443 +#: ../../c-api/init.rst:1452 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1446 +#: ../../c-api/init.rst:1455 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1449 +#: ../../c-api/init.rst:1458 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1454 +#: ../../c-api/init.rst:1463 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1456 ../../c-api/init.rst:1464 +#: ../../c-api/init.rst:1465 ../../c-api/init.rst:1473 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1462 +#: ../../c-api/init.rst:1471 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1471 +#: ../../c-api/init.rst:1480 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 " @@ -1789,7 +1800,7 @@ msgid "" "raised and the caller should assume no current thread state is available." msgstr "" -#: ../../c-api/init.rst:1480 +#: ../../c-api/init.rst:1489 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. " @@ -1801,33 +1812,33 @@ msgid "" "raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1488 +#: ../../c-api/init.rst:1497 msgid "" "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" "`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1494 +#: ../../c-api/init.rst:1503 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:1505 +#: ../../c-api/init.rst:1514 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:1510 +#: ../../c-api/init.rst:1519 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:1516 +#: ../../c-api/init.rst:1525 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 " @@ -1836,17 +1847,17 @@ msgid "" "isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1522 +#: ../../c-api/init.rst:1531 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:1529 +#: ../../c-api/init.rst:1538 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1531 +#: ../../c-api/init.rst:1540 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 " @@ -1854,7 +1865,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1536 +#: ../../c-api/init.rst:1545 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1865,31 +1876,31 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1543 +#: ../../c-api/init.rst:1552 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:1549 +#: ../../c-api/init.rst:1558 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:1555 +#: ../../c-api/init.rst:1564 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1559 +#: ../../c-api/init.rst:1568 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:1563 +#: ../../c-api/init.rst:1572 msgid "" "If this is ``0`` then :c:member:`~PyInterpreterConfig." "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " @@ -1897,44 +1908,44 @@ msgid "" "`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1571 +#: ../../c-api/init.rst:1580 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:1575 +#: ../../c-api/init.rst:1584 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1580 +#: ../../c-api/init.rst:1589 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:1585 +#: ../../c-api/init.rst:1594 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1590 +#: ../../c-api/init.rst:1599 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:1596 +#: ../../c-api/init.rst:1605 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:1603 +#: ../../c-api/init.rst:1612 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 " @@ -1943,37 +1954,37 @@ msgid "" "`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1610 +#: ../../c-api/init.rst:1619 msgid "" "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." "use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1615 +#: ../../c-api/init.rst:1624 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1622 +#: ../../c-api/init.rst:1631 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1626 +#: ../../c-api/init.rst:1635 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1630 +#: ../../c-api/init.rst:1639 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1632 +#: ../../c-api/init.rst:1641 msgid "" "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" "`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1646 +#: ../../c-api/init.rst:1655 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " @@ -1986,13 +1997,13 @@ msgid "" "underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1656 +#: ../../c-api/init.rst:1665 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1659 +#: ../../c-api/init.rst:1668 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 " @@ -2003,7 +2014,7 @@ msgid "" "state." msgstr "" -#: ../../c-api/init.rst:1668 +#: ../../c-api/init.rst:1677 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. " @@ -2015,13 +2026,13 @@ msgid "" "released here." msgstr "" -#: ../../c-api/init.rst:1679 +#: ../../c-api/init.rst:1688 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1682 +#: ../../c-api/init.rst:1691 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2053,7 +2064,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init.rst:1697 +#: ../../c-api/init.rst:1706 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:" @@ -2061,11 +2072,11 @@ msgid "" "internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1706 +#: ../../c-api/init.rst:1715 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1708 +#: ../../c-api/init.rst:1717 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " @@ -2073,7 +2084,7 @@ msgid "" "are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1714 +#: ../../c-api/init.rst:1723 msgid "" "For modules using single-phase initialization, e.g. :c:func:" "`PyModule_Create`, the first time a particular extension is imported, it is " @@ -2085,7 +2096,7 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1725 +#: ../../c-api/init.rst:1734 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:" @@ -2095,7 +2106,7 @@ msgid "" "shared between these modules." msgstr "" -#: ../../c-api/init.rst:1745 +#: ../../c-api/init.rst:1754 msgid "" "Create a new sub-interpreter. This is essentially just a wrapper around :c:" "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " @@ -2104,7 +2115,7 @@ msgid "" "single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1757 +#: ../../c-api/init.rst:1766 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 " @@ -2114,17 +2125,17 @@ msgid "" "be held before calling this function. No GIL is held when it returns." msgstr "" -#: ../../c-api/init.rst:1765 +#: ../../c-api/init.rst:1774 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1770 +#: ../../c-api/init.rst:1779 msgid "A Per-Interpreter GIL" msgstr "" -#: ../../c-api/init.rst:1772 +#: ../../c-api/init.rst:1781 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2136,7 +2147,7 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1782 +#: ../../c-api/init.rst:1791 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2150,7 +2161,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1793 +#: ../../c-api/init.rst:1802 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2158,7 +2169,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1798 +#: ../../c-api/init.rst:1807 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2168,11 +2179,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1809 +#: ../../c-api/init.rst:1818 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1811 +#: ../../c-api/init.rst:1820 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2185,7 +2196,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1821 +#: ../../c-api/init.rst:1830 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2194,7 +2205,7 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1827 +#: ../../c-api/init.rst:1836 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " @@ -2206,25 +2217,25 @@ msgid "" "created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1838 +#: ../../c-api/init.rst:1847 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1840 +#: ../../c-api/init.rst:1849 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:1847 +#: ../../c-api/init.rst:1856 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:1851 +#: ../../c-api/init.rst:1860 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2232,17 +2243,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1856 +#: ../../c-api/init.rst:1865 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1857 +#: ../../c-api/init.rst:1866 msgid "" "with the main thread holding the :term:`global interpreter lock` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1860 +#: ../../c-api/init.rst:1869 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2250,20 +2261,20 @@ msgid "" "if the global interpreter lock is released." msgstr "" -#: ../../c-api/init.rst:1865 +#: ../../c-api/init.rst:1874 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:1868 +#: ../../c-api/init.rst:1877 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:1873 +#: ../../c-api/init.rst:1882 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 " @@ -2273,7 +2284,7 @@ msgid "" "`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1882 +#: ../../c-api/init.rst:1891 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 " @@ -2281,18 +2292,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1891 +#: ../../c-api/init.rst:1900 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1896 +#: ../../c-api/init.rst:1905 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:1900 +#: ../../c-api/init.rst:1909 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 " @@ -2302,7 +2313,7 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1910 +#: ../../c-api/init.rst:1919 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 " @@ -2314,66 +2325,66 @@ msgid "" "value of *what*:" msgstr "" -#: ../../c-api/init.rst:1919 +#: ../../c-api/init.rst:1928 msgid "Value of *what*" msgstr "" -#: ../../c-api/init.rst:1919 +#: ../../c-api/init.rst:1928 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:1921 +#: ../../c-api/init.rst:1930 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:1921 ../../c-api/init.rst:1926 -#: ../../c-api/init.rst:1937 +#: ../../c-api/init.rst:1930 ../../c-api/init.rst:1935 +#: ../../c-api/init.rst:1946 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1923 +#: ../../c-api/init.rst:1932 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1923 +#: ../../c-api/init.rst:1932 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1926 +#: ../../c-api/init.rst:1935 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1937 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1937 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1931 +#: ../../c-api/init.rst:1940 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1931 ../../c-api/init.rst:1933 -#: ../../c-api/init.rst:1935 +#: ../../c-api/init.rst:1940 ../../c-api/init.rst:1942 +#: ../../c-api/init.rst:1944 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:1933 +#: ../../c-api/init.rst:1942 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1935 +#: ../../c-api/init.rst:1944 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1937 +#: ../../c-api/init.rst:1946 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1942 +#: ../../c-api/init.rst:1951 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 " @@ -2382,7 +2393,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:1951 +#: ../../c-api/init.rst:1960 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 " @@ -2394,7 +2405,7 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:1962 +#: ../../c-api/init.rst:1971 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 " @@ -2402,31 +2413,31 @@ msgid "" "f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:1970 +#: ../../c-api/init.rst:1979 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:1976 +#: ../../c-api/init.rst:1985 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:1982 +#: ../../c-api/init.rst:1991 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:1988 +#: ../../c-api/init.rst:1997 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:1994 +#: ../../c-api/init.rst:2003 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 " @@ -2434,7 +2445,7 @@ msgid "" "attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:2002 +#: ../../c-api/init.rst:2011 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``. " @@ -2444,29 +2455,29 @@ msgid "" "`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:2009 +#: ../../c-api/init.rst:2018 msgid "See also the :func:`sys.setprofile` function." msgstr "" -#: ../../c-api/init.rst:2011 ../../c-api/init.rst:2018 -#: ../../c-api/init.rst:2037 ../../c-api/init.rst:2044 +#: ../../c-api/init.rst:2020 ../../c-api/init.rst:2027 +#: ../../c-api/init.rst:2046 ../../c-api/init.rst:2053 msgid "The caller must hold the :term:`GIL`." msgstr "呼叫者必須持有 :term:`GIL`。" -#: ../../c-api/init.rst:2015 +#: ../../c-api/init.rst:2024 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:2020 +#: ../../c-api/init.rst:2029 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:2028 +#: ../../c-api/init.rst:2037 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -2477,28 +2488,28 @@ msgid "" "*what* parameter." msgstr "" -#: ../../c-api/init.rst:2035 +#: ../../c-api/init.rst:2044 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:2041 +#: ../../c-api/init.rst:2050 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:2046 +#: ../../c-api/init.rst:2055 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:2052 +#: ../../c-api/init.rst:2061 msgid "Reference tracing" msgstr "" -#: ../../c-api/init.rst:2058 +#: ../../c-api/init.rst:2067 msgid "" "The type of the trace function registered using :c:func:" "`PyRefTracer_SetTracer`. The first parameter is a Python object that has " @@ -2508,19 +2519,19 @@ msgid "" "provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -#: ../../c-api/init.rst:2068 +#: ../../c-api/init.rst:2077 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" -#: ../../c-api/init.rst:2073 +#: ../../c-api/init.rst:2082 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been destroyed." msgstr "" -#: ../../c-api/init.rst:2078 +#: ../../c-api/init.rst:2087 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 " @@ -2529,7 +2540,7 @@ msgid "" "return ``-1`` on error." msgstr "" -#: ../../c-api/init.rst:2084 +#: ../../c-api/init.rst:2093 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 " @@ -2537,11 +2548,11 @@ msgid "" "the tracer function is called." msgstr "" -#: ../../c-api/init.rst:2089 ../../c-api/init.rst:2100 +#: ../../c-api/init.rst:2098 ../../c-api/init.rst:2109 msgid "The GIL must be held when calling this function." msgstr "" -#: ../../c-api/init.rst:2095 +#: ../../c-api/init.rst:2104 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " @@ -2549,48 +2560,48 @@ msgid "" "set the **data** pointer to NULL." msgstr "" -#: ../../c-api/init.rst:2107 +#: ../../c-api/init.rst:2116 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2112 +#: ../../c-api/init.rst:2121 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2117 +#: ../../c-api/init.rst:2126 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2122 +#: ../../c-api/init.rst:2131 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2127 +#: ../../c-api/init.rst:2136 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2133 +#: ../../c-api/init.rst:2142 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:2139 +#: ../../c-api/init.rst:2148 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:2146 +#: ../../c-api/init.rst:2155 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2150 +#: ../../c-api/init.rst:2159 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2600,19 +2611,19 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2157 +#: ../../c-api/init.rst:2166 msgid "" "The GIL does *not* need to be held when calling these functions; they supply " "their own locking." msgstr "" -#: ../../c-api/init.rst:2160 +#: ../../c-api/init.rst:2169 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:2164 +#: ../../c-api/init.rst:2173 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 " @@ -2620,22 +2631,22 @@ msgid "" "don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2172 +#: ../../c-api/init.rst:2181 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2174 +#: ../../c-api/init.rst:2183 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:2180 +#: ../../c-api/init.rst:2189 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2185 +#: ../../c-api/init.rst:2194 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 " @@ -2643,52 +2654,52 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2190 +#: ../../c-api/init.rst:2199 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:2196 +#: ../../c-api/init.rst:2205 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:2201 +#: ../../c-api/init.rst:2210 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2203 +#: ../../c-api/init.rst:2212 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:2210 +#: ../../c-api/init.rst:2219 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:2217 +#: ../../c-api/init.rst:2226 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:2223 +#: ../../c-api/init.rst:2232 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2228 +#: ../../c-api/init.rst:2237 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2230 +#: ../../c-api/init.rst:2239 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 " @@ -2696,13 +2707,13 @@ msgid "" "func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2238 +#: ../../c-api/init.rst:2247 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:2244 +#: ../../c-api/init.rst:2253 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 " @@ -2711,7 +2722,7 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2253 +#: ../../c-api/init.rst:2262 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 " @@ -2720,31 +2731,31 @@ msgid "" "key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2262 +#: ../../c-api/init.rst:2271 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:2269 +#: ../../c-api/init.rst:2278 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:2277 +#: ../../c-api/init.rst:2286 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2279 +#: ../../c-api/init.rst:2288 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2284 +#: ../../c-api/init.rst:2293 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 " @@ -2753,62 +2764,62 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2289 +#: ../../c-api/init.rst:2298 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:2300 +#: ../../c-api/init.rst:2309 msgid "Synchronization Primitives" msgstr "" -#: ../../c-api/init.rst:2302 +#: ../../c-api/init.rst:2311 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -#: ../../c-api/init.rst:2306 +#: ../../c-api/init.rst:2315 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:2309 +#: ../../c-api/init.rst:2318 msgid "PyMutex mutex = {0};" msgstr "" -#: ../../c-api/init.rst:2311 +#: ../../c-api/init.rst:2320 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:2317 +#: ../../c-api/init.rst:2326 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:2325 +#: ../../c-api/init.rst:2334 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:2333 +#: ../../c-api/init.rst:2342 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" -#: ../../c-api/init.rst:2341 +#: ../../c-api/init.rst:2350 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2343 +#: ../../c-api/init.rst:2352 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded ` CPython. They are " @@ -2816,7 +2827,7 @@ msgid "" "no-ops in versions of Python with the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:2348 +#: ../../c-api/init.rst:2357 msgid "" "Critical sections avoid deadlocks by implicitly suspending active critical " "sections and releasing the locks during calls to :c:func:" @@ -2826,7 +2837,7 @@ msgid "" "-- they are useful because their behavior is similar to the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:2355 +#: ../../c-api/init.rst:2364 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 " @@ -2834,7 +2845,7 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2362 +#: ../../c-api/init.rst:2371 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 " @@ -2843,11 +2854,11 @@ msgid "" "lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2368 +#: ../../c-api/init.rst:2377 msgid "Example usage::" msgstr "" -#: ../../c-api/init.rst:2370 +#: ../../c-api/init.rst:2379 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -2859,7 +2870,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/init.rst:2379 +#: ../../c-api/init.rst:2388 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 " @@ -2869,61 +2880,61 @@ msgid "" "`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2387 +#: ../../c-api/init.rst:2396 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2390 ../../c-api/init.rst:2404 -#: ../../c-api/init.rst:2419 ../../c-api/init.rst:2433 +#: ../../c-api/init.rst:2399 ../../c-api/init.rst:2413 +#: ../../c-api/init.rst:2428 ../../c-api/init.rst:2442 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2392 +#: ../../c-api/init.rst:2401 msgid "" "{\n" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" msgstr "" -#: ../../c-api/init.rst:2396 ../../c-api/init.rst:2425 +#: ../../c-api/init.rst:2405 ../../c-api/init.rst:2434 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2402 +#: ../../c-api/init.rst:2411 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2406 +#: ../../c-api/init.rst:2415 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" msgstr "" -#: ../../c-api/init.rst:2409 ../../c-api/init.rst:2438 +#: ../../c-api/init.rst:2418 ../../c-api/init.rst:2447 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2415 +#: ../../c-api/init.rst:2424 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:2421 +#: ../../c-api/init.rst:2430 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" msgstr "" -#: ../../c-api/init.rst:2431 +#: ../../c-api/init.rst:2440 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2435 +#: ../../c-api/init.rst:2444 msgid "" " PyCriticalSection2_End(&_py_cs2);\n" "}" @@ -2937,147 +2948,147 @@ msgstr "PyEval_InitThreads()" msgid "modules (in module sys)" msgstr "modules(sys 模組中)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:710 msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 ../../c-api/init.rst:1136 -#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:710 ../../c-api/init.rst:1145 +#: ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "sys" msgstr "sys" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:710 msgid "search" msgstr "search(搜尋)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:710 msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1702 ../../c-api/init.rst:1755 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1711 ../../c-api/init.rst:1764 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" -#: ../../c-api/init.rst:567 +#: ../../c-api/init.rst:576 msgid "Py_Initialize()" msgstr "Py_Initialize()" -#: ../../c-api/init.rst:567 ../../c-api/init.rst:799 +#: ../../c-api/init.rst:576 ../../c-api/init.rst:808 msgid "main()" msgstr "main()" -#: ../../c-api/init.rst:567 +#: ../../c-api/init.rst:576 msgid "Py_GetPath()" msgstr "Py_GetPath()" -#: ../../c-api/init.rst:680 +#: ../../c-api/init.rst:689 msgid "executable (in module sys)" msgstr "executable(sys 模組中)" -#: ../../c-api/init.rst:734 ../../c-api/init.rst:776 ../../c-api/init.rst:790 +#: ../../c-api/init.rst:743 ../../c-api/init.rst:785 ../../c-api/init.rst:799 msgid "version (in module sys)" msgstr "version(sys 模組中)" -#: ../../c-api/init.rst:746 +#: ../../c-api/init.rst:755 msgid "platform (in module sys)" msgstr "platform(sys 模組中)" -#: ../../c-api/init.rst:763 +#: ../../c-api/init.rst:772 msgid "copyright (in module sys)" msgstr "copyright(sys 模組中)" -#: ../../c-api/init.rst:799 +#: ../../c-api/init.rst:808 msgid "Py_FatalError()" msgstr "Py_FatalError()" -#: ../../c-api/init.rst:799 +#: ../../c-api/init.rst:808 msgid "argv (in module sys)" msgstr "argv(sys 模組中)" -#: ../../c-api/init.rst:919 +#: ../../c-api/init.rst:928 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../c-api/init.rst:919 +#: ../../c-api/init.rst:928 msgid "interpreter lock" msgstr "interpreter lock(直譯器鎖)" -#: ../../c-api/init.rst:919 +#: ../../c-api/init.rst:928 msgid "lock, interpreter" msgstr "lock, interpreter(鎖、直譯器)" -#: ../../c-api/init.rst:932 +#: ../../c-api/init.rst:941 msgid "setswitchinterval (in module sys)" msgstr "setswitchinterval (sys 模組中)" -#: ../../c-api/init.rst:941 +#: ../../c-api/init.rst:950 msgid "PyThreadState (C type)" msgstr "PyThreadState(C 型別)" -#: ../../c-api/init.rst:967 +#: ../../c-api/init.rst:976 msgid "Py_BEGIN_ALLOW_THREADS (C macro)" msgstr "Py_BEGIN_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:967 +#: ../../c-api/init.rst:976 msgid "Py_END_ALLOW_THREADS (C macro)" msgstr "Py_END_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:983 +#: ../../c-api/init.rst:992 msgid "PyEval_RestoreThread (C function)" msgstr "PyEval_RestoreThread(C 函式)" -#: ../../c-api/init.rst:983 +#: ../../c-api/init.rst:992 msgid "PyEval_SaveThread (C function)" msgstr "PyEval_SaveThread(C 函式)" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1123 msgid "PyEval_AcquireThread()" msgstr "PyEval_AcquireThread()" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1123 msgid "PyEval_ReleaseThread()" msgstr "PyEval_ReleaseThread()" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1123 msgid "PyEval_SaveThread()" msgstr "PyEval_SaveThread()" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1123 msgid "PyEval_RestoreThread()" msgstr "PyEval_RestoreThread()" -#: ../../c-api/init.rst:1136 +#: ../../c-api/init.rst:1145 msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1702 +#: ../../c-api/init.rst:1711 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1732 +#: ../../c-api/init.rst:1741 msgid "close (in module os)" msgstr "close(os 模組中)" diff --git a/c-api/init_config.po b/c-api/init_config.po index 5293b616d7..a8fedbc984 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -8,7 +8,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-12-11 00:14+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-" @@ -479,7 +479,7 @@ msgstr "" #: ../../c-api/init_config.rst:952 ../../c-api/init_config.rst:1012 #: ../../c-api/init_config.rst:1064 ../../c-api/init_config.rst:1126 #: ../../c-api/init_config.rst:1180 ../../c-api/init_config.rst:1209 -#: ../../c-api/init_config.rst:1298 +#: ../../c-api/init_config.rst:1309 msgid "Default: ``0``." msgstr "預設:``0``。" @@ -573,7 +573,7 @@ msgid "" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: ../../c-api/init_config.rst:401 ../../c-api/init_config.rst:1359 +#: ../../c-api/init_config.rst:401 ../../c-api/init_config.rst:1370 msgid "" "The caller is responsible to handle exceptions (error or exit) using :c:func:" "`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." @@ -902,7 +902,7 @@ msgid "stdin is always opened in buffered mode." msgstr "" #: ../../c-api/init_config.rst:645 ../../c-api/init_config.rst:678 -#: ../../c-api/init_config.rst:1197 ../../c-api/init_config.rst:1330 +#: ../../c-api/init_config.rst:1197 ../../c-api/init_config.rst:1341 msgid "Default: ``1``." msgstr "預設值:``1``。" @@ -1215,7 +1215,7 @@ msgid "Install Python signal handlers?" msgstr "" #: ../../c-api/init_config.rst:863 ../../c-api/init_config.rst:1047 -#: ../../c-api/init_config.rst:1071 ../../c-api/init_config.rst:1282 +#: ../../c-api/init_config.rst:1071 ../../c-api/init_config.rst:1293 msgid "Default: ``1`` in Python mode, ``0`` in isolated mode." msgstr "" @@ -1434,8 +1434,8 @@ msgid "" "`Py_GetArgcArgv` function." msgstr "" -#: ../../c-api/init_config.rst:1029 ../../c-api/init_config.rst:1317 -#: ../../c-api/init_config.rst:1336 +#: ../../c-api/init_config.rst:1029 ../../c-api/init_config.rst:1328 +#: ../../c-api/init_config.rst:1347 msgid "Default: empty list." msgstr "" @@ -1740,88 +1740,101 @@ msgid "Set to ``0`` by the :option:`-E` environment variable." msgstr "" #: ../../c-api/init_config.rst:1276 +msgid "" +"If non-zero, ``stdout`` and ``stderr`` will be redirected to the system log." +msgstr "" + +#: ../../c-api/init_config.rst:1279 +msgid "Only available on macOS 10.12 and later, and on iOS." +msgstr "" + +#: ../../c-api/init_config.rst:1281 +msgid "Default: ``0`` (don't use system log)." +msgstr "" + +#: ../../c-api/init_config.rst:1287 msgid "If non-zero, add the user site directory to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1278 +#: ../../c-api/init_config.rst:1289 msgid "Set to ``0`` by the :option:`-s` and :option:`-I` command line options." msgstr "" -#: ../../c-api/init_config.rst:1280 +#: ../../c-api/init_config.rst:1291 msgid "Set to ``0`` by the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1286 +#: ../../c-api/init_config.rst:1297 msgid "" "Verbose mode. If greater than ``0``, print a message each time a module is " "imported, showing the place (filename or built-in module) from which it is " "loaded." msgstr "" -#: ../../c-api/init_config.rst:1290 +#: ../../c-api/init_config.rst:1301 msgid "" "If greater than or equal to ``2``, print a message for each file that is " "checked for when searching for a module. Also provides information on module " "cleanup at exit." msgstr "" -#: ../../c-api/init_config.rst:1294 +#: ../../c-api/init_config.rst:1305 msgid "Incremented by the :option:`-v` command line option." msgstr "" -#: ../../c-api/init_config.rst:1296 +#: ../../c-api/init_config.rst:1307 msgid "Set by the :envvar:`PYTHONVERBOSE` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:1302 +#: ../../c-api/init_config.rst:1313 msgid "" "Options of the :mod:`warnings` module to build warnings filters, lowest to " "highest priority: :data:`sys.warnoptions`." msgstr "" -#: ../../c-api/init_config.rst:1305 +#: ../../c-api/init_config.rst:1316 msgid "" "The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse " "order: the last :c:member:`PyConfig.warnoptions` item becomes the first item " "of :data:`warnings.filters` which is checked first (highest priority)." msgstr "" -#: ../../c-api/init_config.rst:1310 +#: ../../c-api/init_config.rst:1321 msgid "" "The :option:`-W` command line options adds its value to :c:member:`~PyConfig." "warnoptions`, it can be used multiple times." msgstr "" -#: ../../c-api/init_config.rst:1313 +#: ../../c-api/init_config.rst:1324 msgid "" "The :envvar:`PYTHONWARNINGS` environment variable can also be used to add " "warning options. Multiple options can be specified, separated by commas (``," "``)." msgstr "" -#: ../../c-api/init_config.rst:1321 +#: ../../c-api/init_config.rst:1332 msgid "" "If equal to ``0``, Python won't try to write ``.pyc`` files on the import of " "source modules." msgstr "" -#: ../../c-api/init_config.rst:1324 +#: ../../c-api/init_config.rst:1335 msgid "" "Set to ``0`` by the :option:`-B` command line option and the :envvar:" "`PYTHONDONTWRITEBYTECODE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1327 +#: ../../c-api/init_config.rst:1338 msgid "" ":data:`sys.dont_write_bytecode` is initialized to the inverted value of :c:" "member:`~PyConfig.write_bytecode`." msgstr "" -#: ../../c-api/init_config.rst:1334 +#: ../../c-api/init_config.rst:1345 msgid "Values of the :option:`-X` command line options: :data:`sys._xoptions`." msgstr "" -#: ../../c-api/init_config.rst:1338 +#: ../../c-api/init_config.rst:1349 msgid "" "If :c:member:`~PyConfig.parse_argv` is non-zero, :c:member:`~PyConfig.argv` " "arguments are parsed the same way the regular Python parses :ref:`command " @@ -1829,27 +1842,27 @@ msgid "" "c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:1343 +#: ../../c-api/init_config.rst:1354 msgid "" "The :c:member:`~PyConfig.xoptions` options are parsed to set other options: " "see the :option:`-X` command line option." msgstr "" -#: ../../c-api/init_config.rst:1348 +#: ../../c-api/init_config.rst:1359 msgid "The ``show_alloc_count`` field has been removed." msgstr "" -#: ../../c-api/init_config.rst:1354 +#: ../../c-api/init_config.rst:1365 msgid "Initialization with PyConfig" msgstr "" -#: ../../c-api/init_config.rst:1356 +#: ../../c-api/init_config.rst:1367 msgid "" "Initializing the interpreter from a populated configuration struct is " "handled by calling :c:func:`Py_InitializeFromConfig`." msgstr "" -#: ../../c-api/init_config.rst:1362 +#: ../../c-api/init_config.rst:1373 msgid "" "If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` or :c:" "func:`PyImport_ExtendInittab` are used, they must be set or called after " @@ -1858,17 +1871,17 @@ msgid "" "`PyImport_ExtendInittab` must be called before each Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1369 +#: ../../c-api/init_config.rst:1380 msgid "" "The current configuration (``PyConfig`` type) is stored in " "``PyInterpreterState.config``." msgstr "" -#: ../../c-api/init_config.rst:1372 +#: ../../c-api/init_config.rst:1383 msgid "Example setting the program name::" msgstr "" -#: ../../c-api/init_config.rst:1374 +#: ../../c-api/init_config.rst:1385 msgid "" "void init_python(void)\n" "{\n" @@ -1922,7 +1935,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init_config.rst:1400 +#: ../../c-api/init_config.rst:1411 msgid "" "More complete example modifying the default configuration, read the " "configuration, and then override some parameters. Note that since 3.11, many " @@ -1931,7 +1944,7 @@ msgid "" "called will be left unchanged by initialization::" msgstr "" -#: ../../c-api/init_config.rst:1407 +#: ../../c-api/init_config.rst:1418 msgid "" "PyStatus init_python(const char *program_name)\n" "{\n" @@ -1986,18 +1999,18 @@ msgid "" "}" msgstr "" -#: ../../c-api/init_config.rst:1463 +#: ../../c-api/init_config.rst:1474 msgid "Isolated Configuration" msgstr "" -#: ../../c-api/init_config.rst:1465 +#: ../../c-api/init_config.rst:1476 msgid "" ":c:func:`PyPreConfig_InitIsolatedConfig` and :c:func:" "`PyConfig_InitIsolatedConfig` functions create a configuration to isolate " "Python from the system. For example, to embed Python into an application." msgstr "" -#: ../../c-api/init_config.rst:1470 +#: ../../c-api/init_config.rst:1481 msgid "" "This configuration ignores global configuration variables, environment " "variables, command line arguments (:c:member:`PyConfig.argv` is not parsed) " @@ -2005,115 +2018,115 @@ msgid "" "LC_CTYPE locale are left unchanged. Signal handlers are not installed." msgstr "" -#: ../../c-api/init_config.rst:1475 +#: ../../c-api/init_config.rst:1486 msgid "" "Configuration files are still used with this configuration to determine " "paths that are unspecified. Ensure :c:member:`PyConfig.home` is specified to " "avoid computing the default path configuration." msgstr "" -#: ../../c-api/init_config.rst:1483 +#: ../../c-api/init_config.rst:1494 msgid "Python Configuration" msgstr "" -#: ../../c-api/init_config.rst:1485 +#: ../../c-api/init_config.rst:1496 msgid "" ":c:func:`PyPreConfig_InitPythonConfig` and :c:func:" "`PyConfig_InitPythonConfig` functions create a configuration to build a " "customized Python which behaves as the regular Python." msgstr "" -#: ../../c-api/init_config.rst:1489 +#: ../../c-api/init_config.rst:1500 msgid "" "Environments variables and command line arguments are used to configure " "Python, whereas global configuration variables are ignored." msgstr "" -#: ../../c-api/init_config.rst:1492 +#: ../../c-api/init_config.rst:1503 msgid "" "This function enables C locale coercion (:pep:`538`) and :ref:`Python UTF-8 " "Mode ` (:pep:`540`) depending on the LC_CTYPE locale, :envvar:" "`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment variables." msgstr "" -#: ../../c-api/init_config.rst:1501 +#: ../../c-api/init_config.rst:1512 msgid "Python Path Configuration" msgstr "" -#: ../../c-api/init_config.rst:1503 +#: ../../c-api/init_config.rst:1514 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1505 +#: ../../c-api/init_config.rst:1516 msgid "Path configuration inputs:" msgstr "" -#: ../../c-api/init_config.rst:1507 +#: ../../c-api/init_config.rst:1518 msgid ":c:member:`PyConfig.home`" msgstr ":c:member:`PyConfig.home`" -#: ../../c-api/init_config.rst:1508 +#: ../../c-api/init_config.rst:1519 msgid ":c:member:`PyConfig.platlibdir`" msgstr ":c:member:`PyConfig.platlibdir`" -#: ../../c-api/init_config.rst:1509 +#: ../../c-api/init_config.rst:1520 msgid ":c:member:`PyConfig.pathconfig_warnings`" msgstr ":c:member:`PyConfig.pathconfig_warnings`" -#: ../../c-api/init_config.rst:1510 +#: ../../c-api/init_config.rst:1521 msgid ":c:member:`PyConfig.program_name`" msgstr ":c:member:`PyConfig.program_name`" -#: ../../c-api/init_config.rst:1511 +#: ../../c-api/init_config.rst:1522 msgid ":c:member:`PyConfig.pythonpath_env`" msgstr ":c:member:`PyConfig.pythonpath_env`" -#: ../../c-api/init_config.rst:1512 +#: ../../c-api/init_config.rst:1523 msgid "current working directory: to get absolute paths" msgstr "" -#: ../../c-api/init_config.rst:1513 +#: ../../c-api/init_config.rst:1524 msgid "" "``PATH`` environment variable to get the program full path (from :c:member:" "`PyConfig.program_name`)" msgstr "" -#: ../../c-api/init_config.rst:1515 +#: ../../c-api/init_config.rst:1526 msgid "``__PYVENV_LAUNCHER__`` environment variable" msgstr "``__PYVENV_LAUNCHER__`` 環境變數" -#: ../../c-api/init_config.rst:1516 +#: ../../c-api/init_config.rst:1527 msgid "" "(Windows only) Application paths in the registry under " "\"Software\\Python\\PythonCore\\X.Y\\PythonPath\" of HKEY_CURRENT_USER and " "HKEY_LOCAL_MACHINE (where X.Y is the Python version)." msgstr "" -#: ../../c-api/init_config.rst:1520 +#: ../../c-api/init_config.rst:1531 msgid "Path configuration output fields:" msgstr "" -#: ../../c-api/init_config.rst:1522 +#: ../../c-api/init_config.rst:1533 msgid ":c:member:`PyConfig.base_exec_prefix`" msgstr ":c:member:`PyConfig.base_exec_prefix`" -#: ../../c-api/init_config.rst:1523 +#: ../../c-api/init_config.rst:1534 msgid ":c:member:`PyConfig.base_executable`" msgstr ":c:member:`PyConfig.base_executable`" -#: ../../c-api/init_config.rst:1524 +#: ../../c-api/init_config.rst:1535 msgid ":c:member:`PyConfig.base_prefix`" msgstr ":c:member:`PyConfig.base_prefix`" -#: ../../c-api/init_config.rst:1525 +#: ../../c-api/init_config.rst:1536 msgid ":c:member:`PyConfig.exec_prefix`" msgstr ":c:member:`PyConfig.exec_prefix`" -#: ../../c-api/init_config.rst:1526 +#: ../../c-api/init_config.rst:1537 msgid ":c:member:`PyConfig.executable`" msgstr ":c:member:`PyConfig.executable`" -#: ../../c-api/init_config.rst:1527 +#: ../../c-api/init_config.rst:1538 msgid "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" @@ -2121,11 +2134,11 @@ msgstr "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" -#: ../../c-api/init_config.rst:1529 +#: ../../c-api/init_config.rst:1540 msgid ":c:member:`PyConfig.prefix`" msgstr ":c:member:`PyConfig.prefix`" -#: ../../c-api/init_config.rst:1531 +#: ../../c-api/init_config.rst:1542 msgid "" "If at least one \"output field\" is not set, Python calculates the path " "configuration to fill unset fields. If :c:member:`~PyConfig." @@ -2134,7 +2147,7 @@ msgid "" "module_search_paths_set` is set to ``1``." msgstr "" -#: ../../c-api/init_config.rst:1537 +#: ../../c-api/init_config.rst:1548 msgid "" "It is possible to completely ignore the function calculating the default " "path configuration by setting explicitly all path configuration output " @@ -2144,52 +2157,52 @@ msgid "" "modification." msgstr "" -#: ../../c-api/init_config.rst:1544 +#: ../../c-api/init_config.rst:1555 msgid "" "Set :c:member:`~PyConfig.pathconfig_warnings` to ``0`` to suppress warnings " "when calculating the path configuration (Unix only, Windows does not log any " "warning)." msgstr "" -#: ../../c-api/init_config.rst:1547 +#: ../../c-api/init_config.rst:1558 msgid "" "If :c:member:`~PyConfig.base_prefix` or :c:member:`~PyConfig." "base_exec_prefix` fields are not set, they inherit their value from :c:" "member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` respectively." msgstr "" -#: ../../c-api/init_config.rst:1551 +#: ../../c-api/init_config.rst:1562 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" msgstr "" -#: ../../c-api/init_config.rst:1553 +#: ../../c-api/init_config.rst:1564 msgid "" "If :c:member:`~PyConfig.run_filename` is set and is a directory which " "contains a ``__main__.py`` script, prepend :c:member:`~PyConfig." "run_filename` to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1556 +#: ../../c-api/init_config.rst:1567 msgid "If :c:member:`~PyConfig.isolated` is zero:" msgstr "如果 :c:member:`~PyConfig.isolated` 為零:" -#: ../../c-api/init_config.rst:1558 +#: ../../c-api/init_config.rst:1569 msgid "" "If :c:member:`~PyConfig.run_module` is set, prepend the current directory " "to :data:`sys.path`. Do nothing if the current directory cannot be read." msgstr "" -#: ../../c-api/init_config.rst:1560 +#: ../../c-api/init_config.rst:1571 msgid "" "If :c:member:`~PyConfig.run_filename` is set, prepend the directory of the " "filename to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1562 +#: ../../c-api/init_config.rst:1573 msgid "Otherwise, prepend an empty string to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1564 +#: ../../c-api/init_config.rst:1575 msgid "" "If :c:member:`~PyConfig.site_import` is non-zero, :data:`sys.path` can be " "modified by the :mod:`site` module. If :c:member:`~PyConfig." @@ -2198,143 +2211,143 @@ msgid "" "data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1570 +#: ../../c-api/init_config.rst:1581 msgid "The following configuration files are used by the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1572 +#: ../../c-api/init_config.rst:1583 msgid "``pyvenv.cfg``" msgstr "``pyvenv.cfg``" -#: ../../c-api/init_config.rst:1573 +#: ../../c-api/init_config.rst:1584 msgid "``._pth`` file (ex: ``python._pth``)" msgstr "" -#: ../../c-api/init_config.rst:1574 +#: ../../c-api/init_config.rst:1585 msgid "``pybuilddir.txt`` (Unix only)" msgstr "``pybuilddir.txt``\\ (僅限 Unix)" -#: ../../c-api/init_config.rst:1576 +#: ../../c-api/init_config.rst:1587 msgid "If a ``._pth`` file is present:" msgstr "" -#: ../../c-api/init_config.rst:1578 +#: ../../c-api/init_config.rst:1589 msgid "Set :c:member:`~PyConfig.isolated` to ``1``." msgstr "將 :c:member:`~PyConfig.isolated` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1579 +#: ../../c-api/init_config.rst:1590 msgid "Set :c:member:`~PyConfig.use_environment` to ``0``." msgstr "將 :c:member:`~PyConfig.use_environment` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1580 +#: ../../c-api/init_config.rst:1591 msgid "Set :c:member:`~PyConfig.site_import` to ``0``." msgstr "將 :c:member:`~PyConfig.site_import` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1581 +#: ../../c-api/init_config.rst:1592 msgid "Set :c:member:`~PyConfig.safe_path` to ``1``." msgstr "將 :c:member:`~PyConfig.safe_path` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1583 +#: ../../c-api/init_config.rst:1594 msgid "" "The ``__PYVENV_LAUNCHER__`` environment variable is used to set :c:member:" "`PyConfig.base_executable`." msgstr "" -#: ../../c-api/init_config.rst:1588 +#: ../../c-api/init_config.rst:1599 msgid "Py_GetArgcArgv()" msgstr "Py_GetArgcArgv()" -#: ../../c-api/init_config.rst:1592 +#: ../../c-api/init_config.rst:1603 msgid "Get the original command line arguments, before Python modified them." msgstr "" -#: ../../c-api/init_config.rst:1594 +#: ../../c-api/init_config.rst:1605 msgid "See also :c:member:`PyConfig.orig_argv` member." msgstr "也請參與 :c:member:`PyConfig.orig_argv` 成員。" -#: ../../c-api/init_config.rst:1598 +#: ../../c-api/init_config.rst:1609 msgid "Multi-Phase Initialization Private Provisional API" msgstr "" -#: ../../c-api/init_config.rst:1600 +#: ../../c-api/init_config.rst:1611 msgid "" "This section is a private provisional API introducing multi-phase " "initialization, the core feature of :pep:`432`:" msgstr "" -#: ../../c-api/init_config.rst:1603 +#: ../../c-api/init_config.rst:1614 msgid "\"Core\" initialization phase, \"bare minimum Python\":" msgstr "" -#: ../../c-api/init_config.rst:1605 +#: ../../c-api/init_config.rst:1616 msgid "Builtin types;" msgstr "內建型別;" -#: ../../c-api/init_config.rst:1606 +#: ../../c-api/init_config.rst:1617 msgid "Builtin exceptions;" msgstr "內建例外;" -#: ../../c-api/init_config.rst:1607 +#: ../../c-api/init_config.rst:1618 msgid "Builtin and frozen modules;" msgstr "" -#: ../../c-api/init_config.rst:1608 +#: ../../c-api/init_config.rst:1619 msgid "" "The :mod:`sys` module is only partially initialized (ex: :data:`sys.path` " "doesn't exist yet)." msgstr "" -#: ../../c-api/init_config.rst:1611 +#: ../../c-api/init_config.rst:1622 msgid "\"Main\" initialization phase, Python is fully initialized:" msgstr "" -#: ../../c-api/init_config.rst:1613 +#: ../../c-api/init_config.rst:1624 msgid "Install and configure :mod:`importlib`;" msgstr "" -#: ../../c-api/init_config.rst:1614 +#: ../../c-api/init_config.rst:1625 msgid "Apply the :ref:`Path Configuration `;" msgstr "" -#: ../../c-api/init_config.rst:1615 +#: ../../c-api/init_config.rst:1626 msgid "Install signal handlers;" msgstr "" -#: ../../c-api/init_config.rst:1616 +#: ../../c-api/init_config.rst:1627 msgid "" "Finish :mod:`sys` module initialization (ex: create :data:`sys.stdout` and :" "data:`sys.path`);" msgstr "" -#: ../../c-api/init_config.rst:1618 +#: ../../c-api/init_config.rst:1629 msgid "" "Enable optional features like :mod:`faulthandler` and :mod:`tracemalloc`;" msgstr "" -#: ../../c-api/init_config.rst:1619 +#: ../../c-api/init_config.rst:1630 msgid "Import the :mod:`site` module;" msgstr "引入 :mod:`site` 模組;" -#: ../../c-api/init_config.rst:1620 +#: ../../c-api/init_config.rst:1631 msgid "etc." msgstr "" -#: ../../c-api/init_config.rst:1622 +#: ../../c-api/init_config.rst:1633 msgid "Private provisional API:" msgstr "" -#: ../../c-api/init_config.rst:1624 +#: ../../c-api/init_config.rst:1635 msgid "" ":c:member:`PyConfig._init_main`: if set to ``0``, :c:func:" "`Py_InitializeFromConfig` stops at the \"Core\" initialization phase." msgstr "" -#: ../../c-api/init_config.rst:1629 +#: ../../c-api/init_config.rst:1640 msgid "" "Move to the \"Main\" initialization phase, finish the Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1631 +#: ../../c-api/init_config.rst:1642 msgid "" "No module is imported during the \"Core\" phase and the ``importlib`` module " "is not configured: the :ref:`Path Configuration ` is only " @@ -2343,14 +2356,14 @@ msgid "" "maybe install a custom :data:`sys.meta_path` importer or an import hook, etc." msgstr "" -#: ../../c-api/init_config.rst:1637 +#: ../../c-api/init_config.rst:1648 msgid "" "It may become possible to calculate the :ref:`Path Configuration ` in Python, after the Core phase and before the Main phase, which is " "one of the :pep:`432` motivation." msgstr "" -#: ../../c-api/init_config.rst:1641 +#: ../../c-api/init_config.rst:1652 msgid "" "The \"Core\" phase is not properly defined: what should be and what should " "not be available at this phase is not specified yet. The API is marked as " @@ -2358,13 +2371,13 @@ msgid "" "until a proper public API is designed." msgstr "" -#: ../../c-api/init_config.rst:1646 +#: ../../c-api/init_config.rst:1657 msgid "" "Example running Python code between \"Core\" and \"Main\" initialization " "phases::" msgstr "" -#: ../../c-api/init_config.rst:1649 +#: ../../c-api/init_config.rst:1660 msgid "" "void init_python(void)\n" "{\n" diff --git a/c-api/object.po b/c-api/object.po index d557e3d5c6..5898ca290c 100644 --- a/c-api/object.po +++ b/c-api/object.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-12-14 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -623,6 +623,13 @@ msgstr "" #: ../../c-api/object.rst:514 msgid "" +"This is equivalent to the Python ``__iter__(self): return self`` method. It " +"is intended for :term:`iterator` types, to be used in the :c:member:" +"`PyTypeObject.tp_iter` slot." +msgstr "" + +#: ../../c-api/object.rst:520 +msgid "" "This is the equivalent to the Python expression ``aiter(o)``. Takes an :" "class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " "This is typically a new iterator but if the argument is an :class:" @@ -630,67 +637,67 @@ msgid "" "``NULL`` if the object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:524 +#: ../../c-api/object.rst:530 msgid "Get a pointer to subclass-specific data reserved for *cls*." msgstr "" -#: ../../c-api/object.rst:526 +#: ../../c-api/object.rst:532 msgid "" "The object *o* must be an instance of *cls*, and *cls* must have been " "created using negative :c:member:`PyType_Spec.basicsize`. Python does not " "check this." msgstr "" -#: ../../c-api/object.rst:530 +#: ../../c-api/object.rst:536 msgid "On error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/object.rst:536 +#: ../../c-api/object.rst:542 msgid "" "Return the size of the instance memory space reserved for *cls*, i.e. the " "size of the memory :c:func:`PyObject_GetTypeData` returns." msgstr "" -#: ../../c-api/object.rst:539 +#: ../../c-api/object.rst:545 msgid "" "This may be larger than requested using :c:member:`-PyType_Spec.basicsize " "`; it is safe to use this larger size (e.g. with :c:" "func:`!memset`)." msgstr "" -#: ../../c-api/object.rst:542 +#: ../../c-api/object.rst:548 msgid "" "The type *cls* **must** have been created using negative :c:member:" "`PyType_Spec.basicsize`. Python does not check this." msgstr "" -#: ../../c-api/object.rst:546 +#: ../../c-api/object.rst:552 msgid "On error, set an exception and return a negative value." msgstr "" -#: ../../c-api/object.rst:552 +#: ../../c-api/object.rst:558 msgid "" "Get a pointer to per-item data for a class with :c:macro:" "`Py_TPFLAGS_ITEMS_AT_END`." msgstr "" -#: ../../c-api/object.rst:555 +#: ../../c-api/object.rst:561 msgid "" "On error, set an exception and return ``NULL``. :py:exc:`TypeError` is " "raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." msgstr "" -#: ../../c-api/object.rst:563 +#: ../../c-api/object.rst:569 msgid "Visit the managed dictionary of *obj*." msgstr "" -#: ../../c-api/object.rst:565 ../../c-api/object.rst:574 +#: ../../c-api/object.rst:571 ../../c-api/object.rst:580 msgid "" "This function must only be called in a traverse function of the type which " "has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." msgstr "" -#: ../../c-api/object.rst:572 +#: ../../c-api/object.rst:578 msgid "Clear the managed dictionary of *obj*." msgstr "" diff --git a/c-api/stable.po b/c-api/stable.po index 919634426e..5aa8323e0c 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-19 00:03+0000\n" +"POT-Creation-Date: 2024-12-04 00:14+0000\n" "PO-Revision-Date: 2023-01-24 21:07+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -134,13 +134,13 @@ msgstr "受限 C API" #: ../../c-api/stable.rst:67 msgid "" "Python 3.2 introduced the *Limited API*, a subset of Python's C API. " -"Extensions that only use the Limited API can be compiled once and work with " -"multiple versions of Python. Contents of the Limited API are :ref:`listed " +"Extensions that only use the Limited API can be compiled once and be loaded " +"on multiple versions of Python. Contents of the Limited API are :ref:`listed " "below `." msgstr "" "Python 3.2 引入了\\ *受限 API (Limited API)*,它是 Python C API 的一個子集。" -"僅使用受限 API 的擴充可以只編譯一次就使用於多個版本的 Python。受限 API 的內容" -"\\ :ref:`列在下方 `。" +"僅使用受限 API 的擴充可以只編譯一次就被載入於多個版本的 Python。受限 API 的內" +"容\\ :ref:`列在下方 `。" #: ../../c-api/stable.rst:74 msgid "" @@ -153,13 +153,12 @@ msgstr "" msgid "" "Define ``Py_LIMITED_API`` to the value of :c:macro:`PY_VERSION_HEX` " "corresponding to the lowest Python version your extension supports. The " -"extension will work without recompilation with all Python 3 releases from " -"the specified one onward, and can use Limited API introduced up to that " -"version." +"extension will be ABI-compatible with all Python 3 releases from the " +"specified one onward, and can use Limited API introduced up to that version." msgstr "" "將 ``Py_LIMITED_API`` 定義為對應於你的擴充有支援的最低 Python 版本的 :c:" -"macro:`PY_VERSION_HEX` 值。該擴充無需重新編譯即可與從指定版本開始的所有 " -"Python 3 版本一起使用,並且可以使用過去版本有引入的受限 API。" +"macro:`PY_VERSION_HEX` 值。該擴充與從指定版本開始的所有 Python 3 版本之 ABI " +"相容,並且可以使用過去版本有引入的受限 API。" #: ../../c-api/stable.rst:83 msgid "" @@ -186,12 +185,21 @@ msgstr "穩定 ABI" #: ../../c-api/stable.rst:96 msgid "" "To enable this, Python provides a *Stable ABI*: a set of symbols that will " -"remain compatible across Python 3.x versions." +"remain ABI-compatible across Python 3.x versions." msgstr "" "為了實現它,Python 提供了一個\\ *穩定 ABI (Stable ABI)*:一組將在各個 Python " -"3.x 版本之間保持相容的符號。" +"3.x 版本之間保持 ABI 相容的符號。" -#: ../../c-api/stable.rst:99 +#: ../../c-api/stable.rst:101 +msgid "" +"The Stable ABI prevents ABI issues, like linker errors due to missing " +"symbols or data corruption due to changes in structure layouts or function " +"signatures. However, other changes in Python can change the *behavior* of " +"extensions. See Python's Backwards Compatibility Policy (:pep:`387`) for " +"details." +msgstr "" + +#: ../../c-api/stable.rst:107 msgid "" "The Stable ABI contains symbols exposed in the :ref:`Limited API `, but also other ones – for example, functions necessary to support " @@ -200,7 +208,7 @@ msgstr "" "穩定 ABI 被包含在\\ :ref:`受限 API ` 中開放的符號,但也包含其" "他符號 - 例如,支援舊版受限 API 所必需的函式。" -#: ../../c-api/stable.rst:103 +#: ../../c-api/stable.rst:111 msgid "" "On Windows, extensions that use the Stable ABI should be linked against " "``python3.dll`` rather than a version-specific library such as ``python39." @@ -209,7 +217,7 @@ msgstr "" "在 Windows 上,使用穩定 ABI 的擴充應該連接到 ``python3.dll`` 而不是特定版本的" "函式庫,例如 ``python39.dll``。" -#: ../../c-api/stable.rst:107 +#: ../../c-api/stable.rst:115 msgid "" "On some platforms, Python will look for and load shared library files named " "with the ``abi3`` tag (e.g. ``mymodule.abi3.so``). It does not check if such " @@ -222,7 +230,7 @@ msgstr "" "用者(或者打包工具)身上,例如使用 3.10+ 受限 API 建置的擴充不會為較低版本的 " "Python 所安裝。" -#: ../../c-api/stable.rst:114 +#: ../../c-api/stable.rst:122 msgid "" "All functions in the Stable ABI are present as functions in Python's shared " "library, not solely as macros. This makes them usable from languages that " @@ -231,18 +239,18 @@ msgstr "" "穩定 ABI 中的所有函式都作為函式存在於 Python 的共享函式庫中,而不僅是作為巨" "集。這使得它們可被用於不使用 C 預處理器 (preprocessor) 的語言。" -#: ../../c-api/stable.rst:120 +#: ../../c-api/stable.rst:128 msgid "Limited API Scope and Performance" msgstr "受限 API 範圍和性能" -#: ../../c-api/stable.rst:122 +#: ../../c-api/stable.rst:130 msgid "" "The goal for the Limited API is to allow everything that is possible with " "the full C API, but possibly with a performance penalty." msgstr "" "受限 API 的目標是允許使用完整的 C API 進行所有可能的操作,但可能會降低性能。" -#: ../../c-api/stable.rst:125 +#: ../../c-api/stable.rst:133 msgid "" "For example, while :c:func:`PyList_GetItem` is available, its “unsafe” macro " "variant :c:func:`PyList_GET_ITEM` is not. The macro can be faster because it " @@ -252,7 +260,7 @@ msgstr "" "`PyList_GET_ITEM` 為不可用。巨集運行可以更快,因為它可以依賴 list 物件的特定" "版本實作細節。" -#: ../../c-api/stable.rst:130 +#: ../../c-api/stable.rst:138 msgid "" "Without ``Py_LIMITED_API`` defined, some C API functions are inlined or " "replaced by macros. Defining ``Py_LIMITED_API`` disables this inlining, " @@ -263,7 +271,7 @@ msgstr "" "``Py_LIMITED_API`` 會禁用嵌入,從而隨著 Python 資料結構的改進而提高穩定性,但" "可能會降低性能。" -#: ../../c-api/stable.rst:135 +#: ../../c-api/stable.rst:143 msgid "" "By leaving out the ``Py_LIMITED_API`` definition, it is possible to compile " "a Limited API extension with a version-specific ABI. This can improve " @@ -277,11 +285,11 @@ msgstr "" "將產生一個擴充,可以在特定版本的擴充不可用的地方發布 — 例如,用於即將發布的 " "Python 版本的預發布版本 (prerelease)。" -#: ../../c-api/stable.rst:144 +#: ../../c-api/stable.rst:152 msgid "Limited API Caveats" msgstr "受限 API 注意事項" -#: ../../c-api/stable.rst:146 +#: ../../c-api/stable.rst:154 msgid "" "Note that compiling with ``Py_LIMITED_API`` is *not* a complete guarantee " "that code conforms to the :ref:`Limited API ` or the :ref:" @@ -293,7 +301,7 @@ msgstr "" "``Py_LIMITED_API`` 僅涵蓋定義,但 API 還包括其他議題,例如預期的語義 " "(semantic)。" -#: ../../c-api/stable.rst:151 +#: ../../c-api/stable.rst:159 msgid "" "One issue that ``Py_LIMITED_API`` does not guard against is calling a " "function with arguments that are invalid in a lower Python version. For " @@ -307,7 +315,7 @@ msgstr "" "現在代表選擇預設行為,但在 Python 3.8 中,引數將被直接使用,導致 ``NULL`` 取" "消參照 (dereference) 且崩潰 (crash)。類似的引數適用於結構 (struct) 的欄位。" -#: ../../c-api/stable.rst:158 +#: ../../c-api/stable.rst:166 msgid "" "Another issue is that some struct fields are currently not hidden when " "``Py_LIMITED_API`` is defined, even though they're part of the Limited API." @@ -315,7 +323,7 @@ msgstr "" "另一個問題是,當有定義 ``Py_LIMITED_API`` 時,一些結構欄位目前不會被隱藏,即" "使它們是受限 API 的一部分。" -#: ../../c-api/stable.rst:161 +#: ../../c-api/stable.rst:169 msgid "" "For these reasons, we recommend testing an extension with *all* minor Python " "versions it supports, and preferably to build with the *lowest* such version." @@ -323,7 +331,7 @@ msgstr "" "出於這些原因,我們建議要以它支援的\\ *所有*\\ 次要 Python 版本來測試擴充,並" "且最好使用\\ *最低*\\ 版本進行建置。" -#: ../../c-api/stable.rst:164 +#: ../../c-api/stable.rst:172 msgid "" "We also recommend reviewing documentation of all used API to check if it is " "explicitly part of the Limited API. Even with ``Py_LIMITED_API`` defined, a " @@ -334,7 +342,7 @@ msgstr "" "義 ``Py_LIMITED_API``,一些私有聲明也會因為技術原因(或者甚至是無意地,例如臭" "蟲)而被公開出來。" -#: ../../c-api/stable.rst:169 +#: ../../c-api/stable.rst:177 msgid "" "Also note that the Limited API is not necessarily stable: compiling with " "``Py_LIMITED_API`` with Python 3.8 means that the extension will run with " @@ -346,11 +354,11 @@ msgstr "" "行編譯意味著擴充將能以 Python 3.12 運行,但不一定能以 Python 3.12 *編譯*。特" "別是如果穩定 ABI 保持穩定,部分受限 API 可能會被棄用和刪除。" -#: ../../c-api/stable.rst:179 +#: ../../c-api/stable.rst:187 msgid "Platform Considerations" msgstr "平台注意事項" -#: ../../c-api/stable.rst:181 +#: ../../c-api/stable.rst:189 msgid "" "ABI stability depends not only on Python, but also on the compiler used, " "lower-level libraries and compiler options. For the purposes of the :ref:" @@ -361,7 +369,7 @@ msgstr "" "於\\ :ref:`穩定 ABI ` 的目的,這些細節定義了一個「平台」。它們通" "常取決於作業系統種類和處理器架構" -#: ../../c-api/stable.rst:186 +#: ../../c-api/stable.rst:194 msgid "" "It is the responsibility of each particular distributor of Python to ensure " "that all Python versions on a particular platform are built in a way that " @@ -372,11 +380,11 @@ msgstr "" "定 ABI 的方式建置。``python.org`` 和許多第三方發布者發布的 Windows 和 macOS " "版本就是這種情況。" -#: ../../c-api/stable.rst:196 +#: ../../c-api/stable.rst:204 msgid "Contents of Limited API" msgstr "受限 API 的內容" -#: ../../c-api/stable.rst:199 +#: ../../c-api/stable.rst:207 msgid "" "Currently, the :ref:`Limited API ` includes the following " "items:" diff --git a/c-api/sys.po b/c-api/sys.po index 5fa011518f..9037d85432 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -10,7 +10,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-12-12 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -486,6 +486,10 @@ msgid "" "should be called by *func*." msgstr "" +#: ../../c-api/sys.rst:432 +msgid ":c:func:`PyUnstable_AtExit` for passing a ``void *data`` argument." +msgstr "" + #: ../../c-api/sys.rst:101 msgid "USE_STACKCHECK (C macro)" msgstr "USE_STACKCHECK(C 巨集)" diff --git a/c-api/type.po b/c-api/type.po index 9ca76377b5..570d06ce19 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -6,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-12-01 15:01+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-" @@ -602,24 +602,24 @@ msgid "" "`PyType_FromSpecWithBases` instead." msgstr "" -#: ../../c-api/type.rst:517 +#: ../../c-api/type.rst:515 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" -#: ../../c-api/type.rst:519 +#: ../../c-api/type.rst:518 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` are now available under the :ref:`limited API `." msgstr "" -#: ../../c-api/type.rst:526 +#: ../../c-api/type.rst:525 msgid "" "The desired value of the slot. In most cases, this is a pointer to a " "function." msgstr "" -#: ../../c-api/type.rst:529 +#: ../../c-api/type.rst:528 msgid "Slots other than ``Py_tp_doc`` may not be ``NULL``." msgstr "" diff --git a/howto/gdb_helpers.po b/howto/gdb_helpers.po index 67e53cc2e0..4dae44f916 100644 --- a/howto/gdb_helpers.po +++ b/howto/gdb_helpers.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-12 00:04+0000\n" +"POT-Creation-Date: 2024-12-06 00:14+0000\n" "PO-Revision-Date: 2024-05-11 14:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -391,16 +391,20 @@ msgstr "" #: ../../howto/gdb_helpers.rst:183 msgid "" "The internal structure can be revealed with a cast to :c:expr:`PyLongObject " -"*`:" -msgstr "可以透過轉換 (cast) 為 :c:expr:`PyLongObject *` 來揭示內部結構:" +"*`::" +msgstr "可以透過轉換 (cast) 為 :c:expr:`PyLongObject *` 來揭示內部結構: ::" #: ../../howto/gdb_helpers.rst:185 msgid "" -"(gdb) p *(PyLongObject*)some_python_integer $5 = {ob_base = {ob_base = " -"{ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1}, ob_digit = {42}}" +"(gdb) p *(PyLongObject*)some_python_integer\n" +"$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size " +"= 1},\n" +"ob_digit = {42}}" msgstr "" -"(gdb) p *(PyLongObject*)some_python_integer $5 = {ob_base = {ob_base = " -"{ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1}, ob_digit = {42}}" +"(gdb) p *(PyLongObject*)some_python_integer\n" +"$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size " +"= 1},\n" +"ob_digit = {42}}" #: ../../howto/gdb_helpers.rst:189 msgid "" diff --git a/library/ast.po b/library/ast.po index 2bfa5f5ae3..a117a57e5a 100644 --- a/library/ast.po +++ b/library/ast.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-12-15 17:05+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-" @@ -3194,7 +3194,7 @@ msgstr "" #: ../../library/ast.rst:1803 msgid "" -">>> print(ast.dump(ast.parse(\"type Alias[**P = (int, str)] = Callable[P, " +">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, " "int]\"), indent=4))\n" "Module(\n" " body=[\n" @@ -3203,7 +3203,7 @@ msgid "" " type_params=[\n" " ParamSpec(\n" " name='P',\n" -" default_value=Tuple(\n" +" default_value=List(\n" " elts=[\n" " Name(id='int', ctx=Load()),\n" " Name(id='str', ctx=Load())],\n" @@ -3217,7 +3217,7 @@ msgid "" " ctx=Load()),\n" " ctx=Load()))])" msgstr "" -">>> print(ast.dump(ast.parse(\"type Alias[**P = (int, str)] = Callable[P, " +">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, " "int]\"), indent=4))\n" "Module(\n" " body=[\n" @@ -3226,7 +3226,7 @@ msgstr "" " type_params=[\n" " ParamSpec(\n" " name='P',\n" -" default_value=Tuple(\n" +" default_value=List(\n" " elts=[\n" " Name(id='int', ctx=Load()),\n" " Name(id='str', ctx=Load())],\n" diff --git a/library/collections.po b/library/collections.po index b2cd7486d9..abc99d12e2 100644 --- a/library/collections.po +++ b/library/collections.po @@ -1,16 +1,15 @@ -# 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: # 周 忠毅 , 2016 # 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-28 00:13+0000\n" +"POT-Creation-Date: 2024-12-03 00:15+0000\n" "PO-Revision-Date: 2024-01-22 21:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1228,19 +1227,19 @@ msgstr "" msgid "" "When each key is encountered for the first time, it is not already in the " "mapping; so an entry is automatically created using the :attr:`~defaultdict." -"default_factory` function which returns an empty :class:`list`. The :meth:" -"`list.append` operation then attaches the value to the new list. When keys " +"default_factory` function which returns an empty :class:`list`. The :meth:`!" +"list.append` operation then attaches the value to the new list. When keys " "are encountered again, the look-up proceeds normally (returning the list for " -"that key) and the :meth:`list.append` operation adds another value to the " +"that key) and the :meth:`!list.append` operation adds another value to the " "list. This technique is simpler and faster than an equivalent technique " "using :meth:`dict.setdefault`:" msgstr "" "當每個鍵第一次被存取時,它還沒有存在於對映中,所以會自動呼叫 :attr:" "`~defaultdict.default_factory` 方法來回傳一個空的 :class:`list` 以建立一個條" -"目,:meth:`list.append` 操作後續會再新增值到這個新的列表裡。當再次存取該鍵" -"時,就如普通字典般操作(回傳該鍵所對應到的 list),:meth:`list.append` 也會新" -"增另一個值到 list 中。和使用與其等價的 :meth:`dict.setdefault` 相比,這個技巧" -"更加快速和簡單:" +"目,:meth:`!list.append` 操作後續會再新增值到這個新的列表裡。當再次存取該鍵" +"時,就如普通字典般操作(回傳該鍵所對應到的 list),:meth:`!list.append` 也會" +"新增另一個值到 list 中。和使用與其等價的 :meth:`dict.setdefault` 相比,這個技" +"巧更加快速和簡單:" #: ../../library/collections.rst:799 msgid "" diff --git a/library/dis.po b/library/dis.po index 6cf423905f..74ac573ea5 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-11-05 00:13+0000\n" +"POT-Creation-Date: 2024-12-03 00:15+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-" @@ -1119,7 +1119,7 @@ msgid "" "class:`tuple` containing the corresponding values. Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:994 ../../library/dis.rst:1665 +#: ../../library/dis.rst:994 ../../library/dis.rst:1686 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." @@ -1534,45 +1534,64 @@ msgstr "" #: ../../library/dis.rst:1388 msgid "" +"Pushes references to ``co_varnames[var_nums >> 4]`` and " +"``co_varnames[var_nums & 15]`` onto the stack." +msgstr "" + +#: ../../library/dis.rst:1395 +msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " "raising an :exc:`UnboundLocalError` if the local variable has not been " "initialized." msgstr "" -#: ../../library/dis.rst:1396 +#: ../../library/dis.rst:1403 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " "pushes ``NULL`` onto the stack if the local variable has not been " "initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" -#: ../../library/dis.rst:1404 +#: ../../library/dis.rst:1411 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1409 +#: ../../library/dis.rst:1415 +msgid "" +"Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]`` and ``STACK[-2]`` " +"into ``co_varnames[var_nums & 15]``." +msgstr "" + +#: ../../library/dis.rst:1422 +msgid "" +"Stores ``STACK.pop()`` into the local ``co_varnames[var_nums >> 4]`` and " +"pushes a reference to the local ``co_varnames[var_nums & 15]`` onto the " +"stack." +msgstr "" + +#: ../../library/dis.rst:1430 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1414 +#: ../../library/dis.rst:1435 msgid "" "Creates a new cell in slot ``i``. If that slot is nonempty then that value " "is stored into the new cell." msgstr "" -#: ../../library/dis.rst:1422 +#: ../../library/dis.rst:1443 msgid "" "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" -#: ../../library/dis.rst:1425 ../../library/dis.rst:1447 -#: ../../library/dis.rst:1458 +#: ../../library/dis.rst:1446 ../../library/dis.rst:1468 +#: ../../library/dis.rst:1479 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -#: ../../library/dis.rst:1431 +#: ../../library/dis.rst:1452 msgid "" "Pops a mapping off the stack and looks up the name associated with slot " "``i`` of the \"fast locals\" storage in this mapping. If the name is not " @@ -1583,112 +1602,112 @@ msgid "" "class bodies." msgstr "" -#: ../../library/dis.rst:1444 +#: ../../library/dis.rst:1465 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1453 +#: ../../library/dis.rst:1474 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" -#: ../../library/dis.rst:1464 +#: ../../library/dis.rst:1485 msgid "" "Copies the ``n`` :term:`free (closure) variables ` from " "the closure into the frame. Removes the need for special code on the " "caller's side when calling closures." msgstr "" -#: ../../library/dis.rst:1473 +#: ../../library/dis.rst:1494 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: ../../library/dis.rst:1476 +#: ../../library/dis.rst:1497 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: ../../library/dis.rst:1477 +#: ../../library/dis.rst:1498 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1478 +#: ../../library/dis.rst:1499 msgid "" "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " "``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1484 +#: ../../library/dis.rst:1505 msgid "" "Calls a callable object with the number of arguments specified by ``argc``. " "On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1487 ../../library/dis.rst:1511 +#: ../../library/dis.rst:1508 ../../library/dis.rst:1532 msgid "The callable" msgstr "" -#: ../../library/dis.rst:1488 ../../library/dis.rst:1512 +#: ../../library/dis.rst:1509 ../../library/dis.rst:1533 msgid "``self`` or ``NULL``" msgstr "" -#: ../../library/dis.rst:1489 ../../library/dis.rst:1513 +#: ../../library/dis.rst:1510 ../../library/dis.rst:1534 msgid "The remaining positional arguments" msgstr "" -#: ../../library/dis.rst:1491 +#: ../../library/dis.rst:1512 msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -#: ../../library/dis.rst:1493 +#: ../../library/dis.rst:1514 msgid "" "``CALL`` pops all arguments and the callable object off the stack, calls the " "callable object with those arguments, and pushes the return value returned " "by the callable object." msgstr "" -#: ../../library/dis.rst:1499 +#: ../../library/dis.rst:1520 msgid "The callable now always appears at the same position on the stack." msgstr "" -#: ../../library/dis.rst:1502 +#: ../../library/dis.rst:1523 msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -#: ../../library/dis.rst:1508 +#: ../../library/dis.rst:1529 msgid "" "Calls a callable object with the number of arguments specified by ``argc``, " "including one or more named arguments. On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1514 +#: ../../library/dis.rst:1535 msgid "The named arguments" msgstr "" -#: ../../library/dis.rst:1515 +#: ../../library/dis.rst:1536 msgid "A :class:`tuple` of keyword argument names" msgstr "" -#: ../../library/dis.rst:1517 +#: ../../library/dis.rst:1538 msgid "" "``argc`` is the total of the positional and named arguments, excluding " "``self``. The length of the tuple of keyword argument names is the number of " "named arguments." msgstr "" -#: ../../library/dis.rst:1520 +#: ../../library/dis.rst:1541 msgid "" "``CALL_KW`` pops all arguments, the keyword names, and the callable object " "off the stack, calls the callable object with those arguments, and pushes " "the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1529 +#: ../../library/dis.rst:1550 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1700,33 +1719,33 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1544 +#: ../../library/dis.rst:1565 msgid "" "Pushes a ``NULL`` to the stack. Used in the call sequence to match the " "``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1553 +#: ../../library/dis.rst:1574 msgid "" "Pushes a new function object on the stack built from the code object at " "``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:1555 +#: ../../library/dis.rst:1576 msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: ../../library/dis.rst:1558 +#: ../../library/dis.rst:1579 msgid "Qualified name at ``STACK[-1]`` was removed." msgstr "" -#: ../../library/dis.rst:1561 +#: ../../library/dis.rst:1582 msgid "" "Extra function attributes on the stack, signaled by oparg flags, were " "removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" -#: ../../library/dis.rst:1568 +#: ../../library/dis.rst:1589 msgid "" "Sets an attribute on a function object. Expects the function at " "``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " @@ -1734,42 +1753,42 @@ msgid "" "attribute to set:" msgstr "" -#: ../../library/dis.rst:1572 +#: ../../library/dis.rst:1593 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: ../../library/dis.rst:1574 +#: ../../library/dis.rst:1595 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: ../../library/dis.rst:1575 +#: ../../library/dis.rst:1596 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1576 +#: ../../library/dis.rst:1597 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: ../../library/dis.rst:1585 +#: ../../library/dis.rst:1606 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" -#: ../../library/dis.rst:1587 +#: ../../library/dis.rst:1608 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" -#: ../../library/dis.rst:1591 +#: ../../library/dis.rst:1612 msgid "if it is 3, implements::" msgstr "" -#: ../../library/dis.rst:1593 +#: ../../library/dis.rst:1614 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" @@ -1781,11 +1800,11 @@ msgstr "" "start = STACK.pop()\n" "STACK.append(slice(start, end, step))" -#: ../../library/dis.rst:1598 +#: ../../library/dis.rst:1619 msgid "See the :func:`slice` built-in function for more information." msgstr "" -#: ../../library/dis.rst:1603 +#: ../../library/dis.rst:1624 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " @@ -1793,11 +1812,11 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: ../../library/dis.rst:1611 +#: ../../library/dis.rst:1632 msgid "Convert value to a string, depending on ``oparg``::" msgstr "" -#: ../../library/dis.rst:1613 +#: ../../library/dis.rst:1634 msgid "" "value = STACK.pop()\n" "result = func(value)\n" @@ -1807,28 +1826,28 @@ msgstr "" "result = func(value)\n" "STACK.append(result)" -#: ../../library/dis.rst:1617 +#: ../../library/dis.rst:1638 msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" -#: ../../library/dis.rst:1618 +#: ../../library/dis.rst:1639 msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" -#: ../../library/dis.rst:1619 +#: ../../library/dis.rst:1640 msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" -#: ../../library/dis.rst:1621 ../../library/dis.rst:1634 -#: ../../library/dis.rst:1647 +#: ../../library/dis.rst:1642 ../../library/dis.rst:1655 +#: ../../library/dis.rst:1668 msgid "Used for implementing formatted literal strings (f-strings)." msgstr "" -#: ../../library/dis.rst:1628 +#: ../../library/dis.rst:1649 msgid "Formats the value on top of stack::" msgstr "" -#: ../../library/dis.rst:1630 +#: ../../library/dis.rst:1651 msgid "" "value = STACK.pop()\n" "result = value.__format__(\"\")\n" @@ -1838,11 +1857,11 @@ msgstr "" "result = value.__format__(\"\")\n" "STACK.append(result)" -#: ../../library/dis.rst:1640 +#: ../../library/dis.rst:1661 msgid "Formats the given value with the given format spec::" msgstr "" -#: ../../library/dis.rst:1642 +#: ../../library/dis.rst:1663 msgid "" "spec = STACK.pop()\n" "value = STACK.pop()\n" @@ -1854,14 +1873,14 @@ msgstr "" "result = value.__format__(spec)\n" "STACK.append(result)" -#: ../../library/dis.rst:1654 +#: ../../library/dis.rst:1675 msgid "" "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " "class being matched against, and ``STACK[-3]`` is the match subject. " "*count* is the number of positional sub-patterns." msgstr "" -#: ../../library/dis.rst:1658 +#: ../../library/dis.rst:1679 msgid "" "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " "instance of ``STACK[-2]`` and has the positional and keyword attributes " @@ -1869,219 +1888,219 @@ msgid "" "Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:1672 +#: ../../library/dis.rst:1693 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -#: ../../library/dis.rst:1674 +#: ../../library/dis.rst:1695 msgid "" "The ``context`` oparand consists of two parts. The lowest two bits indicate " "where the ``RESUME`` occurs:" msgstr "" -#: ../../library/dis.rst:1677 +#: ../../library/dis.rst:1698 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" -#: ../../library/dis.rst:1679 +#: ../../library/dis.rst:1700 msgid "``1`` After a ``yield`` expression" msgstr "" -#: ../../library/dis.rst:1680 +#: ../../library/dis.rst:1701 msgid "``2`` After a ``yield from`` expression" msgstr "" -#: ../../library/dis.rst:1681 +#: ../../library/dis.rst:1702 msgid "``3`` After an ``await`` expression" msgstr "" -#: ../../library/dis.rst:1683 +#: ../../library/dis.rst:1704 msgid "" "The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " "otherwise." msgstr "" -#: ../../library/dis.rst:1688 +#: ../../library/dis.rst:1709 msgid "The oparg value changed to include information about except-depth" msgstr "" -#: ../../library/dis.rst:1694 +#: ../../library/dis.rst:1715 msgid "" "Create a generator, coroutine, or async generator from the current frame. " "Used as first opcode of in code object for the above mentioned callables. " "Clear the current frame and return the newly created generator." msgstr "" -#: ../../library/dis.rst:1703 +#: ../../library/dis.rst:1724 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" -#: ../../library/dis.rst:1706 +#: ../../library/dis.rst:1727 msgid "" "If the call raises :exc:`StopIteration`, pop the top value from the stack, " "push the exception's ``value`` attribute, and increment the bytecode counter " "by *delta*." msgstr "" -#: ../../library/dis.rst:1715 +#: ../../library/dis.rst:1736 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes in the range [0,255] which don't use their argument and those that " "do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -#: ../../library/dis.rst:1719 +#: ../../library/dis.rst:1740 msgid "" "If your application uses pseudo instructions or specialized instructions, " "use the :data:`hasarg` collection instead." msgstr "" -#: ../../library/dis.rst:1722 +#: ../../library/dis.rst:1743 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -#: ../../library/dis.rst:1726 +#: ../../library/dis.rst:1747 msgid "" "Pseudo instructions were added to the :mod:`dis` module, and for them it is " "not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use " "their arg." msgstr "" -#: ../../library/dis.rst:1731 +#: ../../library/dis.rst:1752 msgid "Use :data:`hasarg` instead." msgstr "" -#: ../../library/dis.rst:1736 +#: ../../library/dis.rst:1757 msgid "" "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " "argument and sets ``STACK[-1]`` to the result. Used to implement " "functionality that is not performance critical." msgstr "" -#: ../../library/dis.rst:1740 ../../library/dis.rst:1794 +#: ../../library/dis.rst:1761 ../../library/dis.rst:1815 msgid "The operand determines which intrinsic function is called:" msgstr "" -#: ../../library/dis.rst:1743 ../../library/dis.rst:1797 +#: ../../library/dis.rst:1764 ../../library/dis.rst:1818 msgid "Operand" msgstr "運算元" -#: ../../library/dis.rst:1743 ../../library/dis.rst:1797 +#: ../../library/dis.rst:1764 ../../library/dis.rst:1818 msgid "Description" msgstr "描述" -#: ../../library/dis.rst:1745 +#: ../../library/dis.rst:1766 msgid "``INTRINSIC_1_INVALID``" msgstr "``INTRINSIC_1_INVALID``" -#: ../../library/dis.rst:1745 ../../library/dis.rst:1799 +#: ../../library/dis.rst:1766 ../../library/dis.rst:1820 msgid "Not valid" msgstr "" -#: ../../library/dis.rst:1747 +#: ../../library/dis.rst:1768 msgid "``INTRINSIC_PRINT``" msgstr "``INTRINSIC_PRINT``" -#: ../../library/dis.rst:1747 +#: ../../library/dis.rst:1768 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" -#: ../../library/dis.rst:1750 +#: ../../library/dis.rst:1771 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "``INTRINSIC_IMPORT_STAR``" -#: ../../library/dis.rst:1750 +#: ../../library/dis.rst:1771 msgid "Performs ``import *`` for the named module." msgstr "" -#: ../../library/dis.rst:1753 +#: ../../library/dis.rst:1774 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "``INTRINSIC_STOPITERATION_ERROR``" -#: ../../library/dis.rst:1753 +#: ../../library/dis.rst:1774 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: ../../library/dis.rst:1756 +#: ../../library/dis.rst:1777 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "``INTRINSIC_ASYNC_GEN_WRAP``" -#: ../../library/dis.rst:1756 +#: ../../library/dis.rst:1777 msgid "Wraps an async generator value" msgstr "" -#: ../../library/dis.rst:1758 +#: ../../library/dis.rst:1779 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "``INTRINSIC_UNARY_POSITIVE``" -#: ../../library/dis.rst:1758 +#: ../../library/dis.rst:1779 msgid "Performs the unary ``+`` operation" msgstr "" -#: ../../library/dis.rst:1761 +#: ../../library/dis.rst:1782 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "``INTRINSIC_LIST_TO_TUPLE``" -#: ../../library/dis.rst:1761 +#: ../../library/dis.rst:1782 msgid "Converts a list to a tuple" msgstr "" -#: ../../library/dis.rst:1763 +#: ../../library/dis.rst:1784 msgid "``INTRINSIC_TYPEVAR``" msgstr "``INTRINSIC_TYPEVAR``" -#: ../../library/dis.rst:1763 +#: ../../library/dis.rst:1784 msgid "Creates a :class:`typing.TypeVar`" msgstr "" -#: ../../library/dis.rst:1765 +#: ../../library/dis.rst:1786 msgid "``INTRINSIC_PARAMSPEC``" msgstr "``INTRINSIC_PARAMSPEC``" -#: ../../library/dis.rst:1765 +#: ../../library/dis.rst:1786 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" -#: ../../library/dis.rst:1768 +#: ../../library/dis.rst:1789 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "``INTRINSIC_TYPEVARTUPLE``" -#: ../../library/dis.rst:1768 +#: ../../library/dis.rst:1789 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" -#: ../../library/dis.rst:1771 +#: ../../library/dis.rst:1792 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "``INTRINSIC_SUBSCRIPT_GENERIC``" -#: ../../library/dis.rst:1771 +#: ../../library/dis.rst:1792 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" -#: ../../library/dis.rst:1774 +#: ../../library/dis.rst:1795 msgid "``INTRINSIC_TYPEALIAS``" msgstr "``INTRINSIC_TYPEALIAS``" -#: ../../library/dis.rst:1774 +#: ../../library/dis.rst:1795 msgid "" "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " "statement. The argument is a tuple of the type alias's name, type " "parameters, and value." msgstr "" -#: ../../library/dis.rst:1786 +#: ../../library/dis.rst:1807 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" -#: ../../library/dis.rst:1789 +#: ../../library/dis.rst:1810 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" @@ -2093,61 +2112,61 @@ msgstr "" "result = intrinsic2(arg1, arg2)\n" "STACK.append(result)" -#: ../../library/dis.rst:1799 +#: ../../library/dis.rst:1820 msgid "``INTRINSIC_2_INVALID``" msgstr "``INTRINSIC_2_INVALID``" -#: ../../library/dis.rst:1801 +#: ../../library/dis.rst:1822 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "``INTRINSIC_PREP_RERAISE_STAR``" -#: ../../library/dis.rst:1801 +#: ../../library/dis.rst:1822 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" -#: ../../library/dis.rst:1805 +#: ../../library/dis.rst:1826 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "``INTRINSIC_TYPEVAR_WITH_BOUND``" -#: ../../library/dis.rst:1805 +#: ../../library/dis.rst:1826 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" -#: ../../library/dis.rst:1808 +#: ../../library/dis.rst:1829 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -#: ../../library/dis.rst:1808 +#: ../../library/dis.rst:1829 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" -#: ../../library/dis.rst:1812 +#: ../../library/dis.rst:1833 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -#: ../../library/dis.rst:1812 +#: ../../library/dis.rst:1833 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -#: ../../library/dis.rst:1819 +#: ../../library/dis.rst:1840 msgid "**Pseudo-instructions**" msgstr "" -#: ../../library/dis.rst:1821 +#: ../../library/dis.rst:1842 msgid "" "These opcodes do not appear in Python bytecode. They are used by the " "compiler but are replaced by real opcodes or removed before bytecode is " "generated." msgstr "" -#: ../../library/dis.rst:1826 +#: ../../library/dis.rst:1847 msgid "" "Set up an exception handler for the following code block. If an exception " "occurs, the value stack level is restored to its current state and control " "is transferred to the exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1833 +#: ../../library/dis.rst:1854 msgid "" "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " "instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " @@ -2156,91 +2175,91 @@ msgid "" "exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1842 +#: ../../library/dis.rst:1863 msgid "" "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " "from the stack before control is transferred to the exception handler at " "``target``." msgstr "" -#: ../../library/dis.rst:1846 +#: ../../library/dis.rst:1867 msgid "" "This variant is used in :keyword:`with` and :keyword:`async with` " "constructs, which push the return value of the context manager's :meth:" "`~object.__enter__` or :meth:`~object.__aenter__` to the stack." msgstr "" -#: ../../library/dis.rst:1853 +#: ../../library/dis.rst:1874 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -#: ../../library/dis.rst:1859 +#: ../../library/dis.rst:1880 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" -#: ../../library/dis.rst:1864 +#: ../../library/dis.rst:1885 msgid "" "Pushes a reference to the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1867 +#: ../../library/dis.rst:1888 msgid "" "Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." msgstr "" -#: ../../library/dis.rst:1869 +#: ../../library/dis.rst:1890 msgid "This opcode is now a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1875 +#: ../../library/dis.rst:1896 msgid "" "Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode with a " "flag set in the arg." msgstr "" -#: ../../library/dis.rst:1882 +#: ../../library/dis.rst:1903 msgid "Opcode collections" msgstr "" -#: ../../library/dis.rst:1884 +#: ../../library/dis.rst:1905 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: ../../library/dis.rst:1887 +#: ../../library/dis.rst:1908 msgid "" "The collections now contain pseudo instructions and instrumented " "instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " "and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" -#: ../../library/dis.rst:1894 +#: ../../library/dis.rst:1915 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: ../../library/dis.rst:1899 +#: ../../library/dis.rst:1920 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: ../../library/dis.rst:1904 +#: ../../library/dis.rst:1925 msgid "Sequence of all compare operation names." msgstr "" -#: ../../library/dis.rst:1909 +#: ../../library/dis.rst:1930 msgid "Sequence of bytecodes that use their argument." msgstr "" -#: ../../library/dis.rst:1916 +#: ../../library/dis.rst:1937 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: ../../library/dis.rst:1921 +#: ../../library/dis.rst:1942 msgid "" "Sequence of bytecodes that access a :term:`free (closure) variable `. 'free' in this context refers to names in the current scope that " @@ -2249,47 +2268,47 @@ msgid "" "scopes." msgstr "" -#: ../../library/dis.rst:1929 +#: ../../library/dis.rst:1950 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: ../../library/dis.rst:1934 +#: ../../library/dis.rst:1955 msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" -#: ../../library/dis.rst:1941 +#: ../../library/dis.rst:1962 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: ../../library/dis.rst:1946 +#: ../../library/dis.rst:1967 msgid "Sequence of bytecodes of Boolean operations." msgstr "" -#: ../../library/dis.rst:1950 +#: ../../library/dis.rst:1971 msgid "Sequence of bytecodes that set an exception handler." msgstr "" -#: ../../library/dis.rst:1957 +#: ../../library/dis.rst:1978 msgid "Sequence of bytecodes that have a relative jump target." msgstr "" -#: ../../library/dis.rst:1959 +#: ../../library/dis.rst:1980 msgid "All jumps are now relative. Use :data:`hasjump`." msgstr "" -#: ../../library/dis.rst:1965 +#: ../../library/dis.rst:1986 msgid "Sequence of bytecodes that have an absolute jump target." msgstr "" -#: ../../library/dis.rst:1967 +#: ../../library/dis.rst:1988 msgid "All jumps are now relative. This list is empty." msgstr "" -#: ../../library/dis.rst:1583 +#: ../../library/dis.rst:1604 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/dis.rst:1583 +#: ../../library/dis.rst:1604 msgid "slice" msgstr "slice(切片)" diff --git a/library/http.cookies.po b/library/http.cookies.po index 4bd8b76059..283f303aa9 100644 --- a/library/http.cookies.po +++ b/library/http.cookies.po @@ -6,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-12-14 00:14+0000\n" "PO-Revision-Date: 2016-11-19 00:31+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -133,9 +133,9 @@ msgstr "" #: ../../library/http.cookies.rst:100 msgid "" "Return a string representation suitable to be sent as HTTP headers. *attrs* " -"and *header* are sent to each :class:`Morsel`'s :meth:`output` method. *sep* " -"is used to join the headers together, and is by default the combination " -"``'\\r\\n'`` (CRLF)." +"and *header* are sent to each :class:`Morsel`'s :meth:`~Morsel.output` " +"method. *sep* is used to join the headers together, and is by default the " +"combination ``'\\r\\n'`` (CRLF)." msgstr "" #: ../../library/http.cookies.rst:108 diff --git a/library/itertools.po b/library/itertools.po index b02809e1e2..f7ba031e9c 100644 --- a/library/itertools.po +++ b/library/itertools.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-12-05 00:14+0000\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1725,6 +1725,11 @@ msgid "" " \"Returns the sequence elements n times.\"\n" " return chain.from_iterable(repeat(tuple(iterable), n))\n" "\n" +"def loops(n):\n" +" \"Loop n times. Like range(n) but without creating integers.\"\n" +" # for _ in loops(100): ...\n" +" return repeat(None, n)\n" +"\n" "def tail(n, iterable):\n" " \"Return an iterator over the last n items.\"\n" " # tail(3, 'ABCDEFG') → E F G\n" @@ -1858,11 +1863,11 @@ msgid "" " yield func()" msgstr "" -#: ../../library/itertools.rst:1008 +#: ../../library/itertools.rst:1013 msgid "The following recipes have a more mathematical flavor:" msgstr "以下的應用技巧具有更多的數學風格:" -#: ../../library/itertools.rst:1010 +#: ../../library/itertools.rst:1015 msgid "" "def powerset(iterable):\n" " \"powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)\"\n" @@ -1954,6 +1959,11 @@ msgid "" " data[p*p : n : p+p] = bytes(len(range(p*p, n, p+p)))\n" " yield from iter_index(data, 1, start=3)\n" "\n" +"def is_prime(n):\n" +" \"Return True if n is prime.\"\n" +" # is_prime(1_000_000_000_000_403) → True\n" +" return n > 1 and all(n % p for p in sieve(math.isqrt(n) + 1))\n" +"\n" "def factor(n):\n" " \"Prime factors of n.\"\n" " # factor(99) → 3 3 11\n" diff --git a/library/string.po b/library/string.po index 8e279ed304..5537df8ef6 100644 --- a/library/string.po +++ b/library/string.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-11-02 00:13+0000\n" +"POT-Creation-Date: 2024-12-15 00:17+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-" @@ -64,15 +63,15 @@ msgid "" "The uppercase letters ``'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``. This value is not " "locale-dependent and will not change." msgstr "" -"大寫字母 ``’ABCDEFGHIJKLMNOPQRSTUVWXYZ’``。 此值與地區設定無關且不會改變。" +"大寫字母 ``'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``。此值與地區設定無關且不會改變。" #: ../../library/string.rst:44 msgid "The string ``'0123456789'``." -msgstr "字串 ``’0123456789’``。" +msgstr "字串 ``'0123456789'``。" #: ../../library/string.rst:49 msgid "The string ``'0123456789abcdefABCDEF'``." -msgstr "字串 ``’0123456789abcdefABCDEF’``。" +msgstr "字串 ``'0123456789abcdefABCDEF'``。" #: ../../library/string.rst:54 msgid "The string ``'01234567'``." @@ -83,7 +82,7 @@ msgid "" "String of ASCII characters which are considered punctuation characters in " "the ``C`` locale: ``!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~``." msgstr "" -"在 ``C`` 語言中被視為標點符號的 ASCII 字元的字串: ``!”#$%&’()*+,-./:;<=>?" +"在 ``C`` 語言中被視為標點符號的 ASCII 字元的字串:``!\"#$%&'()*+,-./:;<=>?" "@[\\]^_`{|}~``。" #: ../../library/string.rst:64 @@ -462,8 +461,8 @@ msgid "Option" msgstr "選項" #: ../../library/string.rst:342 ../../library/string.rst:374 -#: ../../library/string.rst:457 ../../library/string.rst:468 -#: ../../library/string.rst:503 +#: ../../library/string.rst:459 ../../library/string.rst:470 +#: ../../library/string.rst:505 msgid "Meaning" msgstr "含義" @@ -545,7 +544,7 @@ msgstr "" #: ../../library/string.rst:368 ../../library/string.rst:382 msgid "space" -msgstr "" +msgstr "空格" #: ../../library/string.rst:382 msgid "" @@ -580,15 +579,17 @@ msgstr "" #: ../../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." +"The ``','`` option signals the use of a comma for a thousands separator for " +"floating-point presentation types and for integer presentation type ``'d'``. " +"For other presentation types, this option is an error. For a locale aware " +"separator, use the ``'n'`` integer presentation type instead." msgstr "" -#: ../../library/string.rst:416 +#: ../../library/string.rst:418 msgid "Added the ``','`` option (see also :pep:`378`)." msgstr "新增 ``','`` 選項(請見 :pep:`378`\\ )。" -#: ../../library/string.rst:421 +#: ../../library/string.rst:423 msgid "" "The ``'_'`` option signals the use of an underscore for a thousands " "separator for floating-point presentation types and for integer presentation " @@ -600,11 +601,11 @@ msgstr "" "號。對於整數表示型別 ``'b'``,``'o'``,``'x'`` 和 ``'X'``,每 4 位數字會插入" "底線。對於其他表示型別,指定此選項會出錯。" -#: ../../library/string.rst:428 +#: ../../library/string.rst:430 msgid "Added the ``'_'`` option (see also :pep:`515`)." msgstr "新增 ``'_'`` 選項(請見 :pep:`515`\\ )。" -#: ../../library/string.rst:431 +#: ../../library/string.rst:433 msgid "" "*width* is a decimal integer defining the minimum total field width, " "including any prefixes, separators, and other formatting characters. If not " @@ -613,7 +614,7 @@ msgstr "" "*width* 是一個十進位整數,定義了最小總欄位寬度,包括任何前綴、分隔符號和其他" "格式字元。如果未指定,則欄位寬度將由內容決定。" -#: ../../library/string.rst:435 +#: ../../library/string.rst:437 msgid "" "When no explicit alignment is given, preceding the *width* field by a zero " "(``'0'``) character enables sign-aware zero-padding for numeric types, " @@ -624,13 +625,13 @@ msgstr "" "class:`complex` 以外的數值型別啟用有符號察覺的零填充 (sign-aware zero-" "padding)。這相當於使用 ``'0'`` 為 *fill* 字元且對齊類型為 ``'='``。" -#: ../../library/string.rst:440 +#: ../../library/string.rst:442 msgid "" "Preceding the *width* field by ``'0'`` no longer affects the default " "alignment for strings." msgstr "在 *width* 欄位前面加上 ``'0'`` 不再影響字串的預設對齊方式。" -#: ../../library/string.rst:444 +#: ../../library/string.rst:446 msgid "" "The *precision* is a decimal integer indicating how many digits should be " "displayed after the decimal point for presentation types ``'f'`` and " @@ -645,89 +646,89 @@ msgstr "" "示類型,該欄位指定最大欄位大小 - 換言之,將使用欄位中的多少字元。整數表示類型" "不允許使用 *precision*。" -#: ../../library/string.rst:452 +#: ../../library/string.rst:454 msgid "Finally, the *type* determines how the data should be presented." msgstr "最終,型別決定了資料將會如何呈現" -#: ../../library/string.rst:454 +#: ../../library/string.rst:456 msgid "The available string presentation types are:" msgstr "可用的字串表示型別有:" -#: ../../library/string.rst:457 ../../library/string.rst:468 -#: ../../library/string.rst:503 +#: ../../library/string.rst:459 ../../library/string.rst:470 +#: ../../library/string.rst:505 msgid "Type" msgstr "型別" -#: ../../library/string.rst:459 +#: ../../library/string.rst:461 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/string.rst:459 +#: ../../library/string.rst:461 msgid "String format. This is the default type for strings and may be omitted." msgstr "" -#: ../../library/string.rst:462 ../../library/string.rst:491 -#: ../../library/string.rst:576 +#: ../../library/string.rst:464 ../../library/string.rst:493 +#: ../../library/string.rst:578 msgid "None" msgstr "None" -#: ../../library/string.rst:462 +#: ../../library/string.rst:464 msgid "The same as ``'s'``." -msgstr "" +msgstr "與 ``'s'`` 相同。" -#: ../../library/string.rst:465 +#: ../../library/string.rst:467 msgid "The available integer presentation types are:" msgstr "" -#: ../../library/string.rst:470 +#: ../../library/string.rst:472 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/string.rst:470 +#: ../../library/string.rst:472 msgid "Binary format. Outputs the number in base 2." msgstr "" -#: ../../library/string.rst:472 +#: ../../library/string.rst:474 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/string.rst:472 +#: ../../library/string.rst:474 msgid "" "Character. Converts the integer to the corresponding unicode character " "before printing." msgstr "" -#: ../../library/string.rst:475 +#: ../../library/string.rst:477 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/string.rst:475 +#: ../../library/string.rst:477 msgid "Decimal Integer. Outputs the number in base 10." msgstr "" -#: ../../library/string.rst:477 +#: ../../library/string.rst:479 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/string.rst:477 +#: ../../library/string.rst:479 msgid "Octal format. Outputs the number in base 8." msgstr "" -#: ../../library/string.rst:479 +#: ../../library/string.rst:481 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/string.rst:479 +#: ../../library/string.rst:481 msgid "" "Hex format. Outputs the number in base 16, using lower-case letters for the " "digits above 9." msgstr "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用小寫字母。" -#: ../../library/string.rst:482 +#: ../../library/string.rst:484 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/string.rst:482 +#: ../../library/string.rst:484 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 " @@ -736,21 +737,21 @@ msgstr "" "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用大寫字母。如果指定了 " "``'#'``,則前綴 ``'0x'`` 也會被轉成大寫的 ``'0X'``。" -#: ../../library/string.rst:487 ../../library/string.rst:569 +#: ../../library/string.rst:489 ../../library/string.rst:571 msgid "``'n'``" msgstr "``'n'``" -#: ../../library/string.rst:487 +#: ../../library/string.rst:489 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:491 +#: ../../library/string.rst:493 msgid "The same as ``'d'``." -msgstr "" +msgstr "與 ``'d'`` 相同。" -#: ../../library/string.rst:494 +#: ../../library/string.rst:496 msgid "" "In addition to the above presentation types, integers can be formatted with " "the floating-point presentation types listed below (except ``'n'`` and " @@ -758,17 +759,17 @@ msgid "" "floating-point number before formatting." msgstr "" -#: ../../library/string.rst:499 +#: ../../library/string.rst:501 msgid "" "The available presentation types for :class:`float` and :class:`~decimal." "Decimal` values are:" msgstr "" -#: ../../library/string.rst:505 +#: ../../library/string.rst:507 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/string.rst:505 +#: ../../library/string.rst:507 msgid "" "Scientific notation. For a given precision ``p``, formats the number in " "scientific notation with the letter 'e' separating the coefficient from the " @@ -780,21 +781,21 @@ msgid "" "is used." msgstr "" -#: ../../library/string.rst:516 +#: ../../library/string.rst:518 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/string.rst:516 +#: ../../library/string.rst:518 msgid "" "Scientific notation. Same as ``'e'`` except it uses an upper case 'E' as the " "separator character." msgstr "" -#: ../../library/string.rst:519 +#: ../../library/string.rst:521 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/string.rst:519 +#: ../../library/string.rst:521 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 " @@ -804,21 +805,21 @@ msgid "" "point is omitted unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:528 +#: ../../library/string.rst:530 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/string.rst:528 +#: ../../library/string.rst:530 msgid "" "Fixed-point notation. Same as ``'f'``, but converts ``nan`` to ``NAN`` and " "``inf`` to ``INF``." msgstr "" -#: ../../library/string.rst:531 +#: ../../library/string.rst:533 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/string.rst:531 +#: ../../library/string.rst:533 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 " @@ -826,7 +827,7 @@ msgid "" "``0`` is treated as equivalent to a precision of ``1``." msgstr "" -#: ../../library/string.rst:538 +#: ../../library/string.rst:540 msgid "" "The precise rules are as follows: suppose that the result formatted with " "presentation type ``'e'`` and precision ``p-1`` would have exponent " @@ -839,7 +840,7 @@ msgid "" "unless the ``'#'`` option is used." msgstr "" -#: ../../library/string.rst:551 +#: ../../library/string.rst:553 msgid "" "With no precision given, uses a precision of ``6`` significant digits for :" "class:`float`. For :class:`~decimal.Decimal`, the coefficient of the result " @@ -849,40 +850,40 @@ msgid "" "notation is used otherwise." msgstr "" -#: ../../library/string.rst:560 +#: ../../library/string.rst:562 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:565 +#: ../../library/string.rst:567 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/string.rst:565 +#: ../../library/string.rst:567 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:569 +#: ../../library/string.rst:571 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:573 +#: ../../library/string.rst:575 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/string.rst:573 +#: ../../library/string.rst:575 msgid "" "Percentage. Multiplies the number by 100 and displays in fixed (``'f'``) " "format, followed by a percent sign." msgstr "" -#: ../../library/string.rst:576 +#: ../../library/string.rst:578 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 " @@ -891,20 +892,28 @@ msgid "" "as large as needed to represent the given value faithfully." msgstr "" -#: ../../library/string.rst:584 +#: ../../library/string.rst:586 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:588 +#: ../../library/string.rst:590 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:592 +#: ../../library/string.rst:594 +msgid "" +"The result should be correctly rounded to a given precision ``p`` of digits " +"after the decimal point. The rounding mode for :class:`float` matches that " +"of the :func:`round` builtin. For :class:`~decimal.Decimal`, the rounding " +"mode of the current :ref:`context ` will be used." +msgstr "" + +#: ../../library/string.rst:599 msgid "" "The available presentation types for :class:`complex` are the same as those " "for :class:`float` (``'%'`` is not allowed). Both the real and imaginary " @@ -916,17 +925,17 @@ msgid "" "surrounded by parentheses), possibly altered by other format modifiers." msgstr "" -#: ../../library/string.rst:605 +#: ../../library/string.rst:612 msgid "Format examples" msgstr "格式範例" -#: ../../library/string.rst:607 +#: ../../library/string.rst:614 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "本節包含 :meth:`str.format` 語法以及與舊式 ``%`` 格式的比較。" -#: ../../library/string.rst:610 +#: ../../library/string.rst:617 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 " @@ -935,17 +944,17 @@ msgstr "" "此語法在大多情況下與舊式的 ``%`` 格式類似,只是增加了 ``{}`` 和 ``:`` 來取代 " "``%``。例如,``'%03.2f'`` 可以改寫為 ``'{:03.2f}'``。" -#: ../../library/string.rst:614 +#: ../../library/string.rst:621 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "新的語法還支援新的選項,將在以下的範例中說明。" -#: ../../library/string.rst:617 +#: ../../library/string.rst:624 msgid "Accessing arguments by position::" msgstr "按位置存取引數: ::" -#: ../../library/string.rst:619 +#: ../../library/string.rst:626 msgid "" ">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" "'a, b, c'\n" @@ -959,12 +968,22 @@ msgid "" "repeated\n" "'abracadabra'" msgstr "" +">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" +"'a, b, c'\n" +">>> '{}, {}, {}'.format('a', 'b', 'c') # 3.1+ only\n" +"'a, b, c'\n" +">>> '{2}, {1}, {0}'.format('a', 'b', 'c')\n" +"'c, b, a'\n" +">>> '{2}, {1}, {0}'.format(*'abc') # 解包引數序列\n" +"'c, b, a'\n" +">>> '{0}{1}{0}'.format('abra', 'cad') # 引數索引可以重複\n" +"'abracadabra'" -#: ../../library/string.rst:630 +#: ../../library/string.rst:637 msgid "Accessing arguments by name::" msgstr "按名稱存取引數: ::" -#: ../../library/string.rst:632 +#: ../../library/string.rst:639 msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" @@ -974,11 +993,11 @@ msgid "" "'Coordinates: 37.24N, -115.81W'" msgstr "" -#: ../../library/string.rst:638 +#: ../../library/string.rst:645 msgid "Accessing arguments' attributes::" msgstr "存取引數的屬性: ::" -#: ../../library/string.rst:640 +#: ../../library/string.rst:647 msgid "" ">>> c = 3-5j\n" ">>> ('The complex number {0} is formed from the real part {0.real} '\n" @@ -995,22 +1014,25 @@ msgid "" "'Point(4, 2)'" msgstr "" -#: ../../library/string.rst:653 +#: ../../library/string.rst:660 msgid "Accessing arguments' items::" msgstr "存取引數的內容: ::" -#: ../../library/string.rst:655 +#: ../../library/string.rst:662 msgid "" ">>> coord = (3, 5)\n" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" "'X: 3; Y: 5'" msgstr "" +">>> coord = (3, 5)\n" +">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" +"'X: 3; Y: 5'" -#: ../../library/string.rst:659 +#: ../../library/string.rst:666 msgid "Replacing ``%s`` and ``%r``::" msgstr "替換 ``%s`` 和 ``%r``: ::" -#: ../../library/string.rst:661 +#: ../../library/string.rst:668 msgid "" ">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " "'test2')\n" @@ -1020,11 +1042,11 @@ msgstr "" "'test2')\n" "\"repr() shows quotes: 'test1'; str() doesn't: test2\"" -#: ../../library/string.rst:664 +#: ../../library/string.rst:671 msgid "Aligning the text and specifying a width::" msgstr "對齊文字以及指定寬度: ::" -#: ../../library/string.rst:666 +#: ../../library/string.rst:673 msgid "" ">>> '{:<30}'.format('left aligned')\n" "'left aligned '\n" @@ -1036,11 +1058,11 @@ msgid "" "'***********centered***********'" msgstr "" -#: ../../library/string.rst:675 +#: ../../library/string.rst:682 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "替換 ``%+f``、``%-f`` 和 ``% f`` 以及指定正負號: ::" -#: ../../library/string.rst:677 +#: ../../library/string.rst:684 msgid "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" @@ -1050,13 +1072,20 @@ msgid "" "f}; {:f}'\n" "'3.140000; -3.140000'" msgstr "" +">>> '{:+f}; {:+f}'.format(3.14, -3.14) # 總會顯示\n" +"'+3.140000; -3.140000'\n" +">>> '{: f}; {: f}'.format(3.14, -3.14) # 若為正數則顯示空格\n" +"' 3.140000; -3.140000'\n" +">>> '{:-f}; {:-f}'.format(3.14, -3.14) # 只顯示負號 -- 與 '{:f}; {:f}' 相" +"同\n" +"'3.140000; -3.140000'" -#: ../../library/string.rst:684 +#: ../../library/string.rst:691 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "替換 ``%x`` 和 ``%o`` 並將其值轉換為不同的進位制: ::" -#: ../../library/string.rst:686 +#: ../../library/string.rst:693 msgid "" ">>> # format also supports binary numbers\n" ">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" @@ -1066,11 +1095,11 @@ msgid "" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" msgstr "" -#: ../../library/string.rst:693 +#: ../../library/string.rst:700 msgid "Using the comma as a thousands separator::" msgstr "使用逗號作為千位分隔符: ::" -#: ../../library/string.rst:695 +#: ../../library/string.rst:702 msgid "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" @@ -1078,11 +1107,11 @@ msgstr "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" -#: ../../library/string.rst:698 +#: ../../library/string.rst:705 msgid "Expressing a percentage::" msgstr "表示為百分比: ::" -#: ../../library/string.rst:700 +#: ../../library/string.rst:707 msgid "" ">>> points = 19\n" ">>> total = 22\n" @@ -1094,11 +1123,11 @@ msgstr "" ">>> 'Correct answers: {:.2%}'.format(points/total)\n" "'Correct answers: 86.36%'" -#: ../../library/string.rst:705 +#: ../../library/string.rst:712 msgid "Using type-specific formatting::" msgstr "作為特定型別格式: ::" -#: ../../library/string.rst:707 +#: ../../library/string.rst:714 msgid "" ">>> import datetime\n" ">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" @@ -1110,11 +1139,11 @@ msgstr "" ">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" "'2010-07-04 12:15:58'" -#: ../../library/string.rst:712 +#: ../../library/string.rst:719 msgid "Nesting arguments and more complex examples::" msgstr "巢狀引數及更多複雜範例: ::" -#: ../../library/string.rst:714 +#: ../../library/string.rst:721 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1172,11 +1201,11 @@ msgstr "" " 10 A 12 1010\n" " 11 B 13 1011" -#: ../../library/string.rst:746 +#: ../../library/string.rst:753 msgid "Template strings" msgstr "模板字串" -#: ../../library/string.rst:748 +#: ../../library/string.rst:755 msgid "" "Template strings provide simpler string substitutions as described in :pep:" "`292`. A primary use case for template strings is for internationalization " @@ -1190,17 +1219,17 @@ msgstr "" "化工具更容易翻譯。基於模板字串建構的 i18n 函式庫範例,請參閱 `flufl.i18n " "`_ 套件。" -#: ../../library/string.rst:758 +#: ../../library/string.rst:765 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:760 +#: ../../library/string.rst:767 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:762 +#: ../../library/string.rst:769 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1210,30 +1239,30 @@ msgid "" "specification." msgstr "" -#: ../../library/string.rst:769 +#: ../../library/string.rst:776 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:773 +#: ../../library/string.rst:780 msgid "" "Any other appearance of ``$`` in the string will result in a :exc:" "`ValueError` being raised." msgstr "" -#: ../../library/string.rst:776 +#: ../../library/string.rst:783 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:782 +#: ../../library/string.rst:789 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:787 +#: ../../library/string.rst:794 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -1245,7 +1274,7 @@ msgstr "" "的字典型物件。或者如果關鍵字就是佔位符號時,你也可以改提供關鍵字引數。當 " "*mapping* 跟 *kwds* 同時給定並存在重複時,*kwds* 的佔位符號會被優先使用。" -#: ../../library/string.rst:796 +#: ../../library/string.rst:803 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -1258,7 +1287,7 @@ msgstr "" "與 :meth:`substitute` 不同的是,任何包含 ``$`` 的字句會直接回傳 ``$`` 而非引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:802 +#: ../../library/string.rst:809 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 " @@ -1272,7 +1301,7 @@ msgstr "" "完全安全,因為它會默默忽略格式錯誤的模板,這些模板包含了多餘的左右定界符、不" "匹配的括號,或者不是有效的 Python 識別字的佔位符號。" -#: ../../library/string.rst:812 +#: ../../library/string.rst:819 msgid "" "Returns false if the template has invalid placeholders that will cause :meth:" "`substitute` to raise :exc:`ValueError`." @@ -1280,18 +1309,18 @@ msgstr "" "如果模板有將導致 :meth:`substitute` 引發 :exc:`ValueError` 的無效佔位符號,就" "會回傳 false。" -#: ../../library/string.rst:820 +#: ../../library/string.rst:827 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:825 +#: ../../library/string.rst:832 msgid ":class:`Template` instances also provide one public data attribute:" msgstr ":class:`Template` 實例也提供一個公開的資料屬性:" -#: ../../library/string.rst:829 +#: ../../library/string.rst:836 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." @@ -1299,11 +1328,11 @@ msgstr "" "這是傳遞給建構函式 *template* 引數的物件。一般來說,你不應該改變它,但並沒有" "強制設定成唯讀。" -#: ../../library/string.rst:832 +#: ../../library/string.rst:839 msgid "Here is an example of how to use a Template::" msgstr "以下是如何使用 Template 的一個範例: ::" -#: ../../library/string.rst:834 +#: ../../library/string.rst:841 msgid "" ">>> from string import Template\n" ">>> s = Template('$who likes $what')\n" @@ -1337,7 +1366,7 @@ msgstr "" ">>> Template('$who likes $what').safe_substitute(d)\n" "'tim likes $what'" -#: ../../library/string.rst:850 +#: ../../library/string.rst:857 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1347,7 +1376,7 @@ msgstr "" "進階用法:你可以衍生 :class:`Template` 類別來自定義佔位符號語法、左右定界符字" "元,或者用於剖析模板字串的正規表示式。你可以透過覆寫這些類別屬性來達成:" -#: ../../library/string.rst:855 +#: ../../library/string.rst:862 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " @@ -1361,7 +1390,7 @@ msgstr "" "注意你不能在建立類別後修改左右定界符。(意即在子類別的命名空間中必須設置不同" "的左右定界符)" -#: ../../library/string.rst:862 +#: ../../library/string.rst:869 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1369,19 +1398,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:869 +#: ../../library/string.rst:876 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:873 +#: ../../library/string.rst:880 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:877 +#: ../../library/string.rst:884 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1390,7 +1419,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:885 +#: ../../library/string.rst:892 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1399,7 +1428,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:893 +#: ../../library/string.rst:900 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1408,13 +1437,13 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:899 +#: ../../library/string.rst:906 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "*escaped* -- 此群組與跳脫序列匹配,例如在預設模式下為 ``$$``。" -#: ../../library/string.rst:902 +#: ../../library/string.rst:909 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." @@ -1422,7 +1451,7 @@ msgstr "" "*named* -- 此群組與不帶大括號的佔位符號名稱匹配;它不應包含擷取群組中的左右定" "界符號。" -#: ../../library/string.rst:905 +#: ../../library/string.rst:912 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." @@ -1430,7 +1459,7 @@ msgstr "" "*braced* -- 此群組與大括號括起來的佔位符號名稱匹配;它不應在擷取群組中包含左" "右定界符或大括號。" -#: ../../library/string.rst:908 +#: ../../library/string.rst:915 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." @@ -1438,7 +1467,7 @@ msgstr "" "*invalid* -- 此群組與任何其他左右定界符模式(通常是單一左右定界符)匹配,且它" "應該出現在正規表示式的最後。" -#: ../../library/string.rst:911 +#: ../../library/string.rst:918 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." @@ -1446,11 +1475,11 @@ msgstr "" "當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引發 :exc:" "`ValueError`。" -#: ../../library/string.rst:916 +#: ../../library/string.rst:923 msgid "Helper functions" msgstr "輔助函式" -#: ../../library/string.rst:920 +#: ../../library/string.rst:927 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " "using :meth:`str.capitalize`, and join the capitalized words using :meth:" @@ -1471,7 +1500,7 @@ msgstr "{} (花括號)" #: ../../library/string.rst:195 ../../library/string.rst:335 #: ../../library/string.rst:368 ../../library/string.rst:387 #: ../../library/string.rst:396 ../../library/string.rst:410 -#: ../../library/string.rst:419 +#: ../../library/string.rst:421 msgid "in string formatting" msgstr "於字串格式化" @@ -1527,14 +1556,14 @@ msgstr "# (井字號)" msgid ", (comma)" msgstr ", (逗號)" -#: ../../library/string.rst:419 +#: ../../library/string.rst:421 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../library/string.rst:756 +#: ../../library/string.rst:763 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/string.rst:756 +#: ../../library/string.rst:763 msgid "in template strings" msgstr "於 template strings(模板字串)" diff --git a/library/token.po b/library/token.po index bd30000c13..de853e2c2d 100644 --- a/library/token.po +++ b/library/token.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-30 23:07+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -287,21 +287,27 @@ msgid "" "only produced when :func:`ast.parse` is invoked with ``type_comments=True``." msgstr "" -#: ../../library/token.rst:82 +#: ../../library/token.rst:84 +msgid "" +"A dictionary mapping the string representation of a token to its numeric " +"code." +msgstr "" + +#: ../../library/token.rst:89 msgid "Added :data:`!AWAIT` and :data:`!ASYNC` tokens." msgstr "" -#: ../../library/token.rst:85 +#: ../../library/token.rst:92 msgid "Added :data:`COMMENT`, :data:`NL` and :data:`ENCODING` tokens." msgstr "" -#: ../../library/token.rst:88 +#: ../../library/token.rst:95 msgid "" "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens. \"async\" and \"await\" " "are now tokenized as :data:`NAME` tokens." msgstr "" -#: ../../library/token.rst:92 +#: ../../library/token.rst:99 msgid "" "Added :data:`TYPE_COMMENT`, :data:`TYPE_IGNORE`, :data:`COLONEQUAL`. Added :" "data:`!AWAIT` and :data:`!ASYNC` tokens back (they're needed to support " @@ -309,6 +315,6 @@ msgid "" "set to 6 or lower)." msgstr "" -#: ../../library/token.rst:98 +#: ../../library/token.rst:105 msgid "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens again." msgstr "" diff --git a/library/traceback.po b/library/traceback.po index b2fbc3ea87..3a7269ef34 100644 --- a/library/traceback.po +++ b/library/traceback.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-12-13 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -150,11 +150,11 @@ msgid "" "when printing an unhandled exception." msgstr "" -#: ../../library/traceback.rst:104 ../../library/traceback.rst:208 +#: ../../library/traceback.rst:104 ../../library/traceback.rst:215 msgid "The *etype* argument is ignored and inferred from the type of *value*." msgstr "" -#: ../../library/traceback.rst:107 ../../library/traceback.rst:188 +#: ../../library/traceback.rst:107 ../../library/traceback.rst:195 msgid "" "The *etype* parameter has been renamed to *exc* and is now positional-only." msgstr "" @@ -205,6 +205,13 @@ msgstr "" #: ../../library/traceback.rst:162 msgid "" +"Print the list of tuples as returned by :func:`extract_tb` or :func:" +"`extract_stack` as a formatted stack trace to the given file. If *file* is " +"``None``, the output is written to :data:`sys.stderr`." +msgstr "" + +#: ../../library/traceback.rst:169 +msgid "" "Given a list of tuples or :class:`FrameSummary` objects as returned by :func:" "`extract_tb` or :func:`extract_stack`, return a list of strings ready for " "printing. Each string in the resulting list corresponds to the item with " @@ -213,7 +220,7 @@ msgid "" "text line is not ``None``." msgstr "" -#: ../../library/traceback.rst:172 +#: ../../library/traceback.rst:179 msgid "" "Format the exception part of a traceback using an exception value such as " "given by :data:`sys.last_value`. The return value is a list of strings, " @@ -224,31 +231,31 @@ msgid "" "contains the exception's :attr:`notes `." msgstr "" -#: ../../library/traceback.rst:180 +#: ../../library/traceback.rst:187 msgid "" "Since Python 3.10, instead of passing *value*, an exception object can be " "passed as the first argument. If *value* is provided, the first argument is " "ignored in order to provide backwards compatibility." msgstr "" -#: ../../library/traceback.rst:184 ../../library/traceback.rst:415 +#: ../../library/traceback.rst:191 ../../library/traceback.rst:422 msgid "" "When *show_group* is ``True``, and the exception is an instance of :exc:" "`BaseExceptionGroup`, the nested exceptions are included as well, " "recursively, with indentation relative to their nesting depth." msgstr "" -#: ../../library/traceback.rst:192 +#: ../../library/traceback.rst:199 msgid "" "The returned list now includes any :attr:`notes ` " "attached to the exception." msgstr "" -#: ../../library/traceback.rst:196 +#: ../../library/traceback.rst:203 msgid "*show_group* parameter was added." msgstr "" -#: ../../library/traceback.rst:202 +#: ../../library/traceback.rst:209 msgid "" "Format a stack trace and the exception information. The arguments have the " "same meaning as the corresponding arguments to :func:`print_exception`. The " @@ -257,69 +264,69 @@ msgid "" "printed, exactly the same text is printed as does :func:`print_exception`." msgstr "" -#: ../../library/traceback.rst:211 +#: ../../library/traceback.rst:218 msgid "" "This function's behavior and signature were modified to match :func:" "`print_exception`." msgstr "" -#: ../../library/traceback.rst:218 +#: ../../library/traceback.rst:225 msgid "" "This is like ``print_exc(limit)`` but returns a string instead of printing " "to a file." msgstr "" -#: ../../library/traceback.rst:224 +#: ../../library/traceback.rst:231 msgid "A shorthand for ``format_list(extract_tb(tb, limit))``." msgstr "``format_list(extract_tb(tb, limit))`` 的簡寫。" -#: ../../library/traceback.rst:229 +#: ../../library/traceback.rst:236 msgid "A shorthand for ``format_list(extract_stack(f, limit))``." msgstr "``format_list(extract_stack(f, limit))`` 的簡寫。" -#: ../../library/traceback.rst:233 +#: ../../library/traceback.rst:240 msgid "" "Clears the local variables of all the stack frames in a :ref:`traceback " "` *tb* by calling the :meth:`~frame.clear` method of " "each :ref:`frame object `." msgstr "" -#: ../../library/traceback.rst:242 +#: ../../library/traceback.rst:249 msgid "" "Walk a stack following :attr:`f.f_back ` from the given frame, " "yielding the frame and line number for each frame. If *f* is ``None``, the " "current stack is used. This helper is used with :meth:`StackSummary.extract`." msgstr "" -#: ../../library/traceback.rst:251 +#: ../../library/traceback.rst:258 msgid "" "Walk a traceback following :attr:`~traceback.tb_next` yielding the frame and " "line number for each frame. This helper is used with :meth:`StackSummary." "extract`." msgstr "" -#: ../../library/traceback.rst:259 +#: ../../library/traceback.rst:266 msgid ":class:`!TracebackException` Objects" msgstr ":class:`!TracebackException` 物件" -#: ../../library/traceback.rst:263 +#: ../../library/traceback.rst:270 msgid "" ":class:`!TracebackException` objects are created from actual exceptions to " "capture data for later printing. They offer a more lightweight method of " "storing this information by avoiding holding references to :ref:" -"`traceback` and :ref:`frame` objects In " +"`traceback` and :ref:`frame` objects. In " "addition, they expose more options to configure the output compared to the " "module-level functions described above." msgstr "" -#: ../../library/traceback.rst:272 +#: ../../library/traceback.rst:279 msgid "" "Capture an exception for later rendering. The meaning of *limit*, " "*lookup_lines* and *capture_locals* are as for the :class:`StackSummary` " "class." msgstr "" -#: ../../library/traceback.rst:276 +#: ../../library/traceback.rst:283 msgid "" "If *compact* is true, only data that is required by :class:`!" "TracebackException`'s :meth:`format` method is saved in the class " @@ -327,12 +334,12 @@ msgid "" "if :attr:`__cause__` is ``None`` and :attr:`__suppress_context__` is false." msgstr "" -#: ../../library/traceback.rst:282 ../../library/traceback.rst:383 +#: ../../library/traceback.rst:289 ../../library/traceback.rst:390 msgid "" "Note that when locals are captured, they are also shown in the traceback." msgstr "" -#: ../../library/traceback.rst:284 +#: ../../library/traceback.rst:291 msgid "" "*max_group_width* and *max_group_depth* control the formatting of exception " "groups (see :exc:`BaseExceptionGroup`). The depth refers to the nesting " @@ -341,128 +348,128 @@ msgid "" "limit is exceeded." msgstr "" -#: ../../library/traceback.rst:290 +#: ../../library/traceback.rst:297 msgid "Added the *compact* parameter." msgstr "新增 *compact* 參數。" -#: ../../library/traceback.rst:293 +#: ../../library/traceback.rst:300 msgid "Added the *max_group_width* and *max_group_depth* parameters." msgstr "新增 *max_group_width* 和 *max_group_depth* 參數。" -#: ../../library/traceback.rst:298 +#: ../../library/traceback.rst:305 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__cause__`." msgstr "" -#: ../../library/traceback.rst:303 +#: ../../library/traceback.rst:310 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__context__`." msgstr "" -#: ../../library/traceback.rst:308 +#: ../../library/traceback.rst:315 msgid "" "If ``self`` represents an :exc:`ExceptionGroup`, this field holds a list of :" "class:`!TracebackException` instances representing the nested exceptions. " "Otherwise it is ``None``." msgstr "" -#: ../../library/traceback.rst:316 +#: ../../library/traceback.rst:323 msgid "" "The :attr:`~BaseException.__suppress_context__` value from the original " "exception." msgstr "" -#: ../../library/traceback.rst:321 +#: ../../library/traceback.rst:328 msgid "" "The :attr:`~BaseException.__notes__` value from the original exception, or " "``None`` if the exception does not have any notes. If it is not ``None`` is " "it formatted in the traceback after the exception string." msgstr "" -#: ../../library/traceback.rst:330 +#: ../../library/traceback.rst:337 msgid "A :class:`StackSummary` representing the traceback." msgstr "" -#: ../../library/traceback.rst:334 +#: ../../library/traceback.rst:341 msgid "The class of the original traceback." msgstr "" -#: ../../library/traceback.rst:340 +#: ../../library/traceback.rst:347 msgid "String display of the class of the original exception." msgstr "" -#: ../../library/traceback.rst:346 +#: ../../library/traceback.rst:353 msgid "For syntax errors - the file name where the error occurred." msgstr "" -#: ../../library/traceback.rst:350 +#: ../../library/traceback.rst:357 msgid "For syntax errors - the line number where the error occurred." msgstr "" -#: ../../library/traceback.rst:354 +#: ../../library/traceback.rst:361 msgid "" "For syntax errors - the end line number where the error occurred. Can be " "``None`` if not present." msgstr "" -#: ../../library/traceback.rst:361 +#: ../../library/traceback.rst:368 msgid "For syntax errors - the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:365 +#: ../../library/traceback.rst:372 msgid "For syntax errors - the offset into the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:369 +#: ../../library/traceback.rst:376 msgid "" "For syntax errors - the end offset into the text where the error occurred. " "Can be ``None`` if not present." msgstr "" -#: ../../library/traceback.rst:376 +#: ../../library/traceback.rst:383 msgid "For syntax errors - the compiler error message." msgstr "" -#: ../../library/traceback.rst:380 +#: ../../library/traceback.rst:387 msgid "" "Capture an exception for later rendering. *limit*, *lookup_lines* and " "*capture_locals* are as for the :class:`StackSummary` class." msgstr "" -#: ../../library/traceback.rst:387 +#: ../../library/traceback.rst:394 msgid "" "Print to *file* (default ``sys.stderr``) the exception information returned " "by :meth:`format`." msgstr "" -#: ../../library/traceback.rst:394 +#: ../../library/traceback.rst:401 msgid "Format the exception." msgstr "" -#: ../../library/traceback.rst:396 +#: ../../library/traceback.rst:403 msgid "" "If *chain* is not ``True``, :attr:`__cause__` and :attr:`__context__` will " "not be formatted." msgstr "" -#: ../../library/traceback.rst:399 +#: ../../library/traceback.rst:406 msgid "" "The return value is a generator of strings, each ending in a newline and " "some containing internal newlines. :func:`~traceback.print_exception` is a " "wrapper around this method which just prints the lines to a file." msgstr "" -#: ../../library/traceback.rst:405 +#: ../../library/traceback.rst:412 msgid "Format the exception part of the traceback." msgstr "" -#: ../../library/traceback.rst:407 +#: ../../library/traceback.rst:414 msgid "The return value is a generator of strings, each ending in a newline." msgstr "" -#: ../../library/traceback.rst:409 +#: ../../library/traceback.rst:416 msgid "" "When *show_group* is ``False``, the generator emits the exception's message " "followed by its notes (if it has any). The exception message is normally a " @@ -471,32 +478,32 @@ msgid "" "the syntax error occurred." msgstr "" -#: ../../library/traceback.rst:419 +#: ../../library/traceback.rst:426 msgid "" "The exception's :attr:`notes ` are now included in " "the output." msgstr "" -#: ../../library/traceback.rst:423 +#: ../../library/traceback.rst:430 msgid "Added the *show_group* parameter." msgstr "新增 *show_group* 參數。" -#: ../../library/traceback.rst:428 +#: ../../library/traceback.rst:435 msgid ":class:`!StackSummary` Objects" msgstr ":class:`!StackSummary` 物件" -#: ../../library/traceback.rst:432 +#: ../../library/traceback.rst:439 msgid "" ":class:`!StackSummary` objects represent a call stack ready for formatting." msgstr "" -#: ../../library/traceback.rst:438 +#: ../../library/traceback.rst:445 msgid "" "Construct a :class:`!StackSummary` object from a frame generator (such as is " "returned by :func:`~traceback.walk_stack` or :func:`~traceback.walk_tb`)." msgstr "" -#: ../../library/traceback.rst:442 +#: ../../library/traceback.rst:449 msgid "" "If *limit* is supplied, only this many frames are taken from *frame_gen*. If " "*lookup_lines* is ``False``, the returned :class:`FrameSummary` objects will " @@ -506,20 +513,20 @@ msgid "" "class:`!FrameSummary` are captured as object representations." msgstr "" -#: ../../library/traceback.rst:450 +#: ../../library/traceback.rst:457 msgid "" "Exceptions raised from :func:`repr` on a local variable (when " "*capture_locals* is ``True``) are no longer propagated to the caller." msgstr "" -#: ../../library/traceback.rst:456 +#: ../../library/traceback.rst:463 msgid "" "Construct a :class:`!StackSummary` object from a supplied list of :class:" "`FrameSummary` objects or old-style list of tuples. Each tuple should be a " "4-tuple with *filename*, *lineno*, *name*, *line* as the elements." msgstr "" -#: ../../library/traceback.rst:463 +#: ../../library/traceback.rst:470 msgid "" "Returns a list of strings ready for printing. Each string in the resulting " "list corresponds to a single :ref:`frame ` from the stack. " @@ -527,18 +534,18 @@ msgid "" "well, for those items with source text lines." msgstr "" -#: ../../library/traceback.rst:469 +#: ../../library/traceback.rst:476 msgid "" "For long sequences of the same frame and line, the first few repetitions are " "shown, followed by a summary line stating the exact number of further " "repetitions." msgstr "" -#: ../../library/traceback.rst:473 +#: ../../library/traceback.rst:480 msgid "Long sequences of repeated frames are now abbreviated." msgstr "" -#: ../../library/traceback.rst:478 +#: ../../library/traceback.rst:485 msgid "" "Returns a string for printing one of the :ref:`frames ` " "involved in the stack. This method is called for each :class:`FrameSummary` " @@ -546,17 +553,17 @@ msgid "" "the frame is omitted from the output." msgstr "" -#: ../../library/traceback.rst:488 +#: ../../library/traceback.rst:495 msgid ":class:`!FrameSummary` Objects" msgstr ":class:`!FrameSummary` 物件" -#: ../../library/traceback.rst:492 +#: ../../library/traceback.rst:499 msgid "" "A :class:`!FrameSummary` object represents a single :ref:`frame ` in a :ref:`traceback `." msgstr "" -#: ../../library/traceback.rst:497 +#: ../../library/traceback.rst:504 msgid "" "Represents a single :ref:`frame ` in the :ref:`traceback " "` or stack that is being formatted or printed. It may " @@ -570,38 +577,38 @@ msgid "" "display." msgstr "" -#: ../../library/traceback.rst:508 +#: ../../library/traceback.rst:515 msgid ":class:`!FrameSummary` instances have the following attributes:" msgstr "" -#: ../../library/traceback.rst:512 +#: ../../library/traceback.rst:519 msgid "" "The filename of the source code for this frame. Equivalent to accessing :" "attr:`f.f_code.co_filename ` on a :ref:`frame object " "` *f*." msgstr "" -#: ../../library/traceback.rst:518 +#: ../../library/traceback.rst:525 msgid "The line number of the source code for this frame." msgstr "" -#: ../../library/traceback.rst:522 +#: ../../library/traceback.rst:529 msgid "" "Equivalent to accessing :attr:`f.f_code.co_name ` on a :" "ref:`frame object ` *f*." msgstr "" -#: ../../library/traceback.rst:527 +#: ../../library/traceback.rst:534 msgid "" "A string representing the source code for this frame, with leading and " "trailing whitespace stripped. If the source is not available, it is ``None``." msgstr "" -#: ../../library/traceback.rst:534 +#: ../../library/traceback.rst:541 msgid "Examples of Using the Module-Level Functions" msgstr "" -#: ../../library/traceback.rst:536 +#: ../../library/traceback.rst:543 msgid "" "This simple example implements a basic read-eval-print loop, similar to (but " "less useful than) the standard Python interactive interpreter loop. For a " @@ -609,7 +616,7 @@ msgid "" "`code` module. ::" msgstr "" -#: ../../library/traceback.rst:541 +#: ../../library/traceback.rst:548 msgid "" "import sys, traceback\n" "\n" @@ -628,13 +635,13 @@ msgid "" " run_user_code(envdir)" msgstr "" -#: ../../library/traceback.rst:558 +#: ../../library/traceback.rst:565 msgid "" "The following example demonstrates the different ways to print and format " "the exception and traceback:" msgstr "" -#: ../../library/traceback.rst:561 +#: ../../library/traceback.rst:568 msgid "" "import sys, traceback\n" "\n" @@ -666,11 +673,11 @@ msgid "" " print(\"*** tb_lineno:\", exc.__traceback__.tb_lineno)" msgstr "" -#: ../../library/traceback.rst:592 +#: ../../library/traceback.rst:599 msgid "The output for the example would look similar to this:" msgstr "" -#: ../../library/traceback.rst:594 +#: ../../library/traceback.rst:601 msgid "" "*** print_tb:\n" " File \"\", line 10, in \n" @@ -720,13 +727,13 @@ msgid "" "*** tb_lineno: 10" msgstr "" -#: ../../library/traceback.rst:639 +#: ../../library/traceback.rst:646 msgid "" "The following example shows the different ways to print and format the " "stack::" msgstr "" -#: ../../library/traceback.rst:641 +#: ../../library/traceback.rst:648 msgid "" ">>> import traceback\n" ">>> def another_function():\n" @@ -778,11 +785,11 @@ msgstr "" " ' File \"\", line 8, in lumberstack\\n print(repr(traceback." "format_stack()))\\n']" -#: ../../library/traceback.rst:665 +#: ../../library/traceback.rst:672 msgid "This last example demonstrates the final few formatting functions:" msgstr "" -#: ../../library/traceback.rst:667 +#: ../../library/traceback.rst:674 msgid "" ">>> import traceback\n" ">>> traceback.format_list([('spam.py', 3, '', 'spam.eggs()'),\n" @@ -794,15 +801,15 @@ msgid "" "['IndexError: tuple index out of range\\n']" msgstr "" -#: ../../library/traceback.rst:681 +#: ../../library/traceback.rst:688 msgid "Examples of Using :class:`TracebackException`" msgstr ":class:`TracebackException` 的使用範例" -#: ../../library/traceback.rst:683 +#: ../../library/traceback.rst:690 msgid "With the helper class, we have more options::" msgstr "" -#: ../../library/traceback.rst:685 +#: ../../library/traceback.rst:692 msgid "" ">>> import sys\n" ">>> from traceback import TracebackException\n" diff --git a/library/xmlrpc.po b/library/xmlrpc.po index 15a6dc34eb..00defcf838 100644 --- a/library/xmlrpc.po +++ b/library/xmlrpc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-29 10:36+0000\n" +"POT-Creation-Date: 2024-12-11 00:14+0000\n" "PO-Revision-Date: 2022-02-16 01:58+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,7 +23,7 @@ msgstr "" msgid ":mod:`!xmlrpc` --- XMLRPC server and client modules" msgstr ":mod:`!xmlrpc` --- XMLRPC 伺服器與用戶模組" -#: ../../library/xmlrpc.rst:4 +#: ../../library/xmlrpc.rst:7 msgid "" "XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP as a " "transport. With it, a client can call methods with parameters on a remote " @@ -33,17 +33,17 @@ msgstr "" "(transport)的 XML 來做傳遞。有了它,用戶端可以在遠端伺服器上呼叫帶有參數的" "方法(伺服器以 URI 命名)並獲取結構化的資料。" -#: ../../library/xmlrpc.rst:8 +#: ../../library/xmlrpc.rst:11 msgid "" "``xmlrpc`` is a package that collects server and client modules implementing " "XML-RPC. The modules are:" msgstr "" "``xmlrpc`` 是一個集合了 XML-RPC 伺服器與用戶端模組實作的套件。這些模組是:" -#: ../../library/xmlrpc.rst:11 +#: ../../library/xmlrpc.rst:14 msgid ":mod:`xmlrpc.client`" msgstr ":mod:`xmlrpc.client`" -#: ../../library/xmlrpc.rst:12 +#: ../../library/xmlrpc.rst:15 msgid ":mod:`xmlrpc.server`" msgstr ":mod:`xmlrpc.server`" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index b29815534b..8ad51dca40 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -6,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-12-03 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -447,12 +447,13 @@ msgstr "" msgid "" "These equivalences assume that :const:`__debug__` and :exc:`AssertionError` " "refer to the built-in variables with those names. In the current " -"implementation, the built-in variable :const:`__debug__` is ``True`` under " -"normal circumstances, ``False`` when optimization is requested (command line " -"option :option:`-O`). The current code generator emits no code for an " -"assert statement when optimization is requested at compile time. Note that " -"it is unnecessary to include the source code for the expression that failed " -"in the error message; it will be displayed as part of the stack trace." +"implementation, the built-in variable ``__debug__`` is ``True`` under normal " +"circumstances, ``False`` when optimization is requested (command line " +"option :option:`-O`). The current code generator emits no code for an :" +"keyword:`assert` statement when optimization is requested at compile time. " +"Note that it is unnecessary to include the source code for the expression " +"that failed in the error message; it will be displayed as part of the stack " +"trace." msgstr "" #: ../../reference/simple_stmts.rst:416 @@ -569,7 +570,7 @@ msgstr ":keyword:`!yield` 陳述式" #: ../../reference/simple_stmts.rst:533 msgid "" "A :keyword:`yield` statement is semantically equivalent to a :ref:`yield " -"expression `. The yield statement can be used to omit the " +"expression `. The ``yield`` statement can be used to omit the " "parentheses that would otherwise be required in the equivalent yield " "expression statement. For example, the yield statements ::" msgstr "" @@ -598,8 +599,9 @@ msgstr "" msgid "" "Yield expressions and statements are only used when defining a :term:" "`generator` function, and are only used in the body of the generator " -"function. Using yield in a function definition is sufficient to cause that " -"definition to create a generator function instead of a normal function." +"function. Using :keyword:`yield` in a function definition is sufficient to " +"cause that definition to create a generator function instead of a normal " +"function." msgstr "" #: ../../reference/simple_stmts.rst:551 @@ -1153,35 +1155,20 @@ msgstr ":keyword:`!global` 陳述式" #: ../../reference/simple_stmts.rst:967 msgid "" -"The :keyword:`global` statement is a declaration which holds for the entire " -"current code block. It means that the listed identifiers are to be " -"interpreted as globals. It would be impossible to assign to a global " +"The :keyword:`global` statement causes the listed identifiers to be " +"interpreted as globals. It would be impossible to assign to a global " "variable without :keyword:`!global`, although free variables may refer to " "globals without being declared global." msgstr "" -#: ../../reference/simple_stmts.rst:973 +#: ../../reference/simple_stmts.rst:972 msgid "" -"Names listed in a :keyword:`global` statement must not be used in the same " -"code block textually preceding that :keyword:`!global` statement." +"The :keyword:`global` statement applies to the entire scope of a function or " +"class body. A :exc:`SyntaxError` is raised if a variable is used or assigned " +"to prior to its global declaration in the scope." msgstr "" -#: ../../reference/simple_stmts.rst:976 -msgid "" -"Names listed in a :keyword:`global` statement must not be defined as formal " -"parameters, or as targets in :keyword:`with` statements or :keyword:`except` " -"clauses, or in a :keyword:`for` target list, :keyword:`class` definition, " -"function definition, :keyword:`import` statement, or variable annotation." -msgstr "" - -#: ../../reference/simple_stmts.rst:983 -msgid "" -"The current implementation does not enforce some of these restrictions, but " -"programs should not abuse this freedom, as future implementations may " -"enforce them or silently change the meaning of the program." -msgstr "" - -#: ../../reference/simple_stmts.rst:992 +#: ../../reference/simple_stmts.rst:981 msgid "" "**Programmer's note:** :keyword:`global` is a directive to the parser. It " "applies only to code parsed at the same time as the :keyword:`!global` " @@ -1193,11 +1180,11 @@ msgid "" "func:`compile` functions." msgstr "" -#: ../../reference/simple_stmts.rst:1004 +#: ../../reference/simple_stmts.rst:993 msgid "The :keyword:`!nonlocal` statement" msgstr ":keyword:`!nonlocal` 陳述式" -#: ../../reference/simple_stmts.rst:1012 +#: ../../reference/simple_stmts.rst:1001 msgid "" "When the definition of a function or class is nested (enclosed) within the " "definitions of other functions, its nonlocal scopes are the local scopes of " @@ -1209,64 +1196,64 @@ msgid "" "`SyntaxError` is raised." msgstr "" -#: ../../reference/simple_stmts.rst:1021 +#: ../../reference/simple_stmts.rst:1010 msgid "" -"The nonlocal statement applies to the entire scope of a function or class " -"body. A :exc:`SyntaxError` is raised if a variable is used or assigned to " -"prior to its nonlocal declaration in the scope." +"The :keyword:`nonlocal` statement applies to the entire scope of a function " +"or class body. A :exc:`SyntaxError` is raised if a variable is used or " +"assigned to prior to its nonlocal declaration in the scope." msgstr "" -#: ../../reference/simple_stmts.rst:1027 +#: ../../reference/simple_stmts.rst:1016 msgid ":pep:`3104` - Access to Names in Outer Scopes" msgstr "" -#: ../../reference/simple_stmts.rst:1028 +#: ../../reference/simple_stmts.rst:1017 msgid "The specification for the :keyword:`nonlocal` statement." msgstr "" -#: ../../reference/simple_stmts.rst:1030 +#: ../../reference/simple_stmts.rst:1019 msgid "" "**Programmer's note:** :keyword:`nonlocal` is a directive to the parser and " "applies only to code parsed along with it. See the note for the :keyword:" "`global` statement." msgstr "" -#: ../../reference/simple_stmts.rst:1038 +#: ../../reference/simple_stmts.rst:1027 msgid "The :keyword:`!type` statement" msgstr ":keyword:`!type` 陳述式" -#: ../../reference/simple_stmts.rst:1045 +#: ../../reference/simple_stmts.rst:1034 msgid "" "The :keyword:`!type` statement declares a type alias, which is an instance " "of :class:`typing.TypeAliasType`." msgstr "" -#: ../../reference/simple_stmts.rst:1048 +#: ../../reference/simple_stmts.rst:1037 msgid "For example, the following statement creates a type alias::" msgstr "" -#: ../../reference/simple_stmts.rst:1050 +#: ../../reference/simple_stmts.rst:1039 msgid "type Point = tuple[float, float]" msgstr "" -#: ../../reference/simple_stmts.rst:1052 +#: ../../reference/simple_stmts.rst:1041 msgid "This code is roughly equivalent to::" msgstr "" -#: ../../reference/simple_stmts.rst:1054 +#: ../../reference/simple_stmts.rst:1043 msgid "" "annotation-def VALUE_OF_Point():\n" " return tuple[float, float]\n" "Point = typing.TypeAliasType(\"Point\", VALUE_OF_Point())" msgstr "" -#: ../../reference/simple_stmts.rst:1058 +#: ../../reference/simple_stmts.rst:1047 msgid "" "``annotation-def`` indicates an :ref:`annotation scope `, " "which behaves mostly like a function, but with several small differences." msgstr "" -#: ../../reference/simple_stmts.rst:1061 +#: ../../reference/simple_stmts.rst:1050 msgid "" "The value of the type alias is evaluated in the annotation scope. It is not " "evaluated when the type alias is created, but only when the value is " @@ -1275,21 +1262,21 @@ msgid "" "not yet defined." msgstr "" -#: ../../reference/simple_stmts.rst:1067 +#: ../../reference/simple_stmts.rst:1056 msgid "" "Type aliases may be made generic by adding a :ref:`type parameter list ` after the name. See :ref:`generic-type-aliases` for more." msgstr "" -#: ../../reference/simple_stmts.rst:1070 +#: ../../reference/simple_stmts.rst:1059 msgid ":keyword:`!type` is a :ref:`soft keyword `." msgstr "" -#: ../../reference/simple_stmts.rst:1076 +#: ../../reference/simple_stmts.rst:1065 msgid ":pep:`695` - Type Parameter Syntax" msgstr "" -#: ../../reference/simple_stmts.rst:1077 +#: ../../reference/simple_stmts.rst:1066 msgid "" "Introduced the :keyword:`!type` statement and syntax for generic classes and " "functions." @@ -1307,8 +1294,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:523 ../../reference/simple_stmts.rst:559 #: ../../reference/simple_stmts.rst:684 ../../reference/simple_stmts.rst:718 #: ../../reference/simple_stmts.rst:743 ../../reference/simple_stmts.rst:873 -#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:1006 -#: ../../reference/simple_stmts.rst:1040 +#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:995 +#: ../../reference/simple_stmts.rst:1029 msgid "statement" msgstr "statement(陳述式)" @@ -1322,7 +1309,7 @@ msgstr "" msgid "list" msgstr "list(串列)" -#: ../../reference/simple_stmts.rst:56 ../../reference/simple_stmts.rst:987 +#: ../../reference/simple_stmts.rst:56 ../../reference/simple_stmts.rst:976 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -1418,7 +1405,7 @@ msgstr "target" #: ../../reference/simple_stmts.rst:116 ../../reference/simple_stmts.rst:382 #: ../../reference/simple_stmts.rst:743 ../../reference/simple_stmts.rst:959 -#: ../../reference/simple_stmts.rst:1006 +#: ../../reference/simple_stmts.rst:995 msgid ", (comma)" msgstr ", (逗號)" @@ -1748,26 +1735,26 @@ msgstr "__future__" msgid "future statement" msgstr "future statement(future 陳述式)" -#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:1006 +#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:995 msgid "identifier list" msgstr "identifier list(識別符號清單)" -#: ../../reference/simple_stmts.rst:987 +#: ../../reference/simple_stmts.rst:976 msgid "exec" msgstr "exec" -#: ../../reference/simple_stmts.rst:987 +#: ../../reference/simple_stmts.rst:976 msgid "eval" msgstr "eval" -#: ../../reference/simple_stmts.rst:987 +#: ../../reference/simple_stmts.rst:976 msgid "compile" msgstr "compile(編譯)" -#: ../../reference/simple_stmts.rst:1006 +#: ../../reference/simple_stmts.rst:995 msgid "nonlocal" msgstr "nonlocal" -#: ../../reference/simple_stmts.rst:1040 +#: ../../reference/simple_stmts.rst:1029 msgid "type" msgstr "" diff --git a/tutorial/datastructures.po b/tutorial/datastructures.po index 2974c0a980..d466df73d1 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-10-31 00:13+0000\n" +"POT-Creation-Date: 2024-12-07 00:14+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-" @@ -160,6 +160,27 @@ msgid "" ">>> fruits.pop()\n" "'pear'" msgstr "" +">>> fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', " +"'banana']\n" +">>> fruits.count('apple')\n" +"2\n" +">>> fruits.count('tangerine')\n" +"0\n" +">>> fruits.index('banana')\n" +"3\n" +">>> fruits.index('banana', 4) # 從位置 4 開始找到下一個 banana\n" +"6\n" +">>> fruits.reverse()\n" +">>> fruits\n" +"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange']\n" +">>> fruits.append('grape')\n" +">>> fruits\n" +"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange', 'grape']\n" +">>> fruits.sort()\n" +">>> fruits\n" +"['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear']\n" +">>> fruits.pop()\n" +"'pear'" #: ../../tutorial/datastructures.rst:122 msgid "" @@ -193,14 +214,14 @@ msgstr "將 List 作為 Stack(堆疊)使用" msgid "" "The list methods make it very easy to use a list as a stack, where the last " "element added is the first element retrieved (\"last-in, first-out\"). To " -"add an item to the top of the stack, use :meth:`~list.append`. To retrieve " -"an item from the top of the stack, use :meth:`~list.pop` without an explicit " -"index. For example::" +"add an item to the top of the stack, use :meth:`!append`. To retrieve an " +"item from the top of the stack, use :meth:`!pop` without an explicit index. " +"For example::" msgstr "" "List 的操作方法使得它非常簡單可以用來實作 stack(堆疊)。Stack 為一個遵守最後" "加入元素最先被取回(後進先出,\"last-in, first-out\")規則的資料結構。你可以" -"使用方法 :meth:`~list.append` 將一個項目放到堆疊的頂層。而使用方法 :meth:" -"`~list.pop` 且不給定索引值去取得堆疊最上面的項目。舉例而言: ::" +"使用方法 :meth:`!append` 將一個項目放到堆疊的頂層。而使用方法 :meth:`!pop` 且" +"不給定索引值去取得堆疊最上面的項目。舉例而言: ::" #: ../../tutorial/datastructures.rst:148 msgid "" @@ -274,6 +295,16 @@ msgid "" ">>> queue # Remaining queue in order of arrival\n" "deque(['Michael', 'Terry', 'Graham'])" msgstr "" +">>> from collections import deque\n" +">>> queue = deque([\"Eric\", \"John\", \"Michael\"])\n" +">>> queue.append(\"Terry\") # Terry 加進來\n" +">>> queue.append(\"Graham\") # Graham 加進來\n" +">>> queue.popleft() # 第一個加進來的現在離開\n" +"'Eric'\n" +">>> queue.popleft() # 第二個加進來的現在離開\n" +"'John'\n" +">>> queue # queue 裡剩下的會按照加進來的順序排列\n" +"deque(['Michael', 'Terry', 'Graham'])" #: ../../tutorial/datastructures.rst:196 msgid "List Comprehensions" @@ -528,6 +559,16 @@ msgid "" ">>> transposed\n" "[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]" msgstr "" +">>> transposed = []\n" +">>> for i in range(4):\n" +"... # 下面這三行實作了巢狀的 listcomp\n" +"... transposed_row = []\n" +"... for row in matrix:\n" +"... transposed_row.append(row[i])\n" +"... transposed.append(transposed_row)\n" +"...\n" +">>> transposed\n" +"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]" #: ../../tutorial/datastructures.rst:329 msgid "" @@ -557,15 +598,15 @@ msgstr ":keyword:`!del` 陳述式" #: ../../tutorial/datastructures.rst:342 msgid "" "There is a way to remove an item from a list given its index instead of its " -"value: the :keyword:`del` statement. This differs from the :meth:`~list." -"pop` method which returns a value. The :keyword:`!del` statement can also " -"be used to remove slices from a list or clear the entire list (which we did " +"value: the :keyword:`del` statement. This differs from the :meth:`!pop` " +"method which returns a value. The :keyword:`!del` statement can also be " +"used to remove slices from a list or clear the entire list (which we did " "earlier by assignment of an empty list to the slice). For example::" msgstr "" "有一個方法可以藉由索引而不是值來刪除 list 中的項目::keyword:`del` 陳述式。這" -"和 :meth:`~list.pop` method 傳回一個值不同,:keyword:`!del` 陳述式可以用來刪" -"除 list 中的片段或者清空整個 list(我們之前藉由指派一個空的 list 給想刪除的片" -"段來完成這件事)。例如: ::" +"和 :meth:`!pop` method 傳回一個值不同,:keyword:`!del` 陳述式可以用來刪除 " +"list 中的片段或者清空整個 list(我們之前藉由指派一個空的 list 給想刪除的片段" +"來完成這件事)。例如: ::" #: ../../tutorial/datastructures.rst:348 msgid "" @@ -650,6 +691,24 @@ msgid "" ">>> v\n" "([1, 2, 3], [3, 2, 1])" msgstr "" +">>> t = 12345, 54321, 'hello!'\n" +">>> t[0]\n" +"12345\n" +">>> t\n" +"(12345, 54321, 'hello!')\n" +">>> # Tuple 可以為巢狀的:\n" +">>> u = t, (1, 2, 3, 4, 5)\n" +">>> u\n" +"((12345, 54321, 'hello!'), (1, 2, 3, 4, 5))\n" +">>> # Tuple 為不可變的:\n" +">>> t[0] = 88888\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: 'tuple' object does not support item assignment\n" +">>> # but they can contain mutable objects:\n" +">>> v = ([1, 2, 3], [3, 2, 1])\n" +">>> v\n" +"([1, 2, 3], [3, 2, 1])" #: ../../tutorial/datastructures.rst:400 msgid "" @@ -706,6 +765,14 @@ msgid "" ">>> singleton\n" "('hello',)" msgstr "" +">>> empty = ()\n" +">>> singleton = 'hello', # <-- 注意後面有個逗號\n" +">>> len(empty)\n" +"0\n" +">>> len(singleton)\n" +"1\n" +">>> singleton\n" +"('hello',)" #: ../../tutorial/datastructures.rst:430 msgid "" @@ -822,8 +889,8 @@ msgid "" "can be used as keys if they contain only strings, numbers, or tuples; if a " "tuple contains any mutable object either directly or indirectly, it cannot " "be used as a key. You can't use lists as keys, since lists can be modified " -"in place using index assignments, slice assignments, or methods like :meth:" -"`~list.append` and :meth:`~list.extend`." +"in place using index assignments, slice assignments, or methods like :meth:`!" +"append` and :meth:`!extend`." msgstr "" "下一個常用的 Python 內建資料類型為 *dictionary*\\ (請參考\\ :ref:" "`typesmapping`\\ )。 Dictionary 有時被稱為「關聯記憶體」(associative " @@ -832,8 +899,7 @@ msgstr "" "和數字都可以當作鍵。Tuple 也可以當作鍵,如果他們只含有字串、數字或 tuple;若" "一個 tuple 直接或間接地含有任何可變的物件,它就不能當作鍵。你無法使用 list 當" "作鍵,因為 list 可以經由索引指派 (index assignment)、切片指派 (slice " -"assignment) 或是像 :meth:`~list.append` 和 :meth:`~list.extend` 等 method 被" -"修改。" +"assignment) 或是像 :meth:`!append` 和 :meth:`!extend` 等 method 被修改。" #: ../../tutorial/datastructures.rst:506 msgid "" diff --git a/using/ios.po b/using/ios.po index 1f1bd2a519..1f08607933 100644 --- a/using/ios.po +++ b/using/ios.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-12-10 00:15+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-" @@ -473,59 +473,65 @@ msgid "" msgstr "" #: ../../using/ios.rst:295 -msgid ":c:member:`UTF-8 mode ` is *enabled*;" +msgid "UTF-8 mode (:c:member:`PyPreConfig.utf8_mode`) is *enabled*;" msgstr "" #: ../../using/ios.rst:296 -msgid ":c:member:`Buffered stdio ` is *disabled*;" +msgid "Buffered stdio (:c:member:`PyConfig.buffered_stdio`) is *disabled*;" msgstr "" #: ../../using/ios.rst:297 -msgid ":c:member:`Writing bytecode ` is *disabled*;" +msgid "Writing bytecode (:c:member:`PyConfig.write_bytecode`) is *disabled*;" msgstr "" #: ../../using/ios.rst:298 msgid "" -":c:member:`Signal handlers ` are *enabled*;" +"Signal handlers (:c:member:`PyConfig.install_signal_handlers`) are *enabled*;" msgstr "" #: ../../using/ios.rst:299 msgid "" +"System logging (:c:member:`PyConfig.use_system_logger`) is *enabled* " +"(optional, but strongly recommended);" +msgstr "" + +#: ../../using/ios.rst:301 +msgid "" "``PYTHONHOME`` for the interpreter is configured to point at the ``python`` " "subfolder of your app's bundle; and" msgstr "" -#: ../../using/ios.rst:301 +#: ../../using/ios.rst:303 msgid "The ``PYTHONPATH`` for the interpreter includes:" msgstr "" -#: ../../using/ios.rst:303 +#: ../../using/ios.rst:305 msgid "the ``python/lib/python3.X`` subfolder of your app's bundle," msgstr "" -#: ../../using/ios.rst:304 +#: ../../using/ios.rst:306 msgid "" "the ``python/lib/python3.X/lib-dynload`` subfolder of your app's bundle, and" msgstr "" -#: ../../using/ios.rst:305 +#: ../../using/ios.rst:307 msgid "the ``app`` subfolder of your app's bundle" msgstr "" -#: ../../using/ios.rst:307 +#: ../../using/ios.rst:309 msgid "" "Your app's bundle location can be determined using ``[[NSBundle mainBundle] " "resourcePath]``." msgstr "" -#: ../../using/ios.rst:310 +#: ../../using/ios.rst:312 msgid "" "Steps 8, 9 and 10 of these instructions assume that you have a single folder " "of pure Python application code, named ``app``. If you have third-party " "binary modules in your app, some additional steps will be required:" msgstr "" -#: ../../using/ios.rst:314 +#: ../../using/ios.rst:316 msgid "" "You need to ensure that any folders containing third-party binaries are " "either associated with the app target, or copied in as part of step 8. Step " @@ -534,24 +540,90 @@ msgid "" "building an app targeting the simulator)." msgstr "" -#: ../../using/ios.rst:320 +#: ../../using/ios.rst:322 msgid "" "Any folders that contain third-party binaries must be processed into " "framework form by step 9. The invocation of ``install_dylib`` that processes " "the ``lib-dynload`` folder can be copied and adapted for this purpose." msgstr "" -#: ../../using/ios.rst:324 +#: ../../using/ios.rst:326 msgid "" "If you're using a separate folder for third-party packages, ensure that " "folder is included as part of the ``PYTHONPATH`` configuration in step 10." msgstr "" -#: ../../using/ios.rst:328 +#: ../../using/ios.rst:330 +msgid "Testing a Python package" +msgstr "" + +#: ../../using/ios.rst:332 +msgid "" +"The CPython source tree contains :source:`a testbed project ` " +"that is used to run the CPython test suite on the iOS simulator. This " +"testbed can also be used as a testbed project for running your Python " +"library's test suite on iOS." +msgstr "" + +#: ../../using/ios.rst:336 +msgid "" +"After building or obtaining an iOS XCFramework (See :source:`iOS/README.rst` " +"for details), create a clone of the Python iOS testbed project by running:" +msgstr "" + +#: ../../using/ios.rst:339 +msgid "" +"$ python iOS/testbed clone --framework --app " +" --app app-testbed" +msgstr "" + +#: ../../using/ios.rst:343 +msgid "" +"You will need to modify the ``iOS/testbed`` reference to point to that " +"directory in the CPython source tree; any folders specified with the ``--" +"app`` flag will be copied into the cloned testbed project. The resulting " +"testbed will be created in the ``app-testbed`` folder. In this example, the " +"``module1`` and ``module2`` would be importable modules at runtime. If your " +"project has additional dependencies, they can be installed into the ``app-" +"testbed/iOSTestbed/app_packages`` folder (using ``pip install --target app-" +"testbed/iOSTestbed/app_packages`` or similar)." +msgstr "" + +#: ../../using/ios.rst:352 +msgid "" +"You can then use the ``app-testbed`` folder to run the test suite for your " +"app, For example, if ``module1.tests`` was the entry point to your test " +"suite, you could run:" +msgstr "" + +#: ../../using/ios.rst:356 +msgid "$ python app-testbed run -- module1.tests" +msgstr "" + +#: ../../using/ios.rst:360 +msgid "" +"This is the equivalent of running ``python -m module1.tests`` on a desktop " +"Python build. Any arguments after the ``--`` will be passed to the testbed " +"as if they were arguments to ``python -m`` on a desktop machine." +msgstr "" + +#: ../../using/ios.rst:364 +msgid "You can also open the testbed project in Xcode by running:" +msgstr "" + +#: ../../using/ios.rst:366 +msgid "$ open app-testbed/iOSTestbed.xcodeproj" +msgstr "" + +#: ../../using/ios.rst:370 +msgid "This will allow you to use the full Xcode suite of tools for debugging." +msgstr "" + +#: ../../using/ios.rst:373 msgid "App Store Compliance" msgstr "" -#: ../../using/ios.rst:330 +#: ../../using/ios.rst:375 msgid "" "The only mechanism for distributing apps to third-party iOS devices is to " "submit the app to the iOS App Store; apps submitted for distribution must " @@ -560,7 +632,7 @@ msgid "" "problematic code." msgstr "" -#: ../../using/ios.rst:335 +#: ../../using/ios.rst:380 msgid "" "The Python standard library contains some code that is known to violate " "these automated rules. While these violations appear to be false positives, " @@ -568,7 +640,7 @@ msgid "" "Python standard library for an app to pass App Store review." msgstr "" -#: ../../using/ios.rst:340 +#: ../../using/ios.rst:385 msgid "" "The Python source tree contains :source:`a patch file ` that will remove all code that is known to cause " diff --git a/whatsnew/2.6.po b/whatsnew/2.6.po index c5606c2af5..a7e0c2a770 100644 --- a/whatsnew/2.6.po +++ b/whatsnew/2.6.po @@ -34,6 +34,8 @@ msgid "" "This article explains the new features in Python 2.6, released on October 1, " "2008. The release schedule is described in :pep:`361`." msgstr "" +"本文介紹了已於 2008 年 10 月 1 日發布的 Python 2.6 有哪些新功能。發布時間表請" +"見 :pep:`361`。" #: ../../whatsnew/2.6.rst:53 msgid "" @@ -199,7 +201,7 @@ msgstr "https://bugs.python.org" #: ../../whatsnew/2.6.rst:183 msgid "The Python bug tracker." -msgstr "" +msgstr "Python 問題追蹤系統。" #: ../../whatsnew/2.6.rst:185 msgid "https://bugs.jython.org:" @@ -207,7 +209,7 @@ msgstr "https://bugs.jython.org:" #: ../../whatsnew/2.6.rst:186 msgid "The Jython bug tracker." -msgstr "" +msgstr "Jython 問題追蹤系統。" #: ../../whatsnew/2.6.rst:188 msgid "https://roundup.sourceforge.io/" @@ -223,11 +225,11 @@ msgstr "https://svn.python.org/view/tracker/importer/" #: ../../whatsnew/2.6.rst:192 msgid "Martin von Löwis's conversion scripts." -msgstr "" +msgstr "Martin von Löwis 的轉換腳本。" #: ../../whatsnew/2.6.rst:195 msgid "New Documentation Format: reStructuredText Using Sphinx" -msgstr "" +msgstr "新文件格式:使用 Sphinx 的 reStructuredText" #: ../../whatsnew/2.6.rst:197 msgid "" @@ -276,31 +278,31 @@ msgstr "" #: ../../whatsnew/2.6.rst:233 msgid "`Documenting Python `__" -msgstr "" +msgstr "`Python 文件撰寫 `__" #: ../../whatsnew/2.6.rst:234 msgid "Describes how to write for Python's documentation." -msgstr "" +msgstr "說明如何為 Python 撰寫文件。" #: ../../whatsnew/2.6.rst:236 msgid "`Sphinx `__" -msgstr "" +msgstr "`Sphinx `__" #: ../../whatsnew/2.6.rst:237 msgid "Documentation and code for the Sphinx toolchain." -msgstr "" +msgstr "Sphinx 工具鏈的文件和程式碼。" #: ../../whatsnew/2.6.rst:239 msgid "`Docutils `__" -msgstr "" +msgstr "`Docutils `__" #: ../../whatsnew/2.6.rst:240 msgid "The underlying reStructuredText parser and toolset." -msgstr "" +msgstr "底層 reStructuredText 剖析器和工具集。" #: ../../whatsnew/2.6.rst:246 msgid "PEP 343: The 'with' statement" -msgstr "" +msgstr "PEP 343:'with' 陳述式" #: ../../whatsnew/2.6.rst:248 msgid "" @@ -333,6 +335,8 @@ msgid "" "with expression [as variable]:\n" " with-block" msgstr "" +"with expression [as variable]:\n" +" with-block" #: ../../whatsnew/2.6.rst:269 msgid "" @@ -370,6 +374,10 @@ msgid "" " print line\n" " ... more processing code ..." msgstr "" +"with open('/etc/passwd', 'r') as f:\n" +" for line in f:\n" +" print line\n" +" ... 更多處理程式碼 ..." #: ../../whatsnew/2.6.rst:290 msgid "" @@ -458,7 +466,7 @@ msgstr "" #: ../../whatsnew/2.6.rst:347 msgid "The code in *BLOCK* is executed." -msgstr "" +msgstr "*BLOCK* 中的程式碼會被執行。" #: ../../whatsnew/2.6.rst:349 msgid "" @@ -508,6 +516,11 @@ msgid "" " cursor.execute('delete from ...')\n" " # ... more operations ..." msgstr "" +"db_connection = DatabaseConnection()\n" +"with db_connection as cursor:\n" +" cursor.execute('insert into ...')\n" +" cursor.execute('delete from ...')\n" +" # ... 更多操作 ..." #: ../../whatsnew/2.6.rst:379 msgid "" @@ -625,6 +638,22 @@ msgid "" "with db_transaction(db) as cursor:\n" " ..." msgstr "" +"from contextlib import contextmanager\n" +"\n" +"@contextmanager\n" +"def db_transaction(connection):\n" +" cursor = connection.cursor()\n" +" try:\n" +" yield cursor\n" +" except:\n" +" connection.rollback()\n" +" raise\n" +" else:\n" +" connection.commit()\n" +"\n" +"db = DatabaseConnection()\n" +"with db_transaction(db) as cursor:\n" +" ..." #: ../../whatsnew/2.6.rst:463 msgid "" @@ -641,6 +670,9 @@ msgid "" "with nested (db_transaction(db), lock) as (cursor, locked):\n" " ..." msgstr "" +"lock = threading.Lock()\n" +"with nested (db_transaction(db), lock) as (cursor, locked):\n" +" ..." #: ../../whatsnew/2.6.rst:472 msgid "" @@ -658,10 +690,16 @@ msgid "" " for line in f:\n" " sys.stdout.write(line)" msgstr "" +"import urllib, sys\n" +"from contextlib import closing\n" +"\n" +"with closing(urllib.urlopen('http://www.yahoo.com')) as f:\n" +" for line in f:\n" +" sys.stdout.write(line)" #: ../../whatsnew/2.6.rst:486 msgid ":pep:`343` - The \"with\" statement" -msgstr "" +msgstr ":pep:`343` - \"with\" 陳述式" #: ../../whatsnew/2.6.rst:487 msgid "" @@ -721,11 +759,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:530 msgid "Unix and Mac OS X: :file:`~/.local/`" -msgstr "" +msgstr "Unix 和 Mac OS X::file:`~/.local/`" #: ../../whatsnew/2.6.rst:531 msgid "Windows: :file:`%APPDATA%/Python`" -msgstr "" +msgstr "Windows::file:`%APPDATA%/Python`" #: ../../whatsnew/2.6.rst:533 msgid "" @@ -822,6 +860,35 @@ msgid "" " result = queue.get()\n" " print 'Factorial', N, '=', result" msgstr "" +"import time\n" +"from multiprocessing import Process, Queue\n" +"\n" +"\n" +"def factorial(queue, N):\n" +" \"計算階乘。\"\n" +" # 如果 N 是 4 的倍數,則此函式將花費更多時間。\n" +" if (N % 4) == 0:\n" +" time.sleep(.05 * N/4)\n" +"\n" +" # 計算結果\n" +" fact = 1L\n" +" for i in range(1, N+1):\n" +" fact = fact * i\n" +"\n" +" # 將結果放進佇列裡\n" +" queue.put(fact)\n" +"\n" +"if __name__ == '__main__':\n" +" queue = Queue()\n" +"\n" +" N = 5\n" +"\n" +" p = Process(target=factorial, args=(queue, N))\n" +" p.start()\n" +" p.join()\n" +"\n" +" result = queue.get()\n" +" print 'Factorial', N, '=', result" #: ../../whatsnew/2.6.rst:614 msgid "" @@ -856,6 +923,15 @@ msgid "" "for v in result:\n" " print v" msgstr "" +"from multiprocessing import Pool\n" +"\n" +"def factorial(N, dictionary):\n" +" \"計算階乘。\"\n" +" ...\n" +"p = Pool(5)\n" +"result = p.map(factorial, range(1, 1000, 10))\n" +"for v in result:\n" +" print v" #: ../../whatsnew/2.6.rst:640 msgid "This produces the following output::" @@ -870,6 +946,12 @@ msgid "" "33452526613163807108170062053440751665152000000000\n" "..." msgstr "" +"1\n" +"39916800\n" +"51090942171709440000\n" +"8222838654177922817725562880000000\n" +"33452526613163807108170062053440751665152000000000\n" +"..." #: ../../whatsnew/2.6.rst:649 msgid "" @@ -1014,6 +1096,16 @@ msgid "" ">>> 'Content-type: {0[.mp4]}'.format(mimetypes.types_map)\n" "'Content-type: video/mp4'" msgstr "" +">>> import sys\n" +">>> print 'Platform: {0.platform}\\nPython version: {0.version}'." +"format(sys)\n" +"Platform: darwin\n" +"Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41)\n" +"[GCC 4.0.1 (Apple Computer, Inc. build 5367)]'\n" +"\n" +">>> import mimetypes\n" +">>> 'Content-type: {0[.mp4]}'.format(mimetypes.types_map)\n" +"'Content-type: video/mp4'" #: ../../whatsnew/2.6.rst:754 msgid "" @@ -1065,11 +1157,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:787 msgid "Character" -msgstr "" +msgstr "字元" #: ../../whatsnew/2.6.rst:787 msgid "Effect" -msgstr "" +msgstr "效果" #: ../../whatsnew/2.6.rst:789 msgid "< (default)" @@ -1117,6 +1209,10 @@ msgid "" ">>> '{0:e}'.format(3.75)\n" "'3.750000e+00'" msgstr "" +">>> '{0:g}'.format(3.75)\n" +"'3.75'\n" +">>> '{0:e}'.format(3.75)\n" +"'3.750000e+00'" #: ../../whatsnew/2.6.rst:804 msgid "" @@ -1223,6 +1319,11 @@ msgid "" " else:\n" " return str(self)" msgstr "" +"def __format__(self, format_spec):\n" +" if isinstance(format_spec, unicode):\n" +" return unicode(str(self))\n" +" else:\n" +" return str(self)" #: ../../whatsnew/2.6.rst:836 msgid "" @@ -1235,6 +1336,8 @@ msgid "" ">>> format(75.6564, '.2f')\n" "'75.66'" msgstr "" +">>> format(75.6564, '.2f')\n" +"'75.66'" #: ../../whatsnew/2.6.rst:846 msgid ":ref:`formatstrings`" @@ -1274,6 +1377,8 @@ msgid "" ">>> from __future__ import print_function\n" ">>> print('# of entries', len(dictionary), file=sys.stderr)" msgstr "" +">>> from __future__ import print_function\n" +">>> print('# of entries', len(dictionary), file=sys.stderr)" #: ../../whatsnew/2.6.rst:869 msgid "The signature of the new function is::" @@ -1281,7 +1386,7 @@ msgstr "" #: ../../whatsnew/2.6.rst:871 msgid "def print(*args, sep=' ', end='\\n', file=None)" -msgstr "" +msgstr "def print(*args, sep=' ', end='\\n', file=None)" #: ../../whatsnew/2.6.rst:874 msgid "The parameters are:" @@ -1307,7 +1412,7 @@ msgstr "" #: ../../whatsnew/2.6.rst:884 msgid ":pep:`3105` - Make print a function" -msgstr "" +msgstr ":pep:`3105` - 將 print 變成函式" #: ../../whatsnew/2.6.rst:885 msgid "PEP written by Georg Brandl." @@ -1330,6 +1435,10 @@ msgid "" "except TypeError, ValueError: # Wrong!\n" " ..." msgstr "" +"try:\n" +" ...\n" +"except TypeError, ValueError: # 錯誤!\n" +" ..." #: ../../whatsnew/2.6.rst:902 msgid "" @@ -1347,6 +1456,10 @@ msgid "" "except (TypeError, ValueError):\n" " ..." msgstr "" +"try:\n" +" ...\n" +"except (TypeError, ValueError):\n" +" ..." #: ../../whatsnew/2.6.rst:914 msgid "" @@ -1369,6 +1482,10 @@ msgid "" "except TypeError as exc:\n" " ..." msgstr "" +"try:\n" +" ...\n" +"except TypeError as exc:\n" +" ..." #: ../../whatsnew/2.6.rst:927 msgid "" @@ -1435,6 +1552,12 @@ msgid "" "\n" "print len(s) # 12 Unicode characters" msgstr "" +"from __future__ import unicode_literals\n" +"\n" +"s = ('\\u751f\\u3080\\u304e\\u3000\\u751f\\u3054'\n" +" '\\u3081\\u3000\\u751f\\u305f\\u307e\\u3054')\n" +"\n" +"print len(s) # 12 個 Unicode 字元" #: ../../whatsnew/2.6.rst:977 msgid "" @@ -1465,6 +1588,16 @@ msgid "" ">>> unicode(str(b), 'utf-8')\n" "u'\\u31ef \\u3244'" msgstr "" +">>> bytearray([65, 66, 67])\n" +"bytearray(b'ABC')\n" +">>> b = bytearray(u'\\u21ef\\u3244', 'utf-8')\n" +">>> b\n" +"bytearray(b'\\xe2\\x87\\xaf\\xe3\\x89\\x84')\n" +">>> b[0] = '\\xe3'\n" +">>> b\n" +"bytearray(b'\\xe3\\x87\\xaf\\xe3\\x89\\x84')\n" +">>> unicode(str(b), 'utf-8')\n" +"u'\\u31ef \\u3244'" #: ../../whatsnew/2.6.rst:999 msgid "" @@ -1481,6 +1614,11 @@ msgid "" ">>> b\n" "bytearray(b'ABCde')" msgstr "" +">>> b = bytearray('ABC')\n" +">>> b.append('d')\n" +">>> b.append(ord('e'))\n" +">>> b\n" +"bytearray(b'ABCde')" #: ../../whatsnew/2.6.rst:1012 msgid "" @@ -1498,7 +1636,7 @@ msgstr "" #: ../../whatsnew/2.6.rst:1027 msgid "PEP 3116: New I/O Library" -msgstr "" +msgstr "PEP 3116:新 I/O 函式庫" #: ../../whatsnew/2.6.rst:1029 msgid "" @@ -1721,6 +1859,10 @@ msgid "" "class Storage(collections.MutableMapping):\n" " ..." msgstr "" +"import collections\n" +"\n" +"class Storage(collections.MutableMapping):\n" +" ..." #: ../../whatsnew/2.6.rst:1196 msgid "" @@ -1738,6 +1880,12 @@ msgid "" "\n" "collections.MutableMapping.register(Storage)" msgstr "" +"import collections\n" +"\n" +"class Storage:\n" +" ...\n" +"\n" +"collections.MutableMapping.register(Storage)" #: ../../whatsnew/2.6.rst:1207 msgid "" @@ -1755,6 +1903,10 @@ msgid "" "PrintableType.register(float)\n" "PrintableType.register(str)" msgstr "" +"# 註冊 Python 的型別\n" +"PrintableType.register(int)\n" +"PrintableType.register(float)\n" +"PrintableType.register(str)" #: ../../whatsnew/2.6.rst:1219 msgid "" @@ -1775,6 +1927,9 @@ msgid "" " if not isinstance(d, collections.MutableMapping):\n" " raise ValueError(\"Mapping object expected, not %r\" % d)" msgstr "" +"def func(d):\n" +" if not isinstance(d, collections.MutableMapping):\n" +" raise ValueError(\"Mapping object expected, not %r\" % d)" #: ../../whatsnew/2.6.rst:1230 msgid "" @@ -1811,6 +1966,22 @@ msgid "" " def draw(self, x, y, scale):\n" " ..." msgstr "" +"from abc import ABCMeta, abstractmethod\n" +"\n" +"class Drawable():\n" +" __metaclass__ = ABCMeta\n" +"\n" +" @abstractmethod\n" +" def draw(self, x, y, scale=1.0):\n" +" pass\n" +"\n" +" def draw_doubled(self, x, y):\n" +" self.draw(x, y, scale=2.0)\n" +"\n" +"\n" +"class Square(Drawable):\n" +" def draw(self, x, y, scale):\n" +" ..." #: ../../whatsnew/2.6.rst:1258 msgid "" @@ -1843,6 +2014,15 @@ msgid "" "draw\n" ">>>" msgstr "" +">>> class Circle(Drawable):\n" +"... pass\n" +"...\n" +">>> c = Circle()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: Can't instantiate abstract class Circle with abstract methods " +"draw\n" +">>>" #: ../../whatsnew/2.6.rst:1281 msgid "" @@ -1859,6 +2039,12 @@ msgid "" "def readonly(self):\n" " return self._x" msgstr "" +"from abc import abstractproperty\n" +"...\n" +"\n" +"@abstractproperty\n" +"def readonly(self):\n" +" return self._x" #: ../../whatsnew/2.6.rst:1291 msgid "Subclasses must then define a :meth:`readonly` property." @@ -1898,6 +2084,10 @@ msgid "" ">>> 0b101111\n" "47" msgstr "" +">>> 0o21, 2*8 + 1\n" +"(17, 17)\n" +">>> 0b101111\n" +"47" #: ../../whatsnew/2.6.rst:1320 msgid "" @@ -1915,6 +2105,12 @@ msgid "" ">>> bin(173)\n" "'0b10101101'" msgstr "" +">>> oct(42)\n" +"'052'\n" +">>> future_builtins.oct(42)\n" +"'0o52'\n" +">>> bin(173)\n" +"'0b10101101'" #: ../../whatsnew/2.6.rst:1331 msgid "" @@ -1935,6 +2131,14 @@ msgid "" ">>> int('0b1101', 0)\n" "13" msgstr "" +">>> int ('0o52', 0)\n" +"42\n" +">>> int('1101', 2)\n" +"13\n" +">>> int('0b1101', 2)\n" +"13\n" +">>> int('0b1101', 0)\n" +"13" #: ../../whatsnew/2.6.rst:1348 msgid ":pep:`3127` - Integer Literal Support and Syntax" @@ -1961,10 +2165,14 @@ msgid "" "class A:\n" " pass" msgstr "" +"@foo\n" +"@bar\n" +"class A:\n" +" pass" #: ../../whatsnew/2.6.rst:1367 msgid "This is equivalent to::" -msgstr "" +msgstr "這等價於: ::" #: ../../whatsnew/2.6.rst:1369 msgid "" @@ -1973,6 +2181,10 @@ msgid "" "\n" "A = foo(bar(A))" msgstr "" +"class A:\n" +" pass\n" +"\n" +"A = foo(bar(A))" #: ../../whatsnew/2.6.rst:1376 msgid ":pep:`3129` - Class Decorators" @@ -2093,6 +2305,15 @@ msgid "" ">>> a/b\n" "Fraction(5, 3)" msgstr "" +">>> from fractions import Fraction\n" +">>> a = Fraction(2, 3)\n" +">>> b = Fraction(2, 5)\n" +">>> float(a), float(b)\n" +"(0.66666666666666663, 0.40000000000000002)\n" +">>> a+b\n" +"Fraction(16, 15)\n" +">>> a/b\n" +"Fraction(5, 3)" #: ../../whatsnew/2.6.rst:1455 msgid "" @@ -2110,6 +2331,12 @@ msgid "" ">>> (1./3) .as_integer_ratio()\n" "(6004799503160661L, 18014398509481984L)" msgstr "" +">>> (2.5) .as_integer_ratio()\n" +"(5, 2)\n" +">>> (3.1415) .as_integer_ratio()\n" +"(7074029114692207L, 2251799813685248L)\n" +">>> (1./3) .as_integer_ratio()\n" +"(6004799503160661L, 18014398509481984L)" #: ../../whatsnew/2.6.rst:1467 msgid "" @@ -2171,6 +2398,14 @@ msgid "" ">>> f(**ud)\n" "['a', 'b']" msgstr "" +">>> def f(**kw):\n" +"... print sorted(kw)\n" +"...\n" +">>> ud=UserDict.UserDict()\n" +">>> ud['a'] = 1\n" +">>> ud['b'] = 'string'\n" +">>> f(**ud)\n" +"['a', 'b']" #: ../../whatsnew/2.6.rst:1511 msgid "(Contributed by Alexander Belopolsky; :issue:`1686487`.)" @@ -2190,6 +2425,11 @@ msgid "" ">>> f(1,2,3, *(4,5,6), keyword=13)\n" "(1, 2, 3, 4, 5, 6) {'keyword': 13}" msgstr "" +">>> def f(*args, **kw):\n" +"... print args, kw\n" +"...\n" +">>> f(1,2,3, *(4,5,6), keyword=13)\n" +"(1, 2, 3, 4, 5, 6) {'keyword': 13}" #: ../../whatsnew/2.6.rst:1522 msgid "" @@ -2264,6 +2504,27 @@ msgid "" " def x(self, value):\n" " self._x = value / 2" msgstr "" +"class C(object):\n" +" @property\n" +" def x(self):\n" +" return self._x\n" +"\n" +" @x.setter\n" +" def x(self, value):\n" +" self._x = value\n" +"\n" +" @x.deleter\n" +" def x(self):\n" +" del self._x\n" +"\n" +"class D(C):\n" +" @C.x.getter\n" +" def x(self):\n" +" return self._x * 2\n" +"\n" +" @x.setter\n" +" def x(self, value):\n" +" self._x = value / 2" #: ../../whatsnew/2.6.rst:1576 msgid "" @@ -2323,6 +2584,14 @@ msgid "" ">>> b.hex()\n" "'0x1.5555555555555p-2'" msgstr "" +">>> a = 3.75\n" +">>> a.hex()\n" +"'0x1.e000000000000p+1'\n" +">>> float.fromhex('0x1.e000000000000p+1')\n" +"3.75\n" +">>> b=1./3\n" +">>> b.hex()\n" +"'0x1.5555555555555p-2'" #: ../../whatsnew/2.6.rst:1619 msgid "" @@ -2701,6 +2970,16 @@ msgid "" ">>> dq\n" "deque([2, 3, 4], maxlen=3)" msgstr "" +">>> from collections import deque\n" +">>> dq=deque(maxlen=3)\n" +">>> dq\n" +"deque([], maxlen=3)\n" +">>> dq.append(1); dq.append(2); dq.append(3)\n" +">>> dq\n" +"deque([1, 2, 3], maxlen=3)\n" +">>> dq.append(4)\n" +">>> dq\n" +"deque([2, 3, 4], maxlen=3)" #: ../../whatsnew/2.6.rst:1898 msgid "" @@ -2758,6 +3037,12 @@ msgid "" ">>> Decimal(1000).log10()\n" "Decimal(\"3\")" msgstr "" +">>> Decimal(1).exp()\n" +"Decimal(\"2.718281828459045235360287471\")\n" +">>> Decimal(\"2.7182818\").ln()\n" +"Decimal(\"0.9999999895305022877376682436\")\n" +">>> Decimal(1000).log10()\n" +"Decimal(\"3\")" #: ../../whatsnew/2.6.rst:1935 msgid "" @@ -2826,6 +3111,8 @@ msgid "" ">>> list(heapq.merge([1, 3, 5, 9], [2, 8, 16]))\n" "[1, 2, 3, 5, 8, 9, 16]" msgstr "" +">>> list(heapq.merge([1, 3, 5, 9], [2, 8, 16]))\n" +"[1, 2, 3, 5, 8, 9, 16]" #: ../../whatsnew/2.6.rst:1978 msgid "" @@ -2880,6 +3167,8 @@ msgid "" ">>> tuple(itertools.izip_longest([1,2,3], [1,2,3,4,5]))\n" "((1, 1), (2, 2), (3, 3), (None, 4), (None, 5))" msgstr "" +">>> tuple(itertools.izip_longest([1,2,3], [1,2,3,4,5]))\n" +"((1, 1), (2, 2), (3, 3), (None, 4), (None, 5))" #: ../../whatsnew/2.6.rst:2013 msgid "" @@ -2895,6 +3184,10 @@ msgid "" " (2, 4), (2, 5), (2, 6),\n" " (3, 4), (3, 5), (3, 6)]" msgstr "" +">>> list(itertools.product([1,2,3], [4,5,6]))\n" +"[(1, 4), (1, 5), (1, 6),\n" +" (2, 4), (2, 5), (2, 6),\n" +" (3, 4), (3, 5), (3, 6)]" #: ../../whatsnew/2.6.rst:2022 msgid "" @@ -2909,6 +3202,9 @@ msgid "" "[(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),\n" " (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)]" msgstr "" +">>> list(itertools.product([1,2], repeat=3))\n" +"[(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),\n" +" (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)]" #: ../../whatsnew/2.6.rst:2031 msgid "With two iterables, *2N*-tuples are returned. ::" @@ -2922,6 +3218,11 @@ msgid "" " (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4),\n" " (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)]" msgstr "" +">>> list(itertools.product([1,2], [3,4], repeat=2))\n" +"[(1, 3, 1, 3), (1, 3, 1, 4), (1, 3, 2, 3), (1, 3, 2, 4),\n" +" (1, 4, 1, 3), (1, 4, 1, 4), (1, 4, 2, 3), (1, 4, 2, 4),\n" +" (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4),\n" +" (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)]" #: ../../whatsnew/2.6.rst:2039 msgid "" @@ -2939,6 +3240,13 @@ msgid "" "[('1', '2', '3'), ('1', '2', '4'),\n" " ('1', '3', '4'), ('2', '3', '4')]" msgstr "" +">>> list(itertools.combinations('123', 2))\n" +"[('1', '2'), ('1', '3'), ('2', '3')]\n" +">>> list(itertools.combinations('123', 3))\n" +"[('1', '2', '3')]\n" +">>> list(itertools.combinations('1234', 3))\n" +"[('1', '2', '3'), ('1', '2', '4'),\n" +" ('1', '3', '4'), ('2', '3', '4')]" #: ../../whatsnew/2.6.rst:2050 msgid "" @@ -2955,6 +3263,11 @@ msgid "" " (3, 1), (3, 2), (3, 4),\n" " (4, 1), (4, 2), (4, 3)]" msgstr "" +">>> list(itertools.permutations([1,2,3,4], 2))\n" +"[(1, 2), (1, 3), (1, 4),\n" +" (2, 1), (2, 3), (2, 4),\n" +" (3, 1), (3, 2), (3, 4),\n" +" (4, 1), (4, 2), (4, 3)]" #: ../../whatsnew/2.6.rst:2060 msgid "" @@ -2970,6 +3283,8 @@ msgid "" ">>> list(itertools.chain.from_iterable([[1,2,3], [4,5,6]]))\n" "[1, 2, 3, 4, 5, 6]" msgstr "" +">>> list(itertools.chain.from_iterable([[1,2,3], [4,5,6]]))\n" +"[1, 2, 3, 4, 5, 6]" #: ../../whatsnew/2.6.rst:2070 msgid "(All contributed by Raymond Hettinger.)" @@ -3103,6 +3418,12 @@ msgid "" ">>> inst_name(help)\n" "'_Helper'" msgstr "" +">>> inst_name = operator.attrgetter(\n" +"... '__class__.__name__')\n" +">>> inst_name('')\n" +"'str'\n" +">>> inst_name(help)\n" +"'_Helper'" #: ../../whatsnew/2.6.rst:2157 msgid "(Contributed by Georg Brandl, after a suggestion by Barry Warsaw.)" @@ -3217,6 +3538,16 @@ msgid "" " +-- StandardError\n" " ..." msgstr "" +">>> import pkgutil\n" +">>> print pkgutil.get_data('test', 'exception_hierarchy.txt')\n" +"BaseException\n" +" +-- SystemExit\n" +" +-- KeyboardInterrupt\n" +" +-- GeneratorExit\n" +" +-- Exception\n" +" +-- StopIteration\n" +" +-- StandardError\n" +" ..." #: ../../whatsnew/2.6.rst:2236 msgid "(Contributed by Paul Moore; :issue:`2439`.)" @@ -3320,6 +3651,8 @@ msgid "" "shutil.copytree('Doc/library', '/tmp/library',\n" " ignore=shutil.ignore_patterns('*~', '.svn'))" msgstr "" +"shutil.copytree('Doc/library', '/tmp/library',\n" +" ignore=shutil.ignore_patterns('*~', '.svn'))" #: ../../whatsnew/2.6.rst:2310 msgid "(Contributed by Tarek Ziadé; :issue:`2663`.)" @@ -3504,6 +3837,8 @@ msgid "" "tar = tarfile.open(\"output.tar\", \"w\",\n" " format=tarfile.PAX_FORMAT)" msgstr "" +"tar = tarfile.open(\"output.tar\", \"w\",\n" +" format=tarfile.PAX_FORMAT)" #: ../../whatsnew/2.6.rst:2444 msgid "" @@ -3583,6 +3918,10 @@ msgid "" " f = urllib.urlopen('https://sf.net')\n" " ..." msgstr "" +"with test_support.TransientResource(IOError,\n" +" errno=errno.ETIMEDOUT):\n" +" f = urllib.urlopen('https://sf.net')\n" +" ..." #: ../../whatsnew/2.6.rst:2498 msgid "" @@ -3735,6 +4074,12 @@ msgid "" "urllib2.URLError: \n" ">>>" msgstr "" +">>> u = urllib2.urlopen(\"http://slow.example.com\",\n" +" timeout=3)\n" +"Traceback (most recent call last):\n" +" ...\n" +"urllib2.URLError: \n" +">>>" #: ../../whatsnew/2.6.rst:2592 msgid "(Added by Facundo Batista.)" @@ -3864,6 +4209,15 @@ msgid "" "\"\"\")\n" "print ast.dump(t)" msgstr "" +"import ast\n" +"\n" +"t = ast.parse(\"\"\"\n" +"d = {}\n" +"for i in 'abcdefghijklm':\n" +" d[i + i] = ord(i) - ord('a') + 1\n" +"print d\n" +"\"\"\")\n" +"print ast.dump(t)" #: ../../whatsnew/2.6.rst:2685 msgid "This outputs a deeply nested tree::" @@ -3902,6 +4256,36 @@ msgid "" " ], nl=True)\n" " ])" msgstr "" +"Module(body=[\n" +" Assign(targets=[\n" +" Name(id='d', ctx=Store())\n" +" ], value=Dict(keys=[], values=[]))\n" +" For(target=Name(id='i', ctx=Store()),\n" +" iter=Str(s='abcdefghijklm'), body=[\n" +" Assign(targets=[\n" +" Subscript(value=\n" +" Name(id='d', ctx=Load()),\n" +" slice=\n" +" Index(value=\n" +" BinOp(left=Name(id='i', ctx=Load()), op=Add(),\n" +" right=Name(id='i', ctx=Load()))), ctx=Store())\n" +" ], value=\n" +" BinOp(left=\n" +" BinOp(left=\n" +" Call(func=\n" +" Name(id='ord', ctx=Load()), args=[\n" +" Name(id='i', ctx=Load())\n" +" ], keywords=[], starargs=None, kwargs=None),\n" +" op=Sub(), right=Call(func=\n" +" Name(id='ord', ctx=Load()), args=[\n" +" Str(s='a')\n" +" ], keywords=[], starargs=None, kwargs=None)),\n" +" op=Add(), right=Num(n=1)))\n" +" ], orelse=[])\n" +" Print(dest=None, values=[\n" +" Name(id='d', ctx=Load())\n" +" ], nl=True)\n" +" ])" #: ../../whatsnew/2.6.rst:2718 msgid "" @@ -3923,6 +4307,13 @@ msgid "" " ...\n" "ValueError: malformed string" msgstr "" +">>> literal = '(\"a\", \"b\", {2:4, 3:8, 1:2})'\n" +">>> print ast.literal_eval(literal)\n" +"('a', 'b', {1: 2, 2: 4, 3: 8})\n" +">>> print ast.literal_eval('\"a\" + \"b\"')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: malformed string" #: ../../whatsnew/2.6.rst:2734 msgid "" diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index 8eaa5f46cd..969d821d8b 100644 --- a/whatsnew/2.7.po +++ b/whatsnew/2.7.po @@ -307,6 +307,12 @@ msgid "" ">>> d.items()\n" "[('first', 1), ('second', 2), ('third', 3)]" msgstr "" +">>> from collections import OrderedDict\n" +">>> d = OrderedDict([('first', 1),\n" +"... ('second', 2),\n" +"... ('third', 3)])\n" +">>> d.items()\n" +"[('first', 1), ('second', 2), ('third', 3)]" #: ../../whatsnew/2.7.rst:233 msgid "" @@ -320,6 +326,9 @@ msgid "" ">>> d.items()\n" "[('first', 1), ('second', 4), ('third', 3)]" msgstr "" +">>> d['second'] = 4\n" +">>> d.items()\n" +"[('first', 1), ('second', 4), ('third', 3)]" #: ../../whatsnew/2.7.rst:240 msgid "Deleting an entry and reinserting it will move it to the end::" @@ -332,6 +341,10 @@ msgid "" ">>> d.items()\n" "[('first', 1), ('third', 3), ('second', 5)]" msgstr "" +">>> del d['second']\n" +">>> d['second'] = 5\n" +">>> d.items()\n" +"[('first', 1), ('third', 3), ('second', 5)]" #: ../../whatsnew/2.7.rst:247 msgid "" @@ -353,6 +366,15 @@ msgid "" ">>> od.popitem(last=False)\n" "(1, 0)" msgstr "" +">>> od = OrderedDict([(x,0) for x in range(20)])\n" +">>> od.popitem()\n" +"(19, 0)\n" +">>> od.popitem()\n" +"(18, 0)\n" +">>> od.popitem(last=False)\n" +"(0, 0)\n" +">>> od.popitem(last=False)\n" +"(1, 0)" #: ../../whatsnew/2.7.rst:262 msgid "" @@ -375,6 +397,18 @@ msgid "" ">>> od1 == od2\n" "True" msgstr "" +">>> od1 = OrderedDict([('first', 1),\n" +"... ('second', 2),\n" +"... ('third', 3)])\n" +">>> od2 = OrderedDict([('third', 3),\n" +"... ('first', 1),\n" +"... ('second', 2)])\n" +">>> od1 == od2\n" +"False\n" +">>> # Move 'third' key to the end\n" +">>> del od2['third']; od2['third'] = 3\n" +">>> od1 == od2\n" +"True" #: ../../whatsnew/2.7.rst:278 msgid "" @@ -461,6 +495,8 @@ msgid "" ">>> '{:20,.2f}'.format(18446744073709551616.0)\n" "'18,446,744,073,709,551,616.00'" msgstr "" +">>> '{:20,.2f}'.format(18446744073709551616.0)\n" +"'18,446,744,073,709,551,616.00'" #: ../../whatsnew/2.7.rst:333 msgid "When formatting an integer, include the comma after the width:" @@ -563,6 +599,20 @@ msgid "" " -o FILE direct output to FILE instead of stdout\n" " -C NUM display NUM lines of added context" msgstr "" +"-> ./python.exe argparse-example.py --help\n" +"usage: argparse-example.py [-h] [-v] [-o FILE] [-C NUM] [inputs " +"[inputs ...]]\n" +"\n" +"Command-line example.\n" +"\n" +"positional arguments:\n" +" inputs input filenames (default is stdin)\n" +"\n" +"optional arguments:\n" +" -h, --help show this help message and exit\n" +" -v produce verbose output\n" +" -o FILE direct output to FILE instead of stdout\n" +" -C NUM display NUM lines of added context" #: ../../whatsnew/2.7.rst:410 msgid "" @@ -584,6 +634,17 @@ msgid "" " 'context': 4,\n" " 'inputs': ['file1', 'file2']}" msgstr "" +"-> ./python.exe argparse-example.py -v\n" +"{'output': None,\n" +" 'is_verbose': True,\n" +" 'context': 0,\n" +" 'inputs': []}\n" +"\n" +"-> ./python.exe argparse-example.py -v -o /tmp/output -C 4 file1 file2\n" +"{'output': '/tmp/output',\n" +" 'is_verbose': True,\n" +" 'context': 4,\n" +" 'inputs': ['file1', 'file2']}" #: ../../whatsnew/2.7.rst:425 msgid "" @@ -773,6 +834,11 @@ msgid "" ">>> d.viewkeys()\n" "dict_keys([0, 130, 10, 140, 20, 150, 30, ..., 250])" msgstr "" +">>> d = dict((i*10, chr(65+i)) for i in range(26))\n" +">>> d\n" +"{0: 'A', 130: 'N', 10: 'B', 140: 'O', 20: ..., 250: 'Z'}\n" +">>> d.viewkeys()\n" +"dict_keys([0, 130, 10, 140, 20, 150, 30, ..., 250])" #: ../../whatsnew/2.7.rst:568 msgid "" @@ -789,6 +855,12 @@ msgid "" ">>> d1.viewkeys() | range(0, 30)\n" "set([0, 1, 130, 3, 4, 5, 6, ..., 120, 250])" msgstr "" +">>> d1 = dict((i*10, chr(65+i)) for i in range(26))\n" +">>> d2 = dict((i**.5, i) for i in range(1000))\n" +">>> d1.viewkeys() & d2.viewkeys()\n" +"set([0.0, 10.0, 20.0, 30.0])\n" +">>> d1.viewkeys() | range(0, 30)\n" +"set([0, 1, 130, 3, 4, 5, 6, ..., 120, 250])" #: ../../whatsnew/2.7.rst:579 msgid "" @@ -805,6 +877,12 @@ msgid "" ">>> vk\n" "dict_keys([0, 130, 260, 10, ..., 250])" msgstr "" +">>> vk = d.viewkeys()\n" +">>> vk\n" +"dict_keys([0, 130, 10, ..., 250])\n" +">>> d[260] = '&'\n" +">>> vk\n" +"dict_keys([0, 130, 260, 10, ..., 250])" #: ../../whatsnew/2.7.rst:589 msgid "" @@ -821,6 +899,12 @@ msgid "" " File \"\", line 1, in \n" "RuntimeError: dictionary changed size during iteration" msgstr "" +">>> for k in vk:\n" +"... d[k*2] = k\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"RuntimeError: dictionary changed size during iteration" #: ../../whatsnew/2.7.rst:599 msgid "" @@ -878,6 +962,11 @@ msgid "" "[97, 98, 99, 100, 101, 102, 103, ... 121, 122]\n" ">>>" msgstr "" +">>> m2.tobytes()\n" +"'abcdefghijklmnopqrstuvwxyz'\n" +">>> m2.tolist()\n" +"[97, 98, 99, 100, 101, 102, 103, ... 121, 122]\n" +">>>" #: ../../whatsnew/2.7.rst:643 msgid "" @@ -956,6 +1045,10 @@ msgid "" ">>> {('a'*x) for x in range(6)}\n" "set(['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'])" msgstr "" +">>> {x: x*x for x in range(6)}\n" +"{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}\n" +">>> {('a'*x) for x in range(6)}\n" +"set(['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'])" #: ../../whatsnew/2.7.rst:707 msgid "Backported by Alexandre Vassalotti; :issue:`2333`." @@ -976,7 +1069,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:717 msgid "is equivalent to::" -msgstr "" +msgstr "等價於: ::" #: ../../whatsnew/2.7.rst:719 msgid "" @@ -996,6 +1089,7 @@ msgid "" "(Proposed in https://codereview.appspot.com/53094; implemented by Georg " "Brandl.)" msgstr "" +"(於 https://codereview.appspot.com/53094 提出;由 Georg Brandl 實作。)" #: ../../whatsnew/2.7.rst:729 msgid "" @@ -1050,6 +1144,11 @@ msgid "" ">>> n - long(float(n))\n" "65535L" msgstr "" +">>> n = 295147905179352891391\n" +">>> float(n)\n" +"2.9514790517935283e+20\n" +">>> n - long(float(n))\n" +"65535L" #: ../../whatsnew/2.7.rst:773 msgid "" @@ -1065,6 +1164,11 @@ msgid "" ">>> n - long(float(n))\n" "-1L" msgstr "" +">>> n = 295147905179352891391\n" +">>> float(n)\n" +"2.9514790517935289e+20\n" +">>> n - long(float(n))\n" +"-1L" #: ../../whatsnew/2.7.rst:782 msgid "(Implemented by Mark Dickinson; :issue:`3166`.)" @@ -1097,6 +1201,10 @@ msgid "" ">>> '{}:{}:{day}'.format(2009, 4, day='Sunday')\n" "'2009:4:Sunday'" msgstr "" +">>> '{}:{}:{}'.format(2009, 04, 'Sunday')\n" +"'2009:4:Sunday'\n" +">>> '{}:{}:{day}'.format(2009, 4, day='Sunday')\n" +"'2009:4:Sunday'" #: ../../whatsnew/2.7.rst:800 msgid "" @@ -1155,6 +1263,16 @@ msgid "" ">>> (n+1).bit_length()\n" "124" msgstr "" +">>> n = 37\n" +">>> bin(n)\n" +"'0b100101'\n" +">>> n.bit_length()\n" +"6\n" +">>> n = 2**123-1\n" +">>> n.bit_length()\n" +"123\n" +">>> (n+1).bit_length()\n" +"124" #: ../../whatsnew/2.7.rst:843 msgid "(Contributed by Fredrik Johansson and Victor Stinner; :issue:`3439`.)" @@ -1268,7 +1386,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:924 msgid "export PYTHONWARNINGS=all,error:::Cookie:0" -msgstr "" +msgstr "export PYTHONWARNINGS=all,error:::Cookie:0" #: ../../whatsnew/2.7.rst:930 msgid "Optimizations" @@ -1336,6 +1454,9 @@ msgid "" ">>> sys.long_info\n" "sys.long_info(bits_per_digit=30, sizeof_digit=4)" msgstr "" +">>> import sys\n" +">>> sys.long_info\n" +"sys.long_info(bits_per_digit=30, sizeof_digit=4)" #: ../../whatsnew/2.7.rst:978 msgid "(Contributed by Mark Dickinson; :issue:`4258`.)" @@ -1474,6 +1595,19 @@ msgid "" ">>> c['z']\n" "0" msgstr "" +">>> from collections import Counter\n" +">>> c = Counter()\n" +">>> for letter in 'here is a sample of english text':\n" +"... c[letter] += 1\n" +"...\n" +">>> c \n" +"Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2,\n" +"'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1,\n" +"'p': 1, 'r': 1, 'x': 1})\n" +">>> c['e']\n" +"5\n" +">>> c['z']\n" +"0" #: ../../whatsnew/2.7.rst:1081 msgid "" @@ -1504,7 +1638,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:1104 msgid "Contributed by Raymond Hettinger; :issue:`1696199`." -msgstr "" +msgstr "由 Raymond Hettinger 貢獻;:issue:`1696199`。" #: ../../whatsnew/2.7.rst:1108 msgid "" @@ -1840,7 +1974,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:1346 msgid "Contributed by George Sakkis; :issue:`3135`." -msgstr "" +msgstr "由 George Sakkis 貢獻;:issue:`3135`。" #: ../../whatsnew/2.7.rst:1348 msgid "" @@ -2846,14 +2980,14 @@ msgid "" "ElementTree's code for converting trees to a string has been significantly " "reworked, making it roughly twice as fast in many cases. The :meth:" "`ElementTree.write() ` and :meth:" -"`Element.write` methods now have a *method* parameter that can be " -"\"xml\" (the default), \"html\", or \"text\". HTML mode will output empty " -"elements as ```` instead of ````, and text mode will " -"skip over elements and only output the text chunks. If you set the :attr:" -"`~xml.etree.ElementTree.Element.tag` attribute of an element to ``None`` but " -"leave its children in place, the element will be omitted when the tree is " -"written out, so you don't need to do more extensive rearrangement to remove " -"a single element." +"`Element.write` methods now have a *method* parameter that can be \"xml\" " +"(the default), \"html\", or \"text\". HTML mode will output empty elements " +"as ```` instead of ````, and text mode will skip over " +"elements and only output the text chunks. If you set the :attr:`~xml.etree." +"ElementTree.Element.tag` attribute of an element to ``None`` but leave its " +"children in place, the element will be omitted when the tree is written out, " +"so you don't need to do more extensive rearrangement to remove a single " +"element." msgstr "" #: ../../whatsnew/2.7.rst:2044 @@ -3379,7 +3513,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:2439 msgid "Porting to Python 2.7" -msgstr "" +msgstr "移植至 Python 2.7" #: ../../whatsnew/2.7.rst:2441 msgid "" diff --git a/whatsnew/3.0.po b/whatsnew/3.0.po index 029b569e43..77d4d2f766 100644 --- a/whatsnew/3.0.po +++ b/whatsnew/3.0.po @@ -1,4 +1,4 @@ -# 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: @@ -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-12-11 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -72,7 +72,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:95 msgid "Print Is A Function" -msgstr "" +msgstr "Print 是一個函式" #: ../../whatsnew/3.0.rst:97 msgid "" @@ -80,6 +80,8 @@ msgid "" "with keyword arguments to replace most of the special syntax of the old " "``print`` statement (:pep:`3105`). Examples::" msgstr "" +"``print`` 陳述式已經被 :func:`print` 函式所取代,且舊 ``print`` 陳述式的大部" +"分特殊語法也被關鍵字引數所取代 (:pep:`3105`)。範例如下: ::" #: ../../whatsnew/3.0.rst:101 msgid "" @@ -146,7 +148,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:145 msgid "Some well-known APIs no longer return lists:" -msgstr "" +msgstr "一些眾所周知的 API 不再回傳串列:" #: ../../whatsnew/3.0.rst:147 msgid "" @@ -158,7 +160,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:153 msgid "" -"Also, the :meth:`dict.iterkeys`, :meth:`dict.iteritems` and :meth:`dict." +"Also, the :meth:`!dict.iterkeys`, :meth:`!dict.iteritems` and :meth:`!dict." "itervalues` methods are no longer supported." msgstr "" @@ -185,13 +187,13 @@ msgstr "" #: ../../whatsnew/3.0.rst:173 msgid "" -":func:`range` now behaves like :func:`xrange` used to behave, except it " +":func:`range` now behaves like :func:`!xrange` used to behave, except it " "works with values of arbitrary size. The latter no longer exists." msgstr "" #: ../../whatsnew/3.0.rst:177 msgid ":func:`zip` now returns an iterator." -msgstr "" +msgstr ":func:`zip` 現在會回傳一個疊代器。" #: ../../whatsnew/3.0.rst:180 msgid "Ordering Comparisons" @@ -215,18 +217,19 @@ msgstr "" #: ../../whatsnew/3.0.rst:195 msgid "" -":meth:`builtin.sorted` and :meth:`list.sort` no longer accept the *cmp* " -"argument providing a comparison function. Use the *key* argument instead. N." -"B. the *key* and *reverse* arguments are now \"keyword-only\"." +":meth:`sorted` and :meth:`list.sort` no longer accept the *cmp* argument " +"providing a comparison function. Use the *key* argument instead. N.B. the " +"*key* and *reverse* arguments are now \"keyword-only\"." msgstr "" #: ../../whatsnew/3.0.rst:200 msgid "" -"The :func:`cmp` function should be treated as gone, and the :meth:`__cmp__` " -"special method is no longer supported. Use :meth:`__lt__` for sorting, :" -"meth:`__eq__` with :meth:`__hash__`, and other rich comparisons as needed. " -"(If you really need the :func:`cmp` functionality, you could use the " -"expression ``(a > b) - (a < b)`` as the equivalent for ``cmp(a, b)``.)" +"The :func:`!cmp` function should be treated as gone, and the :meth:`!" +"__cmp__` special method is no longer supported. Use :meth:`~object.__lt__` " +"for sorting, :meth:`~object.__eq__` with :meth:`~object.__hash__`, and other " +"rich comparisons as needed. (If you really need the :func:`!cmp` " +"functionality, you could use the expression ``(a > b) - (a < b)`` as the " +"equivalent for ``cmp(a, b)``.)" msgstr "" #: ../../whatsnew/3.0.rst:207 @@ -235,9 +238,9 @@ msgstr "整數" #: ../../whatsnew/3.0.rst:209 msgid "" -":pep:`237`: Essentially, :class:`long` renamed to :class:`int`. That is, " +":pep:`237`: Essentially, :class:`!long` renamed to :class:`int`. That is, " "there is only one built-in integral type, named :class:`int`; but it behaves " -"mostly like the old :class:`long` type." +"mostly like the old :class:`!long` type." msgstr "" #: ../../whatsnew/3.0.rst:213 @@ -249,11 +252,11 @@ msgstr "" #: ../../whatsnew/3.0.rst:217 msgid "" -"The :data:`sys.maxint` constant was removed, since there is no longer a " +"The :data:`!sys.maxint` constant was removed, since there is no longer a " "limit to the value of integers. However, :data:`sys.maxsize` can be used as " "an integer larger than any practical list or string index. It conforms to " "the implementation's \"natural\" integer size and is typically the same as :" -"data:`sys.maxint` in previous releases on the same platform (assuming the " +"data:`!sys.maxint` in previous releases on the same platform (assuming the " "same build options)." msgstr "" @@ -298,7 +301,7 @@ msgid "" "uses Unicode, encodings or binary data most likely has to change. The " "change is for the better, as in the 2.x world there were numerous bugs " "having to do with mixing encoded and unencoded text. To be prepared in " -"Python 2.x, start using :class:`unicode` for all unencoded text, and :class:" +"Python 2.x, start using :class:`!unicode` for all unencoded text, and :class:" "`str` for binary or encoded data only. Then the ``2to3`` tool will do most " "of the work for you." msgstr "" @@ -323,7 +326,8 @@ msgid "" "Like :class:`str`, the :class:`bytes` type is immutable. There is a " "separate *mutable* type to hold buffered binary data, :class:`bytearray`. " "Nearly all APIs that accept :class:`bytes` also accept :class:`bytearray`. " -"The mutable API is based on :class:`collections.MutableSequence`." +"The mutable API is based on :class:`collections.MutableSequence `." msgstr "" #: ../../whatsnew/3.0.rst:274 @@ -338,10 +342,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:281 msgid "" -"The built-in :class:`basestring` abstract type was removed. Use :class:" +"The built-in :class:`!basestring` abstract type was removed. Use :class:" "`str` instead. The :class:`str` and :class:`bytes` types don't have " "functionality enough in common to warrant a shared base class. The ``2to3`` " -"tool (see below) replaces every occurrence of :class:`basestring` with :" +"tool (see below) replaces every occurrence of :class:`!basestring` with :" "class:`str`." msgstr "" @@ -436,16 +440,16 @@ msgstr "" #: ../../whatsnew/3.0.rst:354 msgid "New Syntax" -msgstr "" +msgstr "新增語法" #: ../../whatsnew/3.0.rst:356 msgid "" ":pep:`3107`: Function argument and return value annotations. This provides " "a standardized way of annotating a function's parameters and return value. " "There are no semantics attached to such annotations except that they can be " -"introspected at runtime using the :attr:`~object.__annotations__` " -"attribute. The intent is to encourage experimentation through metaclasses, " -"decorators or frameworks." +"introspected at runtime using the :attr:`!__annotations__` attribute. The " +"intent is to encourage experimentation through metaclasses, decorators or " +"frameworks." msgstr "" #: ../../whatsnew/3.0.rst:363 @@ -482,11 +486,12 @@ msgstr "" #: ../../whatsnew/3.0.rst:383 msgid "(a, *rest, b) = range(5)" -msgstr "" +msgstr "(a, *rest, b) = range(5)" #: ../../whatsnew/3.0.rst:385 msgid "This sets *a* to ``0``, *b* to ``4``, and *rest* to ``[1, 2, 3]``." msgstr "" +"這會將 *a* 設為 ``0``、將 *b* 設為 ``4``,並將 *rest* 設為 ``[1, 2, 3]``。" #: ../../whatsnew/3.0.rst:387 msgid "" @@ -558,20 +563,25 @@ msgid "" " __metaclass__ = M\n" " ..." msgstr "" +"class C:\n" +" __metaclass__ = M\n" +" ..." #: ../../whatsnew/3.0.rst:426 msgid "you must now use::" -msgstr "" +msgstr "現在必須使用: ::" #: ../../whatsnew/3.0.rst:428 msgid "" "class C(metaclass=M):\n" " ..." msgstr "" +"class C(metaclass=M):\n" +" ..." #: ../../whatsnew/3.0.rst:431 msgid "" -"The module-global :data:`__metaclass__` variable is no longer supported. " +"The module-global :data:`!__metaclass__` variable is no longer supported. " "(It was a crutch to make it easier to default to new-style classes without " "deriving every class from :class:`object`.)" msgstr "" @@ -606,11 +616,11 @@ msgstr "" #: ../../whatsnew/3.0.rst:456 msgid "Removed backticks (use :func:`repr` instead)." -msgstr "" +msgstr "移除反引號(請改用 :func:`repr`)。" #: ../../whatsnew/3.0.rst:458 msgid "Removed ``<>`` (use ``!=`` instead)." -msgstr "移除 ``<>``\\ (請改用 ``!=``\\ )。" +msgstr "移除 ``<>``\\ (請改用 ``!=``)。" #: ../../whatsnew/3.0.rst:460 msgid "" @@ -715,15 +725,15 @@ msgid "" "and has additional keyword arguments *encoding*, *errors*, *newline* and " "*closefd*. Also note that an invalid *mode* argument now raises :exc:" "`ValueError`, not :exc:`IOError`. The binary file object underlying a text " -"file object can be accessed as :attr:`f.buffer` (but beware that the text " +"file object can be accessed as :attr:`!f.buffer` (but beware that the text " "object maintains a buffer of itself in order to speed up the encoding and " "decoding operations)." msgstr "" #: ../../whatsnew/3.0.rst:529 msgid "" -":ref:`pep-3118`. The old builtin :func:`buffer` is now really gone; the new " -"builtin :func:`memoryview` provides (mostly) similar functionality." +":ref:`pep-3118`. The old builtin :func:`!buffer` is now really gone; the " +"new builtin :func:`memoryview` provides (mostly) similar functionality." msgstr "" #: ../../whatsnew/3.0.rst:533 @@ -731,8 +741,9 @@ msgid "" ":ref:`pep-3119`. The :mod:`abc` module and the ABCs defined in the :mod:" "`collections` module plays a somewhat more prominent role in the language " "now, and built-in collection types like :class:`dict` and :class:`list` " -"conform to the :class:`collections.MutableMapping` and :class:`collections." -"MutableSequence` ABCs, respectively." +"conform to the :class:`collections.MutableMapping ` and :class:`collections.MutableSequence ` ABCs, respectively." msgstr "" #: ../../whatsnew/3.0.rst:539 @@ -905,10 +916,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:615 msgid "" -":mod:`tkinter` (all :mod:`Tkinter`-related modules except :mod:`turtle`). " -"The target audience of :mod:`turtle` doesn't really care about :mod:" -"`tkinter`. Also note that as of Python 2.6, the functionality of :mod:" -"`turtle` has been greatly enhanced." +":mod:`tkinter` (all ``Tkinter``-related modules except :mod:`turtle`). The " +"target audience of :mod:`turtle` doesn't really care about :mod:`tkinter`. " +"Also note that as of Python 2.6, the functionality of :mod:`turtle` has been " +"greatly enhanced." msgstr "" #: ../../whatsnew/3.0.rst:620 @@ -938,24 +949,26 @@ msgstr "移除 :mod:`!sets`。請使用內建的 :func:`set` 類別。" #: ../../whatsnew/3.0.rst:631 msgid "" -"Cleanup of the :mod:`sys` module: removed :func:`sys.exitfunc`, :func:`sys." -"exc_clear`, :data:`sys.exc_type`, :data:`sys.exc_value`, :data:`sys." +"Cleanup of the :mod:`sys` module: removed :func:`!sys.exitfunc`, :func:`!sys." +"exc_clear`, :data:`!sys.exc_type`, :data:`!sys.exc_value`, :data:`!sys." "exc_traceback`. (Note that :data:`sys.last_type` etc. remain.)" msgstr "" #: ../../whatsnew/3.0.rst:636 msgid "" -"Cleanup of the :class:`array.array` type: the :meth:`read` and :meth:`write` " -"methods are gone; use :meth:`fromfile` and :meth:`tofile` instead. Also, " -"the ``'c'`` typecode for array is gone -- use either ``'b'`` for bytes or " -"``'u'`` for Unicode characters." +"Cleanup of the :class:`array.array` type: the :meth:`!read` and :meth:`!" +"write` methods are gone; use :meth:`~array.array.fromfile` and :meth:`~array." +"array.tofile` instead. Also, the ``'c'`` typecode for array is gone -- use " +"either ``'b'`` for bytes or ``'u'`` for Unicode characters." msgstr "" #: ../../whatsnew/3.0.rst:642 msgid "" -"Cleanup of the :mod:`operator` module: removed :func:`sequenceIncludes` and :" -"func:`isCallable`." +"Cleanup of the :mod:`operator` module: removed :func:`!sequenceIncludes` " +"and :func:`!isCallable`." msgstr "" +"清理 :mod:`operator` 模組:移除 :func:`!sequenceIncludes` 和 :func:`!" +"isCallable`。" #: ../../whatsnew/3.0.rst:645 msgid "" @@ -965,8 +978,9 @@ msgid "" msgstr "" #: ../../whatsnew/3.0.rst:649 -msgid "Cleanup of the :mod:`random` module: removed the :func:`jumpahead` API." -msgstr "清理 :mod:`random` 模組:移除 :func:`jumpahead` API。" +msgid "" +"Cleanup of the :mod:`random` module: removed the :func:`!jumpahead` API." +msgstr "清理 :mod:`random` 模組:移除 :func:`!jumpahead` API。" #: ../../whatsnew/3.0.rst:651 msgid "The :mod:`!new` module is gone." @@ -974,8 +988,8 @@ msgstr "移除 :mod:`!new` 模組。" #: ../../whatsnew/3.0.rst:653 msgid "" -"The functions :func:`os.tmpnam`, :func:`os.tempnam` and :func:`os.tmpfile` " -"have been removed in favor of the :mod:`tempfile` module." +"The functions :func:`!os.tmpnam`, :func:`!os.tempnam` and :func:`!os." +"tmpfile` have been removed in favor of the :mod:`tempfile` module." msgstr "" #: ../../whatsnew/3.0.rst:657 @@ -986,19 +1000,19 @@ msgstr "" #: ../../whatsnew/3.0.rst:661 msgid "" -":data:`string.letters` and its friends (:data:`string.lowercase` and :data:" -"`string.uppercase`) are gone. Use :data:`string.ascii_letters` etc. " -"instead. (The reason for the removal is that :data:`string.letters` and " +":data:`!string.letters` and its friends (:data:`!string.lowercase` and :data:" +"`!string.uppercase`) are gone. Use :data:`string.ascii_letters` etc. " +"instead. (The reason for the removal is that :data:`!string.letters` and " "friends had locale-specific behavior, which is a bad idea for such " "attractively named global \"constants\".)" msgstr "" #: ../../whatsnew/3.0.rst:668 msgid "" -"Renamed module :mod:`__builtin__` to :mod:`builtins` (removing the " -"underscores, adding an 's'). The :data:`__builtins__` variable found in " +"Renamed module :mod:`!__builtin__` to :mod:`builtins` (removing the " +"underscores, adding an 's'). The :data:`!__builtins__` variable found in " "most global namespaces is unchanged. To modify a builtin, you should use :" -"mod:`builtins`, not :data:`__builtins__`!" +"mod:`builtins`, not :data:`!__builtins__`!" msgstr "" #: ../../whatsnew/3.0.rst:675 @@ -1043,13 +1057,13 @@ msgid "" msgstr "" #: ../../whatsnew/3.0.rst:705 -msgid ":exc:`StandardError` was removed." -msgstr ":exc:`StandardError` 被移除。" +msgid ":exc:`!StandardError` was removed." +msgstr ":exc:`!StandardError` 已被移除。" #: ../../whatsnew/3.0.rst:707 msgid "" -"Exceptions no longer behave as sequences. Use the :attr:`args` attribute " -"instead." +"Exceptions no longer behave as sequences. Use the :attr:`~BaseException." +"args` attribute instead." msgstr "" #: ../../whatsnew/3.0.rst:710 @@ -1135,10 +1149,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:768 msgid "" -":meth:`__getslice__`, :meth:`__setslice__` and :meth:`__delslice__` were " +":meth:`!__getslice__`, :meth:`!__setslice__` and :meth:`!__delslice__` were " "killed. The syntax ``a[i:j]`` now translates to ``a.__getitem__(slice(i, " -"j))`` (or :meth:`__setitem__` or :meth:`__delitem__`, when used as an " -"assignment or deletion target, respectively)." +"j))`` (or :meth:`~object.__setitem__` or :meth:`~object.__delitem__`, when " +"used as an assignment or deletion target, respectively)." msgstr "" #: ../../whatsnew/3.0.rst:774 @@ -1149,14 +1163,14 @@ msgstr "" #: ../../whatsnew/3.0.rst:777 msgid "" -"The :meth:`__oct__` and :meth:`__hex__` special methods are removed -- :func:" -"`oct` and :func:`hex` use :meth:`__index__` now to convert the argument to " -"an integer." +"The :meth:`!__oct__` and :meth:`!__hex__` special methods are removed -- :" +"func:`oct` and :func:`hex` use :meth:`~object.__index__` now to convert the " +"argument to an integer." msgstr "" #: ../../whatsnew/3.0.rst:781 -msgid "Removed support for :attr:`__members__` and :attr:`__methods__`." -msgstr "移除對 :attr:`__members__` 和 :attr:`__methods__` 的支援。" +msgid "Removed support for :attr:`!__members__` and :attr:`!__methods__`." +msgstr "移除對 :attr:`!__members__` 和 :attr:`!__methods__` 的支援。" #: ../../whatsnew/3.0.rst:783 msgid "" @@ -1189,7 +1203,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:805 msgid "" -":pep:`3111`: :func:`raw_input` was renamed to :func:`input`. That is, the " +":pep:`3111`: :func:`!raw_input` was renamed to :func:`input`. That is, the " "new :func:`input` function reads a line from :data:`sys.stdin` and returns " "it with the trailing newline stripped. It raises :exc:`EOFError` if the " "input is terminated prematurely. To get the old behavior of :func:`input`, " @@ -1214,55 +1228,55 @@ msgid "" msgstr "" #: ../../whatsnew/3.0.rst:823 -msgid "Moved :func:`intern` to :func:`sys.intern`." +msgid "Moved :func:`!intern` to :func:`sys.intern`." msgstr "" #: ../../whatsnew/3.0.rst:825 msgid "" -"Removed: :func:`apply`. Instead of ``apply(f, args)`` use ``f(*args)``." -msgstr "" +"Removed: :func:`!apply`. Instead of ``apply(f, args)`` use ``f(*args)``." +msgstr "移除 :func:`!apply`。請使用 ``f(*args)`` 來替換 ``apply(f, args)``。" #: ../../whatsnew/3.0.rst:828 msgid "" "Removed :func:`callable`. Instead of ``callable(f)`` you can use " -"``isinstance(f, collections.Callable)``. The :func:`operator.isCallable` " +"``isinstance(f, collections.Callable)``. The :func:`!operator.isCallable` " "function is also gone." msgstr "" #: ../../whatsnew/3.0.rst:832 msgid "" -"Removed :func:`coerce`. This function no longer serves a purpose now that " +"Removed :func:`!coerce`. This function no longer serves a purpose now that " "classic classes are gone." msgstr "" #: ../../whatsnew/3.0.rst:835 msgid "" -"Removed :func:`execfile`. Instead of ``execfile(fn)`` use ``exec(open(fn)." +"Removed :func:`!execfile`. Instead of ``execfile(fn)`` use ``exec(open(fn)." "read())``." msgstr "" -"移除 :func:`execfile`。請使用 ``exec(open(fn).read())`` 來替換 " +"移除 :func:`!execfile`。請使用 ``exec(open(fn).read())`` 來替換 " "``execfile(fn)``。" #: ../../whatsnew/3.0.rst:838 msgid "" -"Removed the :class:`file` type. Use :func:`open`. There are now several " +"Removed the :class:`!file` type. Use :func:`open`. There are now several " "different kinds of streams that open can return in the :mod:`io` module." msgstr "" #: ../../whatsnew/3.0.rst:841 msgid "" -"Removed :func:`reduce`. Use :func:`functools.reduce` if you really need it; " -"however, 99 percent of the time an explicit :keyword:`for` loop is more " +"Removed :func:`!reduce`. Use :func:`functools.reduce` if you really need " +"it; however, 99 percent of the time an explicit :keyword:`for` loop is more " "readable." msgstr "" #: ../../whatsnew/3.0.rst:845 -msgid "Removed :func:`reload`. Use :func:`!imp.reload`." -msgstr "" +msgid "Removed :func:`!reload`. Use :func:`!imp.reload`." +msgstr "移除 :func:`!reload`。請使用 :func:`!imp.reload`。" #: ../../whatsnew/3.0.rst:847 msgid "" -"Removed. :meth:`dict.has_key` -- use the :keyword:`in` operator instead." +"Removed. :meth:`!dict.has_key` -- use the :keyword:`in` operator instead." msgstr "" #: ../../whatsnew/3.0.rst:854 diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index b0f93a3c71..3202bc30a7 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -3991,7 +3991,7 @@ msgstr "(由 Zhang Na 於 :gh:`90656` 中貢獻。)" #: ../../whatsnew/3.12.rst:1819 msgid "``PYTHON_FOR_REGEN`` now require Python 3.10 or newer." -msgstr "" +msgstr "``PYTHON_FOR_REGEN`` 現在需要 Python 3.10 或更新的版本。" #: ../../whatsnew/3.12.rst:1821 msgid "" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index 5e82698d42..ea9bec402b 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -513,7 +513,7 @@ msgstr "" #: ../../whatsnew/3.13.rst:308 msgid "" "(Contributed by Pablo Galindo Salgado and Shantanu Jain in :gh:`107944`.)" -msgstr "" +msgstr "(由 Pablo Galindo Salgado 和 Shantanu Jain 於 :gh:`107944` 中貢獻。)" #: ../../whatsnew/3.13.rst:314 msgid "Free-threaded CPython" diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index b63071a79e..d4e6ccd8c2 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -1167,7 +1167,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:801 msgid "Contributed by Serhiy Storchaka in :issue:`26492`." -msgstr "" +msgstr "由 Serhiy Storchaka 於 :issue:`26492` 中貢獻。" #: ../../whatsnew/3.6.rst:804 msgid "ast" @@ -1181,7 +1181,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:809 msgid "Contributed by Victor Stinner in :issue:`26146`." -msgstr "" +msgstr "由 Victor Stinner 於 :issue:`26146` 中貢獻。" #: ../../whatsnew/3.6.rst:813 msgid "asyncio" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 6e6f30678a..b2c04d4e21 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -882,7 +882,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:610 msgid "Contributed by Barry Warsaw and Brett Cannon in :issue:`32248`." -msgstr "" +msgstr "由 Barry Warsaw 與 Brett Cannon 在 :issue:`32248` 中貢獻。" #: ../../whatsnew/3.7.rst:614 msgid ""