diff --git a/library/functions.po b/library/functions.po index 9493604248..b7cf344003 100644 --- a/library/functions.po +++ b/library/functions.po @@ -6,21 +6,21 @@ # Matt Wang , 2021 # Phil Lin , 2022 # Steven Hsu , 2023 +# Weilin Du <1372449351@qq.com>, 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-02-19 00:13+0000\n" -"PO-Revision-Date: 2024-05-06 17:06+0800\n" -"Last-Translator: KNChiu \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" +"PO-Revision-Date: 2025-07-28 21:38+0800\n" +"Last-Translator: Weilin Du <1372449351@qq.com>\n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.4.2\n" +"X-Generator: Poedit 3.6\n" #: ../../library/functions.rst:5 ../../library/functions.rst:11 msgid "Built-in Functions" @@ -28,10 +28,9 @@ msgstr "內建函式" #: ../../library/functions.rst:7 msgid "" -"The Python interpreter has a number of functions and types built into it " -"that are always available. They are listed here in alphabetical order." -msgstr "" -"Python 直譯器有內建多個可隨時使用的函式和型別。以下按照英文字母排序列出。" +"The Python interpreter has a number of functions and types built into it that are always available. They are listed " +"here in alphabetical order." +msgstr "Python 直譯器有內建多個可隨時使用的函式和型別。以下按照英文字母排序列出。" #: ../../library/functions.rst:0 msgid "**A**" @@ -399,32 +398,27 @@ msgstr ":func:`__import__`" #: ../../library/functions.rst:59 msgid "" -"Return the absolute value of a number. The argument may be an integer, a " -"floating-point number, or an object implementing :meth:`~object.__abs__`. If " -"the argument is a complex number, its magnitude is returned." +"Return the absolute value of a number. The argument may be an integer, a floating-point number, or an object " +"implementing :meth:`~object.__abs__`. If the argument is a complex number, its magnitude is returned." msgstr "" -"回傳一個數的絕對值,引數可以是整數、浮點數或有實現 :meth:`~object.__abs__` 的" -"物件。如果引數是一個複數,回傳它的純量(大小)。" +"回傳一個數的絕對值,引數可以是整數、浮點數或有實現 :meth:`~object.__abs__` 的物件。如果引數是一個複數,回傳它的純量" +"(大小)。" #: ../../library/functions.rst:67 msgid "" -"Return an :term:`asynchronous iterator` for an :term:`asynchronous " -"iterable`. Equivalent to calling ``x.__aiter__()``." +"Return an :term:`asynchronous iterator` for an :term:`asynchronous iterable`. Equivalent to calling " +"``x.__aiter__()``." msgstr "" -"回傳 :term:`非同步疊代器 ` 做為 :term:`非同步可疊代物" -"件 `。相當於呼叫 x.__aiter__()。" +"回傳 :term:`非同步疊代器 ` 做為 :term:`非同步可疊代物件 `。相當於呼叫 " +"x.__aiter__()。" #: ../../library/functions.rst:70 msgid "Note: Unlike :func:`iter`, :func:`aiter` has no 2-argument variant." msgstr "注意:與 :func:`iter` 不同,:func:`aiter` 沒有兩個引數的變體。" #: ../../library/functions.rst:76 -msgid "" -"Return ``True`` if all elements of the *iterable* are true (or if the " -"iterable is empty). Equivalent to::" -msgstr "" -"如果 *iterable* 的所有元素皆為真(或 iterable 為空)則回傳 ``True``。等價" -"於: ::" +msgid "Return ``True`` if all elements of the *iterable* are true (or if the iterable is empty). Equivalent to::" +msgstr "如果 *iterable* 的所有元素皆為真(或 iterable 為空)則回傳 ``True``。等價於: ::" #: ../../library/functions.rst:79 msgid "" @@ -442,35 +436,28 @@ msgstr "" #: ../../library/functions.rst:89 msgid "" -"When awaited, return the next item from the given :term:`asynchronous " -"iterator`, or *default* if given and the iterator is exhausted." -msgstr "" -"當進入 await 時,從給定的 :term:`asynchronous iterator` 中回傳下一個項目" -"(item),疊代完畢則回傳 *default* 。" +"When awaited, return the next item from the given :term:`asynchronous iterator`, or *default* if given and the " +"iterator is exhausted." +msgstr "當進入 await 時,從給定的 :term:`asynchronous iterator` 中回傳下一個項目(item),疊代完畢則回傳 *default* 。" #: ../../library/functions.rst:92 -msgid "" -"This is the async variant of the :func:`next` builtin, and behaves similarly." +msgid "This is the async variant of the :func:`next` builtin, and behaves similarly." msgstr "這是內建函式 :func:`next` 的非同步版本,其行為類似於:" #: ../../library/functions.rst:95 msgid "" -"This calls the :meth:`~object.__anext__` method of *async_iterator*, " -"returning an :term:`awaitable`. Awaiting this returns the next value of the " -"iterator. If *default* is given, it is returned if the iterator is " -"exhausted, otherwise :exc:`StopAsyncIteration` is raised." +"This calls the :meth:`~object.__anext__` method of *async_iterator*, returning an :term:`awaitable`. Awaiting this " +"returns the next value of the iterator. If *default* is given, it is returned if the iterator is exhausted, " +"otherwise :exc:`StopAsyncIteration` is raised." msgstr "" -"呼叫 *async_iterator* 的 :meth:`~object.__anext__` 方法,回" -"傳 :term:`awaitable`。等待返回疊代器的下一個值。如果指定 *default*,當疊代器" -"結束時會返回該值,否則會引發 :exc:`StopAsyncIteration` 。" +"呼叫 *async_iterator* 的 :meth:`~object.__anext__` 方法,回傳 :term:`awaitable`。等待返回疊代器的下一個值。如果指定 " +"*default*,當疊代器結束時會返回該值,否則會引發 :exc:`StopAsyncIteration` 。" #: ../../library/functions.rst:104 msgid "" -"Return ``True`` if any element of the *iterable* is true. If the iterable " -"is empty, return ``False``. Equivalent to::" -msgstr "" -"如果 *iterable* 的任一元素為真,回傳 ``True``。如果 iterable 是空的,則回傳 " -"``False``。等價於: ::" +"Return ``True`` if any element of the *iterable* is true. If the iterable is empty, return ``False``. Equivalent " +"to::" +msgstr "如果 *iterable* 的任一元素為真,回傳 ``True``。如果 iterable 是空的,則回傳 ``False``。等價於: ::" #: ../../library/functions.rst:107 msgid "" @@ -488,51 +475,40 @@ msgstr "" #: ../../library/functions.rst:116 msgid "" -"As :func:`repr`, return a string containing a printable representation of an " -"object, but escape the non-ASCII characters in the string returned " -"by :func:`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates " -"a string similar to that returned by :func:`repr` in Python 2." +"As :func:`repr`, return a string containing a printable representation of an object, but escape the non-ASCII " +"characters in the string returned by :func:`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates a " +"string similar to that returned by :func:`repr` in Python 2." msgstr "" -"就像函式 :func:`repr`,回傳一個表示物件的字串,但是 :func:`repr` 回傳的字串中" -"非 ASCII 編碼的字元會被跳脫 (escape),像是 ``\\x``、``\\u`` 和 ``\\U``。這個" -"函式生成的字串和 Python 2 的 :func:`repr` 回傳的結果相似。" +"就像函式 :func:`repr`,回傳一個表示物件的字串,但是 :func:`repr` 回傳的字串中非 ASCII 編碼的字元會被跳脫 (escape),像" +"是 ``\\x``、``\\u`` 和 ``\\U``。這個函式生成的字串和 Python 2 的 :func:`repr` 回傳的結果相似。" #: ../../library/functions.rst:124 msgid "" -"Convert an integer number to a binary string prefixed with \"0b\". The " -"result is a valid Python expression. If *x* is not a Python :class:`int` " -"object, it has to define an :meth:`~object.__index__` method that returns an " -"integer. Some examples:" +"Convert an integer number to a binary string prefixed with \"0b\". The result is a valid Python expression. If *x* " +"is not a Python :class:`int` object, it has to define an :meth:`~object.__index__` method that returns an integer. " +"Some examples:" msgstr "" -"將一個整數轉變為一個前綴為 \"0b\" 的二進位制字串。結果是一個有效的 Python 運" -"算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定" -"義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" +"將一個整數轉變為一個前綴為 \"0b\" 的二進位制字串。結果是一個有效的 Python 運算式。如果 *x* 不是 Python " +"的 :class:`int` 物件,那它需要定義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" #: ../../library/functions.rst:134 -msgid "" -"If the prefix \"0b\" is desired or not, you can use either of the following " -"ways." +msgid "If the prefix \"0b\" is desired or not, you can use either of the following ways." msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" -#: ../../library/functions.rst:141 ../../library/functions.rst:942 -#: ../../library/functions.rst:1323 +#: ../../library/functions.rst:141 ../../library/functions.rst:942 ../../library/functions.rst:1323 msgid "See also :func:`format` for more information." msgstr "可參考 :func:`format` 取得更多資訊。" #: ../../library/functions.rst:146 msgid "" -"Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is " -"converted using the standard :ref:`truth testing procedure `. If the " -"argument is false or omitted, this returns ``False``; otherwise, it returns " -"``True``. The :class:`bool` class is a subclass of :class:`int` " -"(see :ref:`typesnumeric`). It cannot be subclassed further. Its only " -"instances are ``False`` and ``True`` (see :ref:`typebool`)." +"Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is converted using the standard :ref:`truth " +"testing procedure `. If the argument is false or omitted, this returns ``False``; otherwise, it returns " +"``True``. The :class:`bool` class is a subclass of :class:`int` (see :ref:`typesnumeric`). It cannot be subclassed " +"further. Its only instances are ``False`` and ``True`` (see :ref:`typebool`)." msgstr "" -"回傳一個布林值,即 ``True`` 或者 ``False``。引數會使用標準的\\ :ref:`真值測試" -"程序 `\\ 來轉換。如果引數為假或者被省略,則回傳 ``False``;其他情況回" -"傳 ``True``。:class:`bool` class(類別)是 :class:`int` 的 subclass(子類別)" -"(參見 :ref:`typesnumeric`),其他 class 不能繼承自它。它只有 ``False`` 和 " -"``True`` 兩個實例(參見 :ref:`typebool`)。" +"回傳一個布林值,即 ``True`` 或者 ``False``。引數會使用標準的\\ :ref:`真值測試程序 `\\ 來轉換。如果引數為假或者" +"被省略,則回傳 ``False``;其他情況回傳 ``True``。:class:`bool` class(類別)是 :class:`int` 的 subclass(子類別)(參" +"見 :ref:`typesnumeric`),其他 class 不能繼承自它。它只有 ``False`` 和 ``True`` 兩個實例(參見 :ref:`typebool`)。" #: ../../library/functions.rst:156 ../../library/functions.rst:807 msgid "The parameter is now positional-only." @@ -540,98 +516,72 @@ msgstr "現在為僅限位置參數。" #: ../../library/functions.rst:161 msgid "" -"This function drops you into the debugger at the call site. Specifically, " -"it calls :func:`sys.breakpointhook`, passing ``args`` and ``kws`` straight " -"through. By default, ``sys.breakpointhook()`` calls :func:`pdb.set_trace` " -"expecting no arguments. In this case, it is purely a convenience function " -"so you don't have to explicitly import :mod:`pdb` or type as much code to " -"enter the debugger. However, :func:`sys.breakpointhook` can be set to some " -"other function and :func:`breakpoint` will automatically call that, allowing " -"you to drop into the debugger of choice. If :func:`sys.breakpointhook` is " -"not accessible, this function will raise :exc:`RuntimeError`." -msgstr "" -"這個函式將呼叫 :func:`sys.breakpointhook` 函式,並將 ``args`` 和 ``kws`` 傳遞" -"給它。這將有效地讓你在特定的呼叫點進入除錯器。預設情況下," -"``sys.breakpointhook()`` 呼叫 :func:`pdb.set_trace` 不須帶任何引數。這樣的設" -"計是為了方便使用者,讓他們不需要額外地導入 :mod:`pdb` 模組或輸入太多程式就可" -"以進入除錯器。然而,可以將 :func:`sys.breakpointhook` 設置為其他函式,並" -"且 :func:`breakpoint` 將自動呼叫該函式,讓你進入所選擇的除錯器。如果無法存" -"取 :func:`sys.breakpointhook` 這個函式,則此函式將引發 :exc:`RuntimeError`。" +"This function drops you into the debugger at the call site. Specifically, it calls :func:`sys.breakpointhook`, " +"passing ``args`` and ``kws`` straight through. By default, ``sys.breakpointhook()`` calls :func:`pdb.set_trace` " +"expecting no arguments. In this case, it is purely a convenience function so you don't have to explicitly " +"import :mod:`pdb` or type as much code to enter the debugger. However, :func:`sys.breakpointhook` can be set to " +"some other function and :func:`breakpoint` will automatically call that, allowing you to drop into the debugger of " +"choice. If :func:`sys.breakpointhook` is not accessible, this function will raise :exc:`RuntimeError`." +msgstr "" +"這個函式將呼叫 :func:`sys.breakpointhook` 函式,並將 ``args`` 和 ``kws`` 傳遞給它。這將有效地讓你在特定的呼叫點進入除" +"錯器。預設情況下,``sys.breakpointhook()`` 呼叫 :func:`pdb.set_trace` 不須帶任何引數。這樣的設計是為了方便使用者,讓" +"他們不需要額外地導入 :mod:`pdb` 模組或輸入太多程式就可以進入除錯器。然而,可以將 :func:`sys.breakpointhook` 設置為其" +"他函式,並且 :func:`breakpoint` 將自動呼叫該函式,讓你進入所選擇的除錯器。如果無法存取 :func:`sys.breakpointhook` 這" +"個函式,則此函式將引發 :exc:`RuntimeError`。" #: ../../library/functions.rst:173 msgid "" -"By default, the behavior of :func:`breakpoint` can be changed with " -"the :envvar:`PYTHONBREAKPOINT` environment variable. " -"See :func:`sys.breakpointhook` for usage details." +"By default, the behavior of :func:`breakpoint` can be changed with the :envvar:`PYTHONBREAKPOINT` environment " +"variable. See :func:`sys.breakpointhook` for usage details." msgstr "" -"預設情況下,:func:`breakpoint` 的行為可以透過 :envvar:`PYTHONBREAKPOINT` 環境" -"變數來更改。有關使用詳情,請參考 :func:`sys.breakpointhook`。" +"預設情況下,:func:`breakpoint` 的行為可以透過 :envvar:`PYTHONBREAKPOINT` 環境變數來更改。有關使用詳情,請參" +"考 :func:`sys.breakpointhook`。" #: ../../library/functions.rst:177 -msgid "" -"Note that this is not guaranteed if :func:`sys.breakpointhook` has been " -"replaced." +msgid "Note that this is not guaranteed if :func:`sys.breakpointhook` has been replaced." msgstr "請注意,如果 :func:`sys.breakpointhook` 被替換了,則無法保證此功能。" #: ../../library/functions.rst:180 -msgid "" -"Raises an :ref:`auditing event ` ``builtins.breakpoint`` with " -"argument ``breakpointhook``." -msgstr "" -"引發一個附帶引數 ``breakpointhook`` 的\\ :ref:`稽核事件 ` " -"``builtins.breakpoint``。" +msgid "Raises an :ref:`auditing event ` ``builtins.breakpoint`` with argument ``breakpointhook``." +msgstr "引發一個附帶引數 ``breakpointhook`` 的\\ :ref:`稽核事件 ` ``builtins.breakpoint``。" #: ../../library/functions.rst:190 msgid "" -"Return a new array of bytes. The :class:`bytearray` class is a mutable " -"sequence of integers in the range 0 <= x < 256. It has most of the usual " -"methods of mutable sequences, described in :ref:`typesseq-mutable`, as well " -"as most methods that the :class:`bytes` type has, see :ref:`bytes-methods`." +"Return a new array of bytes. The :class:`bytearray` class is a mutable sequence of integers in the range 0 <= x < " +"256. It has most of the usual methods of mutable sequences, described in :ref:`typesseq-mutable`, as well as most " +"methods that the :class:`bytes` type has, see :ref:`bytes-methods`." msgstr "" -"回傳一個新的 bytes 陣列。:class:`bytearray` class 是一個可變的整數序列,包含" -"範圍為 0 <= x < 256 的整數。它有可變序列大部分常見的 method(如" -"在 :ref:`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 " -"method,參見 :ref:`bytes-methods`。" +"回傳一個新的 bytes 陣列。:class:`bytearray` class 是一個可變的整數序列,包含範圍為 0 <= x < 256 的整數。它有可變序列" +"大部分常見的 method(如在 :ref:`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 method,參" +"見 :ref:`bytes-methods`。" #: ../../library/functions.rst:195 -msgid "" -"The optional *source* parameter can be used to initialize the array in a few " -"different ways:" +msgid "The optional *source* parameter can be used to initialize the array in a few different ways:" msgstr "選擇性參數 *source* 可以被用來以不同的方式初始化陣列:" #: ../../library/functions.rst:198 msgid "" -"If it is a *string*, you must also give the *encoding* (and optionally, " -"*errors*) parameters; :func:`bytearray` then converts the string to bytes " -"using :meth:`str.encode`." +"If it is a *string*, you must also give the *encoding* (and optionally, *errors*) parameters; :func:`bytearray` then " +"converts the string to bytes using :meth:`str.encode`." msgstr "" -"如果是一個 *string*,你必須提供 *encoding* 參數(以及選擇性地提供 " -"*errors* );:func:`bytearray` 會使用 :meth:`str.encode` method 來將 string " -"轉變成 bytes。" +"如果是一個 *string*,你必須提供 *encoding* 參數(以及選擇性地提供 *errors* );:func:`bytearray` 會使" +"用 :meth:`str.encode` method 來將 string 轉變成 bytes。" #: ../../library/functions.rst:202 -msgid "" -"If it is an *integer*, the array will have that size and will be initialized " -"with null bytes." -msgstr "" -"如果是一個 *integer*,陣列則會有該數值的長度,並以 null bytes 來當作初始值。" +msgid "If it is an *integer*, the array will have that size and will be initialized with null bytes." +msgstr "如果是一個 *integer*,陣列則會有該數值的長度,並以 null bytes 來當作初始值。" #: ../../library/functions.rst:205 msgid "" -"If it is an object conforming to the :ref:`buffer interface " -"`, a read-only buffer of the object will be used to " -"initialize the bytes array." -msgstr "" -"如果是一個符合 :ref:`buffer 介面 `\\ 的物件,該物件的唯讀 " -"buffer 會被用來初始化 bytes 陣列。" +"If it is an object conforming to the :ref:`buffer interface `, a read-only buffer of the object will " +"be used to initialize the bytes array." +msgstr "如果是一個符合 :ref:`buffer 介面 `\\ 的物件,該物件的唯讀 buffer 會被用來初始化 bytes 陣列。" #: ../../library/functions.rst:208 msgid "" -"If it is an *iterable*, it must be an iterable of integers in the range ``0 " -"<= x < 256``, which are used as the initial contents of the array." -msgstr "" -"如果是一個 *iterable*,它的元素必須是範圍為 ``0 <= x < 256`` 的整數,並且會被" -"用作陣列的初始值。" +"If it is an *iterable*, it must be an iterable of integers in the range ``0 <= x < 256``, which are used as the " +"initial contents of the array." +msgstr "如果是一個 *iterable*,它的元素必須是範圍為 ``0 <= x < 256`` 的整數,並且會被用作陣列的初始值。" #: ../../library/functions.rst:211 msgid "Without an argument, an array of size 0 is created." @@ -643,18 +593,15 @@ msgstr "可參考 :ref:`binaryseq` 和 :ref:`typebytearray`。" #: ../../library/functions.rst:222 msgid "" -"Return a new \"bytes\" object which is an immutable sequence of integers in " -"the range ``0 <= x < 256``. :class:`bytes` is an immutable version " -"of :class:`bytearray` -- it has the same non-mutating methods and the same " -"indexing and slicing behavior." +"Return a new \"bytes\" object which is an immutable sequence of integers in the range ``0 <= x < " +"256``. :class:`bytes` is an immutable version of :class:`bytearray` -- it has the same non-mutating methods and the " +"same indexing and slicing behavior." msgstr "" -"回傳一個新的 \"bytes\" 物件,會是一個元素是範圍為 ``0 <= x < 256`` 整數的不可" -"變序列。:class:`bytes` 是 :class:`bytearray` 的不可變版本 — 它的同樣具備不改" -"變物件的 method,也有相同的索引和切片操作。" +"回傳一個新的 \"bytes\" 物件,會是一個元素是範圍為 ``0 <= x < 256`` 整數的不可變序列。:class:`bytes` " +"是 :class:`bytearray` 的不可變版本 — 它的同樣具備不改變物件的 method,也有相同的索引和切片操作。" #: ../../library/functions.rst:227 -msgid "" -"Accordingly, constructor arguments are interpreted as for :func:`bytearray`." +msgid "Accordingly, constructor arguments are interpreted as for :func:`bytearray`." msgstr "因此,建構函式的引數和 :func:`bytearray` 相同。" #: ../../library/functions.rst:229 @@ -667,40 +614,32 @@ msgstr "可參考 :ref:`binaryseq`、:ref:`typebytes` 和 :ref:`bytes-methods` #: ../../library/functions.rst:236 msgid "" -"Return :const:`True` if the *object* argument appears " -"callable, :const:`False` if not. If this returns ``True``, it is still " -"possible that a call fails, but if it is ``False``, calling *object* will " -"never succeed. Note that classes are callable (calling a class returns a new " -"instance); instances are callable if their class has " +"Return :const:`True` if the *object* argument appears callable, :const:`False` if not. If this returns ``True``, it " +"is still possible that a call fails, but if it is ``False``, calling *object* will never succeed. Note that classes " +"are callable (calling a class returns a new instance); instances are callable if their class has " "a :meth:`~object.__call__` method." msgstr "" -"如果引數 *object* 是可呼叫的,回傳 :const:`True`,否則回傳 :const:`False`。如" -"果回傳 ``True``,呼叫仍可能會失敗;但如果回傳 ``False``,則呼叫 *object* 肯定" -"會失敗。注意 class 是可呼叫的(呼叫 class 會回傳一個新的實例);如果實例的 " +"如果引數 *object* 是可呼叫的,回傳 :const:`True`,否則回傳 :const:`False`。如果回傳 ``True``,呼叫仍可能會失敗;但如" +"果回傳 ``False``,則呼叫 *object* 肯定會失敗。注意 class 是可呼叫的(呼叫 class 會回傳一個新的實例);如果實例的 " "class 有定義 :meth:`~object.__call__` method,則它是可呼叫的。" #: ../../library/functions.rst:242 -msgid "" -"This function was first removed in Python 3.0 and then brought back in " -"Python 3.2." +msgid "This function was first removed in Python 3.0 and then brought back in Python 3.2." msgstr "這個函式一開始在 Python 3.0 被移除,但在 Python 3.2 又被重新加入。" #: ../../library/functions.rst:249 msgid "" -"Return the string representing a character whose Unicode code point is the " -"integer *i*. For example, ``chr(97)`` returns the string ``'a'``, while " -"``chr(8364)`` returns the string ``'€'``. This is the inverse of :func:`ord`." +"Return the string representing a character whose Unicode code point is the integer *i*. For example, ``chr(97)`` " +"returns the string ``'a'``, while ``chr(8364)`` returns the string ``'€'``. This is the inverse of :func:`ord`." msgstr "" -"回傳代表字元之 Unicode 編碼位置為整數 *i* 的字串。例如,``chr(97)`` 回傳字串 " -"``'a'``,而 ``chr(8364)`` 回傳字串 ``'€'``。這是 :func:`ord` 的逆函式。" +"回傳代表字元之 Unicode 編碼位置為整數 *i* 的字串。例如,``chr(97)`` 回傳字串 ``'a'``,而 ``chr(8364)`` 回傳字串 " +"``'€'``。這是 :func:`ord` 的逆函式。" #: ../../library/functions.rst:253 msgid "" -"The valid range for the argument is from 0 through 1,114,111 (0x10FFFF in " -"base 16). :exc:`ValueError` will be raised if *i* is outside that range." -msgstr "" -"引數的有效範圍是 0 到 1,114,111(16 進制表示為 0x10FFFF)。如果 *i* 超過這個" -"範圍,會引發 :exc:`ValueError`。" +"The valid range for the argument is from 0 through 1,114,111 (0x10FFFF in base 16). :exc:`ValueError` will be " +"raised if *i* is outside that range." +msgstr "引數的有效範圍是 0 到 1,114,111(16 進制表示為 0x10FFFF)。如果 *i* 超過這個範圍,會引發 :exc:`ValueError`。" #: ../../library/functions.rst:259 msgid "Transform a method into a class method." @@ -708,12 +647,11 @@ msgstr "把一個 method 封裝成 class method(類別方法)。" #: ../../library/functions.rst:261 msgid "" -"A class method receives the class as an implicit first argument, just like " -"an instance method receives the instance. To declare a class method, use " -"this idiom::" +"A class method receives the class as an implicit first argument, just like an instance method receives the instance. " +"To declare a class method, use this idiom::" msgstr "" -"一個 class method 把自己的 class 作為第一個引數,就像一個實例 method 把實例自" -"己作為第一個引數。請用以下慣例來宣告 class method: ::" +"一個 class method 把自己的 class 作為第一個引數,就像一個實例 method 把實例自己作為第一個引數。請用以下慣例來宣告 " +"class method: ::" #: ../../library/functions.rst:265 msgid "" @@ -726,218 +664,167 @@ msgstr "" " def f(cls, arg1, arg2): ..." #: ../../library/functions.rst:269 -msgid "" -"The ``@classmethod`` form is a function :term:`decorator` -- " -"see :ref:`function` for details." -msgstr "" -"``@classmethod`` 語法是一個函式 :term:`decorator` — 參見 :ref:`function` 中關" -"於函式定義的詳細介紹。" +msgid "The ``@classmethod`` form is a function :term:`decorator` -- see :ref:`function` for details." +msgstr "``@classmethod`` 語法是一個函式 :term:`decorator` — 參見 :ref:`function` 中關於函式定義的詳細介紹。" #: ../../library/functions.rst:272 msgid "" -"A class method can be called either on the class (such as ``C.f()``) or on " -"an instance (such as ``C().f()``). The instance is ignored except for its " -"class. If a class method is called for a derived class, the derived class " -"object is passed as the implied first argument." +"A class method can be called either on the class (such as ``C.f()``) or on an instance (such as ``C().f()``). The " +"instance is ignored except for its class. If a class method is called for a derived class, the derived class object " +"is passed as the implied first argument." msgstr "" -"一個 class method 可以在 class(如 ``C.f()``)或實例(如 ``C().f()``)上呼" -"叫。實例除了它的 class 資訊,其他都會被忽略。如果一個 class method 在 " -"subclass 上呼叫,subclass 會作為第一個引數傳入。" +"一個 class method 可以在 class(如 ``C.f()``)或實例(如 ``C().f()``)上呼叫。實例除了它的 class 資訊,其他都會被忽" +"略。如果一個 class method 在 subclass 上呼叫,subclass 會作為第一個引數傳入。" #: ../../library/functions.rst:277 msgid "" -"Class methods are different than C++ or Java static methods. If you want " -"those, see :func:`staticmethod` in this section. For more information on " -"class methods, see :ref:`types`." +"Class methods are different than C++ or Java static methods. If you want those, see :func:`staticmethod` in this " +"section. For more information on class methods, see :ref:`types`." msgstr "" -"Class method 和 C++ 與 Java 的 static method 是有區別的。如果你想瞭解 static " -"method,請看本節的 :func:`staticmethod`。關於 class method 的更多資訊,請參考" -"\\ :ref:`types`。" +"Class method 和 C++ 與 Java 的 static method 是有區別的。如果你想瞭解 static method,請看本節" +"的 :func:`staticmethod`。關於 class method 的更多資訊,請參考\\ :ref:`types`。" #: ../../library/functions.rst:281 -msgid "" -"Class methods can now wrap other :term:`descriptors ` such " -"as :func:`property`." -msgstr "" -"Class methods 現在可以包裝其他\\ :term:`描述器 `,例" -"如 :func:`property`" +msgid "Class methods can now wrap other :term:`descriptors ` such as :func:`property`." +msgstr "Class methods 現在可以包裝其他\\ :term:`描述器 `,例如 :func:`property`" #: ../../library/functions.rst:285 msgid "" "Class methods now inherit the method attributes " "(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " -"and :attr:`~function.__annotations__`) and have a new ``__wrapped__`` " -"attribute." +"and :attr:`~function.__annotations__`) and have a new ``__wrapped__`` attribute." msgstr "" "Class method 現在繼承了 method 屬性" "(:attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__doc__` " "和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性。" #: ../../library/functions.rst:292 -msgid "" -"Class methods can no longer wrap other :term:`descriptors ` such " -"as :func:`property`." -msgstr "" -"Class methods 不能再包裝其他的\\ :term:`描述器 `,例" -"如 :func:`property`。" +msgid "Class methods can no longer wrap other :term:`descriptors ` such as :func:`property`." +msgstr "Class methods 不能再包裝其他的\\ :term:`描述器 `,例如 :func:`property`。" #: ../../library/functions.rst:299 msgid "" -"Compile the *source* into a code or AST object. Code objects can be " -"executed by :func:`exec` or :func:`eval`. *source* can either be a normal " -"string, a byte string, or an AST object. Refer to the :mod:`ast` module " +"Compile the *source* into a code or AST object. Code objects can be executed by :func:`exec` or :func:`eval`. " +"*source* can either be a normal string, a byte string, or an AST object. Refer to the :mod:`ast` module " "documentation for information on how to work with AST objects." msgstr "" -"將 *source* 編譯成程式碼或 AST 物件。程式碼物件可以被 :func:`exec` " -"或 :func:`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。" -"參見 :mod:`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" +"將 *source* 編譯成程式碼或 AST 物件。程式碼物件可以被 :func:`exec` 或 :func:`eval` 執行。*source* 可以是一般的字串、" +"bytes 字串、或者 AST 物件。參見 :mod:`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" #: ../../library/functions.rst:304 msgid "" -"The *filename* argument should give the file from which the code was read; " -"pass some recognizable value if it wasn't read from a file (``''`` " -"is commonly used)." +"The *filename* argument should give the file from which the code was read; pass some recognizable value if it wasn't " +"read from a file (``''`` is commonly used)." msgstr "" -"*filename* 引數必須是程式碼的檔名;如果程式碼不是從檔案中讀取,可以傳入一些可" -"辨識的值(經常會使用 ``''`` 來替代)。" +"*filename* 引數必須是程式碼的檔名;如果程式碼不是從檔案中讀取,可以傳入一些可辨識的值(經常會使用 ``''`` 來替" +"代)。" #: ../../library/functions.rst:308 msgid "" -"The *mode* argument specifies what kind of code must be compiled; it can be " -"``'exec'`` if *source* consists of a sequence of statements, ``'eval'`` if " -"it consists of a single expression, or ``'single'`` if it consists of a " -"single interactive statement (in the latter case, expression statements that " -"evaluate to something other than ``None`` will be printed)." +"The *mode* argument specifies what kind of code must be compiled; it can be ``'exec'`` if *source* consists of a " +"sequence of statements, ``'eval'`` if it consists of a single expression, or ``'single'`` if it consists of a single " +"interactive statement (in the latter case, expression statements that evaluate to something other than ``None`` will " +"be printed)." msgstr "" -"*mode* 引數指定了編譯程式碼時必須用的模式。如果 *source* 是一系列的陳述式,可" -"以是 ``'exec'``;如果是單一運算式,可以是 ``'eval'``;如果是單個互動式陳述" -"式,可以是 ``'single'``\\ (在最後一種情況下,如果運算式執行結果不是 " -"``None`` 則會被印出來)。" +"*mode* 引數指定了編譯程式碼時必須用的模式。如果 *source* 是一系列的陳述式,可以是 ``'exec'``;如果是單一運算式,可以" +"是 ``'eval'``;如果是單個互動式陳述式,可以是 ``'single'``\\ (在最後一種情況下,如果運算式執行結果不是 ``None`` 則會" +"被印出來)。" #: ../../library/functions.rst:314 msgid "" -"The optional arguments *flags* and *dont_inherit* control " -"which :ref:`compiler options ` should be activated and " -"which :ref:`future features ` should be allowed. If neither is " -"present (or both are zero) the code is compiled with the same flags that " -"affect the code that is calling :func:`compile`. If the *flags* argument is " -"given and *dont_inherit* is not (or is zero) then the compiler options and " -"the future statements specified by the *flags* argument are used in addition " -"to those that would be used anyway. If *dont_inherit* is a non-zero integer " -"then the *flags* argument is it -- the flags (future features and compiler " -"options) in the surrounding code are ignored." -msgstr "" -"可選引數 *flags* 和 *dont_inherit* 控制啟用哪個\\ :ref:`編譯器選項 `\\ 以及允許哪個\\ :ref:`未來功能 `。如果兩者都不存在" -"(或兩者都為零),則會呼叫與 :func:`compile` 相同旗標的程式碼來編譯。如果給" -"定 *flags* 引數而未給定 *dont_inherit*(或為零)則無論如何都會使用由 *flags* " -"引數所指定的編譯器選項和未來陳述式。如果 *dont_inherit* 是一個非零整數,則使" -"用 *flags* 引數 -- 周圍程式碼中的旗標(未來功能和編譯器選項)將被忽略。" +"The optional arguments *flags* and *dont_inherit* control which :ref:`compiler options ` should " +"be activated and which :ref:`future features ` should be allowed. If neither is present (or both are zero) " +"the code is compiled with the same flags that affect the code that is calling :func:`compile`. If the *flags* " +"argument is given and *dont_inherit* is not (or is zero) then the compiler options and the future statements " +"specified by the *flags* argument are used in addition to those that would be used anyway. If *dont_inherit* is a " +"non-zero integer then the *flags* argument is it -- the flags (future features and compiler options) in the " +"surrounding code are ignored." +msgstr "" +"可選引數 *flags* 和 *dont_inherit* 控制啟用哪個\\ :ref:`編譯器選項 `\\ 以及允許哪個\\ :ref:`未來" +"功能 `。如果兩者都不存在(或兩者都為零),則會呼叫與 :func:`compile` 相同旗標的程式碼來編譯。如果給定 " +"*flags* 引數而未給定 *dont_inherit*(或為零)則無論如何都會使用由 *flags* 引數所指定的編譯器選項和未來陳述式。如果 " +"*dont_inherit* 是一個非零整數,則使用 *flags* 引數 -- 周圍程式碼中的旗標(未來功能和編譯器選項)將被忽略。" #: ../../library/functions.rst:325 msgid "" -"Compiler options and future statements are specified by bits which can be " -"bitwise ORed together to specify multiple options. The bitfield required to " -"specify a given future feature can be found as " -"the :attr:`~__future__._Feature.compiler_flag` attribute on " -"the :class:`~__future__._Feature` instance in the :mod:`__future__` " -"module. :ref:`Compiler flags ` can be found " -"in :mod:`ast` module, with ``PyCF_`` prefix." -msgstr "" -"編譯器選項和 future 陳述式使用 bits 來表示,可以一起被位元操作 OR 來表示複數" -"個選項。需要被具體定義特徵的位元域可以透過 :mod:`__future__` module " -"中 :class:`~__future__._Feature` 實例中" -"的 :attr:`~__future__._Feature.compiler_flag` 屬性來獲得。:ref:`編譯器旗標 " -"`\\ 可以在 :mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名" -"稱。" +"Compiler options and future statements are specified by bits which can be bitwise ORed together to specify multiple " +"options. The bitfield required to specify a given future feature can be found as " +"the :attr:`~__future__._Feature.compiler_flag` attribute on the :class:`~__future__._Feature` instance in " +"the :mod:`__future__` module. :ref:`Compiler flags ` can be found in :mod:`ast` module, with " +"``PyCF_`` prefix." +msgstr "" +"編譯器選項和 future 陳述式使用 bits 來表示,可以一起被位元操作 OR 來表示複數個選項。需要被具體定義特徵的位元域可以透" +"過 :mod:`__future__` module 中 :class:`~__future__._Feature` 實例中的 :attr:`~__future__._Feature.compiler_flag` 屬性" +"來獲得。:ref:`編譯器旗標 `\\ 可以在 :mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名稱。" #: ../../library/functions.rst:333 msgid "" -"The argument *optimize* specifies the optimization level of the compiler; " -"the default value of ``-1`` selects the optimization level of the " -"interpreter as given by :option:`-O` options. Explicit levels are ``0`` (no " -"optimization; ``__debug__`` is true), ``1`` (asserts are removed, " -"``__debug__`` is false) or ``2`` (docstrings are removed too)." +"The argument *optimize* specifies the optimization level of the compiler; the default value of ``-1`` selects the " +"optimization level of the interpreter as given by :option:`-O` options. Explicit levels are ``0`` (no optimization; " +"``__debug__`` is true), ``1`` (asserts are removed, ``__debug__`` is false) or ``2`` (docstrings are removed too)." msgstr "" -"引數 *optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器" -"的 :option:`-O` 選項相同的最佳化級別。其他級別為 ``0``\\ (沒有最佳化;\\ " -"``__debug__`` 為真值)、``1``\\ (assert 被刪除,``__debug__`` 為假值)或 " -"``2``\\ (說明字串 (docstring) 也被刪除)。" +"引數 *optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器的 :option:`-O` 選項相同的最佳化級別。其他級別" +"為 ``0``\\ (沒有最佳化;\\ ``__debug__`` 為真值)、``1``\\ (assert 被刪除,``__debug__`` 為假值)或 ``2``\\ (說明" +"字串 (docstring) 也被刪除)。" #: ../../library/functions.rst:339 msgid "" -"This function raises :exc:`SyntaxError` if the compiled source is invalid, " -"and :exc:`ValueError` if the source contains null bytes." -msgstr "" -"如果編譯的原始碼無效,此函式會引發 :exc:`SyntaxError`,如果原始碼包含 null " -"bytes,則會引發 :exc:`ValueError`。" +"This function raises :exc:`SyntaxError` if the compiled source is invalid, and :exc:`ValueError` if the source " +"contains null bytes." +msgstr "如果編譯的原始碼無效,此函式會引發 :exc:`SyntaxError`,如果原始碼包含 null bytes,則會引發 :exc:`ValueError`。" #: ../../library/functions.rst:342 -msgid "" -"If you want to parse Python code into its AST representation, " -"see :func:`ast.parse`." +msgid "If you want to parse Python code into its AST representation, see :func:`ast.parse`." msgstr "如果你想解析 Python 程式碼為 AST 運算式,請參閱 :func:`ast.parse`。" #: ../../library/functions.rst:345 ../../library/functions.rst:347 msgid "" -"Raises an :ref:`auditing event ` ``compile`` with arguments " -"``source`` and ``filename``. This event may also be raised by implicit " -"compilation." +"Raises an :ref:`auditing event ` ``compile`` with arguments ``source`` and ``filename``. This event may " +"also be raised by implicit compilation." msgstr "" -"引發一個附帶引數 ``source``、``filename`` 的\\ :ref:`稽核事件 ` " -"``compile``。此事件也可能由隱式編譯 (implicit compilation) 所引發。" +"引發一個附帶引數 ``source``、``filename`` 的\\ :ref:`稽核事件 ` ``compile``。此事件也可能由隱式編譯 " +"(implicit compilation) 所引發。" #: ../../library/functions.rst:353 msgid "" -"When compiling a string with multi-line code in ``'single'`` or ``'eval'`` " -"mode, input must be terminated by at least one newline character. This is " -"to facilitate detection of incomplete and complete statements in " +"When compiling a string with multi-line code in ``'single'`` or ``'eval'`` mode, input must be terminated by at " +"least one newline character. This is to facilitate detection of incomplete and complete statements in " "the :mod:`code` module." msgstr "" -"在 ``'single'`` 或 ``'eval'`` 模式編譯多行程式碼時,輸入必須以至少一個換行符" -"結尾。這使 :mod:`code` module 更容易檢測陳述式的完整性。" +"在 ``'single'`` 或 ``'eval'`` 模式編譯多行程式碼時,輸入必須以至少一個換行符結尾。這使 :mod:`code` module 更容易檢測" +"陳述式的完整性。" #: ../../library/functions.rst:360 msgid "" -"It is possible to crash the Python interpreter with a sufficiently large/" -"complex string when compiling to an AST object due to stack depth " -"limitations in Python's AST compiler." -msgstr "" -"如果編譯足夠大或者足夠複雜的字串成 AST 物件時,Python 直譯器會因為 Python " -"AST 編譯器的 stack 深度限制而崩潰。" +"It is possible to crash the Python interpreter with a sufficiently large/complex string when compiling to an AST " +"object due to stack depth limitations in Python's AST compiler." +msgstr "如果編譯足夠大或者足夠複雜的字串成 AST 物件時,Python 直譯器會因為 Python AST 編譯器的 stack 深度限制而崩潰。" #: ../../library/functions.rst:364 msgid "" -"Allowed use of Windows and Mac newlines. Also, input in ``'exec'`` mode " -"does not have to end in a newline anymore. Added the *optimize* parameter." -msgstr "" -"允許使用 Windows 和 Mac 的換行符號。此外,在 ``'exec'`` 模式不需要以換行符號" -"結尾。增加了 *optimize* 參數。" +"Allowed use of Windows and Mac newlines. Also, input in ``'exec'`` mode does not have to end in a newline anymore. " +"Added the *optimize* parameter." +msgstr "允許使用 Windows 和 Mac 的換行符號。此外,在 ``'exec'`` 模式不需要以換行符號結尾。增加了 *optimize* 參數。" #: ../../library/functions.rst:368 -msgid "" -"Previously, :exc:`TypeError` was raised when null bytes were encountered in " -"*source*." +msgid "Previously, :exc:`TypeError` was raised when null bytes were encountered in *source*." msgstr "在之前的版本,*source* 中包含 null bytes 會引發 :exc:`TypeError`。" #: ../../library/functions.rst:372 msgid "" -"``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable " -"support for top-level ``await``, ``async for``, and ``async with``." +"``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable support for top-level ``await``, ``async " +"for``, and ``async with``." msgstr "" -"``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` 現在可以傳遞旗標以啟用對頂層 ``await``、" -"``async for`` 和 ``async with`` 的支援。" +"``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` 現在可以傳遞旗標以啟用對頂層 ``await``、``async for`` 和 ``async with`` 的支援。" #: ../../library/functions.rst:381 msgid "" -"Convert a single string or number to a complex number, or create a complex " -"number from real and imaginary parts." -msgstr "" +"Convert a single string or number to a complex number, or create a complex number from real and imaginary parts." +msgstr "將單一字串或數字轉換為複數,或從實部和虛部創建複數。" -#: ../../library/functions.rst:384 ../../library/functions.rst:752 -#: ../../library/functions.rst:998 +#: ../../library/functions.rst:384 ../../library/functions.rst:752 ../../library/functions.rst:998 msgid "Examples:" -msgstr "例如: ::" +msgstr "例如:" #: ../../library/functions.rst:386 msgid "" @@ -977,160 +864,133 @@ msgstr "" #: ../../library/functions.rst:405 msgid "" -"If the argument is a string, it must contain either a real part (in the same " -"format as for :func:`float`) or an imaginary part (in the same format but " -"with a ``'j'`` or ``'J'`` suffix), or both real and imaginary parts (the " -"sign of the imaginary part is mandatory in this case). The string can " -"optionally be surrounded by whitespaces and the round parentheses ``'('`` " -"and ``')'``, which are ignored. The string must not contain whitespace " -"between ``'+'``, ``'-'``, the ``'j'`` or ``'J'`` suffix, and the decimal " -"number. For example, ``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` " -"raises :exc:`ValueError`. More precisely, the input must conform to " -"the :token:`~float:complexvalue` production rule in the following grammar, " -"after parentheses and leading and trailing whitespace characters are removed:" -msgstr "" +"If the argument is a string, it must contain either a real part (in the same format as for :func:`float`) or an " +"imaginary part (in the same format but with a ``'j'`` or ``'J'`` suffix), or both real and imaginary parts (the sign " +"of the imaginary part is mandatory in this case). The string can optionally be surrounded by whitespaces and the " +"round parentheses ``'('`` and ``')'``, which are ignored. The string must not contain whitespace between ``'+'``, " +"``'-'``, the ``'j'`` or ``'J'`` suffix, and the decimal number. For example, ``complex('1+2j')`` is fine, but " +"``complex('1 + 2j')`` raises :exc:`ValueError`. More precisely, the input must conform to " +"the :token:`~float:complexvalue` production rule in the following grammar, after parentheses and leading and " +"trailing whitespace characters are removed:" +msgstr "" +"如果參數是字串,它必須包含實數部分 (格式與 :func:`float` 相同) 或虛數部分 (格式相同,但後綴為 ``'j'`` 或 ``'J'``) ," +"或同時包含實數部分和虛數部分 (在這種情況下,虛數部分的符號是必須的)。字串可以選擇以空白和圓括號 ``'('``和``')'``包" +"圍,這些都會被忽略。字串在``'+'``、``'-'``、``'j'``或``'J'``後綴和十進位數字之間不能包含空白。例如," +"``complex('1+2j')`` 沒有問題,但``complex('1 + 2j')``會產生 :exc:`ValueError`。更精確地說,輸入必須符合以下文法中" +"的 :token:`~float:complexvalue` 產生規則,在去除括號和前後空白字元之後:" #: ../../library/functions.rst:424 msgid "" -"If the argument is a number, the constructor serves as a numeric conversion " -"like :class:`int` and :class:`float`. For a general Python object ``x``, " -"``complex(x)`` delegates to ``x.__complex__()``. " -"If :meth:`~object.__complex__` is not defined then it falls back " -"to :meth:`~object.__float__`. If :meth:`!__float__` is not defined then it " -"falls back to :meth:`~object.__index__`." +"If the argument is a number, the constructor serves as a numeric conversion like :class:`int` and :class:`float`. " +"For a general Python object ``x``, ``complex(x)`` delegates to ``x.__complex__()``. If :meth:`~object.__complex__` " +"is not defined then it falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not defined then it falls " +"back to :meth:`~object.__index__`." msgstr "" -"如果引數是一個數字,則建構函式會像 :class:`int` 和 :class:`float` 一樣進行數" -"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 " -"``x.__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " -"back) 到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未定義,則會再回" -"退到 :meth:`~object.__index__`。" +"如果引數是一個數字,則建構函式會像 :class:`int` 和 :class:`float` 一樣進行數值轉換。對於一個普通的 Python 物件 " +"``x``,``complex(x)`` 會委派給 ``x.__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall back) " +"到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未定義,則會再回退到 :meth:`~object.__index__`。" #: ../../library/functions.rst:433 msgid "" -"If two arguments are provided or keyword arguments are used, each argument " -"may be any numeric type (including complex). If both arguments are real " -"numbers, return a complex number with the real component *real* and the " -"imaginary component *imag*. If both arguments are complex numbers, return a " -"complex number with the real component ``real.real-imag.imag`` and the " -"imaginary component ``real.imag+imag.real``. If one of arguments is a real " -"number, only its real component is used in the above expressions." +"If two arguments are provided or keyword arguments are used, each argument may be any numeric type (including " +"complex). If both arguments are real numbers, return a complex number with the real component *real* and the " +"imaginary component *imag*. If both arguments are complex numbers, return a complex number with the real component " +"``real.real-imag.imag`` and the imaginary component ``real.imag+imag.real``. If one of arguments is a real number, " +"only its real component is used in the above expressions." msgstr "" +"如果提供兩個參數或使用關鍵字參數,每個參數可以是任何數值類型 (包括複數)。如果兩個參數都是實數,則回傳一個有實數分量 " +"*real* 和 虛數分量 *imag* 的複數。如果兩個參數都是複數,則回傳一個包含實數分量`real.real-imag.imag``和 虛數分量" +"`real.imag+imag.real`的複數。如果其中一個參數是實數,則在上述表達式中只使用其實數分量。" #: ../../library/functions.rst:443 msgid "If all arguments are omitted, returns ``0j``." -msgstr "" +msgstr "如果省略所有參數,則返回 ``0j``。" #: ../../library/functions.rst:445 msgid "The complex type is described in :ref:`typesnumeric`." msgstr "複數型別在 :ref:`typesnumeric` 中有相關描述。" -#: ../../library/functions.rst:447 ../../library/functions.rst:804 -#: ../../library/functions.rst:1047 +#: ../../library/functions.rst:447 ../../library/functions.rst:804 ../../library/functions.rst:1047 msgid "Grouping digits with underscores as in code literals is allowed." msgstr "可以使用底線將程式碼文字中的數字進行分組。" #: ../../library/functions.rst:450 msgid "" -"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` " -"and :meth:`~object.__float__` are not defined." -msgstr "" -"如果 :meth:`~object.__complex__` 和 :meth:`~object.__float__` 未定義,則會回" -"退到 :meth:`~object.__index__`。" +"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :meth:`~object.__float__` are not defined." +msgstr "如果 :meth:`~object.__complex__` 和 :meth:`~object.__float__` 未定義,則會回退到 :meth:`~object.__index__`。" #: ../../library/functions.rst:457 msgid "" -"This is a relative of :func:`setattr`. The arguments are an object and a " -"string. The string must be the name of one of the object's attributes. The " -"function deletes the named attribute, provided the object allows it. For " -"example, ``delattr(x, 'foobar')`` is equivalent to ``del x.foobar``. *name* " -"need not be a Python identifier (see :func:`setattr`)." +"This is a relative of :func:`setattr`. The arguments are an object and a string. The string must be the name of " +"one of the object's attributes. The function deletes the named attribute, provided the object allows it. For " +"example, ``delattr(x, 'foobar')`` is equivalent to ``del x.foobar``. *name* need not be a Python identifier " +"(see :func:`setattr`)." msgstr "" -"這是 :func:`setattr` 相關的函式。引數是一個物件和一個字串,該字串必須是物件中" -"某個屬性名稱。如果物件允許,該函式將刪除指定的屬性。例如 ``delattr(x, " -"'foobar')`` 等價於 ``del x.foobar``。*name* 不必是個 Python 識別符 " -"(identifier)(請見 :func:`setattr`)。" +"這是 :func:`setattr` 相關的函式。引數是一個物件和一個字串,該字串必須是物件中某個屬性名稱。如果物件允許,該函式將刪除" +"指定的屬性。例如 ``delattr(x, 'foobar')`` 等價於 ``del x.foobar``。*name* 不必是個 Python 識別符 (identifier)(請" +"見 :func:`setattr`)。" #: ../../library/functions.rst:470 msgid "" -"Create a new dictionary. The :class:`dict` object is the dictionary class. " -"See :class:`dict` and :ref:`typesmapping` for documentation about this class." +"Create a new dictionary. The :class:`dict` object is the dictionary class. See :class:`dict` " +"and :ref:`typesmapping` for documentation about this class." msgstr "" -"建立一個新的 dictionary(字典)。:class:`dict` 物件是一個 dictionary class。" -"參見 :class:`dict` 和 :ref:`typesmapping` 來瞭解這個 class。" +"建立一個新的 dictionary(字典)。:class:`dict` 物件是一個 dictionary class。參見 :class:`dict` " +"和 :ref:`typesmapping` 來瞭解這個 class。" #: ../../library/functions.rst:473 msgid "" -"For other containers see the built-in :class:`list`, :class:`set`, " -"and :class:`tuple` classes, as well as the :mod:`collections` module." +"For other containers see the built-in :class:`list`, :class:`set`, and :class:`tuple` classes, as well as " +"the :mod:`collections` module." msgstr "" -"其他容器型別,請參見內建的 :class:`list`、:class:`set` 和 :class:`tuple` " -"class,以及 :mod:`collections` module。" +"其他容器型別,請參見內建的 :class:`list`、:class:`set` 和 :class:`tuple` class,以及 :mod:`collections` module。" #: ../../library/functions.rst:480 msgid "" -"Without arguments, return the list of names in the current local scope. " -"With an argument, attempt to return a list of valid attributes for that " -"object." -msgstr "" -"如果沒有引數,則回傳目前區域作用域 (local scope) 中的名稱列表。如果有引數,它" -"會嘗試回傳該物件的有效屬性列表。" +"Without arguments, return the list of names in the current local scope. With an argument, attempt to return a list " +"of valid attributes for that object." +msgstr "如果沒有引數,則回傳目前區域作用域 (local scope) 中的名稱列表。如果有引數,它會嘗試回傳該物件的有效屬性列表。" #: ../../library/functions.rst:483 msgid "" -"If the object has a method named :meth:`~object.__dir__`, this method will " -"be called and must return the list of attributes. This allows objects that " -"implement a custom :func:`~object.__getattr__` " -"or :func:`~object.__getattribute__` function to customize the " -"way :func:`dir` reports their attributes." +"If the object has a method named :meth:`~object.__dir__`, this method will be called and must return the list of " +"attributes. This allows objects that implement a custom :func:`~object.__getattr__` " +"or :func:`~object.__getattribute__` function to customize the way :func:`dir` reports their attributes." msgstr "" -"如果物件有一個名為 :meth:`~object.__dir__` 的 method,那麼該 method 將被呼" -"叫,並且必須回傳一個屬性列表。這允許實現自定義 :func:`~object.__getattr__` " -"或 :func:`~object.__getattribute__` 函式的物件能夠自定義 :func:`dir` 來報告它" -"們的屬性。" +"如果物件有一個名為 :meth:`~object.__dir__` 的 method,那麼該 method 將被呼叫,並且必須回傳一個屬性列表。這允許實現自" +"定義 :func:`~object.__getattr__` 或 :func:`~object.__getattribute__` 函式的物件能夠自定義 :func:`dir` 來報告它們的屬" +"性。" #: ../../library/functions.rst:490 msgid "" -"If the object does not provide :meth:`~object.__dir__`, the function tries " -"its best to gather information from the object's :attr:`~object.__dict__` " -"attribute, if defined, and from its type object. The resulting list is not " -"necessarily complete and may be inaccurate when the object has a " -"custom :func:`~object.__getattr__`." +"If the object does not provide :meth:`~object.__dir__`, the function tries its best to gather information from the " +"object's :attr:`~object.__dict__` attribute, if defined, and from its type object. The resulting list is not " +"necessarily complete and may be inaccurate when the object has a custom :func:`~object.__getattr__`." msgstr "" -"如果物件不提供 :meth:`~object.__dir__`,這個函式會嘗試從物件已定義" -"的 :attr:`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的," -"如果物件有自定義 :func:`~object.__getattr__`,那結果可能不準確。" +"如果物件不提供 :meth:`~object.__dir__`,這個函式會嘗試從物件已定義的 :attr:`~object.__dict__` 屬性和型別物件收集資" +"訊。結果列表並不總是完整的,如果物件有自定義 :func:`~object.__getattr__`,那結果可能不準確。" #: ../../library/functions.rst:496 msgid "" -"The default :func:`dir` mechanism behaves differently with different types " -"of objects, as it attempts to produce the most relevant, rather than " -"complete, information:" -msgstr "" -"預設的 :func:`dir` 機制對不同型別的物件有不同行為,它會試圖回傳最相關而非最完" -"整的資訊:" +"The default :func:`dir` mechanism behaves differently with different types of objects, as it attempts to produce the " +"most relevant, rather than complete, information:" +msgstr "預設的 :func:`dir` 機制對不同型別的物件有不同行為,它會試圖回傳最相關而非最完整的資訊:" #: ../../library/functions.rst:500 -msgid "" -"If the object is a module object, the list contains the names of the " -"module's attributes." +msgid "If the object is a module object, the list contains the names of the module's attributes." msgstr "如果物件是 module 物件,則列表包含 module 的屬性名稱。" #: ../../library/functions.rst:503 msgid "" -"If the object is a type or class object, the list contains the names of its " -"attributes, and recursively of the attributes of its bases." -msgstr "" -"如果物件是型別或 class 物件,則列表包含它們的屬性名稱,並且遞迴查詢其基礎的所" -"有屬性。" +"If the object is a type or class object, the list contains the names of its attributes, and recursively of the " +"attributes of its bases." +msgstr "如果物件是型別或 class 物件,則列表包含它們的屬性名稱,並且遞迴查詢其基礎的所有屬性。" #: ../../library/functions.rst:506 msgid "" -"Otherwise, the list contains the object's attributes' names, the names of " -"its class's attributes, and recursively of the attributes of its class's " -"base classes." -msgstr "" -"否則,包含物件的屬性名稱列表、它的 class 屬性名稱,並且遞迴查詢它的 class 的" -"所有基礎 class 的屬性。" +"Otherwise, the list contains the object's attributes' names, the names of its class's attributes, and recursively of " +"the attributes of its class's base classes." +msgstr "否則,包含物件的屬性名稱列表、它的 class 屬性名稱,並且遞迴查詢它的 class 的所有基礎 class 的屬性。" #: ../../library/functions.rst:510 msgid "The resulting list is sorted alphabetically. For example:" @@ -1138,47 +998,36 @@ msgstr "回傳的列表按字母表排序,例如:" #: ../../library/functions.rst:530 msgid "" -"Because :func:`dir` is supplied primarily as a convenience for use at an " -"interactive prompt, it tries to supply an interesting set of names more than " -"it tries to supply a rigorously or consistently defined set of names, and " -"its detailed behavior may change across releases. For example, metaclass " -"attributes are not in the result list when the argument is a class." +"Because :func:`dir` is supplied primarily as a convenience for use at an interactive prompt, it tries to supply an " +"interesting set of names more than it tries to supply a rigorously or consistently defined set of names, and its " +"detailed behavior may change across releases. For example, metaclass attributes are not in the result list when the " +"argument is a class." msgstr "" -"因為 :func:`dir` 主要是為了便於在互動式提示字元時使用,所以它會試圖回傳人們感" -"興趣的名稱集合,而不是試圖保證結果的嚴格性或一致性,它具體的行為也可能在不同" -"版本之間改變。例如,當引數是一個 class 時,metaclass 的屬性不包含在結果列表" -"中。" +"因為 :func:`dir` 主要是為了便於在互動式提示字元時使用,所以它會試圖回傳人們感興趣的名稱集合,而不是試圖保證結果的嚴格" +"性或一致性,它具體的行為也可能在不同版本之間改變。例如,當引數是一個 class 時,metaclass 的屬性不包含在結果列表中。" #: ../../library/functions.rst:540 msgid "" -"Take two (non-complex) numbers as arguments and return a pair of numbers " -"consisting of their quotient and remainder when using integer division. " -"With mixed operand types, the rules for binary arithmetic operators apply. " -"For integers, the result is the same as ``(a // b, a % b)``. For floating-" -"point numbers the result is ``(q, a % b)``, where *q* is usually " -"``math.floor(a / b)`` but may be 1 less than that. In any case ``q * b + a " -"% b`` is very close to *a*, if ``a % b`` is non-zero it has the same sign as " -"*b*, and ``0 <= abs(a % b) < abs(b)``." -msgstr "" -"它將兩個(非複數)數字作為引數,並在執行整數除法時回傳一對商和餘數。對於混合" -"運算元型別,適用二進位算術運算子的規則。對於整數,運算結果和 ``(a // b, a % " -"b)`` 一致。對於浮點數,運算結果是 ``(q, a % b)``,*q* 通常是 " -"``math.floor(a / b)`` 但可能會比 1 小。在任何情況下,``q * b + a % b`` 和 " -"*a* 基本相等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % " -"b) < abs(b)``。" +"Take two (non-complex) numbers as arguments and return a pair of numbers consisting of their quotient and remainder " +"when using integer division. With mixed operand types, the rules for binary arithmetic operators apply. For " +"integers, the result is the same as ``(a // b, a % b)``. For floating-point numbers the result is ``(q, a % b)``, " +"where *q* is usually ``math.floor(a / b)`` but may be 1 less than that. In any case ``q * b + a % b`` is very close " +"to *a*, if ``a % b`` is non-zero it has the same sign as *b*, and ``0 <= abs(a % b) < abs(b)``." +msgstr "" +"它將兩個(非複數)數字作為引數,並在執行整數除法時回傳一對商和餘數。對於混合運算元型別,適用二進位算術運算子的規則。" +"對於整數,運算結果和 ``(a // b, a % b)`` 一致。對於浮點數,運算結果是 ``(q, a % b)``,*q* 通常是 ``math.floor(a / " +"b)`` 但可能會比 1 小。在任何情況下,``q * b + a % b`` 和 *a* 基本相等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣," +"且 ``0 <= abs(a % b) < abs(b)``。" #: ../../library/functions.rst:552 msgid "" -"Return an enumerate object. *iterable* must be a sequence, " -"an :term:`iterator`, or some other object which supports iteration. " -"The :meth:`~iterator.__next__` method of the iterator returned " -"by :func:`enumerate` returns a tuple containing a count (from *start* which " -"defaults to 0) and the values obtained from iterating over *iterable*." +"Return an enumerate object. *iterable* must be a sequence, an :term:`iterator`, or some other object which supports " +"iteration. The :meth:`~iterator.__next__` method of the iterator returned by :func:`enumerate` returns a tuple " +"containing a count (from *start* which defaults to 0) and the values obtained from iterating over *iterable*." msgstr "" -"回傳一個列舉 (enumerate) 物件。*iterable* 必須是一個序列、:term:`iterator` 或" -"其他支援疊代的物件。:func:`enumerate` 回傳之 iterator " -"的 :meth:`~iterator.__next__` method 回傳一個 tuple(元組),裡面包含一個計數" -"值(從 *start* 開始,預設為 0)和透過疊代 *iterable* 獲得的值。" +"回傳一個列舉 (enumerate) 物件。*iterable* 必須是一個序列、:term:`iterator` 或其他支援疊代的物件。:func:`enumerate` 回" +"傳之 iterator 的 :meth:`~iterator.__next__` method 回傳一個 tuple(元組),裡面包含一個計數值(從 *start* 開始,預設" +"為 0)和透過疊代 *iterable* 獲得的值。" #: ../../library/functions.rst:564 msgid "Equivalent to::" @@ -1200,27 +1049,27 @@ msgstr "" #: ../../library/functions.rst:0 msgid "Parameters" -msgstr "" +msgstr "參數" #: ../../library/functions.rst:576 msgid "A Python expression." -msgstr "" +msgstr "一個 Python 表達式。" #: ../../library/functions.rst:580 msgid "The global namespace (default: ``None``)." -msgstr "" +msgstr "全局命名空間 (預設值: ``None``)。" #: ../../library/functions.rst:584 msgid "The local namespace (default: ``None``)." -msgstr "" +msgstr "本地命名空間 (預設:``None``)。" #: ../../library/functions.rst:0 msgid "Returns" -msgstr "" +msgstr "回傳值" #: ../../library/functions.rst:588 msgid "The result of the evaluated expression." -msgstr "" +msgstr "求值表達式的結果。" #: ../../library/functions.rst:0 msgid "raises" @@ -1228,43 +1077,33 @@ msgstr "引發" #: ../../library/functions.rst:589 msgid "Syntax errors are reported as exceptions." -msgstr "" +msgstr "語法錯誤會報告為例外。" #: ../../library/functions.rst:593 ../../library/functions.rst:654 msgid "" -"This function executes arbitrary code. Calling it with user-supplied input " -"may lead to security vulnerabilities." -msgstr "" +"This function executes arbitrary code. Calling it with user-supplied input may lead to security vulnerabilities." +msgstr "此功能會執行任意程式碼。使用使用者提供的輸入資料來呼叫它,可能會導致安全漏洞。" #: ../../library/functions.rst:596 msgid "" -"The *expression* argument is parsed and evaluated as a Python expression " -"(technically speaking, a condition list) using the *globals* and *locals* " -"mappings as global and local namespace. If the *globals* dictionary is " -"present and does not contain a value for the key ``__builtins__``, a " -"reference to the dictionary of the built-in module :mod:`builtins` is " -"inserted under that key before *expression* is parsed. That way you can " -"control what builtins are available to the executed code by inserting your " -"own ``__builtins__`` dictionary into *globals* before passing it " -"to :func:`eval`. If the *locals* mapping is omitted it defaults to the " -"*globals* dictionary. If both mappings are omitted, the expression is " -"executed with the *globals* and *locals* in the environment " -"where :func:`eval` is called. Note, *eval()* will only have access to " -"the :term:`nested scopes ` (non-locals) in the enclosing " -"environment if they are already referenced in the scope that is " -"calling :func:`eval` (e.g. via a :keyword:`nonlocal` statement)." -msgstr "" -"*expression* 引數會被視為一條 Python 運算式(技術上而言,是條件列表)來剖析及" -"求值,而 *globals* 和 *locals* 對映分別用作全域和區域命名空間。如果 " -"*globals* dictionary 存在但缺少 ``__builtins__`` 的鍵值,那 *expression* 被剖" -"析之前,將為該鍵插入對內建 :mod:`builtins` module dictionary 的引用。這麼一" -"來,在將 ``__builtins__`` dictionary 傳入 :func:`eval` 之前,你可以透過將它插" -"入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 對映被省略," -"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以" -"在 :func:`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意," -"*eval()* 在封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透" -"過 :keyword:`nonlocal` 陳述式)。" +"The *expression* argument is parsed and evaluated as a Python expression (technically speaking, a condition list) " +"using the *globals* and *locals* mappings as global and local namespace. If the *globals* dictionary is present and " +"does not contain a value for the key ``__builtins__``, a reference to the dictionary of the built-in " +"module :mod:`builtins` is inserted under that key before *expression* is parsed. That way you can control what " +"builtins are available to the executed code by inserting your own ``__builtins__`` dictionary into *globals* before " +"passing it to :func:`eval`. If the *locals* mapping is omitted it defaults to the *globals* dictionary. If both " +"mappings are omitted, the expression is executed with the *globals* and *locals* in the environment " +"where :func:`eval` is called. Note, *eval()* will only have access to the :term:`nested scopes ` (non-" +"locals) in the enclosing environment if they are already referenced in the scope that is calling :func:`eval` (e.g. " +"via a :keyword:`nonlocal` statement)." +msgstr "" +"*expression* 引數會被視為一條 Python 運算式(技術上而言,是條件列表)來剖析及求值,而 *globals* 和 *locals* 對映分別" +"用作全域和區域命名空間。如果 *globals* dictionary 存在但缺少 ``__builtins__`` 的鍵值,那 *expression* 被剖析之前,將" +"為該鍵插入對內建 :mod:`builtins` module dictionary 的引用。這麼一來,在將 ``__builtins__`` dictionary 傳" +"入 :func:`eval` 之前,你可以透過將它插入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 對映被省略,那" +"它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以在 :func:`eval` 被呼叫的環境中的 *globals* 和 *locals* " +"執行運算式。請注意,*eval()* 在封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-locals),除非" +"呼叫 :func:`eval` 的作用域已經有參照它們(例如透過 :keyword:`nonlocal` 陳述式)。" #: ../../library/functions.rst:612 msgid "Example:" @@ -1272,147 +1111,121 @@ msgstr "範例:" #: ../../library/functions.rst:618 msgid "" -"This function can also be used to execute arbitrary code objects (such as " -"those created by :func:`compile`). In this case, pass a code object instead " -"of a string. If the code object has been compiled with ``'exec'`` as the " +"This function can also be used to execute arbitrary code objects (such as those created by :func:`compile`). In " +"this case, pass a code object instead of a string. If the code object has been compiled with ``'exec'`` as the " "*mode* argument, :func:`eval`\\'s return value will be ``None``." msgstr "" -"這個函式也可以用來執行任意程式碼物件(如被 :func:`compile` 建立的那些)。這種" -"情況下,傳入的引數是程式碼物件而不是字串。如果編譯該物件時的 *mode* 引數是 " -"``'exec'``,那麼 :func:`eval` 回傳值為 ``None``。" +"這個函式也可以用來執行任意程式碼物件(如被 :func:`compile` 建立的那些)。這種情況下,傳入的引數是程式碼物件而不是字" +"串。如果編譯該物件時的 *mode* 引數是 ``'exec'``,那麼 :func:`eval` 回傳值為 ``None``。" #: ../../library/functions.rst:623 msgid "" -"Hints: dynamic execution of statements is supported by the :func:`exec` " -"function. The :func:`globals` and :func:`locals` functions return the " -"current global and local dictionary, respectively, which may be useful to " +"Hints: dynamic execution of statements is supported by the :func:`exec` function. The :func:`globals` " +"and :func:`locals` functions return the current global and local dictionary, respectively, which may be useful to " "pass around for use by :func:`eval` or :func:`exec`." msgstr "" -"提示::func:`exec` 函式支援動態執行陳述式。:func:`globals` 和 :func:`locals` " -"函式分別回傳目前的全域性和局部性 dictionary,它們對於將引數傳遞" -"給 :func:`eval` 或 :func:`exec` 可能會方便許多。" +"提示::func:`exec` 函式支援動態執行陳述式。:func:`globals` 和 :func:`locals` 函式分別回傳目前的全域性和局部性 " +"dictionary,它們對於將引數傳遞給 :func:`eval` 或 :func:`exec` 可能會方便許多。" #: ../../library/functions.rst:628 -msgid "" -"If the given source is a string, then leading and trailing spaces and tabs " -"are stripped." +msgid "If the given source is a string, then leading and trailing spaces and tabs are stripped." msgstr "如果給定來源是一個字串,那麼其前後的空格和定位字元會被移除。" #: ../../library/functions.rst:631 msgid "" -"See :func:`ast.literal_eval` for a function that can safely evaluate strings " -"with expressions containing only literals." -msgstr "" -"另外可以參閱 :func:`ast.literal_eval`,該函式可以安全執行僅包含文字的運算式字" -"串。" +"See :func:`ast.literal_eval` for a function that can safely evaluate strings with expressions containing only " +"literals." +msgstr "另外可以參閱 :func:`ast.literal_eval`,該函式可以安全執行僅包含文字的運算式字串。" -#: ../../library/functions.rst:634 ../../library/functions.rst:636 -#: ../../library/functions.rst:696 ../../library/functions.rst:698 +#: ../../library/functions.rst:634 ../../library/functions.rst:636 ../../library/functions.rst:696 +#: ../../library/functions.rst:698 msgid "" -"Raises an :ref:`auditing event ` ``exec`` with the code object as " -"the argument. Code compilation events may also be raised." -msgstr "" -"引發一個附帶程式碼物件為引數的\\ :ref:`稽核事件 ` ``exec``。也可能" -"會引發程式碼編譯事件。" +"Raises an :ref:`auditing event ` ``exec`` with the code object as the argument. Code compilation events " +"may also be raised." +msgstr "引發一個附帶程式碼物件為引數的\\ :ref:`稽核事件 ` ``exec``。也可能會引發程式碼編譯事件。" #: ../../library/functions.rst:641 ../../library/functions.rst:718 msgid "The *globals* and *locals* arguments can now be passed as keywords." -msgstr "" +msgstr "*globals* 和 *locals* 參數現在可以作為關鍵字傳送。" #: ../../library/functions.rst:645 ../../library/functions.rst:722 -msgid "" -"The semantics of the default *locals* namespace have been adjusted as " -"described for the :func:`locals` builtin." -msgstr "" +msgid "The semantics of the default *locals* namespace have been adjusted as described for the :func:`locals` builtin." +msgstr "如 :func:`locals` 內建物件所述,已調整預設 *locals* 命名空間的語意。" #: ../../library/functions.rst:657 msgid "" -"This function supports dynamic execution of Python code. *source* must be " -"either a string or a code object. If it is a string, the string is parsed " -"as a suite of Python statements which is then executed (unless a syntax " -"error occurs). [#]_ If it is a code object, it is simply executed. In all " -"cases, the code that's executed is expected to be valid as file input (see " -"the section :ref:`file-input` in the Reference Manual). Be aware that " -"the :keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements " -"may not be used outside of function definitions even within the context of " -"code passed to the :func:`exec` function. The return value is ``None``." -msgstr "" -"這個函式支援動態執行 Python 程式碼。*source* 必須是字串或者程式碼物件。如果是" -"字串,那麼該字串將被剖析為一系列 Python 陳述式並執行(除非發生語法錯誤)。" -"[#]_ 如果是程式碼物件,它將被直接執行。無論哪種情況,被執行的程式碼都需要和檔" -"案輸入一樣是有效的(可參閱語言參考手冊中關於\\ :ref:`file-input`\\ 的章節)。" -"請注意,即使在傳遞給 :func:`exec` 函式的程式碼的上下文" -"中,:keyword:`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在" -"函式之外使用。該函式回傳值是 ``None``。" +"This function supports dynamic execution of Python code. *source* must be either a string or a code object. If it " +"is a string, the string is parsed as a suite of Python statements which is then executed (unless a syntax error " +"occurs). [#]_ If it is a code object, it is simply executed. In all cases, the code that's executed is expected to " +"be valid as file input (see the section :ref:`file-input` in the Reference Manual). Be aware that " +"the :keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements may not be used outside of function " +"definitions even within the context of code passed to the :func:`exec` function. The return value is ``None``." +msgstr "" +"這個函式支援動態執行 Python 程式碼。*source* 必須是字串或者程式碼物件。如果是字串,那麼該字串將被剖析為一系列 Python " +"陳述式並執行(除非發生語法錯誤)。[#]_ 如果是程式碼物件,它將被直接執行。無論哪種情況,被執行的程式碼都需要和檔案輸入" +"一樣是有效的(可參閱語言參考手冊中關於\\ :ref:`file-input`\\ 的章節)。請注意,即使在傳遞給 :func:`exec` 函式的程式碼" +"的上下文中,:keyword:`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使用。該函式回傳值是 " +"``None``。" #: ../../library/functions.rst:668 msgid "" -"In all cases, if the optional parts are omitted, the code is executed in the " -"current scope. If only *globals* is provided, it must be a dictionary (and " -"not a subclass of dictionary), which will be used for both the global and " -"the local variables. If *globals* and *locals* are given, they are used for " -"the global and local variables, respectively. If provided, *locals* can be " -"any mapping object. Remember that at the module level, globals and locals " -"are the same dictionary." +"In all cases, if the optional parts are omitted, the code is executed in the current scope. If only *globals* is " +"provided, it must be a dictionary (and not a subclass of dictionary), which will be used for both the global and the " +"local variables. If *globals* and *locals* are given, they are used for the global and local variables, " +"respectively. If provided, *locals* can be any mapping object. Remember that at the module level, globals and " +"locals are the same dictionary." msgstr "" -"無論哪種情況,如果省略了選擇性的部分,程式碼將在目前作用域內執行。如果只提供" -"了 *globals* 引數,就必須是 dictionary 型別(且不能是 dictionary 的子類別)," -"而且會被用作全域和區域變數。如果同時提供了 *globals* 和 *locals*,它們分別被" -"用作全域和區域變數。如果提供了 *locals*,則它可以是任何對映物件。請記住在 " -"module 層級中全域和區域變數是相同的 dictionary。" +"無論哪種情況,如果省略了選擇性的部分,程式碼將在目前作用域內執行。如果只提供了 *globals* 引數,就必須是 dictionary 型" +"別(且不能是 dictionary 的子類別),而且會被用作全域和區域變數。如果同時提供了 *globals* 和 *locals*,它們分別被用作" +"全域和區域變數。如果提供了 *locals*,則它可以是任何對映物件。請記住在 module 層級中全域和區域變數是相同的 " +"dictionary。" #: ../../library/functions.rst:678 msgid "" -"When ``exec`` gets two separate objects as *globals* and *locals*, the code " -"will be executed as if it were embedded in a class definition. This means " -"functions and classes defined in the executed code will not be able to " -"access variables assigned at the top level (as the \"top level\" variables " -"are treated as class variables in a class definition)." +"When ``exec`` gets two separate objects as *globals* and *locals*, the code will be executed as if it were embedded " +"in a class definition. This means functions and classes defined in the executed code will not be able to access " +"variables assigned at the top level (as the \"top level\" variables are treated as class variables in a class " +"definition)." msgstr "" +"當 ``exec`` 得到兩個獨立的物件作為 *globals* 和 *locals*,程式碼會被執行,就像它被嵌入在類別定義中一樣。這表示在執行" +"的程式碼中定義的函數和類別將無法存取在頂層指定的變數 (因為在類別定義中,「頂層」變數被視為類別變數)。" #: ../../library/functions.rst:684 msgid "" -"If the *globals* dictionary does not contain a value for the key " -"``__builtins__``, a reference to the dictionary of the built-in " -"module :mod:`builtins` is inserted under that key. That way you can control " -"what builtins are available to the executed code by inserting your own " -"``__builtins__`` dictionary into *globals* before passing it to :func:`exec`." +"If the *globals* dictionary does not contain a value for the key ``__builtins__``, a reference to the dictionary of " +"the built-in module :mod:`builtins` is inserted under that key. That way you can control what builtins are " +"available to the executed code by inserting your own ``__builtins__`` dictionary into *globals* before passing it " +"to :func:`exec`." msgstr "" -"如果 *globals* dictionary 不包含 ``__builtins__`` 鍵值,則將為該鍵插入對內" -"建 :mod:`builtins` module dictionary 的引用。這麼一來,在將 ``__builtins__`` " -"dictionary 傳入 :func:`exec` 之前,你可以透過將它插入 *globals* 來控制你需要" -"哪些內建函式來執行程式碼。" +"如果 *globals* dictionary 不包含 ``__builtins__`` 鍵值,則將為該鍵插入對內建 :mod:`builtins` module dictionary 的引" +"用。這麼一來,在將 ``__builtins__`` dictionary 傳入 :func:`exec` 之前,你可以透過將它插入 *globals* 來控制你需要哪些" +"內建函式來執行程式碼。" #: ../../library/functions.rst:690 msgid "" -"The *closure* argument specifies a closure--a tuple of cellvars. It's only " -"valid when the *object* is a code object containing :term:`free (closure) " -"variables `. The length of the tuple must exactly match " -"the length of the code object's :attr:`~codeobject.co_freevars` attribute." +"The *closure* argument specifies a closure--a tuple of cellvars. It's only valid when the *object* is a code object " +"containing :term:`free (closure) variables `. The length of the tuple must exactly match the " +"length of the code object's :attr:`~codeobject.co_freevars` attribute." msgstr "" -"*closure* 引數會指定一個閉包 (closure) — 它是一個 cellvar(格變數)的 tuple。" -"只有在 *object* 是一個含有\\ :term:`自由(閉包)變數 (free (closure) " -"variables) ` 的程式碼物件時,它才有效。Tuple 的長度必須與程" -"式碼物件的 :attr:`~codeobject.co_freevars` 屬性完全匹配。" +"*closure* 引數會指定一個閉包 (closure) — 它是一個 cellvar(格變數)的 tuple。只有在 *object* 是一個含有\\ :term:`自由" +"(閉包)變數 (free (closure) variables) ` 的程式碼物件時,它才有效。Tuple 的長度必須與程式碼物件" +"的 :attr:`~codeobject.co_freevars` 屬性完全匹配。" #: ../../library/functions.rst:703 msgid "" -"The built-in functions :func:`globals` and :func:`locals` return the current " -"global and local namespace, respectively, which may be useful to pass around " -"for use as the second and third argument to :func:`exec`." +"The built-in functions :func:`globals` and :func:`locals` return the current global and local namespace, " +"respectively, which may be useful to pass around for use as the second and third argument to :func:`exec`." msgstr "" -"內建 :func:`globals` 和 :func:`locals` 函式各自回傳目前的全域和區域命名空間," -"因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數以供後續使用。" +"內建 :func:`globals` 和 :func:`locals` 函式各自回傳目前的全域和區域命名空間,因此可以將它們傳遞給 :func:`exec` 的第二" +"個和第三個引數以供後續使用。" #: ../../library/functions.rst:709 msgid "" -"The default *locals* act as described for function :func:`locals` below. " -"Pass an explicit *locals* dictionary if you need to see effects of the code " -"on *locals* after function :func:`exec` returns." +"The default *locals* act as described for function :func:`locals` below. Pass an explicit *locals* dictionary if you " +"need to see effects of the code on *locals* after function :func:`exec` returns." msgstr "" -"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想" -"在 :func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 " -"*locals* dictionary 。" +"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想在 :func:`exec` 函式回傳時知道程式碼對 " +"*locals* 的變動,請明確地傳遞 *locals* dictionary 。" #: ../../library/functions.rst:713 msgid "Added the *closure* parameter." @@ -1420,34 +1233,27 @@ msgstr "增加了 *closure* 參數。" #: ../../library/functions.rst:728 msgid "" -"Construct an iterator from those elements of *iterable* for which *function* " -"is true. *iterable* may be either a sequence, a container which supports " -"iteration, or an iterator. If *function* is ``None``, the identity function " -"is assumed, that is, all elements of *iterable* that are false are removed." +"Construct an iterator from those elements of *iterable* for which *function* is true. *iterable* may be either a " +"sequence, a container which supports iteration, or an iterator. If *function* is ``None``, the identity function is " +"assumed, that is, all elements of *iterable* that are false are removed." msgstr "" -"用 *iterable* 中函式 *function* 為 True 的那些元素,構建一個新的 iterator。" -"*iterable* 可以是一個序列、一個支援疊代的容器、或一個 iterator。如果 " -"*function* 是 ``None``,則會假設它是一個識別性函式,即 *iterable* 中所有假值" -"元素會被移除。" +"用 *iterable* 中函式 *function* 為 True 的那些元素,構建一個新的 iterator。*iterable* 可以是一個序列、一個支援疊代的" +"容器、或一個 iterator。如果 *function* 是 ``None``,則會假設它是一個識別性函式,即 *iterable* 中所有假值元素會被移" +"除。" #: ../../library/functions.rst:734 msgid "" -"Note that ``filter(function, iterable)`` is equivalent to the generator " -"expression ``(item for item in iterable if function(item))`` if function is " -"not ``None`` and ``(item for item in iterable if item)`` if function is " -"``None``." +"Note that ``filter(function, iterable)`` is equivalent to the generator expression ``(item for item in iterable if " +"function(item))`` if function is not ``None`` and ``(item for item in iterable if item)`` if function is ``None``." msgstr "" -"請注意,``filter(function, iterable)`` 相當於一個生成器運算式,當 function 不" -"是 ``None`` 的時候為 ``(item for item in iterable if function(item))``;" -"function 是 ``None`` 的時候為 ``(item for item in iterable if item)``。" +"請注意,``filter(function, iterable)`` 相當於一個生成器運算式,當 function 不是 ``None`` 的時候為 ``(item for item " +"in iterable if function(item))``;function 是 ``None`` 的時候為 ``(item for item in iterable if item)``。" #: ../../library/functions.rst:739 msgid "" -"See :func:`itertools.filterfalse` for the complementary function that " -"returns elements of *iterable* for which *function* is false." -msgstr "" -"請參閱 :func:`itertools.filterfalse`,只有 *function* 為 false 時才選取 " -"*iterable* 中元素的互補函式。" +"See :func:`itertools.filterfalse` for the complementary function that returns elements of *iterable* for which " +"*function* is false." +msgstr "請參閱 :func:`itertools.filterfalse`,只有 *function* 為 false 時才選取 *iterable* 中元素的互補函式。" #: ../../library/functions.rst:750 msgid "Return a floating-point number constructed from a number or a string." @@ -1479,45 +1285,38 @@ msgstr "" #: ../../library/functions.rst:767 msgid "" -"If the argument is a string, it should contain a decimal number, optionally " -"preceded by a sign, and optionally embedded in whitespace. The optional " -"sign may be ``'+'`` or ``'-'``; a ``'+'`` sign has no effect on the value " -"produced. The argument may also be a string representing a NaN (not-a-" -"number), or positive or negative infinity. More precisely, the input must " -"conform to the :token:`~float:floatvalue` production rule in the following " -"grammar, after leading and trailing whitespace characters are removed:" +"If the argument is a string, it should contain a decimal number, optionally preceded by a sign, and optionally " +"embedded in whitespace. The optional sign may be ``'+'`` or ``'-'``; a ``'+'`` sign has no effect on the value " +"produced. The argument may also be a string representing a NaN (not-a-number), or positive or negative infinity. " +"More precisely, the input must conform to the :token:`~float:floatvalue` production rule in the following grammar, " +"after leading and trailing whitespace characters are removed:" msgstr "" -"如果引數是字串,則它必須是包含十進位制數字的字串,字串前面可以有符號,之前也" -"可以有空格。選擇性的符號有 ``'+'`` 和 ``'-'``;``'+'`` 對建立的值沒有影響。引" -"數也可以是 NaN(非數字)或正負無窮大的字串。確切地說,除去首尾的空格後,輸入" -"必須遵循以下語法中 :token:`~float:floatvalue` 的生成規則:" +"如果引數是字串,則它必須是包含十進位制數字的字串,字串前面可以有符號,之前也可以有空格。選擇性的符號有 ``'+'`` 和 " +"``'-'``;``'+'`` 對建立的值沒有影響。引數也可以是 NaN(非數字)或正負無窮大的字串。確切地說,除去首尾的空格後,輸入必" +"須遵循以下語法中 :token:`~float:floatvalue` 的生成規則:" #: ../../library/functions.rst:788 msgid "" -"Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", " -"and \"iNfINity\" are all acceptable spellings for positive infinity." -msgstr "" -"字母大小寫不影響,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表" -"示正無窮大。" +"Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", and \"iNfINity\" are all acceptable " +"spellings for positive infinity." +msgstr "字母大小寫不影響,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表示正無窮大。" #: ../../library/functions.rst:791 msgid "" -"Otherwise, if the argument is an integer or a floating-point number, a " -"floating-point number with the same value (within Python's floating-point " -"precision) is returned. If the argument is outside the range of a Python " -"float, an :exc:`OverflowError` will be raised." +"Otherwise, if the argument is an integer or a floating-point number, a floating-point number with the same value " +"(within Python's floating-point precision) is returned. If the argument is outside the range of a Python float, " +"an :exc:`OverflowError` will be raised." msgstr "" -"否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的" -"浮點數。如果引數在 Python 浮點精度範圍外,則會引發 :exc:`OverflowError`。" +"否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的浮點數。如果引數在 Python 浮點精度範圍" +"外,則會引發 :exc:`OverflowError`。" #: ../../library/functions.rst:796 msgid "" -"For a general Python object ``x``, ``float(x)`` delegates to " -"``x.__float__()``. If :meth:`~object.__float__` is not defined then it " -"falls back to :meth:`~object.__index__`." +"For a general Python object ``x``, ``float(x)`` delegates to ``x.__float__()``. If :meth:`~object.__float__` is not " +"defined then it falls back to :meth:`~object.__index__`." msgstr "" -"對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" -"定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" +"對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未定義 :meth:`~object.__float__` 則會回退" +"到 :meth:`~object.__index__`。" #: ../../library/functions.rst:800 msgid "If no argument is given, ``0.0`` is returned." @@ -1528,239 +1327,182 @@ msgid "The float type is described in :ref:`typesnumeric`." msgstr ":ref:`typesnumeric` 描述了浮點數型別。" #: ../../library/functions.rst:810 -msgid "" -"Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not " -"defined." -msgstr "" -"如果 :meth:`~object.__float__` 未定義,則會回退到 :meth:`~object.__index__`。" +msgid "Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not defined." +msgstr "如果 :meth:`~object.__float__` 未定義,則會回退到 :meth:`~object.__index__`。" #: ../../library/functions.rst:820 msgid "" -"Convert a *value* to a \"formatted\" representation, as controlled by " -"*format_spec*. The interpretation of *format_spec* will depend on the type " -"of the *value* argument; however, there is a standard formatting syntax that " +"Convert a *value* to a \"formatted\" representation, as controlled by *format_spec*. The interpretation of " +"*format_spec* will depend on the type of the *value* argument; however, there is a standard formatting syntax that " "is used by most built-in types: :ref:`formatspec`." msgstr "" -"將 *value* 轉換為 *format_spec* 控制的 \"格式化\" 表示。*format_spec* 的解釋" -"取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語" -"法::ref:`formatspec`。" +"將 *value* 轉換為 *format_spec* 控制的 \"格式化\" 表示。*format_spec* 的解釋取決於 *value* 引數的型別,但是大多數內建" +"型別使用標準格式化語法::ref:`formatspec`。" #: ../../library/functions.rst:825 msgid "" -"The default *format_spec* is an empty string which usually gives the same " -"effect as calling :func:`str(value) `." -msgstr "" -"預設的 *format_spec* 是一個空字串,它通常和呼叫 :func:`str(value) ` 的效" -"果相同。" +"The default *format_spec* is an empty string which usually gives the same effect as calling :func:`str(value) `." +msgstr "預設的 *format_spec* 是一個空字串,它通常和呼叫 :func:`str(value) ` 的效果相同。" #: ../../library/functions.rst:828 msgid "" -"A call to ``format(value, format_spec)`` is translated to " -"``type(value).__format__(value, format_spec)`` which bypasses the instance " -"dictionary when searching for the value's :meth:`~object.__format__` method. " -"A :exc:`TypeError` exception is raised if the method search " -"reaches :mod:`object` and the *format_spec* is non-empty, or if either the " -"*format_spec* or the return value are not strings." +"A call to ``format(value, format_spec)`` is translated to ``type(value).__format__(value, format_spec)`` which " +"bypasses the instance dictionary when searching for the value's :meth:`~object.__format__` method. " +"A :exc:`TypeError` exception is raised if the method search reaches :mod:`object` and the *format_spec* is non-" +"empty, or if either the *format_spec* or the return value are not strings." msgstr "" -"呼叫 ``format(value, format_spec)`` 會轉換成 ``type(value).__format__(value, " -"format_spec)``,當搜尋 value 的 :meth:`~object.__format__` method 時,會忽略" -"實例中的字典。如果搜尋到 :mod:`object` 這個 method 但 *format_spec* 不為空," -"或是 *format_spec* 或回傳值不是字串,則會引發 :exc:`TypeError`。" +"呼叫 ``format(value, format_spec)`` 會轉換成 ``type(value).__format__(value, format_spec)``,當搜尋 value " +"的 :meth:`~object.__format__` method 時,會忽略實例中的字典。如果搜尋到 :mod:`object` 這個 method 但 *format_spec* 不" +"為空,或是 *format_spec* 或回傳值不是字串,則會引發 :exc:`TypeError`。" #: ../../library/functions.rst:835 -msgid "" -"``object().__format__(format_spec)`` raises :exc:`TypeError` if " -"*format_spec* is not an empty string." -msgstr "" -"當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引" -"發 :exc:`TypeError`。" +msgid "``object().__format__(format_spec)`` raises :exc:`TypeError` if *format_spec* is not an empty string." +msgstr "當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :exc:`TypeError`。" #: ../../library/functions.rst:844 msgid "" -"Return a new :class:`frozenset` object, optionally with elements taken from " -"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` " -"and :ref:`types-set` for documentation about this class." +"Return a new :class:`frozenset` object, optionally with elements taken from *iterable*. ``frozenset`` is a built-in " +"class. See :class:`frozenset` and :ref:`types-set` for documentation about this class." msgstr "" -"回傳一個新的 :class:`frozenset` 物件,它包含選擇性引數 *iterable* 中的元素。" -"``frozenset`` 是一個內建的 class。有關此 class 的文件,請參" -"閱 :class:`frozenset` 和 :ref:`types-set`。" +"回傳一個新的 :class:`frozenset` 物件,它包含選擇性引數 *iterable* 中的元素。``frozenset`` 是一個內建的 class。有關此 " +"class 的文件,請參閱 :class:`frozenset` 和 :ref:`types-set`。" #: ../../library/functions.rst:848 msgid "" -"For other containers see the built-" -"in :class:`set`, :class:`list`, :class:`tuple`, and :class:`dict` classes, " -"as well as the :mod:`collections` module." +"For other containers see the built-in :class:`set`, :class:`list`, :class:`tuple`, and :class:`dict` classes, as " +"well as the :mod:`collections` module." msgstr "" -"請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " -"class,以及 :mod:`collections` module 來了解其它的容器。" +"請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` class,以及 :mod:`collections` module 來了" +"解其它的容器。" #: ../../library/functions.rst:856 msgid "" -"Return the value of the named attribute of *object*. *name* must be a " -"string. If the string is the name of one of the object's attributes, the " -"result is the value of that attribute. For example, ``getattr(x, " -"'foobar')`` is equivalent to ``x.foobar``. If the named attribute does not " -"exist, *default* is returned if provided, otherwise :exc:`AttributeError` is " -"raised. *name* need not be a Python identifier (see :func:`setattr`)." -msgstr "" -"回傳 *object* 之具名屬性的值。*name* 必須是字串。如果該字串是物件屬性之一的名" -"稱,則回傳該屬性的值。例如,``getattr(x, 'foobar')`` 等同於 ``x.foobar``。如" -"果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則引" -"發 :exc:`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請" -"見 :func:`setattr`)。" +"Return the value of the named attribute of *object*. *name* must be a string. If the string is the name of one of " +"the object's attributes, the result is the value of that attribute. For example, ``getattr(x, 'foobar')`` is " +"equivalent to ``x.foobar``. If the named attribute does not exist, *default* is returned if provided, " +"otherwise :exc:`AttributeError` is raised. *name* need not be a Python identifier (see :func:`setattr`)." +msgstr "" +"回傳 *object* 之具名屬性的值。*name* 必須是字串。如果該字串是物件屬性之一的名稱,則回傳該屬性的值。例如," +"``getattr(x, 'foobar')`` 等同於 ``x.foobar``。如果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則引" +"發 :exc:`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:`setattr`)。" #: ../../library/functions.rst:865 msgid "" -"Since :ref:`private name mangling ` happens at " -"compilation time, one must manually mangle a private attribute's (attributes " -"with two leading underscores) name in order to retrieve it " -"with :func:`getattr`." +"Since :ref:`private name mangling ` happens at compilation time, one must manually mangle a " +"private attribute's (attributes with two leading underscores) name in order to retrieve it with :func:`getattr`." msgstr "" -"由於\\ :ref:`私有名稱改編 (private name mangling) ` 是" -"發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" -"使用 :func:`getattr` 來取得它。" +"由於\\ :ref:`私有名稱改編 (private name mangling) ` 是發生在編譯期,因此你必須手動改編私有屬性" +"(有兩個前導底線的屬性)的名稱,才能使用 :func:`getattr` 來取得它。" #: ../../library/functions.rst:873 msgid "" -"Return the dictionary implementing the current module namespace. For code " -"within functions, this is set when the function is defined and remains the " -"same regardless of where the function is called." +"Return the dictionary implementing the current module namespace. For code within functions, this is set when the " +"function is defined and remains the same regardless of where the function is called." msgstr "" -"回傳代表目前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" -"函式時設定且不論該函式是在何處呼叫都會保持相同。" +"回傳代表目前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義函式時設定且不論該函式是在何處呼叫都會保" +"持相同。" #: ../../library/functions.rst:880 msgid "" -"The arguments are an object and a string. The result is ``True`` if the " -"string is the name of one of the object's attributes, ``False`` if not. " -"(This is implemented by calling ``getattr(object, name)`` and seeing whether " -"it raises an :exc:`AttributeError` or not.)" +"The arguments are an object and a string. The result is ``True`` if the string is the name of one of the object's " +"attributes, ``False`` if not. (This is implemented by calling ``getattr(object, name)`` and seeing whether it raises " +"an :exc:`AttributeError` or not.)" msgstr "" -"該引數是一個物件和一個字串。如果字串是物件屬性之一的名稱,則回傳 ``True``,否" -"則回傳 ``False``。(此功能是透過呼叫 ``getattr(object, name)`` 並檢查是否引" -"發 :exc:`AttributeError` 來實作的。)" +"該引數是一個物件和一個字串。如果字串是物件屬性之一的名稱,則回傳 ``True``,否則回傳 ``False``。(此功能是透過呼叫 " +"``getattr(object, name)`` 並檢查是否引發 :exc:`AttributeError` 來實作的。)" #: ../../library/functions.rst:888 msgid "" -"Return the hash value of the object (if it has one). Hash values are " -"integers. They are used to quickly compare dictionary keys during a " -"dictionary lookup. Numeric values that compare equal have the same hash " -"value (even if they are of different types, as is the case for 1 and 1.0)." +"Return the hash value of the object (if it has one). Hash values are integers. They are used to quickly compare " +"dictionary keys during a dictionary lookup. Numeric values that compare equal have the same hash value (even if " +"they are of different types, as is the case for 1 and 1.0)." msgstr "" -"回傳該物件的雜湊值(如果它有的話)。雜湊值是整數。它們在 dictionary 查詢元素" -"時用來快速比較 dictionary 的鍵。相同大小的數字數值有相同的雜湊值(即使它們型" -"別不同,如 1 和 1.0)。" +"回傳該物件的雜湊值(如果它有的話)。雜湊值是整數。它們在 dictionary 查詢元素時用來快速比較 dictionary 的鍵。相同大小" +"的數字數值有相同的雜湊值(即使它們型別不同,如 1 和 1.0)。" #: ../../library/functions.rst:895 msgid "" -"For objects with custom :meth:`~object.__hash__` methods, note " -"that :func:`hash` truncates the return value based on the bit width of the " -"host machine." -msgstr "" -"請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" -"運行機器的位元長度來截斷回傳值。" +"For objects with custom :meth:`~object.__hash__` methods, note that :func:`hash` truncates the return value based on " +"the bit width of the host machine." +msgstr "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據運行機器的位元長度來截斷回傳值。" #: ../../library/functions.rst:902 msgid "" -"Invoke the built-in help system. (This function is intended for interactive " -"use.) If no argument is given, the interactive help system starts on the " -"interpreter console. If the argument is a string, then the string is looked " -"up as the name of a module, function, class, method, keyword, or " -"documentation topic, and a help page is printed on the console. If the " -"argument is any other kind of object, a help page on the object is generated." +"Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the " +"interactive help system starts on the interpreter console. If the argument is a string, then the string is looked " +"up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on " +"the console. If the argument is any other kind of object, a help page on the object is generated." msgstr "" -"啟動內建的幫助系統(此函式主要以互動式使用)。如果沒有引數,直譯器控制台裡會" -"啟動互動式幫助系統。如果引數是一個字串,則會在 module、函式、class、method、" -"關鍵字或說明文件主題中搜尋該字串,並在控制台上列印幫助資訊。如果引數是其他任" -"意物件,則會生成該物件的幫助頁。" +"啟動內建的幫助系統(此函式主要以互動式使用)。如果沒有引數,直譯器控制台裡會啟動互動式幫助系統。如果引數是一個字串," +"則會在 module、函式、class、method、關鍵字或說明文件主題中搜尋該字串,並在控制台上列印幫助資訊。如果引數是其他任意物" +"件,則會生成該物件的幫助頁。" #: ../../library/functions.rst:909 msgid "" -"Note that if a slash(/) appears in the parameter list of a function when " -"invoking :func:`help`, it means that the parameters prior to the slash are " -"positional-only. For more info, see :ref:`the FAQ entry on positional-only " +"Note that if a slash(/) appears in the parameter list of a function when invoking :func:`help`, it means that the " +"parameters prior to the slash are positional-only. For more info, see :ref:`the FAQ entry on positional-only " "parameters `." msgstr "" -"請注意,呼叫 :func:`help` 時,如果斜線 (/) 出現在函式的參數列表中,這表示斜線" -"前面的參數是僅限位置 (positional-only) 參數。有關更多資訊,請參閱\\ :ref:`常" -"見問答集中的僅限位置參數條目 `。" +"請注意,呼叫 :func:`help` 時,如果斜線 (/) 出現在函式的參數列表中,這表示斜線前面的參數是僅限位置 (positional-only) " +"參數。有關更多資訊,請參閱\\ :ref:`常見問答集中的僅限位置參數條目 `。" #: ../../library/functions.rst:914 -msgid "" -"This function is added to the built-in namespace by the :mod:`site` module." +msgid "This function is added to the built-in namespace by the :mod:`site` module." msgstr "此函式會被 :mod:`site` module 加入到內建命名空間。" #: ../../library/functions.rst:916 msgid "" -"Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " -"for callables are now more comprehensive and consistent." -msgstr "" -"對於 :mod:`pydoc` 和 :mod:`inspect` 的變更,使得可呼叫物件回報的的簽名 " -"(signature) 更加全面和一致。" +"Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures for callables are now more " +"comprehensive and consistent." +msgstr "對於 :mod:`pydoc` 和 :mod:`inspect` 的變更,使得可呼叫物件回報的的簽名 (signature) 更加全面和一致。" #: ../../library/functions.rst:923 msgid "" -"Convert an integer number to a lowercase hexadecimal string prefixed with " -"\"0x\". If *x* is not a Python :class:`int` object, it has to define " -"an :meth:`~object.__index__` method that returns an integer. Some examples:" +"Convert an integer number to a lowercase hexadecimal string prefixed with \"0x\". If *x* is not a " +"Python :class:`int` object, it has to define an :meth:`~object.__index__` method that returns an integer. Some " +"examples:" msgstr "" -"將整數轉換為以 \"0x\" 為前綴的小寫十六進位制字串。如果 *x* 不是 " -"Python :class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並" -"且回傳一個整數。舉例來說:" +"將整數轉換為以 \"0x\" 為前綴的小寫十六進位制字串。如果 *x* 不是 Python :class:`int` 物件,則必須定義一" +"個 :meth:`~object.__index__` method 並且回傳一個整數。舉例來說:" #: ../../library/functions.rst:932 msgid "" -"If you want to convert an integer number to an uppercase or lower " -"hexadecimal string with prefix or not, you can use either of the following " -"ways:" -msgstr "" -"如果要將整數轉換為大寫或小寫的十六進位制字串,並可選擇有無 \"0x\" 前綴,則可" -"以使用如下方法:" +"If you want to convert an integer number to an uppercase or lower hexadecimal string with prefix or not, you can use " +"either of the following ways:" +msgstr "如果要將整數轉換為大寫或小寫的十六進位制字串,並可選擇有無 \"0x\" 前綴,則可以使用如下方法:" #: ../../library/functions.rst:944 -msgid "" -"See also :func:`int` for converting a hexadecimal string to an integer using " -"a base of 16." +msgid "See also :func:`int` for converting a hexadecimal string to an integer using a base of 16." msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基數的整數。" #: ../../library/functions.rst:949 -msgid "" -"To obtain a hexadecimal string representation for a float, use " -"the :meth:`float.hex` method." -msgstr "" -"如果要取得浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" +msgid "To obtain a hexadecimal string representation for a float, use the :meth:`float.hex` method." +msgstr "如果要取得浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" #: ../../library/functions.rst:955 msgid "" -"Return the \"identity\" of an object. This is an integer which is " -"guaranteed to be unique and constant for this object during its lifetime. " -"Two objects with non-overlapping lifetimes may have the same :func:`id` " -"value." +"Return the \"identity\" of an object. This is an integer which is guaranteed to be unique and constant for this " +"object during its lifetime. Two objects with non-overlapping lifetimes may have the same :func:`id` value." msgstr "" -"回傳物件的 \"識別性\" 。該值是一個整數,在此物件的生命週期中保證是唯一且恆定" -"的。兩個生命期不重疊的物件可能具有相同的 :func:`id` 值。" +"回傳物件的 \"識別性\" 。該值是一個整數,在此物件的生命週期中保證是唯一且恆定的。兩個生命期不重疊的物件可能具有相同" +"的 :func:`id` 值。" #: ../../library/functions.rst:960 msgid "This is the address of the object in memory." msgstr "這是該物件在記憶體中的位址。" #: ../../library/functions.rst:962 -msgid "" -"Raises an :ref:`auditing event ` ``builtins.id`` with argument " -"``id``." -msgstr "" -"引發一個附帶引數 ``id`` 的\\ :ref:`稽核事件 ` ``builtins.id``。" +msgid "Raises an :ref:`auditing event ` ``builtins.id`` with argument ``id``." +msgstr "引發一個附帶引數 ``id`` 的\\ :ref:`稽核事件 ` ``builtins.id``。" #: ../../library/functions.rst:968 msgid "" -"If the *prompt* argument is present, it is written to standard output " -"without a trailing newline. The function then reads a line from input, " -"converts it to a string (stripping a trailing newline), and returns that. " -"When EOF is read, :exc:`EOFError` is raised. Example::" +"If the *prompt* argument is present, it is written to standard output without a trailing newline. The function then " +"reads a line from input, converts it to a string (stripping a trailing newline), and returns that. When EOF is " +"read, :exc:`EOFError` is raised. Example::" msgstr "" -"如果有提供 *prompt* 引數,則將其寫入標準輸出,末尾不帶換行符。接下來,該函式" -"從輸入中讀取一行,將其轉換為字串(去除末尾的換行符)並回傳。當讀取到 EOF 時," -"則引發 :exc:`EOFError`。例如: ::" +"如果有提供 *prompt* 引數,則將其寫入標準輸出,末尾不帶換行符。接下來,該函式從輸入中讀取一行,將其轉換為字串(去除末" +"尾的換行符)並回傳。當讀取到 EOF 時,則引發 :exc:`EOFError`。例如: ::" #: ../../library/functions.rst:973 msgid "" @@ -1776,33 +1518,23 @@ msgstr "" #: ../../library/functions.rst:978 msgid "" -"If the :mod:`readline` module was loaded, then :func:`input` will use it to " -"provide elaborate line editing and history features." -msgstr "" -"如果載入了 :mod:`readline` module,:func:`input` 將使用它來提供複雜的行編輯和" -"歷史記錄功能。" +"If the :mod:`readline` module was loaded, then :func:`input` will use it to provide elaborate line editing and " +"history features." +msgstr "如果載入了 :mod:`readline` module,:func:`input` 將使用它來提供複雜的行編輯和歷史記錄功能。" #: ../../library/functions.rst:981 ../../library/functions.rst:983 -msgid "" -"Raises an :ref:`auditing event ` ``builtins.input`` with argument " -"``prompt`` before reading input" -msgstr "" -"引發一個附帶讀取輸入前的引數 ``prompt`` 的\\ :ref:`稽核事件 ` " -"``builtins.input``。" +msgid "Raises an :ref:`auditing event ` ``builtins.input`` with argument ``prompt`` before reading input" +msgstr "引發一個附帶讀取輸入前的引數 ``prompt`` 的\\ :ref:`稽核事件 ` ``builtins.input``。" #: ../../library/functions.rst:986 ../../library/functions.rst:988 msgid "" -"Raises an :ref:`auditing event ` ``builtins.input/result`` with " -"the result after successfully reading input." -msgstr "" -"引發一個附帶成功讀取結果的\\ :ref:`稽核事件 ` ``builtins.input/" -"result``。" +"Raises an :ref:`auditing event ` ``builtins.input/result`` with the result after successfully reading " +"input." +msgstr "引發一個附帶成功讀取結果的\\ :ref:`稽核事件 ` ``builtins.input/result``。" #: ../../library/functions.rst:995 -msgid "" -"Return an integer object constructed from a number or a string, or return " -"``0`` if no arguments are given." -msgstr "" +msgid "Return an integer object constructed from a number or a string, or return ``0`` if no arguments are given." +msgstr "回傳一個由數字或字串所構成的整數物件,若沒有給引數則回傳 ``0``。" #: ../../library/functions.rst:1000 msgid "" @@ -1834,51 +1566,40 @@ msgstr "" #: ../../library/functions.rst:1015 msgid "" -"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns " -"``x.__int__()``. If the argument defines :meth:`~object.__index__`, it " -"returns ``x.__index__()``. If the argument " -"defines :meth:`~object.__trunc__`, it returns ``x.__trunc__()``. For " -"floating-point numbers, this truncates towards zero." +"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x.__int__()``. If the argument " +"defines :meth:`~object.__index__`, it returns ``x.__index__()``. If the argument defines :meth:`~object.__trunc__`, " +"it returns ``x.__trunc__()``. For floating-point numbers, this truncates towards zero." msgstr "" -"如果引數定義了 :meth:`~object.__int__`,則 ``int(x)`` 回傳 ``x.__int__()``。" -"如果引數定義了 :meth:`~object.__index__` 則回傳 ``x.__index__()``。如果引數定" -"義了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數,則會向零" -"的方向無條件捨去。" +"如果引數定義了 :meth:`~object.__int__`,則 ``int(x)`` 回傳 ``x.__int__()``。如果引數定義了 :meth:`~object.__index__` " +"則回傳 ``x.__index__()``。如果引數定義了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數,則會向零的方" +"向無條件捨去。" #: ../../library/functions.rst:1021 msgid "" -"If the argument is not a number or if *base* is given, then it must be a " -"string, :class:`bytes`, or :class:`bytearray` instance representing an " -"integer in radix *base*. Optionally, the string can be preceded by ``+`` or " -"``-`` (with no space in between), have leading zeros, be surrounded by " -"whitespace, and have single underscores interspersed between digits." +"If the argument is not a number or if *base* is given, then it must be a string, :class:`bytes`, " +"or :class:`bytearray` instance representing an integer in radix *base*. Optionally, the string can be preceded by " +"``+`` or ``-`` (with no space in between), have leading zeros, be surrounded by whitespace, and have single " +"underscores interspersed between digits." msgstr "" -"如果引數不是數字或如果有給定 *base*,則它必須是個字串、:class:`bytes` " -"或 :class:`bytearray` 實例,表示基數 (radix) *base* 中的整數。可選地,字串之" -"前可以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、" -"或在數字間有單一底線。" +"如果引數不是數字或如果有給定 *base*,則它必須是個字串、:class:`bytes` 或 :class:`bytearray` 實例,表示基數 (radix) " +"*base* 中的整數。可選地,字串之前可以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在數字間" +"有單一底線。" #: ../../library/functions.rst:1027 msgid "" -"A base-n integer string contains digits, each representing a value from 0 to " -"n-1. The values 0--9 can be represented by any Unicode decimal digit. The " -"values 10--35 can be represented by ``a`` to ``z`` (or ``A`` to ``Z``). The " -"default *base* is 10. The allowed bases are 0 and 2--36. Base-2, -8, and -16 " -"strings can be optionally prefixed with ``0b``/``0B``, ``0o``/``0O``, or " -"``0x``/``0X``, as with integer literals in code. For base 0, the string is " -"interpreted in a similar way to an :ref:`integer literal in code " -"`, in that the actual base is 2, 8, 10, or 16 as determined by the " -"prefix. Base 0 also disallows leading zeros: ``int('010', 0)`` is not legal, " -"while ``int('010')`` and ``int('010', 8)`` are." -msgstr "" -"一個 n 進制的整數字串,包含各個代表 0 到 n-1 的數字,0–9 可以用任何 Unicode " -"十進制數字表示,10–35 可以用 ``a`` 到 ``z``\\ (或 ``A`` 到 ``Z``\\ )表示。" -"預設的 *base* 是 10。允許的進位制有 0、2–36。2、8、16 進位制的字串可以在程式" -"碼中用 ``0b``/``0B``、``0o``/``0O``、``0x``/``0X`` 前綴來表示,如同程式碼中的" -"整數文字。進位制為 0 的字串將以和\\ :ref:`程式碼整數字面值 (integer literal " -"in code) ` 類似的方式來直譯,最後由前綴決定的結果會是 2、8、10、16 " -"進制中的一個,所以 ``int('010', 0)`` 是非法的,但 ``int('010')`` 和 " -"``int('010', 8)`` 是有效的。" +"A base-n integer string contains digits, each representing a value from 0 to n-1. The values 0--9 can be represented " +"by any Unicode decimal digit. The values 10--35 can be represented by ``a`` to ``z`` (or ``A`` to ``Z``). The " +"default *base* is 10. The allowed bases are 0 and 2--36. Base-2, -8, and -16 strings can be optionally prefixed with " +"``0b``/``0B``, ``0o``/``0O``, or ``0x``/``0X``, as with integer literals in code. For base 0, the string is " +"interpreted in a similar way to an :ref:`integer literal in code `, in that the actual base is 2, 8, 10, " +"or 16 as determined by the prefix. Base 0 also disallows leading zeros: ``int('010', 0)`` is not legal, while " +"``int('010')`` and ``int('010', 8)`` are." +msgstr "" +"一個 n 進制的整數字串,包含各個代表 0 到 n-1 的數字,0–9 可以用任何 Unicode 十進制數字表示,10–35 可以用 ``a`` 到 " +"``z``\\ (或 ``A`` 到 ``Z``\\ )表示。預設的 *base* 是 10。允許的進位制有 0、2–36。2、8、16 進位制的字串可以在程式碼" +"中用 ``0b``/``0B``、``0o``/``0O``、``0x``/``0X`` 前綴來表示,如同程式碼中的整數文字。進位制為 0 的字串將以和\\ :ref:`" +"程式碼整數字面值 (integer literal in code) ` 類似的方式來直譯,最後由前綴決定的結果會是 2、8、10、16 進制中" +"的一個,所以 ``int('010', 0)`` 是非法的,但 ``int('010')`` 和 ``int('010', 8)`` 是有效的。" #: ../../library/functions.rst:1038 msgid "The integer type is described in :ref:`typesnumeric`." @@ -1886,26 +1607,21 @@ msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" #: ../../library/functions.rst:1040 msgid "" -"If *base* is not an instance of :class:`int` and the *base* object has " -"a :meth:`base.__index__ ` method, that method is called to " -"obtain an integer for the base. Previous versions used :meth:`base.__int__ " +"If *base* is not an instance of :class:`int` and the *base* object has a :meth:`base.__index__ ` " +"method, that method is called to obtain an integer for the base. Previous versions used :meth:`base.__int__ " "` instead of :meth:`base.__index__ `." msgstr "" -"如果 *base* 不是 :class:`int` 的實例,但 *base* 物件有 :meth:`base.__index__ " -"` method,則會呼叫該 method 來取得此進位制所需的整數。以前" -"的版本使用 :meth:`base.__int__ ` 而不" -"是 :meth:`base.__index__ `。" +"如果 *base* 不是 :class:`int` 的實例,但 *base* 物件有 :meth:`base.__index__ ` method,則會呼叫該 " +"method 來取得此進位制所需的整數。以前的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base.__index__ " +"`。" #: ../../library/functions.rst:1050 msgid "The first parameter is now positional-only." msgstr "第一個參數為僅限位置參數。" #: ../../library/functions.rst:1053 -msgid "" -"Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not " -"defined." -msgstr "" -"如果未定義 :meth:`~object.__int__` 則會回退到 :meth:`~object.__index__`。" +msgid "Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not defined." +msgstr "如果未定義 :meth:`~object.__int__` 則會回退到 :meth:`~object.__index__`。" #: ../../library/functions.rst:1056 msgid "The delegation to :meth:`~object.__trunc__` is deprecated." @@ -1913,38 +1629,29 @@ msgstr "對 :meth:`~object.__trunc__` 的委派已棄用。" #: ../../library/functions.rst:1059 msgid "" -":class:`int` string inputs and string representations can be limited to help " -"avoid denial of service attacks. A :exc:`ValueError` is raised when the " -"limit is exceeded while converting a string to an :class:`int` or when " -"converting an :class:`int` into a string would exceed the limit. See " -"the :ref:`integer string conversion length limitation ` " -"documentation." +":class:`int` string inputs and string representations can be limited to help avoid denial of service attacks. " +"A :exc:`ValueError` is raised when the limit is exceeded while converting a string to an :class:`int` or when " +"converting an :class:`int` into a string would exceed the limit. See the :ref:`integer string conversion length " +"limitation ` documentation." msgstr "" -":class:`int` 的字串輸入和字串表示法可以被限制,以避免阻斷服務攻擊 (denial of " -"service attack)。在字串 *x* 轉換為 :class:`int` 時已超出限制,或是" -"在 :class:`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱" +":class:`int` 的字串輸入和字串表示法可以被限制,以避免阻斷服務攻擊 (denial of service attack)。在字串 *x* 轉換" +"為 :class:`int` 時已超出限制,或是在 :class:`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱" "\\ :ref:`整數字串轉換的長度限制 `\\ 說明文件。" #: ../../library/functions.rst:1069 msgid "" -"Return ``True`` if the *object* argument is an instance of the *classinfo* " -"argument, or of a (direct, indirect, or :term:`virtual `) subclass thereof. If *object* is not an object of the given type, " -"the function always returns ``False``. If *classinfo* is a tuple of type " -"objects (or recursively, other such tuples) or a :ref:`types-union` of " -"multiple types, return ``True`` if *object* is an instance of any of the " -"types. If *classinfo* is not a type or tuple of types and such tuples, " -"a :exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised " -"for an invalid type if an earlier check succeeds." -msgstr "" -"如果 *object* 引數是 *classinfo* 引數的實例,或者是(直接、間接" -"或 :term:`virtual `)subclass 的實例,則回傳 ``True``。" -"如果 *object* 不是給定型別的物件,函式始終回傳 ``False``。如果 *classinfo* 是" -"包含物件型別的 tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-" -"union`,若 *object* 是其中的任何一個物件的實例則回傳 ``True``。如果 " -"*classinfo* 既不是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會引" -"發 :exc:`TypeError` 異常。若是先前檢查已經成功,:exc:`TypeError` 可能不會再因" -"為不合格的型別而被引發。" +"Return ``True`` if the *object* argument is an instance of the *classinfo* argument, or of a (direct, indirect, " +"or :term:`virtual `) subclass thereof. If *object* is not an object of the given type, the " +"function always returns ``False``. If *classinfo* is a tuple of type objects (or recursively, other such tuples) or " +"a :ref:`types-union` of multiple types, return ``True`` if *object* is an instance of any of the types. If " +"*classinfo* is not a type or tuple of types and such tuples, a :exc:`TypeError` exception is " +"raised. :exc:`TypeError` may not be raised for an invalid type if an earlier check succeeds." +msgstr "" +"如果 *object* 引數是 *classinfo* 引數的實例,或者是(直接、間接或 :term:`virtual `)subclass 的" +"實例,則回傳 ``True``。如果 *object* 不是給定型別的物件,函式始終回傳 ``False``。如果 *classinfo* 是包含物件型別的 " +"tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-union`,若 *object* 是其中的任何一個物件的實例則回傳 " +"``True``。如果 *classinfo* 既不是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會引發 :exc:`TypeError` 異常。若是先" +"前檢查已經成功,:exc:`TypeError` 可能不會再因為不合格的型別而被引發。" #: ../../library/functions.rst:1080 ../../library/functions.rst:1094 msgid "*classinfo* can be a :ref:`types-union`." @@ -1952,42 +1659,32 @@ msgstr "*classinfo* 可以是一個 :ref:`types-union`。" #: ../../library/functions.rst:1086 msgid "" -"Return ``True`` if *class* is a subclass (direct, indirect, " -"or :term:`virtual `) of *classinfo*. A class is " -"considered a subclass of itself. *classinfo* may be a tuple of class objects " -"(or recursively, other such tuples) or a :ref:`types-union`, in which case " -"return ``True`` if *class* is a subclass of any entry in *classinfo*. In " -"any other case, a :exc:`TypeError` exception is raised." +"Return ``True`` if *class* is a subclass (direct, indirect, or :term:`virtual `) of " +"*classinfo*. A class is considered a subclass of itself. *classinfo* may be a tuple of class objects (or " +"recursively, other such tuples) or a :ref:`types-union`, in which case return ``True`` if *class* is a subclass of " +"any entry in *classinfo*. In any other case, a :exc:`TypeError` exception is raised." msgstr "" -"如果 *class* 是 *classinfo* 的 subclass(直接、間接或 :term:`virtual " -"`),則回傳 ``True``。*classinfo* 可以是 class 物件的 " -"tuple(或遞迴地其他類似 tuple)或是一個 :ref:`types-union`,此時若 *class* " -"是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引" -"發 :exc:`TypeError`。" +"如果 *class* 是 *classinfo* 的 subclass(直接、間接或 :term:`virtual `),則回傳 ``True``。" +"*classinfo* 可以是 class 物件的 tuple(或遞迴地其他類似 tuple)或是一個 :ref:`types-union`,此時若 *class* 是 " +"*classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :exc:`TypeError`。" #: ../../library/functions.rst:1101 msgid "" -"Return an :term:`iterator` object. The first argument is interpreted very " -"differently depending on the presence of the second argument. Without a " -"second argument, *object* must be a collection object which supports " -"the :term:`iterable` protocol (the :meth:`~object.__iter__` method), or it " -"must support the sequence protocol (the :meth:`~object.__getitem__` method " -"with integer arguments starting at ``0``). If it does not support either of " -"those protocols, :exc:`TypeError` is raised. If the second argument, " -"*sentinel*, is given, then *object* must be a callable object. The iterator " -"created in this case will call *object* with no arguments for each call to " -"its :meth:`~iterator.__next__` method; if the value returned is equal to " -"*sentinel*, :exc:`StopIteration` will be raised, otherwise the value will be " -"returned." -msgstr "" -"回傳一個 :term:`iterator` 物件。根據是否存在第二個引數,第一個引數的意義是非" -"常不同的。如果沒有第二個引數,*object* 必須是支援 :term:`iterable` 協定" -"(有 :meth:`~object.__iter__` method)的集合物件,或必須支援序列協定" -"(有 :meth:`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支" -"援這些協定,會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼 " -"*object* 必須是可呼叫的物件,這種情況下生成的 iterator,每次疊代呼" -"叫 :meth:`~iterator.__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 " -"*sentinel* 則引發 :exc:`StopIteration`,否則回傳呼叫結果。" +"Return an :term:`iterator` object. The first argument is interpreted very differently depending on the presence of " +"the second argument. Without a second argument, *object* must be a collection object which supports " +"the :term:`iterable` protocol (the :meth:`~object.__iter__` method), or it must support the sequence protocol " +"(the :meth:`~object.__getitem__` method with integer arguments starting at ``0``). If it does not support either of " +"those protocols, :exc:`TypeError` is raised. If the second argument, *sentinel*, is given, then *object* must be a " +"callable object. The iterator created in this case will call *object* with no arguments for each call to " +"its :meth:`~iterator.__next__` method; if the value returned is equal to *sentinel*, :exc:`StopIteration` will be " +"raised, otherwise the value will be returned." +msgstr "" +"回傳一個 :term:`iterator` 物件。根據是否存在第二個引數,第一個引數的意義是非常不同的。如果沒有第二個引數,*object* 必" +"須是支援 :term:`iterable` 協定(有 :meth:`~object.__iter__` method)的集合物件,或必須支援序列協定" +"(有 :meth:`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支援這些協定,會引發 :exc:`TypeError`。如果" +"有第二個引數 *sentinel*,那麼 *object* 必須是可呼叫的物件,這種情況下生成的 iterator,每次疊代呼" +"叫 :meth:`~iterator.__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 *sentinel* 則引發 :exc:`StopIteration`," +"否則回傳呼叫結果。" #: ../../library/functions.rst:1115 msgid "See also :ref:`typeiter`." @@ -1995,12 +1692,11 @@ msgstr "另請參閱 :ref:`typeiter`。" #: ../../library/functions.rst:1117 msgid "" -"One useful application of the second form of :func:`iter` is to build a " -"block-reader. For example, reading fixed-width blocks from a binary database " -"file until the end of file is reached::" +"One useful application of the second form of :func:`iter` is to build a block-reader. For example, reading fixed-" +"width blocks from a binary database file until the end of file is reached::" msgstr "" -":func:`iter` 的第二種形式有一個好用的應用,是能夠建立一個區塊閱讀器 (block-" -"reader)。例如,從二進位資料庫檔案中讀取固定寬度的區塊,直到檔案的結尾: ::" +":func:`iter` 的第二種形式有一個好用的應用,是能夠建立一個區塊閱讀器 (block-reader)。例如,從二進位資料庫檔案中讀取固" +"定寬度的區塊,直到檔案的結尾: ::" #: ../../library/functions.rst:1121 msgid "" @@ -2016,160 +1712,139 @@ msgstr "" #: ../../library/functions.rst:1129 msgid "" -"Return the length (the number of items) of an object. The argument may be a " -"sequence (such as a string, bytes, tuple, list, or range) or a collection " -"(such as a dictionary, set, or frozen set)." +"Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, " +"tuple, list, or range) or a collection (such as a dictionary, set, or frozen set)." msgstr "" -"回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 " -"range)或集合(如 dictionary、set 或 frozen set)。" +"回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 range)或集合(如 dictionary、set 或 " +"frozen set)。" #: ../../library/functions.rst:1135 msgid "" -"``len`` raises :exc:`OverflowError` on lengths larger " -"than :data:`sys.maxsize`, such as :class:`range(2 ** 100) `." +"``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys.maxsize`, such as :class:`range(2 ** 100) " +"`." msgstr "" -"如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," -"則 ``len`` 會引發 :exc:`OverflowError`。" +"如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `,則 ``len`` 會引發 :exc:`OverflowError`。" #: ../../library/functions.rst:1144 msgid "" -"Rather than being a function, :class:`list` is actually a mutable sequence " -"type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." -msgstr "" -"除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` " -"和 :ref:`typesseq`。" +"Rather than being a function, :class:`list` is actually a mutable sequence type, as documented in :ref:`typesseq-" +"list` and :ref:`typesseq`." +msgstr "除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` 和 :ref:`typesseq`。" #: ../../library/functions.rst:1150 msgid "" -"Return a mapping object representing the current local symbol table, with " -"variable names as the keys, and their currently bound references as the " -"values." -msgstr "" +"Return a mapping object representing the current local symbol table, with variable names as the keys, and their " +"currently bound references as the values." +msgstr "回傳代表目前本機符號表的對應物件,變數名稱為鍵,目前綁定的參照為值。" #: ../../library/functions.rst:1154 msgid "" -"At module scope, as well as when using :func:`exec` or :func:`eval` with a " -"single namespace, this function returns the same namespace " -"as :func:`globals`." +"At module scope, as well as when using :func:`exec` or :func:`eval` with a single namespace, this function returns " +"the same namespace as :func:`globals`." msgstr "" +"在模組作用域,以及使用 :func:`exec` 或 :func:`eval` 單一命名空間時,此函式會返回與 :func:`globals` 相同的命名空間。" #: ../../library/functions.rst:1158 -msgid "" -"At class scope, it returns the namespace that will be passed to the " -"metaclass constructor." -msgstr "" +msgid "At class scope, it returns the namespace that will be passed to the metaclass constructor." +msgstr "在類別作用域中,它會回傳將傳遞給元類(metaclass)建構器的命名空間。" #: ../../library/functions.rst:1161 msgid "" -"When using ``exec()`` or ``eval()`` with separate local and global " -"arguments, it returns the local namespace passed in to the function call." -msgstr "" +"When using ``exec()`` or ``eval()`` with separate local and global arguments, it returns the local namespace passed " +"in to the function call." +msgstr "當使用 ``exec()`` 或 ``eval()``,並分別使用本機和全局參數時,它會回傳傳入函式呼叫的本機命名空間。" #: ../../library/functions.rst:1164 msgid "" -"In all of the above cases, each call to ``locals()`` in a given frame of " -"execution will return the *same* mapping object. Changes made through the " -"mapping object returned from ``locals()`` will be visible as assigned, " -"reassigned, or deleted local variables, and assigning, reassigning, or " -"deleting local variables will immediately affect the contents of the " -"returned mapping object." +"In all of the above cases, each call to ``locals()`` in a given frame of execution will return the *same* mapping " +"object. Changes made through the mapping object returned from ``locals()`` will be visible as assigned, reassigned, " +"or deleted local variables, and assigning, reassigning, or deleting local variables will immediately affect the " +"contents of the returned mapping object." msgstr "" +"在上述所有情況下,在指定的執行框架中,每次呼叫 ``locals()`` 都會返回*相同*的映射物件。透過 ``locals()`` 傳回的映射物" +"件所做的變更,會以被指派、重新指派或刪除的局部變數的形式顯示,而指派、重新指派或刪除局部變數會立即影響傳回的映射物件" +"的內容。" #: ../../library/functions.rst:1171 msgid "" -"In an :term:`optimized scope` (including functions, generators, and " -"coroutines), each call to ``locals()`` instead returns a fresh dictionary " -"containing the current bindings of the function's local variables and any " -"nonlocal cell references. In this case, name binding changes made via the " -"returned dict are *not* written back to the corresponding local variables or " -"nonlocal cell references, and assigning, reassigning, or deleting local " -"variables and nonlocal cell references does *not* affect the contents of " -"previously returned dictionaries." +"In an :term:`optimized scope` (including functions, generators, and coroutines), each call to ``locals()`` instead " +"returns a fresh dictionary containing the current bindings of the function's local variables and any nonlocal cell " +"references. In this case, name binding changes made via the returned dict are *not* written back to the " +"corresponding local variables or nonlocal cell references, and assigning, reassigning, or deleting local variables " +"and nonlocal cell references does *not* affect the contents of previously returned dictionaries." msgstr "" +"在 :term:`optimized scope` 中(包括函数、生成器和協程),每次调用 ``locals()`` 都会返回一个新的字典,其中包含函数的局" +"部变量和任何非局部单元引用的当前绑定。在這種情況下,透過回傳的字典所做的名稱綁定變更,**不會**寫回對應的局部變數或非" +"局部單元格引用,而且分配、重新分配或刪除局部變數和非局部單元格引用,**不會**影響先前回傳字典的內容。" #: ../../library/functions.rst:1180 msgid "" -"Calling ``locals()`` as part of a comprehension in a function, generator, or " -"coroutine is equivalent to calling it in the containing scope, except that " -"the comprehension's initialised iteration variables will be included. In " -"other scopes, it behaves as if the comprehension were running as a nested " -"function." +"Calling ``locals()`` as part of a comprehension in a function, generator, or coroutine is equivalent to calling it " +"in the containing scope, except that the comprehension's initialised iteration variables will be included. In other " +"scopes, it behaves as if the comprehension were running as a nested function." msgstr "" +"在函数、生成器或協程中作为理解的一部分调用 ``locals()`` 等同于在包含的作用域中调用它,但理解的初始化迭代变量将被包含" +"在内。在其他作用域中,它的行为就像理解作为嵌套函数运行一样。" #: ../../library/functions.rst:1186 msgid "" -"Calling ``locals()`` as part of a generator expression is equivalent to " -"calling it in a nested generator function." -msgstr "" +"Calling ``locals()`` as part of a generator expression is equivalent to calling it in a nested generator function." +msgstr "呼叫 ``locals()`` 作為產生器表達式的一部分,等同於在巢狀的產生器函式中呼叫它。" #: ../../library/functions.rst:1189 -msgid "" -"The behaviour of ``locals()`` in a comprehension has been updated as " -"described in :pep:`709`." -msgstr "" +msgid "The behaviour of ``locals()`` in a comprehension has been updated as described in :pep:`709`." +msgstr "如 :pep:`709` 所述,更新了理解中 ``locals()`` 的行為。" #: ../../library/functions.rst:1193 msgid "" -"As part of :pep:`667`, the semantics of mutating the mapping objects " -"returned from this function are now defined. The behavior " -"in :term:`optimized scopes ` is now as described above. " -"Aside from being defined, the behaviour in other scopes remains unchanged " -"from previous versions." +"As part of :pep:`667`, the semantics of mutating the mapping objects returned from this function are now defined. " +"The behavior in :term:`optimized scopes ` is now as described above. Aside from being defined, the " +"behaviour in other scopes remains unchanged from previous versions." msgstr "" +"作為 :pep:`667` 的一部分,現在定義了變更此函式返回的映射物件的語意。在 :term:`optimized scopes ` 中" +"的行為現在如上所述。除了被定義外,其他作用域中的行為與先前版本保持不變。" #: ../../library/functions.rst:1203 msgid "" -"Return an iterator that applies *function* to every item of *iterable*, " -"yielding the results. If additional *iterables* arguments are passed, " -"*function* must take that many arguments and is applied to the items from " -"all iterables in parallel. With multiple iterables, the iterator stops when " -"the shortest iterable is exhausted. For cases where the function inputs are " -"already arranged into argument tuples, see :func:`itertools.starmap`\\." +"Return an iterator that applies *function* to every item of *iterable*, yielding the results. If additional " +"*iterables* arguments are passed, *function* must take that many arguments and is applied to the items from all " +"iterables in parallel. With multiple iterables, the iterator stops when the shortest iterable is exhausted. For " +"cases where the function inputs are already arranged into argument tuples, see :func:`itertools.starmap`\\." msgstr "" -"產生一個將 *function* 應用於 *iterable* 中所有元素,並收集回傳結果的 " -"iterator。如果傳遞了額外的 *iterables* 引數,則 *function* 必須接受相同個數的" -"引數,並使用所有從 iterables 中同時取得的元素。當有多個 iterables 時,最短的 " -"iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," -"請參閱 :func:`itertools.starmap`。" +"產生一個將 *function* 應用於 *iterable* 中所有元素,並收集回傳結果的 iterator。如果傳遞了額外的 *iterables* 引數,則 " +"*function* 必須接受相同個數的引數,並使用所有從 iterables 中同時取得的元素。當有多個 iterables 時,最短的 iteratable " +"耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple,請參閱 :func:`itertools.starmap`。" #: ../../library/functions.rst:1215 -msgid "" -"Return the largest item in an iterable or the largest of two or more " -"arguments." +msgid "Return the largest item in an iterable or the largest of two or more arguments." msgstr "回傳 iterable 中最大的元素,或者回傳兩個以上的引數中最大的。" #: ../../library/functions.rst:1218 msgid "" -"If one positional argument is provided, it should be an :term:`iterable`. " -"The largest item in the iterable is returned. If two or more positional " -"arguments are provided, the largest of the positional arguments is returned." +"If one positional argument is provided, it should be an :term:`iterable`. The largest item in the iterable is " +"returned. If two or more positional arguments are provided, the largest of the positional arguments is returned." msgstr "" -"如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素" -"會被回傳。如果提供了兩個或以上的位置引數,則回傳最大的位置引數。" +"如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素會被回傳。如果提供了兩個或以上的位置引" +"數,則回傳最大的位置引數。" #: ../../library/functions.rst:1223 ../../library/functions.rst:1261 msgid "" -"There are two optional keyword-only arguments. The *key* argument specifies " -"a one-argument ordering function like that used for :meth:`list.sort`. The " -"*default* argument specifies an object to return if the provided iterable is " -"empty. If the iterable is empty and *default* is not provided, " -"a :exc:`ValueError` is raised." +"There are two optional keyword-only arguments. The *key* argument specifies a one-argument ordering function like " +"that used for :meth:`list.sort`. The *default* argument specifies an object to return if the provided iterable is " +"empty. If the iterable is empty and *default* is not provided, a :exc:`ValueError` is raised." msgstr "" -"這個函式有兩個選擇性的僅限關鍵字引數。*key* 引數能指定單一引數所使用的排序函" -"式,如同 :meth:`list.sort` 的使用方式。*default* 引數是當 iterable 為空時回傳" -"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引" +"這個函式有兩個選擇性的僅限關鍵字引數。*key* 引數能指定單一引數所使用的排序函式,如同 :meth:`list.sort` 的使用方式。" +"*default* 引數是當 iterable 為空時回傳的物件。如果 iterable 為空,並且沒有提供 *default*,則會引" "發 :exc:`ValueError`。" #: ../../library/functions.rst:1229 msgid "" -"If multiple items are maximal, the function returns the first one " -"encountered. This is consistent with other sort-stability preserving tools " -"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and " -"``heapq.nlargest(1, iterable, key=keyfunc)``." +"If multiple items are maximal, the function returns the first one encountered. This is consistent with other sort-" +"stability preserving tools such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and ``heapq.nlargest(1, " +"iterable, key=keyfunc)``." msgstr "" -"如果有多個最大元素,則此函式將回傳第一個找到的。這和其他穩定排序工具如 " -"``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " -"iterable, key=keyfunc)`` 一致。" +"如果有多個最大元素,則此函式將回傳第一個找到的。這和其他穩定排序工具如 ``sorted(iterable, key=keyfunc, reverse=True)" +"[0]`` 和 ``heapq.nlargest(1, iterable, key=keyfunc)`` 一致。" #: ../../library/functions.rst:1234 ../../library/functions.rst:1272 msgid "Added the *default* keyword-only parameter." @@ -2181,130 +1856,102 @@ msgstr "*key* 可以為 ``None``。" #: ../../library/functions.rst:1245 msgid "" -"Return a \"memory view\" object created from the given argument. " -"See :ref:`typememoryview` for more information." -msgstr "" -"回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" -"閱\\ :ref:`typememoryview`。" +"Return a \"memory view\" object created from the given argument. See :ref:`typememoryview` for more information." +msgstr "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參閱\\ :ref:`typememoryview`。" #: ../../library/functions.rst:1253 -msgid "" -"Return the smallest item in an iterable or the smallest of two or more " -"arguments." +msgid "Return the smallest item in an iterable or the smallest of two or more arguments." msgstr "回傳 iterable 中最小的元素,或者回傳兩個以上的引數中最小的。" #: ../../library/functions.rst:1256 msgid "" -"If one positional argument is provided, it should be an :term:`iterable`. " -"The smallest item in the iterable is returned. If two or more positional " -"arguments are provided, the smallest of the positional arguments is returned." +"If one positional argument is provided, it should be an :term:`iterable`. The smallest item in the iterable is " +"returned. If two or more positional arguments are provided, the smallest of the positional arguments is returned." msgstr "" -"如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" -"被回傳。如果提供了兩個以上的位置引數,則回傳最小的位置引數。" +"如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會被回傳。如果提供了兩個以上的位置引數,則" +"回傳最小的位置引數。" #: ../../library/functions.rst:1267 msgid "" -"If multiple items are minimal, the function returns the first one " -"encountered. This is consistent with other sort-stability preserving tools " -"such as ``sorted(iterable, key=keyfunc)[0]`` and ``heapq.nsmallest(1, " -"iterable, key=keyfunc)``." +"If multiple items are minimal, the function returns the first one encountered. This is consistent with other sort-" +"stability preserving tools such as ``sorted(iterable, key=keyfunc)[0]`` and ``heapq.nsmallest(1, iterable, " +"key=keyfunc)``." msgstr "" -"如果有多個最小元素,則此函式將回傳第一個找到的。這和其他穩定排序工具如 " -"``sorted(iterable, key=keyfunc)[0]`` 和 ``heapq.nsmallest(1, iterable, " -"key=keyfunc)`` 一致。" +"如果有多個最小元素,則此函式將回傳第一個找到的。這和其他穩定排序工具如 ``sorted(iterable, key=keyfunc)[0]`` 和 " +"``heapq.nsmallest(1, iterable, key=keyfunc)`` 一致。" #: ../../library/functions.rst:1282 msgid "" -"Retrieve the next item from the :term:`iterator` by calling " -"its :meth:`~iterator.__next__` method. If *default* is given, it is " -"returned if the iterator is exhausted, otherwise :exc:`StopIteration` is " -"raised." +"Retrieve the next item from the :term:`iterator` by calling its :meth:`~iterator.__next__` method. If *default* is " +"given, it is returned if the iterator is exhausted, otherwise :exc:`StopIteration` is raised." msgstr "" -"透過呼叫 :term:`iterator` 的 :meth:`~iterator.__next__` method 取得下一個元" -"素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引" -"發 :exc:`StopIteration`。" +"透過呼叫 :term:`iterator` 的 :meth:`~iterator.__next__` method 取得下一個元素。如果 iterator 耗盡,則回傳給定的預設" +"值 *default*,如果沒有預設值則引發 :exc:`StopIteration`。" #: ../../library/functions.rst:1289 msgid "" -"This is the ultimate base class of all other classes. It has methods that " -"are common to all instances of Python classes. When the constructor is " -"called, it returns a new featureless object. The constructor does not accept " -"any arguments." +"This is the ultimate base class of all other classes. It has methods that are common to all instances of Python " +"classes. When the constructor is called, it returns a new featureless object. The constructor does not accept any " +"arguments." msgstr "" -"這是所有其他 class 的基礎,它具有所有 Python class 實例的通用 method。當建構" -"函式被呼叫時,它會回傳一個新的沒有特徵 (featureless) 的物件。這個建構函式不接" -"受任何引數。" +"這是所有其他 class 的基礎,它具有所有 Python class 實例的通用 method。當建構函式被呼叫時,它會回傳一個新的沒有特徵 " +"(featureless) 的物件。這個建構函式不接受任何引數。" #: ../../library/functions.rst:1296 msgid "" -":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, " -"so you can't assign arbitrary attributes to an instance of :class:`object`." +":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, so you can't assign arbitrary " +"attributes to an instance of :class:`object`." msgstr "" -"由於 :class:`object` 實例\\ *沒有* :attr:`~object.__dict__` 屬性,因此無法將" -"任意屬性賦給 :class:`object` 的實例。" +"由於 :class:`object` 實例\\ *沒有* :attr:`~object.__dict__` 屬性,因此無法將任意屬性賦給 :class:`object` 的實例。" #: ../../library/functions.rst:1303 msgid "" -"Convert an integer number to an octal string prefixed with \"0o\". The " -"result is a valid Python expression. If *x* is not a Python :class:`int` " -"object, it has to define an :meth:`~object.__index__` method that returns an " -"integer. For example:" +"Convert an integer number to an octal string prefixed with \"0o\". The result is a valid Python expression. If *x* " +"is not a Python :class:`int` object, it has to define an :meth:`~object.__index__` method that returns an integer. " +"For example:" msgstr "" -"將一個整數轉變為一個前綴為 \"0o\" 的八進位制字串。回傳結果是一個有效的 " -"Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定" -"義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" +"將一個整數轉變為一個前綴為 \"0o\" 的八進位制字串。回傳結果是一個有效的 Python 運算式。如果 *x* 不是 Python " +"的 :class:`int` 物件,那它需要定義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" #: ../../library/functions.rst:1313 msgid "" -"If you want to convert an integer number to an octal string either with the " -"prefix \"0o\" or not, you can use either of the following ways." -msgstr "" -"如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方" -"法。" +"If you want to convert an integer number to an octal string either with the prefix \"0o\" or not, you can use either " +"of the following ways." +msgstr "如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方法。" #: ../../library/functions.rst:1330 msgid "" -"Open *file* and return a corresponding :term:`file object`. If the file " -"cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more " -"examples of how to use this function." +"Open *file* and return a corresponding :term:`file object`. If the file cannot be opened, an :exc:`OSError` is " +"raised. See :ref:`tut-files` for more examples of how to use this function." msgstr "" -"開啟 *file* 並回傳對應的\\ :term:`檔案物件 `。如果該檔案不能開" -"啟,則引發 :exc:`OSError`。關於使用此函式的更多方法,請參閱\\ :ref:`tut-" -"files`。" +"開啟 *file* 並回傳對應的\\ :term:`檔案物件 `。如果該檔案不能開啟,則引發 :exc:`OSError`。關於使用此函式" +"的更多方法,請參閱\\ :ref:`tut-files`。" #: ../../library/functions.rst:1334 msgid "" -"*file* is a :term:`path-like object` giving the pathname (absolute or " -"relative to the current working directory) of the file to be opened or an " -"integer file descriptor of the file to be wrapped. (If a file descriptor is " -"given, it is closed when the returned I/O object is closed unless *closefd* " -"is set to ``False``.)" +"*file* is a :term:`path-like object` giving the pathname (absolute or relative to the current working directory) of " +"the file to be opened or an integer file descriptor of the file to be wrapped. (If a file descriptor is given, it " +"is closed when the returned I/O object is closed unless *closefd* is set to ``False``.)" msgstr "" -"*file* 是一個\\ :term:`類路徑物件 `,是將被開啟之檔案的路徑" -"(絕對路徑或目前工作目錄的相對路徑),或是要被包裝 (wrap) 檔案的整數檔案描述" -"器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關" -"閉,除非 *closefd* 被設為 ``False``。)" +"*file* 是一個\\ :term:`類路徑物件 `,是將被開啟之檔案的路徑(絕對路徑或目前工作目錄的相對路徑),或" +"是要被包裝 (wrap) 檔案的整數檔案描述器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關閉," +"除非 *closefd* 被設為 ``False``。)" #: ../../library/functions.rst:1340 msgid "" -"*mode* is an optional string that specifies the mode in which the file is " -"opened. It defaults to ``'r'`` which means open for reading in text mode. " -"Other common values are ``'w'`` for writing (truncating the file if it " -"already exists), ``'x'`` for exclusive creation, and ``'a'`` for appending " -"(which on *some* Unix systems, means that *all* writes append to the end of " -"the file regardless of the current seek position). In text mode, if " -"*encoding* is not specified the encoding used is platform-" -"dependent: :func:`locale.getencoding` is called to get the current locale " -"encoding. (For reading and writing raw bytes use binary mode and leave " -"*encoding* unspecified.) The available modes are:" -msgstr "" -"*mode* 是一個選擇性字串,用於指定開啟檔案的模式。預設值是 ``'r'``,這意味著它" -"以文字模式開啟並讀取。其他常見模式有:寫入 ``'w'``\\ (會捨去已經存在的檔" -"案)、唯一性建立 ``'x'``、追加寫入 ``'a'``\\ (在\\ *一些* Unix 系統上,無論" -"目前的檔案指標在什麼位置,*所有* 寫入都會追加到檔案末尾)。在文字模式,如果沒" -"有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼" -"叫 :func:`locale.getencoding` 來取得目前的本地編碼。(要讀取和寫入原始 " -"bytes,請使用二進位制模式且不要指定 *encoding*。)可用的模式有:" +"*mode* is an optional string that specifies the mode in which the file is opened. It defaults to ``'r'`` which " +"means open for reading in text mode. Other common values are ``'w'`` for writing (truncating the file if it already " +"exists), ``'x'`` for exclusive creation, and ``'a'`` for appending (which on *some* Unix systems, means that *all* " +"writes append to the end of the file regardless of the current seek position). In text mode, if *encoding* is not " +"specified the encoding used is platform-dependent: :func:`locale.getencoding` is called to get the current locale " +"encoding. (For reading and writing raw bytes use binary mode and leave *encoding* unspecified.) The available modes " +"are:" +msgstr "" +"*mode* 是一個選擇性字串,用於指定開啟檔案的模式。預設值是 ``'r'``,這意味著它以文字模式開啟並讀取。其他常見模式有:寫" +"入 ``'w'``\\ (會捨去已經存在的檔案)、唯一性建立 ``'x'``、追加寫入 ``'a'``\\ (在\\ *一些* Unix 系統上,無論目前的檔" +"案指標在什麼位置,*所有* 寫入都會追加到檔案末尾)。在文字模式,如果沒有指定 *encoding*,則根據電腦平臺來決定使用的編" +"碼:呼叫 :func:`locale.getencoding` 來取得目前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模式且不要指定 " +"*encoding*。)可用的模式有:" #: ../../library/functions.rst:1357 msgid "Character" @@ -2372,228 +2019,176 @@ msgstr "更新(讀取並寫入)" #: ../../library/functions.rst:1368 msgid "" -"The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). " -"Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'`` and " -"``'r+b'`` open the file with no truncation." +"The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). Modes ``'w+'`` and ``'w+b'`` open and " +"truncate the file. Modes ``'r+'`` and ``'r+b'`` open the file with no truncation." msgstr "" -"預設的模式是 ``'r'``\\ (開啟並讀取文字,同 ``'rt'``)。``'w+'`` 和 " -"``'w+b'`` 模式會開啟並清除檔案。``'r+'`` 和 ``'r+b'`` 模式會開啟且保留檔案內" -"容。" +"預設的模式是 ``'r'``\\ (開啟並讀取文字,同 ``'rt'``)。``'w+'`` 和 ``'w+b'`` 模式會開啟並清除檔案。``'r+'`` 和 " +"``'r+b'`` 模式會開啟且保留檔案內容。" #: ../../library/functions.rst:1372 msgid "" -"As mentioned in the :ref:`io-overview`, Python distinguishes between binary " -"and text I/O. Files opened in binary mode (including ``'b'`` in the *mode* " -"argument) return contents as :class:`bytes` objects without any decoding. " -"In text mode (the default, or when ``'t'`` is included in the *mode* " -"argument), the contents of the file are returned as :class:`str`, the bytes " -"having been first decoded using a platform-dependent encoding or using the " -"specified *encoding* if given." +"As mentioned in the :ref:`io-overview`, Python distinguishes between binary and text I/O. Files opened in binary " +"mode (including ``'b'`` in the *mode* argument) return contents as :class:`bytes` objects without any decoding. In " +"text mode (the default, or when ``'t'`` is included in the *mode* argument), the contents of the file are returned " +"as :class:`str`, the bytes having been first decoded using a platform-dependent encoding or using the specified " +"*encoding* if given." msgstr "" -"如\\ :ref:`io-overview`\\ 中所述,Python 能區分二進制和文字的 I/O。在二進制模" -"式下開啟的檔案(*mode* 引數中含有 ``'b'``)會將其內容以 :class:`bytes` 物件回" -"傳,而不進行任何解碼。在文字模式(預設情況,或當 *mode* 引數中含有 " -"``'t'``),檔案的內容會以 :class:`str` 回傳,其位元組已經先被解碼,使用的是取" -"決於平台的編碼系統或是給定的 *encoding*。" +"如\\ :ref:`io-overview`\\ 中所述,Python 能區分二進制和文字的 I/O。在二進制模式下開啟的檔案(*mode* 引數中含有 " +"``'b'``)會將其內容以 :class:`bytes` 物件回傳,而不進行任何解碼。在文字模式(預設情況,或當 *mode* 引數中含有 " +"``'t'``),檔案的內容會以 :class:`str` 回傳,其位元組已經先被解碼,使用的是取決於平台的編碼系統或是給定的 " +"*encoding*。" #: ../../library/functions.rst:1382 msgid "" -"Python doesn't depend on the underlying operating system's notion of text " -"files; all the processing is done by Python itself, and is therefore " -"platform-independent." -msgstr "" -"Python 不會使用底層作業系統對於文字檔案的操作概念;所有的處理都是由 Python 獨" -"自完成的,因此能獨立於不同平台。" +"Python doesn't depend on the underlying operating system's notion of text files; all the processing is done by " +"Python itself, and is therefore platform-independent." +msgstr "Python 不會使用底層作業系統對於文字檔案的操作概念;所有的處理都是由 Python 獨自完成的,因此能獨立於不同平台。" #: ../../library/functions.rst:1386 msgid "" -"*buffering* is an optional integer used to set the buffering policy. Pass 0 " -"to switch buffering off (only allowed in binary mode), 1 to select line " -"buffering (only usable when writing in text mode), and an integer > 1 to " -"indicate the size in bytes of a fixed-size chunk buffer. Note that " -"specifying a buffer size this way applies for binary buffered I/O, but " -"``TextIOWrapper`` (i.e., files opened with ``mode='r+'``) would have another " -"buffering. To disable buffering in ``TextIOWrapper``, consider using the " -"``write_through`` flag for :func:`io.TextIOWrapper.reconfigure`. When no " -"*buffering* argument is given, the default buffering policy works as follows:" -msgstr "" -"*buffering* 是一個選擇性的整數,用於設定緩衝策略。傳入 0 表示關閉緩衝(僅在二" -"進制模式下被允許),1 表示行緩衝(line buffering,僅在文字模式下可用),而 " -">1 的整數是指示一個大小固定的區塊緩衝區 (chunk buffer),其位元組的數量。請注" -"意,此類指定緩衝區大小的方式適用於二進制緩衝 I/O,但是 ``TextIOWrapper``\\ " -"(以 ``mode='r+'`` 開啟的檔案)會有另一種緩衝方式。若要在 ``TextIOWrapper`` " -"中停用緩衝,可考慮使用 :func:`io.TextIOWrapper.reconfigure` 的 " -"``write_through`` 旗標。若未給定 *buffering* 引數,則預設的緩衝策略會運作如" -"下:" +"*buffering* is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed " +"in binary mode), 1 to select line buffering (only usable when writing in text mode), and an integer > 1 to indicate " +"the size in bytes of a fixed-size chunk buffer. Note that specifying a buffer size this way applies for binary " +"buffered I/O, but ``TextIOWrapper`` (i.e., files opened with ``mode='r+'``) would have another buffering. To disable " +"buffering in ``TextIOWrapper``, consider using the ``write_through`` flag for :func:`io.TextIOWrapper.reconfigure`. " +"When no *buffering* argument is given, the default buffering policy works as follows:" +msgstr "" +"*buffering* 是一個選擇性的整數,用於設定緩衝策略。傳入 0 表示關閉緩衝(僅在二進制模式下被允許),1 表示行緩衝(line " +"buffering,僅在文字模式下可用),而 >1 的整數是指示一個大小固定的區塊緩衝區 (chunk buffer),其位元組的數量。請注意," +"此類指定緩衝區大小的方式適用於二進制緩衝 I/O,但是 ``TextIOWrapper``\\ (以 ``mode='r+'`` 開啟的檔案)會有另一種緩衝" +"方式。若要在 ``TextIOWrapper`` 中停用緩衝,可考慮使用 :func:`io.TextIOWrapper.reconfigure` 的 ``write_through`` 旗" +"標。若未給定 *buffering* 引數,則預設的緩衝策略會運作如下:" #: ../../library/functions.rst:1396 msgid "" -"Binary files are buffered in fixed-size chunks; the size of the buffer is " -"chosen using a heuristic trying to determine the underlying device's \"block " -"size\" and falling back on :const:`io.DEFAULT_BUFFER_SIZE`. On many " +"Binary files are buffered in fixed-size chunks; the size of the buffer is chosen using a heuristic trying to " +"determine the underlying device's \"block size\" and falling back on :const:`io.DEFAULT_BUFFER_SIZE`. On many " "systems, the buffer will typically be 4096 or 8192 bytes long." msgstr "" -"二進制檔案會以固定大小的區塊進行緩衝;緩衝區的大小是使用啟發式嘗試 " -"(heuristic trying) 來決定底層設備的「區塊大小」,並會回退" -"到 :attr:`io.DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 " -"8192 個位元組。" +"二進制檔案會以固定大小的區塊進行緩衝;緩衝區的大小是使用啟發式嘗試 (heuristic trying) 來決定底層設備的「區塊大小」," +"並會回退到 :attr:`io.DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 8192 個位元組。" #: ../../library/functions.rst:1401 msgid "" -"\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " -"returns ``True``) use line buffering. Other text files use the policy " -"described above for binary files." +"\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` returns ``True``) use line buffering. Other " +"text files use the policy described above for binary files." msgstr "" -"「互動式」文字檔(:meth:`~io.IOBase.isatty` 回傳 ``True`` 的檔案)會使用列緩" -"衝。其他文字檔則使用上述的二進制檔案緩衝策略。" +"「互動式」文字檔(:meth:`~io.IOBase.isatty` 回傳 ``True`` 的檔案)會使用列緩衝。其他文字檔則使用上述的二進制檔案緩衝" +"策略。" #: ../../library/functions.rst:1405 msgid "" -"*encoding* is the name of the encoding used to decode or encode the file. " -"This should only be used in text mode. The default encoding is platform " -"dependent (whatever :func:`locale.getencoding` returns), but any :term:`text " -"encoding` supported by Python can be used. See the :mod:`codecs` module for " -"the list of supported encodings." +"*encoding* is the name of the encoding used to decode or encode the file. This should only be used in text mode. " +"The default encoding is platform dependent (whatever :func:`locale.getencoding` returns), but any :term:`text " +"encoding` supported by Python can be used. See the :mod:`codecs` module for the list of supported encodings." msgstr "" -"*encoding* 是用於解碼或編碼檔案的編碼系統之名稱。它只應該在文字模式下使用。預" -"設的編碼系統會取決於平台(根據 :func:`locale.getencoding` 回傳的內容),但 " -"Python 支援的任何 :term:`text encoding`\\ (文字編碼)都是可以使用的。關於支" -"援的編碼系統清單,請參閱 :mod:`codecs` module。" +"*encoding* 是用於解碼或編碼檔案的編碼系統之名稱。它只應該在文字模式下使用。預設的編碼系統會取決於平台(根" +"據 :func:`locale.getencoding` 回傳的內容),但 Python 支援的任何 :term:`text encoding`\\ (文字編碼)都是可以使用的。" +"關於支援的編碼系統清單,請參閱 :mod:`codecs` module。" #: ../../library/functions.rst:1411 msgid "" -"*errors* is an optional string that specifies how encoding and decoding " -"errors are to be handled—this cannot be used in binary mode. A variety of " -"standard error handlers are available (listed under :ref:`error-handlers`), " -"though any error handling name that has been registered " -"with :func:`codecs.register_error` is also valid. The standard names " +"*errors* is an optional string that specifies how encoding and decoding errors are to be handled—this cannot be used " +"in binary mode. A variety of standard error handlers are available (listed under :ref:`error-handlers`), though any " +"error handling name that has been registered with :func:`codecs.register_error` is also valid. The standard names " "include:" msgstr "" -"*errors* 是一個選擇性的字串,用於指定要如何處理編碼和解碼的錯誤——它不能在二進" -"制模式下使用。有許多不同的標準錯誤處理程式(error handler,在\\ :ref:`error-" -"handlers`\\ 有列出清單),不過任何已註冊到 :func:`codecs.register_error` 的錯" -"誤處理程式名稱也都是有效的。標準的名稱包括:" +"*errors* 是一個選擇性的字串,用於指定要如何處理編碼和解碼的錯誤——它不能在二進制模式下使用。有許多不同的標準錯誤處理程" +"式(error handler,在\\ :ref:`error-handlers`\\ 有列出清單),不過任何已註冊到 :func:`codecs.register_error` 的錯誤處" +"理程式名稱也都是有效的。標準的名稱包括:" #: ../../library/functions.rst:1419 msgid "" -"``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " -"error. The default value of ``None`` has the same effect." -msgstr "" -"``'strict'`` 如果發生編碼錯誤,則引發 :exc:`ValueError` 例外。預設值 " -"``None`` 也有相同的效果。" +"``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding error. The default value of ``None`` " +"has the same effect." +msgstr "``'strict'`` 如果發生編碼錯誤,則引發 :exc:`ValueError` 例外。預設值 ``None`` 也有相同的效果。" #: ../../library/functions.rst:1423 -msgid "" -"``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " -"data loss." +msgid "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to data loss." msgstr "``'ignore'`` 忽略錯誤。請注意,忽略編碼錯誤可能導致資料遺失。" #: ../../library/functions.rst:1426 -msgid "" -"``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " -"where there is malformed data." -msgstr "" -"``'replace'`` 會在格式不正確的資料位置插入一個替換標誌(像是 ``'?'``)。" +msgid "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted where there is malformed data." +msgstr "``'replace'`` 會在格式不正確的資料位置插入一個替換標誌(像是 ``'?'``)。" #: ../../library/functions.rst:1429 msgid "" -"``'surrogateescape'`` will represent any incorrect bytes as low surrogate " -"code units ranging from U+DC80 to U+DCFF. These surrogate code units will " -"then be turned back into the same bytes when the ``surrogateescape`` error " -"handler is used when writing data. This is useful for processing files in " -"an unknown encoding." +"``'surrogateescape'`` will represent any incorrect bytes as low surrogate code units ranging from U+DC80 to U+DCFF. " +"These surrogate code units will then be turned back into the same bytes when the ``surrogateescape`` error handler " +"is used when writing data. This is useful for processing files in an unknown encoding." msgstr "" -"``'surrogateescape'`` 會將任何不正確的位元組表示為低位代理碼元 (low " -"surrogate code unit),範圍從 U+DC80 到 U+DCFF。在寫入資料時,這些代理碼元將會" -"被還原回 ``surrogateescape`` 錯誤處理程式當時所處理的那些相同位元組。這對於處" -"理未知編碼方式的檔案會很好用。" +"``'surrogateescape'`` 會將任何不正確的位元組表示為低位代理碼元 (low surrogate code unit),範圍從 U+DC80 到 U+DCFF。在" +"寫入資料時,這些代理碼元將會被還原回 ``surrogateescape`` 錯誤處理程式當時所處理的那些相同位元組。這對於處理未知編碼方" +"式的檔案會很好用。" #: ../../library/functions.rst:1436 msgid "" -"``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " -"not supported by the encoding are replaced with the appropriate XML " -"character reference :samp:`&#{nnn};`." +"``'xmlcharrefreplace'`` is only supported when writing to a file. Characters not supported by the encoding are " +"replaced with the appropriate XML character reference :samp:`&#{nnn};`." msgstr "" -"``'xmlcharrefreplace'`` 僅在寫入檔案時可支援。編碼系統不支援的字元會被替換為" -"適當的 XML 字元參考 (character reference) ``&#nnn;``。" +"``'xmlcharrefreplace'`` 僅在寫入檔案時可支援。編碼系統不支援的字元會被替換為適當的 XML 字元參考 (character " +"reference) ``&#nnn;``。" #: ../../library/functions.rst:1440 -msgid "" -"``'backslashreplace'`` replaces malformed data by Python's backslashed " -"escape sequences." -msgstr "" -"``'backslashreplace'`` 會用 Python 的反斜線跳脫序列 (backslashed escape " -"sequence) 替換格式不正確的資料。" +msgid "``'backslashreplace'`` replaces malformed data by Python's backslashed escape sequences." +msgstr "``'backslashreplace'`` 會用 Python 的反斜線跳脫序列 (backslashed escape sequence) 替換格式不正確的資料。" #: ../../library/functions.rst:1443 msgid "" -"``'namereplace'`` (also only supported when writing) replaces unsupported " -"characters with ``\\N{...}`` escape sequences." -msgstr "" -"``'namereplace'``\\ (也僅在寫入時支援)會將不支援的字元替換為 ``\\N{...}`` " -"跳脫序列。" +"``'namereplace'`` (also only supported when writing) replaces unsupported characters with ``\\N{...}`` escape " +"sequences." +msgstr "``'namereplace'``\\ (也僅在寫入時支援)會將不支援的字元替換為 ``\\N{...}`` 跳脫序列。" #: ../../library/functions.rst:1451 msgid "" -"*newline* determines how to parse newline characters from the stream. It can " -"be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " -"follows:" +"*newline* determines how to parse newline characters from the stream. It can be ``None``, ``''``, ``'\\n'``, " +"``'\\r'``, and ``'\\r\\n'``. It works as follows:" msgstr "" -"*newline* 會決定如何剖析資料串流 (stream) 中的換行字元。它可以是 ``None``、" -"``''``、``'\\n'``、``'\\r'`` 或 ``'\\r\\n'``。它的運作規則如下:" +"*newline* 會決定如何剖析資料串流 (stream) 中的換行字元。它可以是 ``None``、``''``、``'\\n'``、``'\\r'`` 或 " +"``'\\r\\n'``。它的運作規則如下:" #: ../../library/functions.rst:1455 msgid "" -"When reading input from the stream, if *newline* is ``None``, universal " -"newlines mode is enabled. Lines in the input can end in ``'\\n'``, " -"``'\\r'``, or ``'\\r\\n'``, and these are translated into ``'\\n'`` before " -"being returned to the caller. If it is ``''``, universal newlines mode is " -"enabled, but line endings are returned to the caller untranslated. If it " -"has any of the other legal values, input lines are only terminated by the " -"given string, and the line ending is returned to the caller untranslated." +"When reading input from the stream, if *newline* is ``None``, universal newlines mode is enabled. Lines in the " +"input can end in ``'\\n'``, ``'\\r'``, or ``'\\r\\n'``, and these are translated into ``'\\n'`` before being " +"returned to the caller. If it is ``''``, universal newlines mode is enabled, but line endings are returned to the " +"caller untranslated. If it has any of the other legal values, input lines are only terminated by the given string, " +"and the line ending is returned to the caller untranslated." msgstr "" -"從資料串流讀取輸入時,如果 *newline* 是 ``None``,則會啟用通用換行模式。輸入" -"資料中的行結尾可以是 ``'\\n'``、``'\\r'`` 或 ``'\\r\\n'``,這些符號會被轉換" -"為 ``'\\n'`` 之後再回傳給呼叫方。如果是 ``''``,也會啟用通用換行模式,但在回" -"傳給呼叫方時,行尾符號不會被轉換。如果它是任何其他有效的值,則輸入資料的行只" -"會由給定的字串做結尾,且在回傳給呼叫方時,行尾符號不會被轉換。" +"從資料串流讀取輸入時,如果 *newline* 是 ``None``,則會啟用通用換行模式。輸入資料中的行結尾可以是 ``'\\n'``、" +"``'\\r'`` 或 ``'\\r\\n'``,這些符號會被轉換為 ``'\\n'`` 之後再回傳給呼叫方。如果是 ``''``,也會啟用通用換行模式,但在" +"回傳給呼叫方時,行尾符號不會被轉換。如果它是任何其他有效的值,則輸入資料的行只會由給定的字串做結尾,且在回傳給呼叫方" +"時,行尾符號不會被轉換。" #: ../../library/functions.rst:1463 msgid "" -"When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " -"characters written are translated to the system default line " -"separator, :data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no " -"translation takes place. If *newline* is any of the other legal values, any " -"``'\\n'`` characters written are translated to the given string." +"When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` characters written are translated to the " +"system default line separator, :data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no translation takes " +"place. If *newline* is any of the other legal values, any ``'\\n'`` characters written are translated to the given " +"string." msgstr "" -"將輸出寫入資料串流時,如果 *newline* 是 ``None``,則被寫入的任何 ``'\\n'`` 字" -"元都會轉換為系統預設的行分隔符號 :data:`os.linesep`。如果 *newline* 是 " -"``''`` 或 ``'\\n'``,則不做任何轉換。如果 *newline* 是任何其他有效的值,則寫" +"將輸出寫入資料串流時,如果 *newline* 是 ``None``,則被寫入的任何 ``'\\n'`` 字元都會轉換為系統預設的行分隔符" +"號 :data:`os.linesep`。如果 *newline* 是 ``''`` 或 ``'\\n'``,則不做任何轉換。如果 *newline* 是任何其他有效的值,則寫" "入的任何 ``'\\n'`` 字元都將轉換為給定的字串。" #: ../../library/functions.rst:1469 msgid "" -"If *closefd* is ``False`` and a file descriptor rather than a filename was " -"given, the underlying file descriptor will be kept open when the file is " -"closed. If a filename is given *closefd* must be ``True`` (the default); " +"If *closefd* is ``False`` and a file descriptor rather than a filename was given, the underlying file descriptor " +"will be kept open when the file is closed. If a filename is given *closefd* must be ``True`` (the default); " "otherwise, an error will be raised." msgstr "" -"如果 *closefd* 是 ``False``,且給定的 *file* 引數是一個檔案描述器而不是檔名," -"則當檔案關閉時,底層的檔案描述器會保持開啟狀態。如果有給定一個檔名,則 " -"*closefd* 必須是 ``True``\\ (預設值);否則將引發錯誤。" +"如果 *closefd* 是 ``False``,且給定的 *file* 引數是一個檔案描述器而不是檔名,則當檔案關閉時,底層的檔案描述器會保持開" +"啟狀態。如果有給定一個檔名,則 *closefd* 必須是 ``True``\\ (預設值);否則將引發錯誤。" #: ../../library/functions.rst:1474 msgid "" -"A custom opener can be used by passing a callable as *opener*. The " -"underlying file descriptor for the file object is then obtained by calling " -"*opener* with (*file*, *flags*). *opener* must return an open file " -"descriptor (passing :mod:`os.open` as *opener* results in functionality " -"similar to passing ``None``)." +"A custom opener can be used by passing a callable as *opener*. The underlying file descriptor for the file object is " +"then obtained by calling *opener* with (*file*, *flags*). *opener* must return an open file descriptor " +"(passing :mod:`os.open` as *opener* results in functionality similar to passing ``None``)." msgstr "" -"透過以 *opener* 傳遞一個可呼叫物件,就可以自訂開啟函式。然後透過以引數 " -"(*file*, *flags*) 呼叫 *opener*,就能取得檔案物件的底層檔案描述器。*opener* " -"必須回傳一個開啟的檔案描述器(將 :mod:`os.open` 作為 *opener* 傳入,在功能上" -"的結果會相當於傳入 ``None``)。" +"透過以 *opener* 傳遞一個可呼叫物件,就可以自訂開啟函式。然後透過以引數 (*file*, *flags*) 呼叫 *opener*,就能取得檔案" +"物件的底層檔案描述器。*opener* 必須回傳一個開啟的檔案描述器(將 :mod:`os.open` 作為 *opener* 傳入,在功能上的結果會相" +"當於傳入 ``None``)。" #: ../../library/functions.rst:1480 msgid "The newly created file is :ref:`non-inheritable `." @@ -2601,11 +2196,10 @@ msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" #: ../../library/functions.rst:1482 msgid "" -"The following example uses the :ref:`dir_fd ` parameter of " -"the :func:`os.open` function to open a file relative to a given directory::" +"The following example uses the :ref:`dir_fd ` parameter of the :func:`os.open` function to open a file " +"relative to a given directory::" msgstr "" -"下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," -"從給定的目錄中用相對路徑開啟檔案: ::" +"下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數,從給定的目錄中用相對路徑開啟檔案: ::" #: ../../library/functions.rst:1485 msgid "" @@ -2622,50 +2216,35 @@ msgstr "" #: ../../library/functions.rst:1495 msgid "" -"The type of :term:`file object` returned by the :func:`open` function " -"depends on the mode. When :func:`open` is used to open a file in a text " -"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass " -"of :class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When " -"used to open a file in a binary mode with buffering, the returned class is a " -"subclass of :class:`io.BufferedIOBase`. The exact class varies: in read " -"binary mode, it returns an :class:`io.BufferedReader`; in write binary and " -"append binary modes, it returns an :class:`io.BufferedWriter`, and in read/" -"write mode, it returns an :class:`io.BufferedRandom`. When buffering is " -"disabled, the raw stream, a subclass " -"of :class:`io.RawIOBase`, :class:`io.FileIO`, is returned." -msgstr "" -":func:`open` 函式回傳的 :term:`file object` 型別取決於模式。當 :func:`open` " -"是在文字模式中開啟檔案時(``'w'``、``'r'``、``'wt'``、``'rt'`` 等),它會回" -"傳 :class:`io.TextIOBase` 的一個 subclass(具體來說,就" -"是 :class:`io.TextIOWrapper`)。使用有緩衝的二進制模式開啟檔案時,回傳的 " -"class 則會是 :class:`io.BufferedIOBase` 的 subclass。確切的 class 各不相同:" -"在讀取的二進制模式,它會回傳 :class:`io.BufferedReader`;在寫入和附加的二進制" -"模式,它會回傳 :class:`io.BufferedWriter`,而在讀/寫模式,它會回" -"傳 :class:`io.BufferedRandom`。當緩衝被停用時,會回傳原始資料串" -"流 :class:`io.FileIO`,它是 :class:`io.RawIOBase` 的一個 subclass。" +"The type of :term:`file object` returned by the :func:`open` function depends on the mode. When :func:`open` is " +"used to open a file in a text mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass " +"of :class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When used to open a file in a binary mode with " +"buffering, the returned class is a subclass of :class:`io.BufferedIOBase`. The exact class varies: in read binary " +"mode, it returns an :class:`io.BufferedReader`; in write binary and append binary modes, it returns " +"an :class:`io.BufferedWriter`, and in read/write mode, it returns an :class:`io.BufferedRandom`. When buffering is " +"disabled, the raw stream, a subclass of :class:`io.RawIOBase`, :class:`io.FileIO`, is returned." +msgstr "" +":func:`open` 函式回傳的 :term:`file object` 型別取決於模式。當 :func:`open` 是在文字模式中開啟檔案時(``'w'``、" +"``'r'``、``'wt'``、``'rt'`` 等),它會回傳 :class:`io.TextIOBase` 的一個 subclass(具體來說,就" +"是 :class:`io.TextIOWrapper`)。使用有緩衝的二進制模式開啟檔案時,回傳的 class 則會是 :class:`io.BufferedIOBase` 的 " +"subclass。確切的 class 各不相同:在讀取的二進制模式,它會回傳 :class:`io.BufferedReader`;在寫入和附加的二進制模式," +"它會回傳 :class:`io.BufferedWriter`,而在讀/寫模式,它會回傳 :class:`io.BufferedRandom`。當緩衝被停用時,會回傳原始" +"資料串流 :class:`io.FileIO`,它是 :class:`io.RawIOBase` 的一個 subclass。" #: ../../library/functions.rst:1516 msgid "" -"See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " -"(where :func:`open` is " +"See also the file handling modules, such as :mod:`fileinput`, :mod:`io` (where :func:`open` is " "declared), :mod:`os`, :mod:`os.path`, :mod:`tempfile`, and :mod:`shutil`." msgstr "" -"另請參閱檔案操作模組,例如 :mod:`fileinput`、:mod:`io`\\ (定義" -"了 :func:`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以" -"及 :mod:`shutil`。" +"另請參閱檔案操作模組,例如 :mod:`fileinput`、:mod:`io`\\ (定義了 :func:`open` 的 " +"module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:`shutil`。" #: ../../library/functions.rst:1520 -msgid "" -"Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " -"``mode``, ``flags``." -msgstr "" -"引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " -"` ``open``。" +msgid "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, ``mode``, ``flags``." +msgstr "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 ` ``open``。" #: ../../library/functions.rst:1522 -msgid "" -"The ``mode`` and ``flags`` arguments may have been modified or inferred from " -"the original call." +msgid "The ``mode`` and ``flags`` arguments may have been modified or inferred from the original call." msgstr "``mode`` 和 ``flags`` 引數可能會被原始的呼叫所修改或推論 (infer)。" #: ../../library/functions.rst:1527 @@ -2681,12 +2260,8 @@ msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "過去引發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" #: ../../library/functions.rst:1530 -msgid "" -":exc:`FileExistsError` is now raised if the file opened in exclusive " -"creation mode (``'x'``) already exists." -msgstr "" -"如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引" -"發 :exc:`FileExistsError`。" +msgid ":exc:`FileExistsError` is now raised if the file opened in exclusive creation mode (``'x'``) already exists." +msgstr "如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:`FileExistsError`。" #: ../../library/functions.rst:1535 msgid "The file is now non-inheritable." @@ -2694,12 +2269,11 @@ msgstr "檔案在此版本開始是不可繼承的。" #: ../../library/functions.rst:1539 msgid "" -"If the system call is interrupted and the signal handler does not raise an " -"exception, the function now retries the system call instead of raising " -"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." +"If the system call is interrupted and the signal handler does not raise an exception, the function now retries the " +"system call instead of raising an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -"如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" -"不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" +"如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而不是引發 :exc:`InterruptedError` 例外(原" +"因詳見 :pep:`475`)。" #: ../../library/functions.rst:1542 msgid "The ``'namereplace'`` error handler was added." @@ -2711,11 +2285,8 @@ msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" #: ../../library/functions.rst:1547 msgid "" -"On Windows, opening a console buffer may return a subclass " -"of :class:`io.RawIOBase` other than :class:`io.FileIO`." -msgstr "" -"在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " -"subclass,而不是 :class:`io.FileIO`。" +"On Windows, opening a console buffer may return a subclass of :class:`io.RawIOBase` other than :class:`io.FileIO`." +msgstr "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 subclass,而不是 :class:`io.FileIO`。" #: ../../library/functions.rst:1550 msgid "The ``'U'`` mode has been removed." @@ -2723,61 +2294,48 @@ msgstr "``'U'`` 模式被移除。" #: ../../library/functions.rst:1555 msgid "" -"Given a string representing one Unicode character, return an integer " -"representing the Unicode code point of that character. For example, " -"``ord('a')`` returns the integer ``97`` and ``ord('€')`` (Euro sign) returns " -"``8364``. This is the inverse of :func:`chr`." +"Given a string representing one Unicode character, return an integer representing the Unicode code point of that " +"character. For example, ``ord('a')`` returns the integer ``97`` and ``ord('€')`` (Euro sign) returns ``8364``. " +"This is the inverse of :func:`chr`." msgstr "" -"對於代表單個 Unicode 字元的字串,回傳代表它 Unicode 編碼位置的整數。例如 " -"``ord('a')`` 回傳整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這" -"是 :func:`chr` 的逆函式。" +"對於代表單個 Unicode 字元的字串,回傳代表它 Unicode 編碼位置的整數。例如 ``ord('a')`` 回傳整數 ``97``、" +"``ord('€')``\\ (歐元符號)回傳 ``8364``。這是 :func:`chr` 的逆函式。" #: ../../library/functions.rst:1563 msgid "" -"Return *base* to the power *exp*; if *mod* is present, return *base* to the " -"power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " -"mod``). The two-argument form ``pow(base, exp)`` is equivalent to using the " +"Return *base* to the power *exp*; if *mod* is present, return *base* to the power *exp*, modulo *mod* (computed more " +"efficiently than ``pow(base, exp) % mod``). The two-argument form ``pow(base, exp)`` is equivalent to using the " "power operator: ``base**exp``." msgstr "" -"回傳 *base* 的 *exp* 次方;如果 *mod* 存在,則回傳 *base* 的 *exp* 次方對 " -"*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" -"的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" +"回傳 *base* 的 *exp* 次方;如果 *mod* 存在,則回傳 *base* 的 *exp* 次方對 *mod* 取餘數(比直接呼叫 ``pow(base, exp) " +"% mod`` 計算更高效)。兩個引數形式的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" #: ../../library/functions.rst:1568 msgid "" -"The arguments must have numeric types. With mixed operand types, the " -"coercion rules for binary arithmetic operators apply. For :class:`int` " -"operands, the result has the same type as the operands (after coercion) " -"unless the second argument is negative; in that case, all arguments are " -"converted to float and a float result is delivered. For example, ``pow(10, " -"2)`` returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative " -"base of type :class:`int` or :class:`float` and a non-integral exponent, a " -"complex result is delivered. For example, ``pow(-9, 0.5)`` returns a value " -"close to ``3j``. Whereas, for a negative base of type :class:`int` " -"or :class:`float` with an integral exponent, a float result is delivered. " -"For example, ``pow(-9, 2.0)`` returns ``81.0``." -msgstr "" -"引數必須是數值型別。對於混合型別的運算元,會套用二元算術運算子的強制轉型 " -"(coercion) 規則。對於 :class:`int` 運算元,運算結果會(在強制轉型後)與運算元" -"的型別相同,除非第二個引數是負數;在這種情況下,所有的引數都會被轉換為浮點數" -"並得到浮點數的結果。例如,``pow(10, 2)`` 會回傳 ``100``,但 ``pow(10, -2)`` " -"會回傳 ``0.01``。如果底數 (base) 是型別為 :class:`int` 或 :class:`float` 的負" -"數且指數 (exponent) 不是整數,則會得到一個複數的結果,例如 ``pow(-9, 0.5)`` " -"會回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` " -"或 :class:`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 " -"``pow(-9, 2.0)`` 會回傳 ``81.0``。" +"The arguments must have numeric types. With mixed operand types, the coercion rules for binary arithmetic operators " +"apply. For :class:`int` operands, the result has the same type as the operands (after coercion) unless the second " +"argument is negative; in that case, all arguments are converted to float and a float result is delivered. For " +"example, ``pow(10, 2)`` returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative base of " +"type :class:`int` or :class:`float` and a non-integral exponent, a complex result is delivered. For example, " +"``pow(-9, 0.5)`` returns a value close to ``3j``. Whereas, for a negative base of type :class:`int` " +"or :class:`float` with an integral exponent, a float result is delivered. For example, ``pow(-9, 2.0)`` returns " +"``81.0``." +msgstr "" +"引數必須是數值型別。對於混合型別的運算元,會套用二元算術運算子的強制轉型 (coercion) 規則。對於 :class:`int` 運算元," +"運算結果會(在強制轉型後)與運算元的型別相同,除非第二個引數是負數;在這種情況下,所有的引數都會被轉換為浮點數並得到" +"浮點數的結果。例如,``pow(10, 2)`` 會回傳 ``100``,但 ``pow(10, -2)`` 會回傳 ``0.01``。如果底數 (base) 是型別" +"為 :class:`int` 或 :class:`float` 的負數且指數 (exponent) 不是整數,則會得到一個複數的結果,例如 ``pow(-9, 0.5)`` 會" +"回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` 或 :class:`float` 的負數且指數為整數,則會得到一個浮" +"點數的結果,例如 ``pow(-9, 2.0)`` 會回傳 ``81.0``。" #: ../../library/functions.rst:1580 msgid "" -"For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must " -"also be of integer type and *mod* must be nonzero. If *mod* is present and " -"*exp* is negative, *base* must be relatively prime to *mod*. In that case, " -"``pow(inv_base, -exp, mod)`` is returned, where *inv_base* is an inverse to " -"*base* modulo *mod*." +"For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must also be of integer type and *mod* must " +"be nonzero. If *mod* is present and *exp* is negative, *base* must be relatively prime to *mod*. In that case, " +"``pow(inv_base, -exp, mod)`` is returned, where *inv_base* is an inverse to *base* modulo *mod*." msgstr "" -"對於 :class:`int` 運算元 *base* 和 *exp*,如果有給定 *mod*,則 *mod* 也必須是" -"整數型別,且 *mod* 必須不為零。如果有給定 *mod* 且 *exp* 為負,則 *base* 必須" -"與 *mod* 互質。在這種情況下,會回傳 ``pow(inv_base, -exp, mod)``,其中 " +"對於 :class:`int` 運算元 *base* 和 *exp*,如果有給定 *mod*,則 *mod* 也必須是整數型別,且 *mod* 必須不為零。如果有給" +"定 *mod* 且 *exp* 為負,則 *base* 必須與 *mod* 互質。在這種情況下,會回傳 ``pow(inv_base, -exp, mod)``,其中 " "*inv_base* 是 *base* 對 *mod* 的模倒數 (inverse modulo)。" #: ../../library/functions.rst:1586 @@ -2798,58 +2356,45 @@ msgstr "" #: ../../library/functions.rst:1593 msgid "" -"For :class:`int` operands, the three-argument form of ``pow`` now allows the " -"second argument to be negative, permitting computation of modular inverses." -msgstr "" -"對於 :class:`int` 運算元,現在 ``pow`` 的三引數形式允許第二個引數為負數,也容" -"許模倒數的計算。" +"For :class:`int` operands, the three-argument form of ``pow`` now allows the second argument to be negative, " +"permitting computation of modular inverses." +msgstr "對於 :class:`int` 運算元,現在 ``pow`` 的三引數形式允許第二個引數為負數,也容許模倒數的計算。" #: ../../library/functions.rst:1598 -msgid "" -"Allow keyword arguments. Formerly, only positional arguments were supported." +msgid "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "允許關鍵字引數。在此之前只支援位置引數。" #: ../../library/functions.rst:1605 msgid "" -"Print *objects* to the text stream *file*, separated by *sep* and followed " -"by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " -"keyword arguments." +"Print *objects* to the text stream *file*, separated by *sep* and followed by *end*. *sep*, *end*, *file*, and " +"*flush*, if present, must be given as keyword arguments." msgstr "" -"將 *objects* 列印到文字資料串流 *file*,用 *sep* 分隔並以 *end* 結尾。如果有" -"給定 *sep*、*end*、*file* 和 *flush*,那麼它們必須是關鍵字引數的形式。" +"將 *objects* 列印到文字資料串流 *file*,用 *sep* 分隔並以 *end* 結尾。如果有給定 *sep*、*end*、*file* 和 *flush*,那" +"麼它們必須是關鍵字引數的形式。" #: ../../library/functions.rst:1609 msgid "" -"All non-keyword arguments are converted to strings like :func:`str` does and " -"written to the stream, separated by *sep* and followed by *end*. Both *sep* " -"and *end* must be strings; they can also be ``None``, which means to use the " -"default values. If no *objects* are given, :func:`print` will just write " -"*end*." +"All non-keyword arguments are converted to strings like :func:`str` does and written to the stream, separated by " +"*sep* and followed by *end*. Both *sep* and *end* must be strings; they can also be ``None``, which means to use " +"the default values. If no *objects* are given, :func:`print` will just write *end*." msgstr "" -"所有的非關鍵字引數都會像是 :func:`str` 操作一樣地被轉換為字串,並寫入資料串" -"流,彼此以 *sep* 分隔,並以 *end* 結尾。*sep* 和 *end* 都必須是字串;它們也可" -"以是 ``None``,這表示使用預設值。如果沒有給定 *objects*,:func:`print` 就只會" -"寫入 *end*。" +"所有的非關鍵字引數都會像是 :func:`str` 操作一樣地被轉換為字串,並寫入資料串流,彼此以 *sep* 分隔,並以 *end* 結尾。" +"*sep* 和 *end* 都必須是字串;它們也可以是 ``None``,這表示使用預設值。如果沒有給定 *objects*,:func:`print` 就只會寫" +"入 *end*。" #: ../../library/functions.rst:1615 msgid "" -"The *file* argument must be an object with a ``write(string)`` method; if it " -"is not present or ``None``, :data:`sys.stdout` will be used. Since printed " -"arguments are converted to text strings, :func:`print` cannot be used with " -"binary mode file objects. For these, use ``file.write(...)`` instead." +"The *file* argument must be an object with a ``write(string)`` method; if it is not present or " +"``None``, :data:`sys.stdout` will be used. Since printed arguments are converted to text strings, :func:`print` " +"cannot be used with binary mode file objects. For these, use ``file.write(...)`` instead." msgstr "" -"*file* 引數必須是一個有 ``write(string)`` method 的物件;如果沒有給定或被設" -"為 ``None``,則將使用 :data:`sys.stdout`。因為要列印的引數會被轉換為文字字" -"串,所以 :func:`print` 不能用於二進位模式的檔案物件。對於此類物件,請改用 " +"*file* 引數必須是一個有 ``write(string)`` method 的物件;如果沒有給定或被設為 ``None``,則將使用 :data:`sys.stdout`。" +"因為要列印的引數會被轉換為文字字串,所以 :func:`print` 不能用於二進位模式的檔案物件。對於此類物件,請改用 " "``file.write(...)``。" #: ../../library/functions.rst:1620 -msgid "" -"Output buffering is usually determined by *file*. However, if *flush* is " -"true, the stream is forcibly flushed." -msgstr "" -"輸出緩衝通常會由 *file* 決定。但是如果 *flush* 為 true,則資料串流會被強制清" -"除。" +msgid "Output buffering is usually determined by *file*. However, if *flush* is true, the stream is forcibly flushed." +msgstr "輸出緩衝通常會由 *file* 決定。但是如果 *flush* 為 true,則資料串流會被強制清除。" #: ../../library/functions.rst:1624 msgid "Added the *flush* keyword argument." @@ -2861,12 +2406,11 @@ msgstr "回傳 property 屬性。" #: ../../library/functions.rst:1632 msgid "" -"*fget* is a function for getting an attribute value. *fset* is a function " -"for setting an attribute value. *fdel* is a function for deleting an " -"attribute value. And *doc* creates a docstring for the attribute." +"*fget* is a function for getting an attribute value. *fset* is a function for setting an attribute value. *fdel* is " +"a function for deleting an attribute value. And *doc* creates a docstring for the attribute." msgstr "" -"*fget* 是一個用於取得屬性值的函式,*fset* 是一個用於設定屬性值的函式,*fdel* " -"是一個用於刪除屬性值的函式,而 *doc* 會為該屬性建立一個說明字串。" +"*fget* 是一個用於取得屬性值的函式,*fset* 是一個用於設定屬性值的函式,*fdel* 是一個用於刪除屬性值的函式,而 *doc* 會" +"為該屬性建立一個說明字串。" #: ../../library/functions.rst:1636 msgid "A typical use is to define a managed attribute ``x``::" @@ -2906,22 +2450,20 @@ msgstr "" #: ../../library/functions.rst:1653 msgid "" -"If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " -"value`` will invoke the setter, and ``del c.x`` the deleter." +"If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = value`` will invoke the setter, and ``del " +"c.x`` the deleter." msgstr "" -"如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會叫用取得器 (getter),``c.x = " -"value`` 會呼叫設定器 (setter),而 ``del c.x`` 會叫用刪除器 (deleter)。" +"如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會叫用取得器 (getter),``c.x = value`` 會呼叫設定器 (setter),而 ``del " +"c.x`` 會叫用刪除器 (deleter)。" #: ../../library/functions.rst:1656 msgid "" -"If given, *doc* will be the docstring of the property attribute. Otherwise, " -"the property will copy *fget*'s docstring (if it exists). This makes it " -"possible to create read-only properties easily using :func:`property` as " +"If given, *doc* will be the docstring of the property attribute. Otherwise, the property will copy *fget*'s " +"docstring (if it exists). This makes it possible to create read-only properties easily using :func:`property` as " "a :term:`decorator`::" msgstr "" -"如果有給定 *doc*,它將會是 property 屬性的說明字串。否則,property 會複製 " -"*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使" -"用 :func:`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" +"如果有給定 *doc*,它將會是 property 屬性的說明字串。否則,property 會複製 *fget* 的說明字串(如果它存在的話)。這樣一" +"來,就能夠輕鬆地使用 :func:`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" #: ../../library/functions.rst:1660 msgid "" @@ -2937,18 +2479,20 @@ msgstr "" #: ../../library/functions.rst:1669 msgid "" -"The ``@property`` decorator turns the :meth:`!voltage` method into a " -"\"getter\" for a read-only attribute with the same name, and it sets the " -"docstring for *voltage* to \"Get the current voltage.\"" +"The ``@property`` decorator turns the :meth:`!voltage` method into a \"getter\" for a read-only attribute with the " +"same name, and it sets the docstring for *voltage* to \"Get the current voltage.\"" msgstr "" +"``@property``修飾器將 :meth:`!voltage` 方法變成同名只讀屬性的 \"getter\",並將 *voltage* 的 docstring 設成 \"Get the " +"current voltage\"。" #: ../../library/functions.rst:1677 msgid "" -"A property object has ``getter``, ``setter``, and ``deleter`` methods usable " -"as decorators that create a copy of the property with the corresponding " -"accessor function set to the decorated function. This is best explained " -"with an example:" +"A property object has ``getter``, ``setter``, and ``deleter`` methods usable as decorators that create a copy of the " +"property with the corresponding accessor function set to the decorated function. This is best explained with an " +"example:" msgstr "" +"一個屬性物件有 ``getter``、``setter`` 和 ``deleter``方法,這些方法可作為裝飾函數使用,創建一個屬性的副本,並將相應的" +"存取函數設定為裝飾函數。最好用一個範例來說明:" #: ../../library/functions.rst:1682 msgid "" @@ -2988,49 +2532,48 @@ msgstr "" #: ../../library/functions.rst:1701 msgid "" -"This code is exactly equivalent to the first example. Be sure to give the " -"additional functions the same name as the original property (``x`` in this " -"case.)" -msgstr "" +"This code is exactly equivalent to the first example. Be sure to give the additional functions the same name as the " +"original property (``x`` in this case.)" +msgstr "此代碼與第一個範例完全相等。請務必賦予附加函數與原始屬性相同的名稱 (在此例中為 ``x``)。" #: ../../library/functions.rst:1705 msgid "" -"The returned property object also has the attributes ``fget``, ``fset``, and " -"``fdel`` corresponding to the constructor arguments." -msgstr "" +"The returned property object also has the attributes ``fget``, ``fset``, and ``fdel`` corresponding to the " +"constructor arguments." +msgstr "回傳的屬性物件也有對應於構建器參數的屬性 ``fget``、``fset`` 和 ``fdel``。" #: ../../library/functions.rst:1708 msgid "The docstrings of property objects are now writeable." -msgstr "" +msgstr "屬性物件的 docstrings 現在可以寫入。" #: ../../library/functions.rst:1713 -msgid "" -"Attribute holding the name of the property. The name of the property can be " -"changed at runtime." -msgstr "" +msgid "Attribute holding the name of the property. The name of the property can be changed at runtime." +msgstr "持有屬性名稱的屬性。屬性名稱可在執行時變更。" #: ../../library/functions.rst:1724 msgid "" -"Rather than being a function, :class:`range` is actually an immutable " -"sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." +"Rather than being a function, :class:`range` is actually an immutable sequence type, as documented in :ref:`typesseq-" +"range` and :ref:`typesseq`." msgstr "" +"與其說是函數, :class:`range` 實際上是一個不可變的序列類型,如 :ref:`typesseq-range` 和 :ref:`typesseq` 所記載。" #: ../../library/functions.rst:1730 msgid "" -"Return a string containing a printable representation of an object. For " -"many types, this function makes an attempt to return a string that would " -"yield an object with the same value when passed to :func:`eval`; otherwise, " -"the representation is a string enclosed in angle brackets that contains the " -"name of the type of the object together with additional information often " -"including the name and address of the object. A class can control what this " -"function returns for its instances by defining a :meth:`~object.__repr__` " -"method. If :func:`sys.displayhook` is not accessible, this function will " -"raise :exc:`RuntimeError`." +"Return a string containing a printable representation of an object. For many types, this function makes an attempt " +"to return a string that would yield an object with the same value when passed to :func:`eval`; otherwise, the " +"representation is a string enclosed in angle brackets that contains the name of the type of the object together with " +"additional information often including the name and address of the object. A class can control what this function " +"returns for its instances by defining a :meth:`~object.__repr__` method. If :func:`sys.displayhook` is not " +"accessible, this function will raise :exc:`RuntimeError`." msgstr "" +"返回一個包含物件可列印表示的字串。對於許多類型,這個函數會嘗試返回一個字串,當傳送給 :func:`eval` 時,這個字串會產生" +"一個具有相同值的物件;否則,這個表示是一個用角括弧括起來的字串,包含物件類型的名稱,以及額外的資訊,通常包括物件的名" +"稱和位址。一個類別可以透過定義 :meth:`~object.__repr__` 方法來控制這個函式對其實體的回傳值。如" +"果 :func:`sys.displayhook` 不可用,這個函式會產生 :exc:`RuntimeError`。" #: ../../library/functions.rst:1741 msgid "This class has a custom representation that can be evaluated::" -msgstr "" +msgstr "這個類別有一個自定义的表示,可以被执行:" #: ../../library/functions.rst:1743 msgid "" @@ -3052,111 +2595,94 @@ msgstr "" #: ../../library/functions.rst:1754 msgid "" -"Return a reverse :term:`iterator`. *seq* must be an object which has " -"a :meth:`~object.__reversed__` method or supports the sequence protocol " -"(the :meth:`~object.__len__` method and the :meth:`~object.__getitem__` " -"method with integer arguments starting at ``0``)." +"Return a reverse :term:`iterator`. *seq* must be an object which has a :meth:`~object.__reversed__` method or " +"supports the sequence protocol (the :meth:`~object.__len__` method and the :meth:`~object.__getitem__` method with " +"integer arguments starting at ``0``)." msgstr "" +"回傳一個反向的 :term:`iterator`. *seq* 必須是一個有 :meth:`~object.__reversed__` 方法或支援序列通訊協定 (有從 ``0`` " +"開始的整數參數的 :meth:`~object.__len__` 方法和 :meth:`~object.__getitem__` 方法) 的物件。" #: ../../library/functions.rst:1762 msgid "" -"Return *number* rounded to *ndigits* precision after the decimal point. If " -"*ndigits* is omitted or is ``None``, it returns the nearest integer to its " -"input." +"Return *number* rounded to *ndigits* precision after the decimal point. If *ndigits* is omitted or is ``None``, it " +"returns the nearest integer to its input." msgstr "" +"回傳小數點後四捨五入到 *ndigits* 精度的 *number*。如果省略 *ndigits* 或為 ``None``,則會返回最接近其輸入的整數。" #: ../../library/functions.rst:1766 msgid "" -"For the built-in types supporting :func:`round`, values are rounded to the " -"closest multiple of 10 to the power minus *ndigits*; if two multiples are " -"equally close, rounding is done toward the even choice (so, for example, " -"both ``round(0.5)`` and ``round(-0.5)`` are ``0``, and ``round(1.5)`` is " -"``2``). Any integer value is valid for *ndigits* (positive, zero, or " -"negative). The return value is an integer if *ndigits* is omitted or " -"``None``. Otherwise, the return value has the same type as *number*." +"For the built-in types supporting :func:`round`, values are rounded to the closest multiple of 10 to the power minus " +"*ndigits*; if two multiples are equally close, rounding is done toward the even choice (so, for example, both " +"``round(0.5)`` and ``round(-0.5)`` are ``0``, and ``round(1.5)`` is ``2``). Any integer value is valid for " +"*ndigits* (positive, zero, or negative). The return value is an integer if *ndigits* is omitted or ``None``. " +"Otherwise, the return value has the same type as *number*." msgstr "" #: ../../library/functions.rst:1775 -msgid "" -"For a general Python object ``number``, ``round`` delegates to " -"``number.__round__``." +msgid "For a general Python object ``number``, ``round`` delegates to ``number.__round__``." msgstr "" #: ../../library/functions.rst:1780 msgid "" -"The behavior of :func:`round` for floats can be surprising: for example, " -"``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is " -"not a bug: it's a result of the fact that most decimal fractions can't be " -"represented exactly as a float. See :ref:`tut-fp-issues` for more " -"information." +"The behavior of :func:`round` for floats can be surprising: for example, ``round(2.675, 2)`` gives ``2.67`` instead " +"of the expected ``2.68``. This is not a bug: it's a result of the fact that most decimal fractions can't be " +"represented exactly as a float. See :ref:`tut-fp-issues` for more information." msgstr "" #: ../../library/functions.rst:1792 msgid "" -"Return a new :class:`set` object, optionally with elements taken from " -"*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" -"set` for documentation about this class." +"Return a new :class:`set` object, optionally with elements taken from *iterable*. ``set`` is a built-in class. " +"See :class:`set` and :ref:`types-set` for documentation about this class." msgstr "" #: ../../library/functions.rst:1796 msgid "" -"For other containers see the built-" -"in :class:`frozenset`, :class:`list`, :class:`tuple`, and :class:`dict` " -"classes, as well as the :mod:`collections` module." +"For other containers see the built-in :class:`frozenset`, :class:`list`, :class:`tuple`, and :class:`dict` classes, " +"as well as the :mod:`collections` module." msgstr "" #: ../../library/functions.rst:1803 msgid "" -"This is the counterpart of :func:`getattr`. The arguments are an object, a " -"string, and an arbitrary value. The string may name an existing attribute " -"or a new attribute. The function assigns the value to the attribute, " -"provided the object allows it. For example, ``setattr(x, 'foobar', 123)`` " -"is equivalent to ``x.foobar = 123``." +"This is the counterpart of :func:`getattr`. The arguments are an object, a string, and an arbitrary value. The " +"string may name an existing attribute or a new attribute. The function assigns the value to the attribute, provided " +"the object allows it. For example, ``setattr(x, 'foobar', 123)`` is equivalent to ``x.foobar = 123``." msgstr "" #: ../../library/functions.rst:1809 msgid "" -"*name* need not be a Python identifier as defined in :ref:`identifiers` " -"unless the object chooses to enforce that, for example in a " -"custom :meth:`~object.__getattribute__` or via :attr:`~object.__slots__`. An " -"attribute whose name is not an identifier will not be accessible using the " -"dot notation, but is accessible through :func:`getattr` etc.." +"*name* need not be a Python identifier as defined in :ref:`identifiers` unless the object chooses to enforce that, " +"for example in a custom :meth:`~object.__getattribute__` or via :attr:`~object.__slots__`. An attribute whose name " +"is not an identifier will not be accessible using the dot notation, but is accessible through :func:`getattr` etc.." msgstr "" #: ../../library/functions.rst:1817 msgid "" -"Since :ref:`private name mangling ` happens at " -"compilation time, one must manually mangle a private attribute's (attributes " -"with two leading underscores) name in order to set it with :func:`setattr`." +"Since :ref:`private name mangling ` happens at compilation time, one must manually mangle a " +"private attribute's (attributes with two leading underscores) name in order to set it with :func:`setattr`." msgstr "" #: ../../library/functions.rst:1826 msgid "" -"Return a :term:`slice` object representing the set of indices specified by " -"``range(start, stop, step)``. The *start* and *step* arguments default to " -"``None``." +"Return a :term:`slice` object representing the set of indices specified by ``range(start, stop, step)``. The " +"*start* and *step* arguments default to ``None``." msgstr "" #: ../../library/functions.rst:1834 msgid "" -"Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, " -"and :attr:`!step` which merely return the argument values (or their " -"default). They have no other explicit functionality; however, they are used " -"by NumPy and other third-party packages." +"Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, and :attr:`!step` which merely return " +"the argument values (or their default). They have no other explicit functionality; however, they are used by NumPy " +"and other third-party packages." msgstr "" #: ../../library/functions.rst:1839 msgid "" -"Slice objects are also generated when extended indexing syntax is used. For " -"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. " -"See :func:`itertools.islice` for an alternate version that returns " -"an :term:`iterator`." +"Slice objects are also generated when extended indexing syntax is used. For example: ``a[start:stop:step]`` or " +"``a[start:stop, i]``. See :func:`itertools.islice` for an alternate version that returns an :term:`iterator`." msgstr "" #: ../../library/functions.rst:1844 msgid "" -"Slice objects are now :term:`hashable` " -"(provided :attr:`~slice.start`, :attr:`~slice.stop`, and :attr:`~slice.step` " +"Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:`~slice.stop`, and :attr:`~slice.step` " "are hashable)." msgstr "" @@ -3165,53 +2691,43 @@ msgid "Return a new sorted list from the items in *iterable*." msgstr "" #: ../../library/functions.rst:1852 -msgid "" -"Has two optional arguments which must be specified as keyword arguments." +msgid "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" #: ../../library/functions.rst:1854 msgid "" -"*key* specifies a function of one argument that is used to extract a " -"comparison key from each element in *iterable* (for example, " -"``key=str.lower``). The default value is ``None`` (compare the elements " -"directly)." +"*key* specifies a function of one argument that is used to extract a comparison key from each element in *iterable* " +"(for example, ``key=str.lower``). The default value is ``None`` (compare the elements directly)." msgstr "" #: ../../library/functions.rst:1858 msgid "" -"*reverse* is a boolean value. If set to ``True``, then the list elements " -"are sorted as if each comparison were reversed." +"*reverse* is a boolean value. If set to ``True``, then the list elements are sorted as if each comparison were " +"reversed." msgstr "" #: ../../library/functions.rst:1861 -msgid "" -"Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " -"*key* function." +msgid "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a *key* function." msgstr "" #: ../../library/functions.rst:1864 msgid "" -"The built-in :func:`sorted` function is guaranteed to be stable. A sort is " -"stable if it guarantees not to change the relative order of elements that " -"compare equal --- this is helpful for sorting in multiple passes (for " -"example, sort by department, then by salary grade)." +"The built-in :func:`sorted` function is guaranteed to be stable. A sort is stable if it guarantees not to change the " +"relative order of elements that compare equal --- this is helpful for sorting in multiple passes (for example, sort " +"by department, then by salary grade)." msgstr "" #: ../../library/functions.rst:1869 msgid "" -"The sort algorithm uses only ``<`` comparisons between items. While " -"defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " -"recommends that all six :ref:`rich comparisons ` be " -"implemented. This will help avoid bugs when using the same data with other " -"ordering tools such as :func:`max` that rely on a different underlying " -"method. Implementing all six comparisons also helps avoid confusion for " -"mixed type comparisons which can call reflected the :meth:`~object.__gt__` " -"method." +"The sort algorithm uses only ``<`` comparisons between items. While defining an :meth:`~object.__lt__` method will " +"suffice for sorting, :PEP:`8` recommends that all six :ref:`rich comparisons ` be implemented. This " +"will help avoid bugs when using the same data with other ordering tools such as :func:`max` that rely on a different " +"underlying method. Implementing all six comparisons also helps avoid confusion for mixed type comparisons which can " +"call reflected the :meth:`~object.__gt__` method." msgstr "" #: ../../library/functions.rst:1878 -msgid "" -"For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." +msgid "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" #: ../../library/functions.rst:1882 @@ -3219,9 +2735,7 @@ msgid "Transform a method into a static method." msgstr "" #: ../../library/functions.rst:1884 -msgid "" -"A static method does not receive an implicit first argument. To declare a " -"static method, use this idiom::" +msgid "A static method does not receive an implicit first argument. To declare a static method, use this idiom::" msgstr "" #: ../../library/functions.rst:1887 @@ -3235,35 +2749,27 @@ msgstr "" " def f(arg1, arg2, argN): ..." #: ../../library/functions.rst:1891 -msgid "" -"The ``@staticmethod`` form is a function :term:`decorator` -- " -"see :ref:`function` for details." -msgstr "" -"``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" -"的詳細介紹。" +msgid "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:`function` for details." +msgstr "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中的詳細介紹。" #: ../../library/functions.rst:1894 msgid "" -"A static method can be called either on the class (such as ``C.f()``) or on " -"an instance (such as ``C().f()``). Moreover, the static " -"method :term:`descriptor` is also callable, so it can be used in the class " -"definition (such as ``f()``)." +"A static method can be called either on the class (such as ``C.f()``) or on an instance (such as ``C().f()``). " +"Moreover, the static method :term:`descriptor` is also callable, so it can be used in the class definition (such as " +"``f()``)." msgstr "" #: ../../library/functions.rst:1899 msgid "" -"Static methods in Python are similar to those found in Java or C++. Also, " -"see :func:`classmethod` for a variant that is useful for creating alternate " -"class constructors." +"Static methods in Python are similar to those found in Java or C++. Also, see :func:`classmethod` for a variant that " +"is useful for creating alternate class constructors." msgstr "" #: ../../library/functions.rst:1903 msgid "" -"Like all decorators, it is also possible to call ``staticmethod`` as a " -"regular function and do something with its result. This is needed in some " -"cases where you need a reference to a function from a class body and you " -"want to avoid the automatic transformation to instance method. For these " -"cases, use this idiom::" +"Like all decorators, it is also possible to call ``staticmethod`` as a regular function and do something with its " +"result. This is needed in some cases where you need a reference to a function from a class body and you want to " +"avoid the automatic transformation to instance method. For these cases, use this idiom::" msgstr "" #: ../../library/functions.rst:1909 @@ -3288,39 +2794,32 @@ msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" msgid "" "Static methods now inherit the method attributes " "(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " -"and :attr:`~function.__annotations__`), have a new ``__wrapped__`` " -"attribute, and are now callable as regular functions." +"and :attr:`~function.__annotations__`), have a new ``__wrapped__`` attribute, and are now callable as regular " +"functions." msgstr "" "Static method 現在繼承了 method 屬性" "(:attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__doc__` " -"和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性," -"且為如一般函式的可呼叫物件。" +"和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性,且為如一般函式的可呼叫物件。" #: ../../library/functions.rst:1933 -msgid "" -"Return a :class:`str` version of *object*. See :func:`str` for details." +msgid "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" #: ../../library/functions.rst:1935 -msgid "" -"``str`` is the built-in string :term:`class`. For general information about " -"strings, see :ref:`textseq`." +msgid "``str`` is the built-in string :term:`class`. For general information about strings, see :ref:`textseq`." msgstr "" #: ../../library/functions.rst:1941 msgid "" -"Sums *start* and the items of an *iterable* from left to right and returns " -"the total. The *iterable*'s items are normally numbers, and the start value " -"is not allowed to be a string." +"Sums *start* and the items of an *iterable* from left to right and returns the total. The *iterable*'s items are " +"normally numbers, and the start value is not allowed to be a string." msgstr "" #: ../../library/functions.rst:1945 msgid "" -"For some use cases, there are good alternatives to :func:`sum`. The " -"preferred, fast way to concatenate a sequence of strings is by calling " -"``''.join(sequence)``. To add floating-point values with extended " -"precision, see :func:`math.fsum`\\. To concatenate a series of iterables, " -"consider using :func:`itertools.chain`." +"For some use cases, there are good alternatives to :func:`sum`. The preferred, fast way to concatenate a sequence of " +"strings is by calling ``''.join(sequence)``. To add floating-point values with extended precision, " +"see :func:`math.fsum`\\. To concatenate a series of iterables, consider using :func:`itertools.chain`." msgstr "" #: ../../library/functions.rst:1951 @@ -3329,75 +2828,64 @@ msgstr "*start* 參數可被指定為關鍵字引數。" #: ../../library/functions.rst:1954 msgid "" -"Summation of floats switched to an algorithm that gives higher accuracy and " -"better commutativity on most builds." +"Summation of floats switched to an algorithm that gives higher accuracy and better commutativity on most builds." msgstr "" #: ../../library/functions.rst:1961 msgid "" -"Return a proxy object that delegates method calls to a parent or sibling " -"class of *type*. This is useful for accessing inherited methods that have " -"been overridden in a class." +"Return a proxy object that delegates method calls to a parent or sibling class of *type*. This is useful for " +"accessing inherited methods that have been overridden in a class." msgstr "" #: ../../library/functions.rst:1965 msgid "" -"The *object_or_type* determines the :term:`method resolution order` to be " -"searched. The search starts from the class right after the *type*." +"The *object_or_type* determines the :term:`method resolution order` to be searched. The search starts from the " +"class right after the *type*." msgstr "" #: ../../library/functions.rst:1969 msgid "" -"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C " -"-> A -> object`` and the value of *type* is ``B``, then :func:`super` " -"searches ``C -> A -> object``." +"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -> A -> object`` and the value of *type* " +"is ``B``, then :func:`super` searches ``C -> A -> object``." msgstr "" #: ../../library/functions.rst:1973 msgid "" -"The :attr:`~type.__mro__` attribute of the class corresponding to " -"*object_or_type* lists the method resolution search order used by " -"both :func:`getattr` and :func:`super`. The attribute is dynamic and can " -"change whenever the inheritance hierarchy is updated." +"The :attr:`~type.__mro__` attribute of the class corresponding to *object_or_type* lists the method resolution " +"search order used by both :func:`getattr` and :func:`super`. The attribute is dynamic and can change whenever the " +"inheritance hierarchy is updated." msgstr "" #: ../../library/functions.rst:1978 msgid "" -"If the second argument is omitted, the super object returned is unbound. If " -"the second argument is an object, ``isinstance(obj, type)`` must be true. " -"If the second argument is a type, ``issubclass(type2, type)`` must be true " +"If the second argument is omitted, the super object returned is unbound. If the second argument is an object, " +"``isinstance(obj, type)`` must be true. If the second argument is a type, ``issubclass(type2, type)`` must be true " "(this is useful for classmethods)." msgstr "" #: ../../library/functions.rst:1983 msgid "" -"When called directly within an ordinary method of a class, both arguments " -"may be omitted (\"zero-argument :func:`!super`\"). In this case, *type* will " -"be the enclosing class, and *obj* will be the first argument of the " -"immediately enclosing function (typically ``self``). (This means that zero-" -"argument :func:`!super` will not work as expected within nested functions, " -"including generator expressions, which implicitly create nested functions.)" +"When called directly within an ordinary method of a class, both arguments may be omitted (\"zero-argument :func:`!" +"super`\"). In this case, *type* will be the enclosing class, and *obj* will be the first argument of the immediately " +"enclosing function (typically ``self``). (This means that zero-argument :func:`!super` will not work as expected " +"within nested functions, including generator expressions, which implicitly create nested functions.)" msgstr "" #: ../../library/functions.rst:1990 msgid "" -"There are two typical use cases for *super*. In a class hierarchy with " -"single inheritance, *super* can be used to refer to parent classes without " -"naming them explicitly, thus making the code more maintainable. This use " -"closely parallels the use of *super* in other programming languages." +"There are two typical use cases for *super*. In a class hierarchy with single inheritance, *super* can be used to " +"refer to parent classes without naming them explicitly, thus making the code more maintainable. This use closely " +"parallels the use of *super* in other programming languages." msgstr "" #: ../../library/functions.rst:1995 msgid "" -"The second use case is to support cooperative multiple inheritance in a " -"dynamic execution environment. This use case is unique to Python and is not " -"found in statically compiled languages or languages that only support single " -"inheritance. This makes it possible to implement \"diamond diagrams\" where " -"multiple base classes implement the same method. Good design dictates that " -"such implementations have the same calling signature in every case (because " -"the order of calls is determined at runtime, because that order adapts to " -"changes in the class hierarchy, and because that order can include sibling " -"classes that are unknown prior to runtime)." +"The second use case is to support cooperative multiple inheritance in a dynamic execution environment. This use " +"case is unique to Python and is not found in statically compiled languages or languages that only support single " +"inheritance. This makes it possible to implement \"diamond diagrams\" where multiple base classes implement the " +"same method. Good design dictates that such implementations have the same calling signature in every case (because " +"the order of calls is determined at runtime, because that order adapts to changes in the class hierarchy, and " +"because that order can include sibling classes that are unknown prior to runtime)." msgstr "" #: ../../library/functions.rst:2005 @@ -3414,68 +2902,58 @@ msgstr "" #: ../../library/functions.rst:2012 msgid "" -"In addition to method lookups, :func:`super` also works for attribute " -"lookups. One possible use case for this is calling :term:`descriptors " -"` in a parent or sibling class." +"In addition to method lookups, :func:`super` also works for attribute lookups. One possible use case for this is " +"calling :term:`descriptors ` in a parent or sibling class." msgstr "" #: ../../library/functions.rst:2016 msgid "" -"Note that :func:`super` is implemented as part of the binding process for " -"explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " -"does so by implementing its own :meth:`~object.__getattribute__` method for " -"searching classes in a predictable order that supports cooperative multiple " -"inheritance. Accordingly, :func:`super` is undefined for implicit lookups " -"using statements or operators such as ``super()[name]``." +"Note that :func:`super` is implemented as part of the binding process for explicit dotted attribute lookups such as " +"``super().__getitem__(name)``. It does so by implementing its own :meth:`~object.__getattribute__` method for " +"searching classes in a predictable order that supports cooperative multiple inheritance. Accordingly, :func:`super` " +"is undefined for implicit lookups using statements or operators such as ``super()[name]``." msgstr "" #: ../../library/functions.rst:2024 msgid "" -"Also note that, aside from the zero argument form, :func:`super` is not " -"limited to use inside methods. The two argument form specifies the " -"arguments exactly and makes the appropriate references. The zero argument " -"form only works inside a class definition, as the compiler fills in the " -"necessary details to correctly retrieve the class being defined, as well as " -"accessing the current instance for ordinary methods." +"Also note that, aside from the zero argument form, :func:`super` is not limited to use inside methods. The two " +"argument form specifies the arguments exactly and makes the appropriate references. The zero argument form only " +"works inside a class definition, as the compiler fills in the necessary details to correctly retrieve the class " +"being defined, as well as accessing the current instance for ordinary methods." msgstr "" #: ../../library/functions.rst:2031 msgid "" -"For practical suggestions on how to design cooperative classes " -"using :func:`super`, see `guide to using super() `_." +"For practical suggestions on how to design cooperative classes using :func:`super`, see `guide to using super() " +"`_." msgstr "" #: ../../library/functions.rst:2041 msgid "" -"Rather than being a function, :class:`tuple` is actually an immutable " -"sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." +"Rather than being a function, :class:`tuple` is actually an immutable sequence type, as documented in :ref:`typesseq-" +"tuple` and :ref:`typesseq`." msgstr "" #: ../../library/functions.rst:2050 msgid "" -"With one argument, return the type of an *object*. The return value is a " -"type object and generally the same object as returned " -"by :attr:`object.__class__`." +"With one argument, return the type of an *object*. The return value is a type object and generally the same object " +"as returned by :attr:`object.__class__`." msgstr "" #: ../../library/functions.rst:2054 msgid "" -"The :func:`isinstance` built-in function is recommended for testing the type " -"of an object, because it takes subclasses into account." +"The :func:`isinstance` built-in function is recommended for testing the type of an object, because it takes " +"subclasses into account." msgstr "" #: ../../library/functions.rst:2057 msgid "" -"With three arguments, return a new type object. This is essentially a " -"dynamic form of the :keyword:`class` statement. The *name* string is the " -"class name and becomes the :attr:`~type.__name__` attribute. The *bases* " -"tuple contains the base classes and becomes the :attr:`~type.__bases__` " -"attribute; if empty, :class:`object`, the ultimate base of all classes, is " -"added. The *dict* dictionary contains attribute and method definitions for " -"the class body; it may be copied or wrapped before becoming " -"the :attr:`~type.__dict__` attribute. The following two statements create " -"identical :class:`!type` objects:" +"With three arguments, return a new type object. This is essentially a dynamic form of the :keyword:`class` " +"statement. The *name* string is the class name and becomes the :attr:`~type.__name__` attribute. The *bases* tuple " +"contains the base classes and becomes the :attr:`~type.__bases__` attribute; if empty, :class:`object`, the ultimate " +"base of all classes, is added. The *dict* dictionary contains attribute and method definitions for the class body; " +"it may be copied or wrapped before becoming the :attr:`~type.__dict__` attribute. The following two statements " +"create identical :class:`!type` objects:" msgstr "" #: ../../library/functions.rst:2072 @@ -3483,9 +2961,7 @@ msgid "See also:" msgstr "" #: ../../library/functions.rst:2074 -msgid "" -":ref:`Documentation on attributes and methods on classes `." +msgid ":ref:`Documentation on attributes and methods on classes `." msgstr "" #: ../../library/functions.rst:2075 @@ -3494,10 +2970,9 @@ msgstr ":ref:`bltin-type-objects`" #: ../../library/functions.rst:2077 msgid "" -"Keyword arguments provided to the three argument form are passed to the " -"appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " -"in the same way that keywords in a class definition (besides *metaclass*) " -"would." +"Keyword arguments provided to the three argument form are passed to the appropriate metaclass machinery " +"(usually :meth:`~object.__init_subclass__`) in the same way that keywords in a class definition (besides " +"*metaclass*) would." msgstr "" #: ../../library/functions.rst:2082 @@ -3506,23 +2981,21 @@ msgstr "另請參閱 :ref:`class-customization`。" #: ../../library/functions.rst:2084 msgid "" -"Subclasses of :class:`!type` which don't override ``type.__new__`` may no " -"longer use the one-argument form to get the type of an object." +"Subclasses of :class:`!type` which don't override ``type.__new__`` may no longer use the one-argument form to get " +"the type of an object." msgstr "" #: ../../library/functions.rst:2091 msgid "" -"Return the :attr:`~object.__dict__` attribute for a module, class, instance, " -"or any other object with a :attr:`!__dict__` attribute." +"Return the :attr:`~object.__dict__` attribute for a module, class, instance, or any other object with a :attr:`!" +"__dict__` attribute." msgstr "" #: ../../library/functions.rst:2094 msgid "" -"Objects such as modules and instances have an " -"updateable :attr:`~object.__dict__` attribute; however, other objects may " -"have write restrictions on their :attr:`!__dict__` attributes (for example, " -"classes use a :class:`types.MappingProxyType` to prevent direct dictionary " -"updates)." +"Objects such as modules and instances have an updateable :attr:`~object.__dict__` attribute; however, other objects " +"may have write restrictions on their :attr:`!__dict__` attributes (for example, classes use " +"a :class:`types.MappingProxyType` to prevent direct dictionary updates)." msgstr "" #: ../../library/functions.rst:2099 @@ -3531,21 +3004,17 @@ msgstr "" #: ../../library/functions.rst:2101 msgid "" -"A :exc:`TypeError` exception is raised if an object is specified but it " -"doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " -"defines the :attr:`~object.__slots__` attribute)." +"A :exc:`TypeError` exception is raised if an object is specified but it doesn't have a :attr:`~object.__dict__` " +"attribute (for example, if its class defines the :attr:`~object.__slots__` attribute)." msgstr "" #: ../../library/functions.rst:2107 msgid "" -"The result of calling this function without an argument has been updated as " -"described for the :func:`locals` builtin." +"The result of calling this function without an argument has been updated as described for the :func:`locals` builtin." msgstr "" #: ../../library/functions.rst:2113 -msgid "" -"Iterate over several iterables in parallel, producing tuples with an item " -"from each one." +msgid "Iterate over several iterables in parallel, producing tuples with an item from each one." msgstr "" #: ../../library/functions.rst:2116 @@ -3570,38 +3039,36 @@ msgstr "" #: ../../library/functions.rst:2125 msgid "" -"More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " -"tuple contains the *i*-th element from each of the argument iterables." +"More formally: :func:`zip` returns an iterator of tuples, where the *i*-th tuple contains the *i*-th element from " +"each of the argument iterables." msgstr "" #: ../../library/functions.rst:2128 msgid "" -"Another way to think of :func:`zip` is that it turns rows into columns, and " -"columns into rows. This is similar to `transposing a matrix `_." +"Another way to think of :func:`zip` is that it turns rows into columns, and columns into rows. This is similar to " +"`transposing a matrix `_." msgstr "" #: ../../library/functions.rst:2132 msgid "" -":func:`zip` is lazy: The elements won't be processed until the iterable is " -"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in " -"a :class:`list`." +":func:`zip` is lazy: The elements won't be processed until the iterable is iterated on, e.g. by a :keyword:`!for` " +"loop or by wrapping in a :class:`list`." msgstr "" #: ../../library/functions.rst:2136 msgid "" -"One thing to consider is that the iterables passed to :func:`zip` could have " -"different lengths; sometimes by design, and sometimes because of a bug in " -"the code that prepared these iterables. Python offers three different " -"approaches to dealing with this issue:" +"One thing to consider is that the iterables passed to :func:`zip` could have different lengths; sometimes by design, " +"and sometimes because of a bug in the code that prepared these iterables. Python offers three different approaches " +"to dealing with this issue:" msgstr "" #: ../../library/functions.rst:2141 msgid "" -"By default, :func:`zip` stops when the shortest iterable is exhausted. It " -"will ignore the remaining items in the longer iterables, cutting off the " -"result to the length of the shortest iterable::" +"By default, :func:`zip` stops when the shortest iterable is exhausted. It will ignore the remaining items in the " +"longer iterables, cutting off the result to the length of the shortest iterable::" msgstr "" +"預設情況下, :func:`zip` 會在最短的迭代項用盡時停止。它會忽略較長可迭代項中的剩餘項目,將結果切斷到最短可迭代項的長" +"度:" #: ../../library/functions.rst:2145 msgid "" @@ -3613,10 +3080,11 @@ msgstr "" #: ../../library/functions.rst:2148 msgid "" -":func:`zip` is often used in cases where the iterables are assumed to be of " -"equal length. In such cases, it's recommended to use the ``strict=True`` " -"option. Its output is the same as regular :func:`zip`::" +":func:`zip` is often used in cases where the iterables are assumed to be of equal length. In such cases, it's " +"recommended to use the ``strict=True`` option. Its output is the same as regular :func:`zip`::" msgstr "" +":func:`zip` 常常用於迭代物件假設等長的情況。在這種情況下,建議使用 ``strict=True`` 選項。它的輸出與一般" +"的 :func:`zip`: 相同:" #: ../../library/functions.rst:2152 msgid "" @@ -3627,49 +3095,47 @@ msgstr "" "[('a', 1), ('b', 2), ('c', 3)]" #: ../../library/functions.rst:2155 -msgid "" -"Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " -"is exhausted before the others:" -msgstr "" +msgid "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable is exhausted before the others:" +msgstr "與預設行為不同的是,如果有一個疊代先於其他疊代結束,它會產生 :exc:`ValueError`:" #: ../../library/functions.rst:2173 msgid "" -"Without the ``strict=True`` argument, any bug that results in iterables of " -"different lengths will be silenced, possibly manifesting as a hard-to-find " -"bug in another part of the program." +"Without the ``strict=True`` argument, any bug that results in iterables of different lengths will be silenced, " +"possibly manifesting as a hard-to-find bug in another part of the program." msgstr "" +"如果沒有 ``strict=True`` 參數,任何導致迭代式長度不同的 bug 都會被壓制,可能會在程式的其他部分表現為難以發現的 bug。" #: ../../library/functions.rst:2177 msgid "" -"Shorter iterables can be padded with a constant value to make all the " -"iterables have the same length. This is done " +"Shorter iterables can be padded with a constant value to make all the iterables have the same length. This is done " "by :func:`itertools.zip_longest`." -msgstr "" +msgstr "較短的迭代式可以填充常數值,使所有迭代式的長度相同。這可以透過 :func:`itertools.zip_longest` 來完成。" #: ../../library/functions.rst:2181 msgid "" -"Edge cases: With a single iterable argument, :func:`zip` returns an iterator " -"of 1-tuples. With no arguments, it returns an empty iterator." +"Edge cases: With a single iterable argument, :func:`zip` returns an iterator of 1-tuples. With no arguments, it " +"returns an empty iterator." msgstr "" +"邊緣情況: 對於單一可疊代參數,:func:`zip` 會返回一個 1-tuples 的迭代器。如果沒有參數,它會返回一個空的迭代器。" #: ../../library/functions.rst:2184 msgid "Tips and tricks:" -msgstr "" +msgstr "秘訣與技巧:" #: ../../library/functions.rst:2186 msgid "" -"The left-to-right evaluation order of the iterables is guaranteed. This " -"makes possible an idiom for clustering a data series into n-length groups " -"using ``zip(*[iter(s)]*n, strict=True)``. This repeats the *same* iterator " -"``n`` times so that each output tuple has the result of ``n`` calls to the " -"iterator. This has the effect of dividing the input into n-length chunks." +"The left-to-right evaluation order of the iterables is guaranteed. This makes possible an idiom for clustering a " +"data series into n-length groups using ``zip(*[iter(s)]*n, strict=True)``. This repeats the *same* iterator ``n`` " +"times so that each output tuple has the result of ``n`` calls to the iterator. This has the effect of dividing the " +"input into n-length chunks." msgstr "" +"迭代項的從左至右評估順序是有保證的。這使得使用``zip(*[iter(s)]*n, strict=True)``將資料序列聚類為 n 個長度的群組的習慣" +"成為可能。這會重複 * 相同的迭代器 ``n`` 次,因此每個輸出元組會有 ``n`` 次呼叫迭代器的結果。這樣做的效果是將輸入分割" +"成 n 個長度的區塊。" #: ../../library/functions.rst:2192 -msgid "" -":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " -"list::" -msgstr "" +msgid ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a list::" +msgstr ":func:`zip` 與 ``*`` 運算符號結合可以用來解壓縮(unzip) list::" #: ../../library/functions.rst:2195 msgid "" @@ -3695,54 +3161,55 @@ msgstr "增加了 ``strict`` 引數。" #: ../../library/functions.rst:2215 msgid "" -"This is an advanced function that is not needed in everyday Python " -"programming, unlike :func:`importlib.import_module`." -msgstr "" +"This is an advanced function that is not needed in everyday Python programming, " +"unlike :func:`importlib.import_module`." +msgstr "這是一個進階的函式,不像 :func:`importlib.import_module`,這在日常 Python 程式設計中並不需要。" #: ../../library/functions.rst:2218 msgid "" -"This function is invoked by the :keyword:`import` statement. It can be " -"replaced (by importing the :mod:`builtins` module and assigning to " -"``builtins.__import__``) in order to change semantics of the :keyword:`!" -"import` statement, but doing so is **strongly** discouraged as it is usually " -"simpler to use import hooks (see :pep:`302`) to attain the same goals and " -"does not cause issues with code which assumes the default import " -"implementation is in use. Direct use of :func:`__import__` is also " -"discouraged in favor of :func:`importlib.import_module`." +"This function is invoked by the :keyword:`import` statement. It can be replaced (by importing the :mod:`builtins` " +"module and assigning to ``builtins.__import__``) in order to change semantics of the :keyword:`!import` statement, " +"but doing so is **strongly** discouraged as it is usually simpler to use import hooks (see :pep:`302`) to attain the " +"same goals and does not cause issues with code which assumes the default import implementation is in use. Direct " +"use of :func:`__import__` is also discouraged in favor of :func:`importlib.import_module`." msgstr "" +"這個函式被 :keyword:`import` 語句所呼叫。它可以被取代 (透過匯入 :mod:`builtins` 模組並指定給 " +"``builtins.__import__``),以改變 :keyword:`!import` 語句的語義,但這樣做是**強烈**不鼓勵的,因為通常使用 import 鉤子 " +"(見 :pep:`302`)來達到相同的目的會比較簡單,而且也不會造成假設使用預設 import 實作的程式碼問題。我們也不鼓勵直接使" +"用 :func:`__import__`,而應改用 :func:`importlib.import_module`。" #: ../../library/functions.rst:2227 msgid "" -"The function imports the module *name*, potentially using the given " -"*globals* and *locals* to determine how to interpret the name in a package " -"context. The *fromlist* gives the names of objects or submodules that should " -"be imported from the module given by *name*. The standard implementation " -"does not use its *locals* argument at all and uses its *globals* only to " -"determine the package context of the :keyword:`import` statement." +"The function imports the module *name*, potentially using the given *globals* and *locals* to determine how to " +"interpret the name in a package context. The *fromlist* gives the names of objects or submodules that should be " +"imported from the module given by *name*. The standard implementation does not use its *locals* argument at all and " +"uses its *globals* only to determine the package context of the :keyword:`import` statement." msgstr "" +"這個函式引入 *name* 模組,可能會使用給定的 *globals* 和 *locals* 來決定如何在套件上下文中解釋這個名稱。*fromlist* 給" +"出應該從 *name* 給出的模組匯入的物件或子模組的名稱。標準的實作完全不使用 *locals* 參數,而只使用 *globals* 來決" +"定 :keyword:`import` 語句的套件上下文。" #: ../../library/functions.rst:2234 msgid "" -"*level* specifies whether to use absolute or relative imports. ``0`` (the " -"default) means only perform absolute imports. Positive values for *level* " -"indicate the number of parent directories to search relative to the " -"directory of the module calling :func:`__import__` (see :pep:`328` for the " -"details)." +"*level* specifies whether to use absolute or relative imports. ``0`` (the default) means only perform absolute " +"imports. Positive values for *level* indicate the number of parent directories to search relative to the directory " +"of the module calling :func:`__import__` (see :pep:`328` for the details)." msgstr "" +"*level* 指定使用絕對或相對引入。``0``(預設)表示只執行絕對引入。*level* 的正值表示相对于调用 :func:`__import__` 的模" +"块目录要搜索的父目录数目 (参见 :pep:`328` 以了解详情)。" #: ../../library/functions.rst:2240 msgid "" -"When the *name* variable is of the form ``package.module``, normally, the " -"top-level package (the name up till the first dot) is returned, *not* the " -"module named by *name*. However, when a non-empty *fromlist* argument is " -"given, the module named by *name* is returned." +"When the *name* variable is of the form ``package.module``, normally, the top-level package (the name up till the " +"first dot) is returned, *not* the module named by *name*. However, when a non-empty *fromlist* argument is given, " +"the module named by *name* is returned." msgstr "" +"當 *name* 變數的形式是 ``package.module`` 時,通常會回傳最上層的套件 (直到第一個點為止的名稱),而不是 *name* 所命名的" +"模組。然而,當給予一個非空的 *fromlist* 參數時,會返回以 *name* 命名的模組。" #: ../../library/functions.rst:2245 -msgid "" -"For example, the statement ``import spam`` results in bytecode resembling " -"the following code::" -msgstr "" +msgid "For example, the statement ``import spam`` results in bytecode resembling the following code::" +msgstr "例如,語句 ``import spam`` 會產生類似以下程式碼的字節碼(bytecode):" #: ../../library/functions.rst:2248 msgid "spam = __import__('spam', globals(), locals(), [], 0)" @@ -3750,7 +3217,7 @@ msgstr "spam = __import__('spam', globals(), locals(), [], 0)" #: ../../library/functions.rst:2250 msgid "The statement ``import spam.ham`` results in this call::" -msgstr "" +msgstr "語句 ``import spam.ham`` 的結果是這樣的呼叫:" #: ../../library/functions.rst:2252 msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" @@ -3758,15 +3225,15 @@ msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" #: ../../library/functions.rst:2254 msgid "" -"Note how :func:`__import__` returns the toplevel module here because this is " -"the object that is bound to a name by the :keyword:`import` statement." +"Note how :func:`__import__` returns the toplevel module here because this is the object that is bound to a name by " +"the :keyword:`import` statement." msgstr "" +"請注意 :func:`__import__` 在這裡如何返回頂層模組(toplevel module),因為這是由 :keyword:`import` 語句綁定名稱的物" +"件。" #: ../../library/functions.rst:2257 -msgid "" -"On the other hand, the statement ``from spam.ham import eggs, sausage as " -"saus`` results in ::" -msgstr "" +msgid "On the other hand, the statement ``from spam.ham import eggs, sausage as saus`` results in ::" +msgstr "另一方面,語句 ``from spam.ham import eggs, sausage as saus`` 結果是:" #: ../../library/functions.rst:2260 msgid "" @@ -3780,28 +3247,25 @@ msgstr "" #: ../../library/functions.rst:2264 msgid "" -"Here, the ``spam.ham`` module is returned from :func:`__import__`. From " -"this object, the names to import are retrieved and assigned to their " -"respective names." +"Here, the ``spam.ham`` module is returned from :func:`__import__`. From this object, the names to import are " +"retrieved and assigned to their respective names." msgstr "" +"這裡,``spam.ham`` 模組會從 :func:`__import__` 回傳。從這個物件,要引入的名稱會被擷取,並指定給它們各自的名稱。" #: ../../library/functions.rst:2268 msgid "" -"If you simply want to import a module (potentially within a package) by " -"name, use :func:`importlib.import_module`." -msgstr "" +"If you simply want to import a module (potentially within a package) by name, use :func:`importlib.import_module`." +msgstr "如果您只想依名引入一個模組 (可能在套件中),請使用 :func:`importlib.import_module`。" #: ../../library/functions.rst:2271 -msgid "" -"Negative values for *level* are no longer supported (which also changes the " -"default value to 0)." -msgstr "" +msgid "Negative values for *level* are no longer supported (which also changes the default value to 0)." +msgstr "不再支援 *level* 的負值 (這也將預設值變為 0)。" #: ../../library/functions.rst:2275 msgid "" -"When the command line options :option:`-E` or :option:`-I` are being used, " -"the environment variable :envvar:`PYTHONCASEOK` is now ignored." -msgstr "" +"When the command line options :option:`-E` or :option:`-I` are being used, the environment " +"variable :envvar:`PYTHONCASEOK` is now ignored." +msgstr "當使用命令列選項 :option:`-E` 或 :option:`-I` 時,環境變數 :envvar:`PYTHONCASEOK` 現在會被忽略。" #: ../../library/functions.rst:2280 msgid "Footnotes" @@ -3809,12 +3273,11 @@ msgstr "註解" #: ../../library/functions.rst:2281 msgid "" -"Note that the parser only accepts the Unix-style end of line convention. If " -"you are reading the code from a file, make sure to use newline conversion " -"mode to convert Windows or Mac-style newlines." +"Note that the parser only accepts the Unix-style end of line convention. If you are reading the code from a file, " +"make sure to use newline conversion mode to convert Windows or Mac-style newlines." msgstr "" -"剖析器只接受 Unix 風格的行結束符。如果你從檔案中讀取程式碼,請確保用換行符號" -"轉換模式轉換 Windows 或 Mac 風格的換行符號。" +"剖析器只接受 Unix 風格的行結束符。如果你從檔案中讀取程式碼,請確保用換行符號轉換模式轉換 Windows 或 Mac 風格的換行符" +"號。" #: ../../library/functions.rst:154 msgid "Boolean"