diff --git a/library/functions.po b/library/functions.po index edd3866bd1..afc1672055 100644 --- a/library/functions.po +++ b/library/functions.po @@ -5,6 +5,7 @@ # nienzu , 2018 # Matt Wang , 2021 # Phil Lin , 2022 +# Steven Hsu , 2023 msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" @@ -536,7 +537,7 @@ msgid "" "envvar:`PYTHONBREAKPOINT` environment variable. See :func:`sys." "breakpointhook` for usage details." msgstr "" -"預設情況下,:func:`breakpoint` 的行為可以通過 :envvar:`PYTHONBREAKPOINT` 環境" +"預設情況下,:func:`breakpoint` 的行為可以透過 :envvar:`PYTHONBREAKPOINT` 環境" "變數來更改。有關使用詳情,請參考 :func:`sys.breakpointhook`。" #: ../../library/functions.rst:177 @@ -578,8 +579,8 @@ msgid "" "using :meth:`str.encode`." msgstr "" "如果是一個 *string*,你必須提供 *encoding* 參數(以及選擇性地提供 " -"*errors* );\\ :func:`bytearray` 會使用 :meth:`str.encode` method 來將 " -"string 轉變成 bytes。" +"*errors* );:func:`bytearray` 會使用 :meth:`str.encode` method 來將 string " +"轉變成 bytes。" #: ../../library/functions.rst:202 msgid "" @@ -671,7 +672,7 @@ msgid "" "base 16). :exc:`ValueError` will be raised if *i* is outside that range." msgstr "" "引數的有效範圍是 0 到 1,114,111(16 進制表示為 0x10FFFF)。如果 *i* 超過這個" -"範圍,會觸發 :exc:`ValueError`。" +"範圍,會引發 :exc:`ValueError`。" #: ../../library/functions.rst:259 msgid "Transform a method into a class method." @@ -712,15 +713,15 @@ msgid "" "class methods, see :ref:`types`." msgstr "" "Class method 和 C++ 與 Java 的 static method 是有區別的。如果你想瞭解 static " -"method,請看本節的 :func:`staticmethod`。關於 class method 的更多資訊,請參" -"考 :ref:`types`。" +"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:" +"Class methods 現在可以包裝其他\\ :term:`描述器 `,例如 :func:" "`property`" #: ../../library/functions.rst:285 @@ -750,7 +751,7 @@ msgid "" msgstr "" "將 *source* 編譯成程式碼或 AST 物件。程式碼物件可以被 :func:`exec` 或 :func:" "`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。參見 :mod:" -"`ast` module(模組)的文件瞭解如何使用 AST 物件。" +"`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" #: ../../library/functions.rst:302 msgid "" @@ -771,8 +772,8 @@ msgid "" msgstr "" "*mode* 引數指定了編譯程式碼時必須用的模式。如果 *source* 是一系列的陳述式,可" "以是 ``'exec'``;如果是單一運算式,可以是 ``'eval'``;如果是單個互動式陳述" -"式,可以是 ``'single'`` (在最後一種情況下,如果運算式執行結果不是 ``None`` " -"則會被印出來)。" +"式,可以是 ``'single'``\\ (在最後一種情況下,如果運算式執行結果不是 " +"``None`` 則會被印出來)。" #: ../../library/functions.rst:312 msgid "" @@ -820,15 +821,15 @@ msgstr "" "引數 *optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器的 :" "option:`-O` 選項相同的最佳化級別。其他級別為 ``0``\\ (沒有最佳化;\\ " "``__debug__`` 為真值)、``1``\\ (assert 被刪除,``__debug__`` 為假值)或 " -"``2``\\ (文件字串也被刪除)。" +"``2``\\ (說明字串 (docstring) 也被刪除)。" #: ../../library/functions.rst:337 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`。" +"如果編譯的原始碼無效,此函式會引發 :exc:`SyntaxError`,如果原始碼包含 null " +"bytes,則會引發 :exc:`ValueError`。" #: ../../library/functions.rst:340 msgid "" @@ -851,7 +852,7 @@ msgid "" "compilation." msgstr "" "引發一個附帶引數 ``source``、``filename`` 的\\ :ref:`稽核事件 ` " -"``compile``。此事件也可能會由 implicit compilation 所引發。" +"``compile``。此事件也可能由隱式編譯 (implicit compilation) 所引發。" #: ../../library/functions.rst:351 msgid "" @@ -877,15 +878,14 @@ 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* 參數。" +"允許使用 Windows 和 Mac 的換行符號。此外,在 ``'exec'`` 模式不需要以換行符號" +"結尾。增加了 *optimize* 參數。" #: ../../library/functions.rst:366 msgid "" "Previously, :exc:`TypeError` was raised when null bytes were encountered in " "*source*." -msgstr "" -"在之前的版本,*source* 中包含 null bytes 會觸發 :exc:`TypeError` 異常。" +msgstr "在之前的版本,*source* 中包含 null bytes 會引發 :exc:`TypeError`。" #: ../../library/functions.rst:370 msgid "" @@ -931,9 +931,10 @@ msgid "" "If :meth:`!__float__` is not defined then it falls back to :meth:`~object." "__index__`." msgstr "" -"對於一般的 Python 物件 ``x``,``complex(x)`` 指派給 ``x.__complex__()``。如果" -"未定義 :meth:`~object.__complex__` 則會回退使用 :meth:`~object.__float__`。如" -"果未定義 :meth:`!__float__` 則會回退使用 :meth:`~object.__index__`。" +"對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 ``x." +"__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " +"back) 到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未定義,則會再回" +"退到 :meth:`~object.__index__`。" #: ../../library/functions.rst:431 msgid "" @@ -964,6 +965,8 @@ 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__`。" #: ../../library/functions.rst:455 msgid "" @@ -1000,8 +1003,8 @@ msgid "" "With an argument, attempt to return a list of valid attributes for that " "object." msgstr "" -"如果沒有引數,則回傳當前本地作用域中的名稱列表。如果有引數,它會嘗試回傳該物" -"件的有效屬性列表。" +"如果沒有引數,則回傳當前區域作用域 (local scope) 中的名稱列表。如果有引數,它" +"會嘗試回傳該物件的有效屬性列表。" #: ../../library/functions.rst:481 msgid "" @@ -1106,7 +1109,7 @@ msgstr "" "回傳一個列舉 (enumerate) 物件。*iterable* 必須是一個序列、:term:`iterator` 或" "其他支援疊代的物件。:func:`enumerate` 回傳之 iterator 的 :meth:`~iterator." "__next__` method 回傳一個 tuple(元組),裡面包含一個計數值(從 *start* 開" -"始,預設為 0)和通過疊代 *iterable* 獲得的值。" +"始,預設為 0)和透過疊代 *iterable* 獲得的值。" #: ../../library/functions.rst:562 msgid "Equivalent to::" @@ -1160,15 +1163,15 @@ msgid "" "called. Note, *eval()* does not have access to the :term:`nested scopes " "` (non-locals) in the enclosing environment." msgstr "" -"*expression* 引數被剖析並執行成 Python 運算式(技術上而言,是條件列表)," -"*globals* 和 *locals* dictionaries 分別用作全域性和本地命名空間。如果 " +"*expression* 引數會被視為一條 Python 運算式(技術上而言,是條件列表)來剖析及" +"求值,而 *globals* 和 *locals* dictionaries 分別用作全域和區域命名空間。如果 " "*globals* dictionary 存在但缺少 ``__builtins__`` 的鍵值,那 *expression* 被剖" "析之前,將為該鍵插入對內建 :mod:`builtins` module dictionary 的引用。這麼一" -"來,在將 ``__builtins__`` 傳入 :func:`eval` 之前,你可以透過將它插入 " -"*globals* 來控制你需要哪些內建函式。如果 *locals* 被省略,那它的預設值是 " -"*globals* dictionary。如果兩個 dictionary 變數都被省略,則在 :func:`eval` 被" -"呼叫的環境中執行運算式。請注意,*eval()* 在封閉環境中無法存取\\ :term:`巢狀" -"域 ` (non-locals)。" +"來,在將 ``__builtins__`` dictionary 傳入 :func:`eval` 之前,你可以透過將它插" +"入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 被省略,那它" +"的預設值是 *globals* dictionary。如果兩個 dictionary 引數都被省略,則在 :" +"func:`eval` 被呼叫的環境中執行運算式。請注意,*eval()* 在封閉 (enclosing) 環" +"境中無法存取\\ :term:`巢狀作用域 ` (non-locals)。" #: ../../library/functions.rst:604 msgid "Example:" @@ -1240,10 +1243,10 @@ msgstr "" "這個函式支援動態執行 Python 程式碼。*object* 必須是字串或者程式碼物件。如果是" "字串,那麼該字串將被剖析為一系列 Python 陳述式並執行(除非發生語法錯誤)。" "[#]_ 如果是程式碼物件,它將被直接執行。無論哪種情況,被執行的程式碼都需要和檔" -"案輸入一樣是有效的(可參考手冊中關於 :ref:`file-input` 的章節)。請注意,即使" -"在傳遞給 :func:`exec` 函式的程式碼的上下文中,:keyword:`nonlocal`、:keyword:" -"`yield` 和 :keyword:`return` 陳述式也不能在函式之外使用。該函式回傳值是 " -"``None``。" +"案輸入一樣是有效的(可參閱語言參考手冊中關於\\ :ref:`file-input`\\ 的章節)。" +"請注意,即使在傳遞給 :func:`exec` 函式的程式碼的上下文中,:keyword:" +"`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使" +"用。該函式回傳值是 ``None``。" #: ../../library/functions.rst:646 #, fuzzy @@ -1280,9 +1283,9 @@ msgid "" "``__builtins__`` dictionary into *globals* before passing it to :func:`exec`." msgstr "" "如果 *globals* dictionary 不包含 ``__builtins__`` 鍵值,則將為該鍵插入對內" -"建 :mod:`builtins` module dictionary 的引用。因此,在將執行的程式碼傳遞給 :" -"func:`exec` 之前,可以通過將自己的 ``__builtins__`` dictionary 插入到 " -"*globals* 中來控制可以使用哪些內建程式碼。" +"建 :mod:`builtins` module dictionary 的引用。這麼一來,在將 ``__builtins__`` " +"dictionary 傳入 :func:`exec` 之前,你可以透過將它插入 *globals* 來控制你需要" +"哪些內建函式來執行程式碼。" #: ../../library/functions.rst:666 msgid "" @@ -1291,6 +1294,9 @@ msgid "" "length of the tuple must exactly match the number of free variables " "referenced by the code object." msgstr "" +"*closure* 引數會指定一個閉包 (closure) — 它是一個 cellvar(格變數)的 tuple。" +"只有在 *object* 是一個含有自由變數 (free variable) 的程式碼物件時,它才有效。" +"Tuple 的長度必須與程式碼物件所引用的自由變數數量完全匹配。" #: ../../library/functions.rst:678 msgid "" @@ -1382,7 +1388,7 @@ msgid "" "float, an :exc:`OverflowError` will be raised." msgstr "" "否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的" -"浮點數。如果引數在 Python 浮點精度範圍外,則會觸發 :exc:`OverflowError`。" +"浮點數。如果引數在 Python 浮點精度範圍外,則會引發 :exc:`OverflowError`。" #: ../../library/functions.rst:763 msgid "" @@ -1390,8 +1396,8 @@ msgid "" "__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:767 msgid "If no argument is given, ``0.0`` is returned." @@ -1406,6 +1412,7 @@ msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not " "defined." msgstr "" +"如果 :meth:`~object.__float__` 未定義,則會回退到 :meth:`~object.__index__`。" #: ../../library/functions.rst:787 msgid "" @@ -1438,14 +1445,14 @@ 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_spec* 或回傳值不是字串,則會引發 :exc:`TypeError`。" #: ../../library/functions.rst:802 msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." msgstr "" -"當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會觸發 :" +"當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" "exc:`TypeError`。" #: ../../library/functions.rst:811 @@ -1477,7 +1484,7 @@ msgid "" msgstr "" "回傳 *object* 之具名屬性的值。*name* 必須是字串。如果該字串是物件屬性之一的名" "稱,則回傳該屬性的值。例如,``getattr(x, 'foobar')`` 等同於 ``x.foobar``。如" -"果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則觸發 :exc:" +"果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則引發 :exc:" "`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" "`setattr`)。" @@ -1488,6 +1495,9 @@ msgid "" "with two leading underscores) name in order to retrieve it with :func:" "`getattr`." msgstr "" +"由於\\ :ref:`私有名稱改編 (private name mangling) ` 是" +"發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" +"使用 :func:`getattr` 來取得它。" #: ../../library/functions.rst:840 msgid "" @@ -1506,8 +1516,8 @@ msgid "" "it raises an :exc:`AttributeError` or not.)" msgstr "" "該引數是一個物件和一個字串。如果字串是物件屬性之一的名稱,則回傳 ``True``,否" -"則回傳 ``False``。(此功能是通過呼叫 ``getattr(object, name)`` 看是否有 :exc:" -"`AttributeError` 來實現的。)" +"則回傳 ``False``。(此功能是透過呼叫 ``getattr(object, name)`` 並檢查是否引" +"發 :exc:`AttributeError` 來實作的。)" #: ../../library/functions.rst:855 msgid "" @@ -1537,10 +1547,10 @@ msgid "" "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:876 msgid "" @@ -1549,19 +1559,22 @@ msgid "" "positional-only. For more info, see :ref:`the FAQ entry on positional-only " "parameters `." msgstr "" +"請注意,呼叫 :func:`help` 時,如果斜線 (/) 出現在函式的參數列表中,這表示斜線" +"前面的參數是僅限位置 (positional-only) 參數。有關更多資訊,請參閱\\ :ref:`常" +"見問答集中的僅限位置參數條目 `。" #: ../../library/functions.rst:881 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." -msgstr "該函式透過 :mod:`site` module 加入到內建命名空間。" +msgstr "此函式會被 :mod:`site` module 加入到內建命名空間。" #: ../../library/functions.rst:883 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) 更" -"加全面和一致。" +"對於 :mod:`pydoc` 和 :mod:`inspect` 的變更,使得可呼叫物件回報的的簽名 " +"(signature) 更加全面和一致。" #: ../../library/functions.rst:890 msgid "" @@ -1607,7 +1620,7 @@ msgstr "" #: ../../library/functions.rst:927 msgid "This is the address of the object in memory." -msgstr "" +msgstr "這是該物件在記憶體中的位址。" #: ../../library/functions.rst:929 msgid "" @@ -1625,7 +1638,7 @@ msgid "" msgstr "" "如果有提供 *prompt* 引數,則將其寫入標準輸出,末尾不帶換行符。接下來,該函式" "從輸入中讀取一行,將其轉換為字串(去除末尾的換行符)並回傳。當讀取到 EOF 時," -"則觸發 :exc:`EOFError`。例如: ::" +"則引發 :exc:`EOFError`。例如: ::" #: ../../library/functions.rst:945 msgid "" @@ -1683,9 +1696,10 @@ msgid "" "towards zero." msgstr "" "回傳一個使用數字或字串 *x* 建構的整數物件,或者在沒有引數時回傳 ``0``。如果 " -"*x* 定義了 :meth:`~object.__int__`,``int(x)`` 回傳 ``x.__int__()``。如果 " +"*x* 定義了 :meth:`~object.__int__`,則 ``int(x)`` 回傳 ``x.__int__()``。如果 " "*x* 定義了 :meth:`~object.__index__` 則回傳 ``x.__index__()``。如果 *x* 定義" -"了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數則向零舍入。" +"了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數,則會向零的" +"方向無條件捨去。" #: ../../library/functions.rst:988 msgid "" @@ -1724,7 +1738,7 @@ msgstr "" #: ../../library/functions.rst:1005 msgid "The integer type is described in :ref:`typesnumeric`." -msgstr "整數型別定義請參閱 :ref:`typesnumeric`。" +msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" #: ../../library/functions.rst:1007 msgid "" @@ -1734,9 +1748,9 @@ msgid "" "` instead of :meth:`base.__index__ `." msgstr "" "如果 *base* 不是 :class:`int` 的實例,但 *base* 物件有 :meth:`base.__index__ " -"` method,則會呼叫該 method 來獲取此進位制整數。以前的版本" -"使用 :meth:`base.__int__ ` 而不是 :meth:`base.__index__ " -"`。" +"` method,則會呼叫該 method 來獲取此進位制所需的整數。以前" +"的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." +"__index__ `。" #: ../../library/functions.rst:1017 msgid "The first parameter is now positional-only." @@ -1747,10 +1761,11 @@ msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not " "defined." msgstr "" +"如果未定義 :meth:`~object.__int__` 則會回退到 :meth:`~object.__index__`。" #: ../../library/functions.rst:1023 msgid "The delegation to :meth:`~object.__trunc__` is deprecated." -msgstr "" +msgstr "對 :meth:`~object.__trunc__` 的委派已棄用。" #: ../../library/functions.rst:1026 msgid "" @@ -1761,6 +1776,10 @@ msgid "" "ref:`integer string conversion length limitation ` " "documentation." msgstr "" +":class:`int` 的字串輸入和字串表示法可以被限制,以避免阻斷服務攻擊 (denial of " +"service attack)。在字串 *x* 轉換為 :class:`int` 時已超出限制,或是在 :class:" +"`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" +"數字串轉換的長度限制 `\\ 說明文件。" #: ../../library/functions.rst:1036 msgid "" @@ -1779,7 +1798,7 @@ msgstr "" "*object* 不是給定型別的物件,函式始終回傳 ``False``。如果 *classinfo* 是包含" "物件型別的 tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-union`," "若 *object* 是其中的任何一個物件的實例則回傳 ``True``。如果 *classinfo* 既不" -"是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會觸發 :exc:`TypeError` 異" +"是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會引發 :exc:`TypeError` 異" "常。若是先前檢查已經成功,:exc:`TypeError` 可能不會再因為不合格的型別而被引" "發。" @@ -1799,7 +1818,7 @@ msgstr "" "如果 *class* 是 *classinfo* 的 subclass(直接、間接或 :term:`virtual " "`),則回傳 ``True``。*classinfo* 可以是 class 物件的 " "tuple(或遞迴地其他類似 tuple)或是一個 :ref:`types-union`,此時若 *class* " -"是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會觸發 :" +"是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" "exc:`TypeError`。" #: ../../library/functions.rst:1068 @@ -1821,10 +1840,10 @@ msgstr "" "常不同的。如果沒有第二個引數,*object* 必須是支援 :term:`iterable` 協定(有 :" "meth:`~object.__iter__` method)的集合物件,或必須支援序列協定(有 :meth:" "`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支援這些協定," -"會觸發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼 *object* 必須是可" +"會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼 *object* 必須是可" "呼叫的物件,這種情況下生成的 iterator,每次疊代呼叫 :meth:`~iterator." -"__next__` 時會不帶引數地呼叫 *object*\\ ;如果回傳的結果是 *sentinel* 則觸" -"發 :exc:`StopIteration`,否則回傳呼叫結果。" +"__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 *sentinel* 則引發 :" +"exc:`StopIteration`,否則回傳呼叫結果。" #: ../../library/functions.rst:1082 msgid "See also :ref:`typeiter`." @@ -1836,6 +1855,8 @@ msgid "" "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)。例如,從二進位資料庫檔案中讀取固定寬度的區塊,直到檔案的結尾: ::" #: ../../library/functions.rst:1096 msgid "" @@ -1851,6 +1872,8 @@ msgid "" "``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`。" #: ../../library/functions.rst:1111 msgid "" @@ -1889,16 +1912,16 @@ msgid "" "already arranged into argument tuples, see :func:`itertools.starmap`\\." msgstr "" "產生一個將 *function* 應用於 *iterable* 中所有元素,並收集回傳結果的 " -"iterator。如果傳遞了額外的 *iterables* 引數,*function* 必須接受相同個數的引" -"數,並應用於所有 iterables 中同時獲取的元素。當有多個 iterables 時,最短的 " -"iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經是 tuple 的引數,請參" -"閱 :func:`itertools.starmap`\\。" +"iterator。如果傳遞了額外的 *iterables* 引數,則 *function* 必須接受相同個數的" +"引數,並使用所有從 iterables 中同時獲取的元素。當有多個 iterables 時,最短的 " +"iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," +"請參閱 :func:`itertools.starmap`。" #: ../../library/functions.rst:1140 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." -msgstr "回傳 iterable 中最大的元素,或者回傳兩個及以上引數中最大的。" +msgstr "回傳 iterable 中最大的元素,或者回傳兩個以上的引數中最大的。" #: ../../library/functions.rst:1143 msgid "" @@ -1917,9 +1940,10 @@ msgid "" "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*,則會觸發 :exc:`ValueError`。" +"這個函式有兩個選擇性的僅限關鍵字引數。*key* 引數能指定單一引數所使用的排序函" +"式,如同 :meth:`list.sort` 的使用方式。*default* 引數是當 iterable 為空時回傳" +"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" +"`ValueError`。" #: ../../library/functions.rst:1154 msgid "" @@ -1945,14 +1969,14 @@ msgid "" "Return a \"memory view\" object created from the given argument. See :ref:" "`typememoryview` for more information." msgstr "" -"回傳由給定的引數建立之 \"memory view\" 物件。有關詳細資訊,請參閱 :ref:" -"`typememoryview`。" +"回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" +"閱\\ :ref:`typememoryview`。" #: ../../library/functions.rst:1178 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." -msgstr "回傳 iterable 中最小的元素,或者回傳兩個及以上引數中最小的。" +msgstr "回傳 iterable 中最小的元素,或者回傳兩個以上的引數中最小的。" #: ../../library/functions.rst:1181 msgid "" @@ -1961,7 +1985,7 @@ msgid "" "arguments are provided, the smallest of the positional arguments is returned." msgstr "" "如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" -"被回傳。如果提供了兩個或以上的位置引數,則回傳最小的位置引數。" +"被回傳。如果提供了兩個以上的位置引數,則回傳最小的位置引數。" #: ../../library/functions.rst:1192 msgid "" @@ -1980,8 +2004,8 @@ msgid "" "`~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*,如果沒有預設值則觸發 :" +"透過呼叫 :term:`iterator` 的 :meth:`~iterator.__next__` method 獲取下一個元" +"素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" "exc:`StopIteration`。" #: ../../library/functions.rst:1214 @@ -2026,8 +2050,9 @@ msgid "" "cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more " "examples of how to use this function." msgstr "" -"開啟 *file* 並回傳對應的 :term:`file object`。如果該檔案不能開啟,則觸發 :" -"exc:`OSError`。關於使用此函式的更多方法請參閱\\ :ref:`tut-files`。" +"開啟 *file* 並回傳對應的\\ :term:`檔案物件 `。如果該檔案不能開" +"啟,則引發 :exc:`OSError`。關於使用此函式的更多方法,請參閱\\ :ref:`tut-" +"files`。" #: ../../library/functions.rst:1257 msgid "" @@ -2037,10 +2062,10 @@ msgid "" "given, it is closed when the returned I/O object is closed unless *closefd* " "is set to ``False``.)" msgstr "" -"*file* 是一個 :term:`path-like object`,是將被開啟之檔案的路徑(絕對路徑或者" -"當前工作目錄的相當路徑),或是被封裝的整數檔案描述器 (file descriptor)。(如" -"果有提供檔案描述器,它會隨著回傳的 I/O 物件關閉而關閉,除非 *closefd* 被設為 " -"``False``。)" +"*file* 是一個\\ :term:`類路徑物件 `,是將被開啟之檔案的路徑" +"(絕對路徑或當前工作目錄的相對路徑),或是要被包裝 (wrap) 檔案的整數檔案描述" +"器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關" +"閉,除非 *closefd* 被設為 ``False``。)" #: ../../library/functions.rst:1263 msgid "" @@ -2085,7 +2110,7 @@ msgstr "``'w'``" #: ../../library/functions.rst:1283 msgid "open for writing, truncating the file first" -msgstr "" +msgstr "寫入,會先清除檔案內容" #: ../../library/functions.rst:1284 msgid "``'x'``" @@ -2101,7 +2126,7 @@ msgstr "``'a'``" #: ../../library/functions.rst:1285 msgid "open for writing, appending to the end of file if it exists" -msgstr "寫入,如果文件存在則在末尾追加寫入內容" +msgstr "寫入,如果檔案存在則在其末端附加內容" #: ../../library/functions.rst:1286 msgid "``'b'``" @@ -2109,7 +2134,7 @@ msgstr "``'b'``" #: ../../library/functions.rst:1286 ../../library/functions.rst:1430 msgid "binary mode" -msgstr "binary mode(二進位模式)" +msgstr "二進制模式" #: ../../library/functions.rst:1287 msgid "``'t'``" @@ -2133,8 +2158,9 @@ msgid "" "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+b'`` 模式開啟並把檔案內容變成 0 bytes,``'r+b'`` 則不會捨棄原始內容。" +"預設的模式是 ``'r'``\\ (開啟並讀取文字,同 ``'rt'``)。``'w+'`` 和 " +"``'w+b'`` 模式會開啟並清除檔案。``'r+'`` 和 ``'r+b'`` 模式會開啟且保留檔案內" +"容。" #: ../../library/functions.rst:1295 msgid "" @@ -2146,6 +2172,11 @@ msgid "" "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*。" #: ../../library/functions.rst:1305 msgid "" @@ -2153,6 +2184,8 @@ msgid "" "files; all the processing is done by Python itself, and is therefore " "platform-independent." msgstr "" +"Python 不會使用底層作業系統對於文字檔案的操作概念;所有的處理都是由 Python 獨" +"自完成的,因此能獨立於不同平台。" #: ../../library/functions.rst:1309 msgid "" @@ -2166,6 +2199,14 @@ msgid "" "``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:1319 msgid "" @@ -2174,6 +2215,10 @@ msgid "" "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 個位元" +"組。" #: ../../library/functions.rst:1324 msgid "" @@ -2181,6 +2226,8 @@ msgid "" "returns ``True``) use line buffering. Other text files use the policy " "described above for binary files." msgstr "" +"「互動式」文字檔(:meth:`~io.IOBase.isatty` 回傳 ``True`` 的檔案)會使用列緩" +"衝。其他文字檔則使用上述的二進制檔案緩衝策略。" #: ../../library/functions.rst:1328 msgid "" @@ -2190,6 +2237,10 @@ msgid "" "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。" #: ../../library/functions.rst:1334 msgid "" @@ -2199,24 +2250,31 @@ msgid "" "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` 的錯" +"誤處理程式名稱也都是有效的。標準的名稱包括:" #: ../../library/functions.rst:1342 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`` 也有相同的效果。" #: ../../library/functions.rst:1346 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." -msgstr "" +msgstr "``'ignore'`` 忽略錯誤。請注意,忽略編碼錯誤可能導致資料遺失。" #: ../../library/functions.rst:1349 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." msgstr "" +"``'replace'`` 會在格式不正確的資料位置插入一個替換標誌(像是 ``'?'``)。" #: ../../library/functions.rst:1352 msgid "" @@ -2226,6 +2284,10 @@ msgid "" "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`` 錯誤處理程式當時所處理的那些相同位元組。這對於處" +"理未知編碼方式的檔案會很好用。" #: ../../library/functions.rst:1359 msgid "" @@ -2233,18 +2295,24 @@ msgid "" "not supported by the encoding are replaced with the appropriate XML " "character reference :samp:`&#{nnn};`." msgstr "" +"``'xmlcharrefreplace'`` 僅在寫入檔案時可支援。編碼系統不支援的字元會被替換為" +"適當的 XML 字元參考 (character reference) ``&#nnn;``。" #: ../../library/functions.rst:1363 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." msgstr "" +"``'backslashreplace'`` 會用 Python 的反斜線跳脫序列 (backslashed escape " +"sequence) 替換格式不正確的資料。" #: ../../library/functions.rst:1366 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." msgstr "" +"``'namereplace'``\\ (也僅在寫入時支援)會將不支援的字元替換為 ``\\N{...}`` " +"跳脫序列。" #: ../../library/functions.rst:1374 msgid "" @@ -2252,6 +2320,8 @@ msgid "" "be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " "follows:" msgstr "" +"*newline* 會決定如何剖析資料串流 (stream) 中的換行字元。它可以是 ``None``、" +"``''``、``'\\n'``、``'\\r'`` 或 ``'\\r\\n'``。它的運作規則如下:" #: ../../library/functions.rst:1378 msgid "" @@ -2263,6 +2333,11 @@ msgid "" "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'`` 之後再回傳給呼叫方。如果是 ``''``,也會啟用通用換行模式,但在回" +"傳給呼叫方時,行尾符號不會被轉換。如果它是任何其他有效的值,則輸入資料的行只" +"會由給定的字串做結尾,且在回傳給呼叫方時,行尾符號不會被轉換。" #: ../../library/functions.rst:1386 msgid "" @@ -2272,6 +2347,10 @@ msgid "" "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* 是任何其他有效的值,則寫" +"入的任何 ``'\\n'`` 字元都將轉換為給定的字串。" #: ../../library/functions.rst:1392 msgid "" @@ -2280,6 +2359,9 @@ msgid "" "closed. If a filename is given *closefd* must be ``True`` (the default); " "otherwise, an error will be raised." msgstr "" +"如果 *closefd* 是 ``False``,且給定的 *file* 引數是一個檔案描述器而不是檔名," +"則當檔案關閉時,底層的檔案描述器會保持開啟狀態。如果有給定一個檔名,則 " +"*closefd* 必須是 ``True``\\ (預設值);否則將引發錯誤。" #: ../../library/functions.rst:1397 msgid "" @@ -2289,6 +2371,10 @@ msgid "" "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``)。" #: ../../library/functions.rst:1403 msgid "The newly created file is :ref:`non-inheritable `." @@ -2316,6 +2402,15 @@ msgid "" "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:1439 msgid "" @@ -2339,7 +2434,7 @@ msgstr "" msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." -msgstr "" +msgstr "``mode`` 和 ``flags`` 引數可能會被原始的呼叫所修改或推論 (infer)。" #: ../../library/functions.rst:1450 msgid "The *opener* parameter was added." @@ -2351,19 +2446,19 @@ msgstr "增加了 ``'x'`` 模式。" #: ../../library/functions.rst:1452 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." -msgstr "過去觸發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" +msgstr "過去引發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" #: ../../library/functions.rst:1453 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." msgstr "" -"如果檔案已存在但使用了唯一性建立模式 (\\ ``'x'``\\ ),現在會觸發 :exc:" +"如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" "`FileExistsError`。" #: ../../library/functions.rst:1458 msgid "The file is now non-inheritable." -msgstr "檔案在當前版本開始禁止繼承。" +msgstr "檔案在此版本開始是不可繼承的。" #: ../../library/functions.rst:1462 msgid "" @@ -2371,8 +2466,8 @@ msgid "" "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:1465 msgid "The ``'namereplace'`` error handler was added." @@ -2380,7 +2475,7 @@ msgstr "增加了 ``'namereplace'`` 錯誤處理程式。" #: ../../library/functions.rst:1469 msgid "Support added to accept objects implementing :class:`os.PathLike`." -msgstr "增加對實現了 :class:`os.PathLike` 物件的支援。" +msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" #: ../../library/functions.rst:1470 msgid "" @@ -2417,6 +2512,7 @@ msgstr "" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" #: ../../library/functions.rst:1491 +#, fuzzy msgid "" "The arguments must have numeric types. With mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " @@ -2430,6 +2526,13 @@ msgid "" "`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`` 的值。" #: ../../library/functions.rst:1503 msgid "" @@ -2439,21 +2542,27 @@ msgid "" "``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)``,其中 " +"*inv_base* 是 *base* 對 *mod* 的模倒數 (inverse modulo)。" #: ../../library/functions.rst:1509 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" -msgstr "" +msgstr "以下是一個計算 ``38`` 對 ``97`` 取模倒數的範例: ::" #: ../../library/functions.rst:1516 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`` 的三引數形式允許第二個引數為負數,也容" +"許模倒數的計算。" #: ../../library/functions.rst:1521 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." -msgstr "" +msgstr "允許關鍵字引數。在此之前只支援位置引數。" #: ../../library/functions.rst:1528 msgid "" @@ -2461,6 +2570,8 @@ msgid "" "by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " "keyword arguments." msgstr "" +"將 *objects* 列印到文字資料串流 *file*,用 *sep* 分隔並以 *end* 結尾。如果有" +"給定 *sep*、*end*、*file* 和 *flush*,那麼它們必須是關鍵字引數的形式。" #: ../../library/functions.rst:1532 msgid "" @@ -2470,6 +2581,10 @@ msgid "" "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*。" #: ../../library/functions.rst:1538 msgid "" @@ -2478,12 +2593,18 @@ msgid "" "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(...)``。" #: ../../library/functions.rst:1543 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:1547 msgid "Added the *flush* keyword argument." @@ -2499,16 +2620,20 @@ msgid "" "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* 會為該屬性建立一個說明字串。" #: ../../library/functions.rst:1559 msgid "A typical use is to define a managed attribute ``x``::" -msgstr "" +msgstr "一個典型的用途是定義一個受管理的屬性 ``x``: ::" #: ../../library/functions.rst:1576 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." msgstr "" +"如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會呼叫取得器 (getter),``c.x = " +"value`` 會呼叫設定器 (setter),而 ``del c.x`` 會呼叫刪除器 (deleter)。" #: ../../library/functions.rst:1579 msgid "" @@ -2517,6 +2642,9 @@ msgid "" "possible to create read-only properties easily using :func:`property` as a :" "term:`decorator`::" msgstr "" +"如果有給定 *doc*,它將會是 property 屬性的說明字串。否則,property 會複製 " +"*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" +"`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" #: ../../library/functions.rst:1592 msgid "" @@ -3204,8 +3332,8 @@ msgid "" "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" @@ -3265,7 +3393,7 @@ msgstr "universal newlines" #: ../../library/functions.rst:1430 msgid "line-buffered I/O" -msgstr "line-buffered I/O(列緩衝 I/O)" +msgstr "line-buffered I/O(行緩衝 I/O)" #: ../../library/functions.rst:1430 msgid "unbuffered I/O"