From 1cc65554208858171096b2569c16c1543d3be2d6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 23 Aug 2025 00:17:14 +0000 Subject: [PATCH 1/6] sync with cpython 57b5baf3 --- library/sys.po | 8 +-- library/zipfile.po | 164 +++++++++++++++++++++++++-------------------- 2 files changed, 97 insertions(+), 75 deletions(-) diff --git a/library/sys.po b/library/sys.po index 4a3bf4a219..d47573d911 100644 --- a/library/sys.po +++ b/library/sys.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-07 12:52+0000\n" +"POT-Creation-Date: 2025-08-23 00:15+0000\n" "PO-Revision-Date: 2023-04-26 02:54+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2094,9 +2094,9 @@ msgstr "" #: ../../library/sys.rst:1628 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " -"*frame* is the current stack frame. *event* is a string: ``'call'``, " -"``'line'``, ``'return'``, ``'exception'`` or ``'opcode'``. *arg* depends on " -"the event type." +"*frame* is the :ref:`current stack frame `. *event* is a " +"string: ``'call'``, ``'line'``, ``'return'``, ``'exception'`` or " +"``'opcode'``. *arg* depends on the event type." msgstr "" #: ../../library/sys.rst:1633 diff --git a/library/zipfile.po b/library/zipfile.po index b3d90b1c53..72f51531cc 100644 --- a/library/zipfile.po +++ b/library/zipfile.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-09 00:13+0000\n" +"POT-Creation-Date: 2025-08-23 00:15+0000\n" "PO-Revision-Date: 2025-06-26 20:00+0800\n" "Last-Translator: Dr-XYZ \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -259,8 +259,8 @@ msgstr "" "*compresslevel* 參數控制寫入檔案到封存時使用的壓縮層級。當使用 :const:" "`ZIP_STORED` 或 :const:`ZIP_LZMA` 時,它沒有效果。當使用 :const:" "`ZIP_DEFLATED` 時,接受整數 ``0`` 到 ``9``\\ (更多資訊請參閱 :class:`zlib " -"`)。當使用 :const:`ZIP_BZIP2` 時,接受整數 ``1`` 到 ``9``" -"\\ (更多資訊請參閱 :class:`bz2 `)。" +"`)。當使用 :const:`ZIP_BZIP2` 時,接受整數 ``1`` 到 " +"``9``\\ (更多資訊請參閱 :class:`bz2 `)。" #: ../../library/zipfile.rst:187 ../../library/zipfile.rst:768 msgid "" @@ -416,9 +416,9 @@ msgid "" "class:`bytes` object." msgstr "" "以二進位類檔案物件的形式存取封存檔案中的一個成員。*name* 可以是封存檔案內的檔" -"案名稱,或是一個 :class:`ZipInfo` 物件。*mode* 參數如果包含,則必須是 ``'r'``" -"\\ (預設值)或 ``'w'``。*pwd* 是用於解密加密 ZIP 檔案的密碼,為一個 :class:" -"`bytes` 物件。" +"案名稱,或是一個 :class:`ZipInfo` 物件。*mode* 參數如果包含,則必須是 " +"``'r'``\\ (預設值)或 ``'w'``。*pwd* 是用於解密加密 ZIP 檔案的密碼,為一個 :" +"class:`bytes` 物件。" #: ../../library/zipfile.rst:285 msgid "" @@ -459,9 +459,9 @@ msgid "" "open, attempting to read or write other files in the ZIP file will raise a :" "exc:`ValueError`." msgstr "" -"在 ``mode='w'`` 時,會回傳一個可寫的檔案控點 (file handle),它支援 :meth:`~io." -"BufferedIOBase.write` 方法。當一個可寫的檔案控點開啟時,嘗試讀取或寫入 ZIP 檔" -"案中的其他檔案將會引發 :exc:`ValueError`。" +"在 ``mode='w'`` 時,會回傳一個可寫的檔案控點 (file handle),它支援 :meth:" +"`~io.BufferedIOBase.write` 方法。當一個可寫的檔案控點開啟時,嘗試讀取或寫入 " +"ZIP 檔案中的其他檔案將會引發 :exc:`ValueError`。" #: ../../library/zipfile.rst:304 msgid "" @@ -592,8 +592,8 @@ msgid "" "\"``. This module attempts to prevent that. See :meth:`extract` note." msgstr "" "絕不要在未經事先檢查的情況下,從不受信任的來源解壓縮封存檔案。檔案有可能被建" -"立在 *path* 之外,例如,成員具有以 ``\"/\"`` 開頭的絕對檔名或帶有兩個點 ``" -"\"..\"`` 的檔名。本模組會試圖防止這種情況。請參閱 :meth:`extract` 的註解。" +"立在 *path* 之外,例如,成員具有以 ``\"/\"`` 開頭的絕對檔名或帶有兩個點 " +"``\"..\"`` 的檔名。本模組會試圖防止這種情況。請參閱 :meth:`extract` 的註解。" #: ../../library/zipfile.rst:382 msgid "" @@ -1184,80 +1184,99 @@ msgid "Name of the file in the archive." msgstr "封存檔案中檔案的名稱。" #: ../../library/zipfile.rst:801 +#, fuzzy msgid "" "The time and date of the last modification to the archive member. This is a " -"tuple of six values:" +"tuple of six values representing the \"last [modified] file time\" and " +"\"last [modified] file date\" fields from the ZIP file's central directory." msgstr "封存成員的最後修改時間和日期。這是一個包含六個值的元組:" #: ../../library/zipfile.rst:805 +msgid "The tuple contains:" +msgstr "" + +#: ../../library/zipfile.rst:808 msgid "Index" msgstr "索引" -#: ../../library/zipfile.rst:805 +#: ../../library/zipfile.rst:808 msgid "Value" msgstr "值" -#: ../../library/zipfile.rst:807 +#: ../../library/zipfile.rst:810 msgid "``0``" msgstr "``0``" -#: ../../library/zipfile.rst:807 +#: ../../library/zipfile.rst:810 msgid "Year (>= 1980)" msgstr "年(>= 1980)" -#: ../../library/zipfile.rst:809 +#: ../../library/zipfile.rst:812 msgid "``1``" msgstr "``1``" -#: ../../library/zipfile.rst:809 +#: ../../library/zipfile.rst:812 msgid "Month (one-based)" msgstr "月(從 1 開始)" -#: ../../library/zipfile.rst:811 +#: ../../library/zipfile.rst:814 msgid "``2``" msgstr "``2``" -#: ../../library/zipfile.rst:811 +#: ../../library/zipfile.rst:814 msgid "Day of month (one-based)" msgstr "日(從 1 開始)" -#: ../../library/zipfile.rst:813 +#: ../../library/zipfile.rst:816 msgid "``3``" msgstr "``3``" -#: ../../library/zipfile.rst:813 +#: ../../library/zipfile.rst:816 msgid "Hours (zero-based)" msgstr "時(從 0 開始)" -#: ../../library/zipfile.rst:815 +#: ../../library/zipfile.rst:818 msgid "``4``" msgstr "``4``" -#: ../../library/zipfile.rst:815 +#: ../../library/zipfile.rst:818 msgid "Minutes (zero-based)" msgstr "分(從 0 開始)" -#: ../../library/zipfile.rst:817 +#: ../../library/zipfile.rst:820 msgid "``5``" msgstr "``5``" -#: ../../library/zipfile.rst:817 +#: ../../library/zipfile.rst:820 msgid "Seconds (zero-based)" msgstr "秒(從 0 開始)" -#: ../../library/zipfile.rst:822 -msgid "The ZIP file format does not support timestamps before 1980." -msgstr "ZIP 檔案格式不支援 1980 年以前的時間戳記。" +#: ../../library/zipfile.rst:825 +msgid "" +"The ZIP format supports multiple timestamp fields in different locations " +"(central directory, extra fields for NTFS/UNIX systems, etc.). This " +"attribute specifically returns the timestamp from the central directory. The " +"central directory timestamp format in ZIP files does not support timestamps " +"before 1980. While some extra field formats (such as UNIX timestamps) can " +"represent earlier dates, this attribute only returns the central directory " +"timestamp." +msgstr "" -#: ../../library/zipfile.rst:827 +#: ../../library/zipfile.rst:832 +msgid "" +"The central directory timestamp is interpreted as representing local time, " +"rather than UTC time, to match the behavior of other zip tools." +msgstr "" + +#: ../../library/zipfile.rst:838 msgid "Type of compression for the archive member." msgstr "封存成員的壓縮型別。" -#: ../../library/zipfile.rst:832 +#: ../../library/zipfile.rst:843 msgid "Comment for the individual archive member as a :class:`bytes` object." msgstr "個別封存成員的註解,為一個 :class:`bytes` 物件。" -#: ../../library/zipfile.rst:837 +#: ../../library/zipfile.rst:848 msgid "" "Expansion field data. The `PKZIP Application Note`_ contains some comments " "on the internal structure of the data contained in this :class:`bytes` " @@ -1266,66 +1285,66 @@ msgstr "" "擴充欄位資料。`PKZIP Application Note`_ 包含一些關於此 :class:`bytes` 物件中" "所含資料內部結構的註解。" -#: ../../library/zipfile.rst:844 +#: ../../library/zipfile.rst:855 msgid "System which created ZIP archive." msgstr "建立 ZIP 封存檔案的系統。" -#: ../../library/zipfile.rst:849 +#: ../../library/zipfile.rst:860 msgid "PKZIP version which created ZIP archive." msgstr "建立 ZIP 封存檔案的 PKZIP 版本。" -#: ../../library/zipfile.rst:854 +#: ../../library/zipfile.rst:865 msgid "PKZIP version needed to extract archive." msgstr "解壓縮封存檔案所需的 PKZIP 版本。" -#: ../../library/zipfile.rst:859 +#: ../../library/zipfile.rst:870 msgid "Must be zero." msgstr "必須為零。" -#: ../../library/zipfile.rst:864 +#: ../../library/zipfile.rst:875 msgid "ZIP flag bits." msgstr "ZIP 旗標位元。" -#: ../../library/zipfile.rst:869 +#: ../../library/zipfile.rst:880 msgid "Volume number of file header." msgstr "檔案標頭的磁碟空間編號。" -#: ../../library/zipfile.rst:874 +#: ../../library/zipfile.rst:885 msgid "Internal attributes." msgstr "內部屬性。" -#: ../../library/zipfile.rst:879 +#: ../../library/zipfile.rst:890 msgid "External file attributes." msgstr "外部檔案屬性。" -#: ../../library/zipfile.rst:884 +#: ../../library/zipfile.rst:895 msgid "Byte offset to the file header." msgstr "到檔案標頭的位元組偏移量。" -#: ../../library/zipfile.rst:889 +#: ../../library/zipfile.rst:900 msgid "CRC-32 of the uncompressed file." msgstr "未壓縮檔案的 CRC-32。" -#: ../../library/zipfile.rst:894 +#: ../../library/zipfile.rst:905 msgid "Size of the compressed data." msgstr "壓縮資料的大小。" -#: ../../library/zipfile.rst:899 +#: ../../library/zipfile.rst:910 msgid "Size of the uncompressed file." msgstr "未壓縮檔案的大小。" -#: ../../library/zipfile.rst:906 +#: ../../library/zipfile.rst:917 msgid "Command-Line Interface" msgstr "命令列介面" -#: ../../library/zipfile.rst:908 +#: ../../library/zipfile.rst:919 msgid "" "The :mod:`zipfile` module provides a simple command-line interface to " "interact with ZIP archives." msgstr "" ":mod:`zipfile` 模組提供了一個簡單的命令列介面,用以與 ZIP 封存檔案互動。" -#: ../../library/zipfile.rst:911 +#: ../../library/zipfile.rst:922 msgid "" "If you want to create a new ZIP archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" @@ -1333,78 +1352,78 @@ msgstr "" "如果你想建立一個新的 ZIP 封存檔案,請在 :option:`-c` 選項後指定其名稱,然後列" "出應包含的檔名:" -#: ../../library/zipfile.rst:914 +#: ../../library/zipfile.rst:925 msgid "$ python -m zipfile -c monty.zip spam.txt eggs.txt" msgstr "$ python -m zipfile -c monty.zip spam.txt eggs.txt" -#: ../../library/zipfile.rst:918 +#: ../../library/zipfile.rst:929 msgid "Passing a directory is also acceptable:" msgstr "傳遞一個目錄也是可以的:" -#: ../../library/zipfile.rst:920 +#: ../../library/zipfile.rst:931 msgid "$ python -m zipfile -c monty.zip life-of-brian_1979/" msgstr "$ python -m zipfile -c monty.zip life-of-brian_1979/" -#: ../../library/zipfile.rst:924 +#: ../../library/zipfile.rst:935 msgid "" "If you want to extract a ZIP archive into the specified directory, use the :" "option:`-e` option:" msgstr "" "如果你想將一個 ZIP 封存檔案解壓縮到指定的目錄,請使用 :option:`-e` 選項:" -#: ../../library/zipfile.rst:927 +#: ../../library/zipfile.rst:938 msgid "$ python -m zipfile -e monty.zip target-dir/" msgstr "$ python -m zipfile -e monty.zip target-dir/" -#: ../../library/zipfile.rst:931 +#: ../../library/zipfile.rst:942 msgid "For a list of the files in a ZIP archive, use the :option:`-l` option:" msgstr "要列出 ZIP 封存檔案中的檔案,請使用 :option:`-l` 選項:" -#: ../../library/zipfile.rst:933 +#: ../../library/zipfile.rst:944 msgid "$ python -m zipfile -l monty.zip" msgstr "$ python -m zipfile -l monty.zip" -#: ../../library/zipfile.rst:939 +#: ../../library/zipfile.rst:950 msgid "Command-line options" msgstr "命令列選項" -#: ../../library/zipfile.rst:944 +#: ../../library/zipfile.rst:955 msgid "List files in a zipfile." msgstr "列出 zipfile 中的檔案。" -#: ../../library/zipfile.rst:949 +#: ../../library/zipfile.rst:960 msgid "Create zipfile from source files." msgstr "從來源檔案建立 zipfile。" -#: ../../library/zipfile.rst:954 +#: ../../library/zipfile.rst:965 msgid "Extract zipfile into target directory." msgstr "將 zipfile 解壓縮到目標目錄。" -#: ../../library/zipfile.rst:959 +#: ../../library/zipfile.rst:970 msgid "Test whether the zipfile is valid or not." msgstr "測試 zipfile 是否有效。" -#: ../../library/zipfile.rst:963 +#: ../../library/zipfile.rst:974 msgid "" "Specify encoding of member names for :option:`-l`, :option:`-e` and :option:" "`-t`." msgstr "為 :option:`-l`、:option:`-e` 和 :option:`-t` 指定成員名稱的編碼。" -#: ../../library/zipfile.rst:970 +#: ../../library/zipfile.rst:981 msgid "Decompression pitfalls" msgstr "解壓縮的陷阱" -#: ../../library/zipfile.rst:972 +#: ../../library/zipfile.rst:983 msgid "" "The extraction in zipfile module might fail due to some pitfalls listed " "below." msgstr "zipfile 模組中的解壓縮可能會由於下面列出的一些陷阱而失敗。" -#: ../../library/zipfile.rst:975 +#: ../../library/zipfile.rst:986 msgid "From file itself" msgstr "來自檔案本身" -#: ../../library/zipfile.rst:977 +#: ../../library/zipfile.rst:988 msgid "" "Decompression may fail due to incorrect password / CRC checksum / ZIP format " "or unsupported compression method / decryption." @@ -1412,11 +1431,11 @@ msgstr "" "解壓縮可能由於不正確的密碼 / CRC 校驗和 / ZIP 格式或不支援的壓縮方法 / 解密而" "失敗。" -#: ../../library/zipfile.rst:981 +#: ../../library/zipfile.rst:992 msgid "File System limitations" msgstr "檔案系統限制" -#: ../../library/zipfile.rst:983 +#: ../../library/zipfile.rst:994 msgid "" "Exceeding limitations on different file systems can cause decompression " "failed. Such as allowable characters in the directory entries, length of the " @@ -1426,11 +1445,11 @@ msgstr "" "超出不同檔案系統的限制可能導致解壓縮失敗。例如目錄條目中允許的字元、檔名長" "度、路徑名長度、單一檔案的大小以及檔案數量等。" -#: ../../library/zipfile.rst:990 +#: ../../library/zipfile.rst:1001 msgid "Resources limitations" msgstr "資源限制" -#: ../../library/zipfile.rst:992 +#: ../../library/zipfile.rst:1003 msgid "" "The lack of memory or disk volume would lead to decompression failed. For " "example, decompression bombs (aka `ZIP bomb`_) apply to zipfile library that " @@ -1439,11 +1458,11 @@ msgstr "" "記憶體或磁碟空間不足會導致解壓縮失敗。例如,解壓縮炸彈(又稱 `ZIP bomb`_)適" "用於 zipfile 函式庫,可能導致磁碟空間耗盡。" -#: ../../library/zipfile.rst:997 +#: ../../library/zipfile.rst:1008 msgid "Interruption" msgstr "中斷" -#: ../../library/zipfile.rst:999 +#: ../../library/zipfile.rst:1010 msgid "" "Interruption during the decompression, such as pressing control-C or killing " "the decompression process may result in incomplete decompression of the " @@ -1452,11 +1471,11 @@ msgstr "" "在解壓縮過程中斷,例如按下 control-C 或終止解壓縮過程,可能導致封存檔案解壓縮" "不完整。" -#: ../../library/zipfile.rst:1003 +#: ../../library/zipfile.rst:1014 msgid "Default behaviors of extraction" msgstr "解壓縮的預設行為" -#: ../../library/zipfile.rst:1005 +#: ../../library/zipfile.rst:1016 msgid "" "Not knowing the default extraction behaviors can cause unexpected " "decompression results. For example, when extracting the same archive twice, " @@ -1464,3 +1483,6 @@ msgid "" msgstr "" "不了解預設的解壓縮行為可能導致非預期的解壓縮結果。例如,當兩次解壓縮同一個封" "存檔案時,它會不經詢問就覆寫檔案。" + +#~ msgid "The ZIP file format does not support timestamps before 1980." +#~ msgstr "ZIP 檔案格式不支援 1980 年以前的時間戳記。" From 16825e6a5663d2a4fff46667c215491969bf6b91 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 24 Aug 2025 00:19:11 +0000 Subject: [PATCH 2/6] sync with cpython f12e7cb8 --- library/imaplib.po | 110 +++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 53 deletions(-) diff --git a/library/imaplib.po b/library/imaplib.po index 2cdc167ac7..e30c6ea3ac 100644 --- a/library/imaplib.po +++ b/library/imaplib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-08-24 00:17+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -395,34 +395,38 @@ msgid "" "includes the phrase ``AUTH=CRAM-MD5``." msgstr "" -#: ../../library/imaplib.rst:331 +#: ../../library/imaplib.rst:328 +msgid "An :exc:`IMAP4.error` is raised if MD5 support is not available." +msgstr "" + +#: ../../library/imaplib.rst:334 msgid "Shutdown connection to server. Returns server ``BYE`` response." msgstr "" -#: ../../library/imaplib.rst:333 +#: ../../library/imaplib.rst:336 msgid "The method no longer ignores silently arbitrary exceptions." msgstr "" -#: ../../library/imaplib.rst:339 +#: ../../library/imaplib.rst:342 msgid "" "List subscribed mailbox names in directory matching pattern. *directory* " "defaults to the top level directory and *pattern* defaults to match any " "mailbox. Returned data are tuples of message part envelope and data." msgstr "" -#: ../../library/imaplib.rst:346 +#: ../../library/imaplib.rst:349 msgid "Show my ACLs for a mailbox (i.e. the rights that I have on mailbox)." msgstr "" -#: ../../library/imaplib.rst:351 +#: ../../library/imaplib.rst:354 msgid "Returns IMAP namespaces as defined in :rfc:`2342`." msgstr "" -#: ../../library/imaplib.rst:356 +#: ../../library/imaplib.rst:359 msgid "Send ``NOOP`` to server." msgstr "" -#: ../../library/imaplib.rst:361 +#: ../../library/imaplib.rst:364 msgid "" "Opens socket to *port* at *host*. The optional *timeout* parameter specifies " "a timeout in seconds for the connection attempt. If timeout is not given or " @@ -435,7 +439,7 @@ msgid "" "You may override this method." msgstr "" -#: ../../library/imaplib.rst:371 +#: ../../library/imaplib.rst:374 msgid "" "Raises an :ref:`auditing event ` ``imaplib.open`` with arguments " "``self``, ``host``, ``port``." @@ -443,48 +447,48 @@ msgstr "" "引發一個附帶引數 ``self``、``host``、``port`` 的\\ :ref:`稽核事件 " "` ``imaplib.open``。" -#: ../../library/imaplib.rst:373 +#: ../../library/imaplib.rst:376 msgid "The *timeout* parameter was added." msgstr "新增 *timeout* 參數。" -#: ../../library/imaplib.rst:378 +#: ../../library/imaplib.rst:381 msgid "" "Fetch truncated part of a message. Returned data is a tuple of message part " "envelope and data." msgstr "" -#: ../../library/imaplib.rst:384 +#: ../../library/imaplib.rst:387 msgid "" "Assume authentication as *user*. Allows an authorised administrator to proxy " "into any user's mailbox." msgstr "" -#: ../../library/imaplib.rst:390 +#: ../../library/imaplib.rst:393 msgid "" "Reads *size* bytes from the remote server. You may override this method." msgstr "" -#: ../../library/imaplib.rst:395 +#: ../../library/imaplib.rst:398 msgid "Reads one line from the remote server. You may override this method." msgstr "" -#: ../../library/imaplib.rst:400 +#: ../../library/imaplib.rst:403 msgid "" "Prompt server for an update. Returned data is ``None`` if no new messages, " "else value of ``RECENT`` response." msgstr "" -#: ../../library/imaplib.rst:406 +#: ../../library/imaplib.rst:409 msgid "Rename mailbox named *oldmailbox* to *newmailbox*." msgstr "" -#: ../../library/imaplib.rst:411 +#: ../../library/imaplib.rst:414 msgid "" "Return data for response *code* if received, or ``None``. Returns the given " "code, instead of the usual type." msgstr "" -#: ../../library/imaplib.rst:417 +#: ../../library/imaplib.rst:420 msgid "" "Search mailbox for matching messages. *charset* may be ``None``, in which " "case no ``CHARSET`` will be specified in the request to the server. The " @@ -494,11 +498,11 @@ msgid "" "`enable` command." msgstr "" -#: ../../library/imaplib.rst:424 +#: ../../library/imaplib.rst:427 msgid "Example::" msgstr "範例: ::" -#: ../../library/imaplib.rst:426 +#: ../../library/imaplib.rst:429 msgid "" "# M is a connected IMAP4 instance...\n" "typ, msgnums = M.search(None, 'FROM', '\"LDJ\"')\n" @@ -507,18 +511,18 @@ msgid "" "typ, msgnums = M.search(None, '(FROM \"LDJ\")')" msgstr "" -#: ../../library/imaplib.rst:435 +#: ../../library/imaplib.rst:438 msgid "" "Select a mailbox. Returned data is the count of messages in *mailbox* " "(``EXISTS`` response). The default *mailbox* is ``'INBOX'``. If the " "*readonly* flag is set, modifications to the mailbox are not allowed." msgstr "" -#: ../../library/imaplib.rst:442 +#: ../../library/imaplib.rst:445 msgid "Sends ``data`` to the remote server. You may override this method." msgstr "" -#: ../../library/imaplib.rst:444 +#: ../../library/imaplib.rst:447 msgid "" "Raises an :ref:`auditing event ` ``imaplib.send`` with arguments " "``self``, ``data``." @@ -526,42 +530,42 @@ msgstr "" "引發一個附帶引數 ``self``、``data`` 的\\ :ref:`稽核事件 ` " "``imaplib.send``。" -#: ../../library/imaplib.rst:449 +#: ../../library/imaplib.rst:452 msgid "" "Set an ``ACL`` for *mailbox*. The method is non-standard, but is supported " "by the ``Cyrus`` server." msgstr "" -#: ../../library/imaplib.rst:455 +#: ../../library/imaplib.rst:458 msgid "" "Set ``ANNOTATION``\\ s for *mailbox*. The method is non-standard, but is " "supported by the ``Cyrus`` server." msgstr "" -#: ../../library/imaplib.rst:461 +#: ../../library/imaplib.rst:464 msgid "" "Set the ``quota`` *root*'s resource *limits*. This method is part of the " "IMAP4 QUOTA extension defined in rfc2087." msgstr "" -#: ../../library/imaplib.rst:467 +#: ../../library/imaplib.rst:470 msgid "" "Close connection established in ``open``. This method is implicitly called " "by :meth:`IMAP4.logout`. You may override this method." msgstr "" -#: ../../library/imaplib.rst:473 +#: ../../library/imaplib.rst:476 msgid "Returns socket instance used to connect to server." msgstr "" -#: ../../library/imaplib.rst:478 +#: ../../library/imaplib.rst:481 msgid "" "The ``sort`` command is a variant of ``search`` with sorting semantics for " "the results. Returned data contains a space separated list of matching " "message numbers." msgstr "" -#: ../../library/imaplib.rst:482 +#: ../../library/imaplib.rst:485 msgid "" "Sort has two arguments before the *search_criterion* argument(s); a " "parenthesized list of *sort_criteria*, and the searching *charset*. Note " @@ -573,39 +577,39 @@ msgid "" "searching criteria. It then returns the numbers of matching messages." msgstr "" -#: ../../library/imaplib.rst:491 ../../library/imaplib.rst:562 +#: ../../library/imaplib.rst:494 ../../library/imaplib.rst:565 msgid "This is an ``IMAP4rev1`` extension command." msgstr "" -#: ../../library/imaplib.rst:496 +#: ../../library/imaplib.rst:499 msgid "" "Send a ``STARTTLS`` command. The *ssl_context* argument is optional and " "should be a :class:`ssl.SSLContext` object. This will enable encryption on " "the IMAP connection. Please read :ref:`ssl-security` for best practices." msgstr "" -#: ../../library/imaplib.rst:503 +#: ../../library/imaplib.rst:506 msgid "" "The method now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indication* (see :const:`ssl.HAS_SNI`)." msgstr "" -#: ../../library/imaplib.rst:511 +#: ../../library/imaplib.rst:514 msgid "Request named status conditions for *mailbox*." msgstr "" -#: ../../library/imaplib.rst:516 +#: ../../library/imaplib.rst:519 msgid "" "Alters flag dispositions for messages in mailbox. *command* is specified by " "section 6.4.6 of :rfc:`2060` as being one of \"FLAGS\", \"+FLAGS\", or \"-" "FLAGS\", optionally with a suffix of \".SILENT\"." msgstr "" -#: ../../library/imaplib.rst:520 +#: ../../library/imaplib.rst:523 msgid "For example, to set the delete flag on all messages::" msgstr "" -#: ../../library/imaplib.rst:522 +#: ../../library/imaplib.rst:525 msgid "" "typ, data = M.search(None, 'ALL')\n" "for num in data[0].split():\n" @@ -617,7 +621,7 @@ msgstr "" " M.store(num, '+FLAGS', '\\\\Deleted')\n" "M.expunge()" -#: ../../library/imaplib.rst:529 +#: ../../library/imaplib.rst:532 msgid "" "Creating flags containing ']' (for example: \"[test]\") violates :rfc:`3501` " "(the IMAP protocol). However, imaplib has historically allowed creation of " @@ -629,24 +633,24 @@ msgid "" "are sent from the server, since this improves real-world compatibility." msgstr "" -#: ../../library/imaplib.rst:541 +#: ../../library/imaplib.rst:544 msgid "Subscribe to new mailbox." msgstr "" -#: ../../library/imaplib.rst:546 +#: ../../library/imaplib.rst:549 msgid "" "The ``thread`` command is a variant of ``search`` with threading semantics " "for the results. Returned data contains a space separated list of thread " "members." msgstr "" -#: ../../library/imaplib.rst:549 +#: ../../library/imaplib.rst:552 msgid "" "Thread members consist of zero or more messages numbers, delimited by " "spaces, indicating successive parent and child." msgstr "" -#: ../../library/imaplib.rst:552 +#: ../../library/imaplib.rst:555 msgid "" "Thread has two arguments before the *search_criterion* argument(s); a " "*threading_algorithm*, and the searching *charset*. Note that unlike " @@ -659,7 +663,7 @@ msgid "" "specified threading algorithm." msgstr "" -#: ../../library/imaplib.rst:567 +#: ../../library/imaplib.rst:570 msgid "" "Execute command args with messages identified by UID, rather than message " "number. Returns response appropriate to command. At least one argument " @@ -667,11 +671,11 @@ msgid "" "an exception will be raised." msgstr "" -#: ../../library/imaplib.rst:575 +#: ../../library/imaplib.rst:578 msgid "Unsubscribe from old mailbox." msgstr "" -#: ../../library/imaplib.rst:579 +#: ../../library/imaplib.rst:582 msgid "" ":meth:`imaplib.IMAP4.unselect` frees server's resources associated with the " "selected mailbox and returns the server to the authenticated state. This " @@ -679,46 +683,46 @@ msgid "" "that no messages are permanently removed from the currently selected mailbox." msgstr "" -#: ../../library/imaplib.rst:589 +#: ../../library/imaplib.rst:592 msgid "" "Allow simple extension commands notified by server in ``CAPABILITY`` " "response." msgstr "" -#: ../../library/imaplib.rst:592 +#: ../../library/imaplib.rst:595 msgid "The following attributes are defined on instances of :class:`IMAP4`:" msgstr "" -#: ../../library/imaplib.rst:596 +#: ../../library/imaplib.rst:599 msgid "" "The most recent supported protocol in the ``CAPABILITY`` response from the " "server." msgstr "" -#: ../../library/imaplib.rst:602 +#: ../../library/imaplib.rst:605 msgid "" "Integer value to control debugging output. The initialize value is taken " "from the module variable ``Debug``. Values greater than three trace each " "command." msgstr "" -#: ../../library/imaplib.rst:608 +#: ../../library/imaplib.rst:611 msgid "" "Boolean value that is normally ``False``, but is set to ``True`` if an :meth:" "`enable` command is successfully issued for the ``UTF8=ACCEPT`` capability." msgstr "" -#: ../../library/imaplib.rst:618 +#: ../../library/imaplib.rst:621 msgid "IMAP4 Example" msgstr "IMAP4 範例" -#: ../../library/imaplib.rst:620 +#: ../../library/imaplib.rst:623 msgid "" "Here is a minimal example (without error checking) that opens a mailbox and " "retrieves and prints all messages::" msgstr "" -#: ../../library/imaplib.rst:623 +#: ../../library/imaplib.rst:626 msgid "" "import getpass, imaplib\n" "\n" From 5336e88658a015ac130ef856ec93fe94eebf2acf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 25 Aug 2025 00:18:22 +0000 Subject: [PATCH 3/6] sync with cpython 8629d466 --- library/csv.po | 232 ++++++++++++++++++++++++------------------------- 1 file changed, 115 insertions(+), 117 deletions(-) diff --git a/library/csv.po b/library/csv.po index bb95db06de..521f820d4f 100644 --- a/library/csv.po +++ b/library/csv.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-01 00:18+0000\n" +"POT-Creation-Date: 2025-08-25 00:17+0000\n" "PO-Revision-Date: 2023-11-08 15:06+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -122,8 +122,8 @@ msgstr "" "`QUOTE_NONNUMERIC` 有被指定(在這個情況之下,沒有引號的欄位都會被轉換成浮點" "數),否則不會進行自動資料型別轉換。" -#: ../../library/csv.rst:76 ../../library/csv.rst:106 ../../library/csv.rst:181 -#: ../../library/csv.rst:219 +#: ../../library/csv.rst:76 ../../library/csv.rst:106 ../../library/csv.rst:182 +#: ../../library/csv.rst:220 msgid "A short usage example::" msgstr "一個簡短的用法範例: ::" @@ -228,7 +228,7 @@ msgstr "" msgid "Return the names of all registered dialects." msgstr "回傳所有已註冊的 dialect 名稱。" -#: ../../library/csv.rst:144 +#: ../../library/csv.rst:145 msgid "" "Returns the current maximum field size allowed by the parser. If *new_limit* " "is given, this becomes the new limit." @@ -236,11 +236,11 @@ msgstr "" "回傳目前的剖析器 (parser) 允許的最大字串大小。如果 *new_limit* 被給定,則會變" "成新的最大字串大小。" -#: ../../library/csv.rst:148 +#: ../../library/csv.rst:149 msgid "The :mod:`csv` module defines the following classes:" msgstr ":mod:`csv` 模組定義了下列的類別:" -#: ../../library/csv.rst:153 +#: ../../library/csv.rst:154 msgid "" "Create an object that operates like a regular reader but maps the " "information in each row to a :class:`dict` whose keys are given by the " @@ -249,7 +249,7 @@ msgstr "" "建立一個物件,其運作上就像一般的讀取器,但可以將每一列資訊 map (對映) 到 :" "class:`dict` 中,可以透過選填的參數 *fieldnames* 設定 key。" -#: ../../library/csv.rst:157 +#: ../../library/csv.rst:158 msgid "" "The *fieldnames* parameter is a :term:`sequence`. If *fieldnames* is " "omitted, the values in the first row of file *f* will be used as the " @@ -263,7 +263,7 @@ msgstr "" "供,它們就會被使用,且第一列會被包含在結果中。不管欄位標題是如何決定的," "dictionary 都會保留原始的排序。" -#: ../../library/csv.rst:164 +#: ../../library/csv.rst:165 msgid "" "If a row has more fields than fieldnames, the remaining data is put in a " "list and stored with the fieldname specified by *restkey* (which defaults to " @@ -275,28 +275,28 @@ msgstr "" "``None``)特指的欄位標題會放入列表當中並儲存。如果一個非空的 (non-blank) 列中" "的欄位比欄位標題還少,缺少的值則會填入 *restval* (預設為 ``None``)的值。" -#: ../../library/csv.rst:170 +#: ../../library/csv.rst:171 msgid "" "All other optional or keyword arguments are passed to the underlying :class:" "`reader` instance." msgstr "所有其他選填的引數或關鍵字引數皆會傳遞至下層的 :class:`reader` 實例。" -#: ../../library/csv.rst:173 ../../library/csv.rst:217 +#: ../../library/csv.rst:174 ../../library/csv.rst:218 msgid "" "If the argument passed to *fieldnames* is an iterator, it will be coerced to " "a :class:`list`." msgstr "" "如果傳遞至 *fieldnames* 的引數是個疊代器,則會被迫成為一個 :class:`list`。" -#: ../../library/csv.rst:175 +#: ../../library/csv.rst:176 msgid "Returned rows are now of type :class:`OrderedDict`." msgstr "回傳的列已成為型別 :class:`OrderedDict`。" -#: ../../library/csv.rst:178 +#: ../../library/csv.rst:179 msgid "Returned rows are now of type :class:`dict`." msgstr "回傳的列已成為型別 :class:`dict`。" -#: ../../library/csv.rst:183 +#: ../../library/csv.rst:184 msgid "" ">>> import csv\n" ">>> with open('names.csv', newline='') as csvfile:\n" @@ -322,7 +322,7 @@ msgstr "" ">>> print(row)\n" "{'first_name': 'John', 'last_name': 'Cleese'}" -#: ../../library/csv.rst:199 +#: ../../library/csv.rst:200 msgid "" "Create an object which operates like a regular writer but maps dictionaries " "onto output rows. The *fieldnames* parameter is a :mod:`sequence " @@ -347,7 +347,7 @@ msgstr "" "被設定為 ``'ignore'``,dictionary 中額外的值會被忽略。其他選填的引數或關鍵字" "引數皆會傳遞至下層的 :class:`writer` 實例。" -#: ../../library/csv.rst:214 +#: ../../library/csv.rst:215 msgid "" "Note that unlike the :class:`DictReader` class, the *fieldnames* parameter " "of the :class:`DictWriter` class is not optional." @@ -355,7 +355,7 @@ msgstr "" "請記得這不像類別 :class:`DictReader`,在類別 :class:`DictWriter` 中,參數 " "*fieldnames* 並不是選填的。" -#: ../../library/csv.rst:221 +#: ../../library/csv.rst:222 msgid "" "import csv\n" "\n" @@ -379,7 +379,7 @@ msgstr "" " writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})\n" " writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})" -#: ../../library/csv.rst:235 +#: ../../library/csv.rst:236 msgid "" "The :class:`Dialect` class is a container class whose attributes contain " "information for how to handle doublequotes, whitespace, delimiters, etc. Due " @@ -392,7 +392,7 @@ msgstr "" "巧妙不同的 CSV 資料。:class:`Dialect` 實例定義了 :class:`reader` 以及 :class:" "`writer` 的實例該如何表示。" -#: ../../library/csv.rst:241 +#: ../../library/csv.rst:242 msgid "" "All available :class:`Dialect` names are returned by :func:`list_dialects`, " "and they can be registered with specific :class:`reader` and :class:`writer` " @@ -402,7 +402,7 @@ msgstr "" "透過特定 :class:`reader` 及 :class:`writer` 類別的初始器 (initializer, " "``__init__``) 函式進行註冊,就像這樣: ::" -#: ../../library/csv.rst:245 +#: ../../library/csv.rst:246 msgid "" "import csv\n" "\n" @@ -414,7 +414,7 @@ msgstr "" "with open('students.csv', 'w', newline='') as csvfile:\n" " writer = csv.writer(csvfile, dialect='unix')" -#: ../../library/csv.rst:253 +#: ../../library/csv.rst:254 msgid "" "The :class:`excel` class defines the usual properties of an Excel-generated " "CSV file. It is registered with the dialect name ``'excel'``." @@ -422,7 +422,7 @@ msgstr "" "類別 :class:`excel` 定義了透過 Excel 產生的 CSV 檔案的慣用屬性。它被註冊的 " "dialect 名稱為 ``'excel'``。" -#: ../../library/csv.rst:259 +#: ../../library/csv.rst:260 msgid "" "The :class:`excel_tab` class defines the usual properties of an Excel-" "generated TAB-delimited file. It is registered with the dialect name " @@ -431,7 +431,7 @@ msgstr "" "類別 :class:`excel_tab` 定義了透過 Excel 產生並以 Tab 作為分隔的 CSV 檔案的慣" "用屬性。它被註冊的 dialect 名稱為 ``'excel-tab'``。" -#: ../../library/csv.rst:265 +#: ../../library/csv.rst:266 msgid "" "The :class:`unix_dialect` class defines the usual properties of a CSV file " "generated on UNIX systems, i.e. using ``'\\n'`` as line terminator and " @@ -441,15 +441,15 @@ msgstr "" "句話說,使用 ``'\\n'`` 作為換行符號且所有欄位都被引號包覆起來。它被註冊的 " "dialect 名稱為 ``'unix'``。" -#: ../../library/csv.rst:274 +#: ../../library/csv.rst:275 msgid "The :class:`Sniffer` class is used to deduce the format of a CSV file." msgstr "類別 :class:`Sniffer` 被用來推斷 CSV 檔案的格式。" -#: ../../library/csv.rst:276 +#: ../../library/csv.rst:277 msgid "The :class:`Sniffer` class provides two methods:" msgstr "類別 :class:`Sniffer` 提供了兩個 method:" -#: ../../library/csv.rst:280 +#: ../../library/csv.rst:281 msgid "" "Analyze the given *sample* and return a :class:`Dialect` subclass reflecting " "the parameters found. If the optional *delimiters* parameter is given, it " @@ -459,7 +459,7 @@ msgstr "" "數。如果給定選填的參數 *delimiters*,它會被解釋為一個字串且含有可能、有效的分" "隔字元。" -#: ../../library/csv.rst:288 +#: ../../library/csv.rst:289 msgid "" "Analyze the sample text (presumed to be in CSV format) and return :const:" "`True` if the first row appears to be a series of column headers. Inspecting " @@ -470,18 +470,18 @@ msgstr "" "格式)並回傳 :const:`True`。檢查每一欄時,會考慮是否滿足兩個關鍵標準其中之" "一,判斷 sample 是否包含標題:" -#: ../../library/csv.rst:293 +#: ../../library/csv.rst:294 msgid "the second through n-th rows contain numeric values" msgstr "第二列至第 n 列包含數字" -#: ../../library/csv.rst:294 +#: ../../library/csv.rst:295 msgid "" "the second through n-th rows contain strings where at least one value's " "length differs from that of the putative header of that column." msgstr "" "第二列到第 n 列包含的字串中至少有一個值的長度與該行的假定標題的長度不同。" -#: ../../library/csv.rst:297 +#: ../../library/csv.rst:298 msgid "" "Twenty rows after the first row are sampled; if more than half of columns + " "rows meet the criteria, :const:`True` is returned." @@ -489,7 +489,7 @@ msgstr "" "對第一列之後的二十個列進行取樣;如果超過一半的行及列滿足條件,則返回 :const:" "`True`。" -#: ../../library/csv.rst:302 +#: ../../library/csv.rst:303 msgid "" "This method is a rough heuristic and may produce both false positives and " "negatives." @@ -497,11 +497,11 @@ msgstr "" "此方法是一個粗略的啟發,可能會產生偽陽性及偽陰性 (false positives and " "negatives)。" -#: ../../library/csv.rst:305 +#: ../../library/csv.rst:306 msgid "An example for :class:`Sniffer` use::" msgstr "一個 :class:`Sniffer` 的使用範例: ::" -#: ../../library/csv.rst:307 +#: ../../library/csv.rst:308 msgid "" "with open('example.csv', newline='') as csvfile:\n" " dialect = csv.Sniffer().sniff(csvfile.read(1024))\n" @@ -515,34 +515,34 @@ msgstr "" " reader = csv.reader(csvfile, dialect)\n" " # ... 在這邊處理 CSV 檔案 ..." -#: ../../library/csv.rst:316 +#: ../../library/csv.rst:317 msgid "The :mod:`csv` module defines the following constants:" msgstr ":mod:`csv` 模組定義了以下常數:" -#: ../../library/csv.rst:320 +#: ../../library/csv.rst:321 msgid "Instructs :class:`writer` objects to quote all fields." msgstr "引導 :class:`writer` 物件引用所有欄位。" -#: ../../library/csv.rst:325 +#: ../../library/csv.rst:326 msgid "" "Instructs :class:`writer` objects to only quote those fields which contain " "special characters such as *delimiter*, *quotechar*, ``'\\r'``, ``'\\n'`` or " "any of the characters in *lineterminator*." msgstr "" -"引導 :class:`writer` 物件只引用包含特殊字元的欄位,例如:*delimiter*、*quotechar*、" -"``'\\r'``、``'\\n'`` 或是 *lineterminator* 的其他字元。" +"引導 :class:`writer` 物件只引用包含特殊字元的欄位,例如:*delimiter*、" +"*quotechar*、``'\\r'``、``'\\n'`` 或是 *lineterminator* 的其他字元。" -#: ../../library/csv.rst:332 +#: ../../library/csv.rst:333 msgid "Instructs :class:`writer` objects to quote all non-numeric fields." msgstr "引導 :class:`writer` 物件引用所有非數字的欄位。" -#: ../../library/csv.rst:334 +#: ../../library/csv.rst:335 msgid "" "Instructs :class:`reader` objects to convert all non-quoted fields to type :" "class:`float`." msgstr "引導 :class:`reader` 物件轉換所有非引用的欄位為 :class:`float`。" -#: ../../library/csv.rst:337 +#: ../../library/csv.rst:338 msgid "" "Some numeric types, such as :class:`bool`, :class:`~fractions.Fraction`, or :" "class:`~enum.IntEnum`, have a string representation that cannot be converted " @@ -550,7 +550,7 @@ msgid "" "data:`QUOTE_STRINGS` modes." msgstr "" -#: ../../library/csv.rst:345 +#: ../../library/csv.rst:346 msgid "" "Instructs :class:`writer` objects to never quote fields. When the current " "*delimiter*, *quotechar*, *escapechar*, ``'\\r'``, ``'\\n'`` or any of the " @@ -560,18 +560,17 @@ msgid "" "Set *quotechar* to ``None`` to prevent its escaping." msgstr "" "引導 :class:`writer` 物件不得引用欄位。當目前的 *delimiter*、*quotechar*、" -"``'\\r'``、``'\\n'`` 或是 *lineterminator* 的其他字元出現在輸出資料時,在" -"他之前的字元是目前的 *escapechar*。如果沒有設定 *escapechar*,若遇到任何字" -"元需要逸出,寫入器則會引發 :exc:`Error`。設定 *quotechar* 為 ``None`` 以防止" -"逸出。" +"``'\\r'``、``'\\n'`` 或是 *lineterminator* 的其他字元出現在輸出資料時,在他之" +"前的字元是目前的 *escapechar*。如果沒有設定 *escapechar*,若遇到任何字元需要" +"逸出,寫入器則會引發 :exc:`Error`。設定 *quotechar* 為 ``None`` 以防止逸出。" -#: ../../library/csv.rst:353 +#: ../../library/csv.rst:354 msgid "" "Instructs :class:`reader` objects to perform no special processing of quote " "characters." msgstr "引導 :class:`reader` 物件不對引號進行特別處理。" -#: ../../library/csv.rst:357 +#: ../../library/csv.rst:358 msgid "" "Instructs :class:`writer` objects to quote all fields which are not " "``None``. This is similar to :data:`QUOTE_ALL`, except that if a field " @@ -580,7 +579,7 @@ msgstr "" "引導 :class:`writer` 物件引用所有非 ``None`` 的欄位。這與 :data:`QUOTE_ALL` " "相似,除非如果欄位值為 ``None``,該欄位則被寫成空(沒有引號)字串。" -#: ../../library/csv.rst:361 +#: ../../library/csv.rst:362 msgid "" "Instructs :class:`reader` objects to interpret an empty (unquoted) field as " "``None`` and to otherwise behave as :data:`QUOTE_ALL`." @@ -588,7 +587,7 @@ msgstr "" "引導 :class:`reader` 物件將空(沒有引號)欄位直譯 (interpret) 為 ``None``,否" "則會和 :data:`QUOTE_ALL` 有相同的表現方式。" -#: ../../library/csv.rst:368 +#: ../../library/csv.rst:369 msgid "" "Instructs :class:`writer` objects to always place quotes around fields which " "are strings. This is similar to :data:`QUOTE_NONNUMERIC`, except that if a " @@ -598,7 +597,7 @@ msgstr "" "`QUOTE_NONNUMERIC` 相似,除非如果欄位值為 ``None``,該欄位則被寫成空(沒有引" "號)字串。" -#: ../../library/csv.rst:372 +#: ../../library/csv.rst:373 msgid "" "Instructs :class:`reader` objects to interpret an empty (unquoted) string as " "``None`` and to otherwise behave as :data:`QUOTE_NONNUMERIC`." @@ -606,19 +605,19 @@ msgstr "" "引導 :class:`reader` 物件將空(沒有引號)字串直譯為 ``None``,否則會和 :data:" "`QUOTE_ALL` 有相同的表現方式。" -#: ../../library/csv.rst:377 +#: ../../library/csv.rst:378 msgid "The :mod:`csv` module defines the following exception:" msgstr ":mod:`csv` 模組定義下列例外:" -#: ../../library/csv.rst:382 +#: ../../library/csv.rst:383 msgid "Raised by any of the functions when an error is detected." msgstr "當偵測到錯誤時,任何函式都可以引發。" -#: ../../library/csv.rst:387 +#: ../../library/csv.rst:388 msgid "Dialects and Formatting Parameters" msgstr "Dialect 與格式參數" -#: ../../library/csv.rst:389 +#: ../../library/csv.rst:390 msgid "" "To make it easier to specify the format of input and output records, " "specific formatting parameters are grouped together into dialects. A " @@ -637,16 +636,16 @@ msgstr "" "代,在\\ *dialect*\\ 參數中,程式設計師可以指定個別的格式化參數,其與 :class:" "`Dialect` 類別定義的屬性具有相同的名字。" -#: ../../library/csv.rst:399 +#: ../../library/csv.rst:400 msgid "Dialects support the following attributes:" msgstr "Dialect 支援下列屬性:" -#: ../../library/csv.rst:404 +#: ../../library/csv.rst:405 msgid "" "A one-character string used to separate fields. It defaults to ``','``." msgstr "一個單一字元 (one-character) 的字串可已用來分割欄位。預設為 ``','``。" -#: ../../library/csv.rst:409 +#: ../../library/csv.rst:410 msgid "" "Controls how instances of *quotechar* appearing inside a field should " "themselves be quoted. When :const:`True`, the character is doubled. When :" @@ -657,7 +656,7 @@ msgstr "" "為 :const:`True`,字元會是雙引號。若為 :const:`False`,在 *quotechar* 之前會" "先使用 *escapechar* 作為前綴字。預設為 :const:`True`。" -#: ../../library/csv.rst:414 +#: ../../library/csv.rst:415 msgid "" "On output, if *doublequote* is :const:`False` and no *escapechar* is set, :" "exc:`Error` is raised if a *quotechar* is found in a field." @@ -665,47 +664,46 @@ msgstr "" "在輸出時,若 *doublequote* 是 :const:`False` 且\\ *逸出字元*\\ 沒有被設定,當" "一個\\ *引號*\\ 在欄位中被發現時,:exc:`Error` 會被引發。" -#: ../../library/csv.rst:420 +#: ../../library/csv.rst:421 msgid "" "A one-character string used by the writer to escape characters that require " "escaping:" -msgstr "" -"一個單一字元的字串,會被寫入器用來逸出需要逸出的字元:" +msgstr "一個單一字元的字串,會被寫入器用來逸出需要逸出的字元:" -#: ../../library/csv.rst:423 +#: ../../library/csv.rst:424 msgid "" "the *delimiter*, the *quotechar*, ``'\\r'``, ``'\\n'`` and any of the " "characters in *lineterminator* are escaped if *quoting* is set to :const:" "`QUOTE_NONE`;" msgstr "" -#: ../../library/csv.rst:426 +#: ../../library/csv.rst:427 msgid "the *quotechar* is escaped if *doublequote* is :const:`False`;" msgstr "" -#: ../../library/csv.rst:427 +#: ../../library/csv.rst:428 msgid "the *escapechar* itself." msgstr "*escapechar* 本身。" -#: ../../library/csv.rst:429 +#: ../../library/csv.rst:430 msgid "" "On reading, the *escapechar* removes any special meaning from the following " "character. It defaults to :const:`None`, which disables escaping." msgstr "" -"在讀取時,*escapechar* 會移除後面字元的任何特殊意義。預設為 :const:" -"`None`,表示禁止逸出。" +"在讀取時,*escapechar* 會移除後面字元的任何特殊意義。預設為 :const:`None`,表" +"示禁止逸出。" -#: ../../library/csv.rst:432 +#: ../../library/csv.rst:433 msgid "An empty *escapechar* is not allowed." msgstr "*escapechar* 為空是不被接受的。" -#: ../../library/csv.rst:437 +#: ../../library/csv.rst:438 msgid "" "The string used to terminate lines produced by the :class:`writer`. It " "defaults to ``'\\r\\n'``." msgstr "由 :class:`writer` 產生被用來分行的字串。預設為 ``'\\r\\n'``。" -#: ../../library/csv.rst:442 +#: ../../library/csv.rst:443 msgid "" "The :class:`reader` is hard-coded to recognise either ``'\\r'`` or ``'\\n'`` " "as end-of-line, and ignores *lineterminator*. This behavior may change in " @@ -714,7 +712,7 @@ msgstr "" ":class:`reader` 是 hard-coded 辨別 ``'\\r'`` or ``'\\n'`` 作為行尾 (end-of-" "line),並忽略\\ *lineterminator*。未來可能會改變這個行為。" -#: ../../library/csv.rst:449 +#: ../../library/csv.rst:450 msgid "" "A one-character string used to quote fields containing special characters, " "such as the *delimiter* or the *quotechar*, or which contain new-line " @@ -723,26 +721,26 @@ msgid "" "prevent escaping ``'\"'`` if *quoting* is set to :const:`QUOTE_NONE`." msgstr "" "一個單一字元的字串被用於引用包含特殊字元的欄位,像是 *delimiter*、" -"*quotechar* 或是換行字元(``'\\r'``、``'\\n'`` 或是 *lineterminator* 的任" -"一字元)。預設為 ``'\"'``。如果 *quoting* 設定為 :const:`QUOTE_NONE`,可以" -"設定為 ``None`` 以防止逸出 ``'\"'``。" +"*quotechar* 或是換行字元(``'\\r'``、``'\\n'`` 或是 *lineterminator* 的任一字" +"元)。預設為 ``'\"'``。如果 *quoting* 設定為 :const:`QUOTE_NONE`,可以設定為 " +"``None`` 以防止逸出 ``'\"'``。" -#: ../../library/csv.rst:456 +#: ../../library/csv.rst:457 msgid "An empty *quotechar* is not allowed." msgstr "*quotechar* 為空是不被允許的。" -#: ../../library/csv.rst:461 +#: ../../library/csv.rst:462 msgid "" "Controls when quotes should be generated by the writer and recognised by the " "reader. It can take on any of the :ref:`QUOTE_\\* constants ` and defaults to :const:`QUOTE_MINIMAL` if *quotechar* is not " "``None``, and :const:`QUOTE_NONE` otherwise." msgstr "" -"控制 writer 何時產生引號,以及 reader 如何辨識引號。如 *quotechar* 不為 ``None``," -"則可以使用任何 :ref:`QUOTE_\\* 常數 `\\ 且預設為 :const:" -"`QUOTE_MINIMAL`。否則預設為 :const:`QUOTE_NONE`。" +"控制 writer 何時產生引號,以及 reader 如何辨識引號。如 *quotechar* 不為 " +"``None``,則可以使用任何 :ref:`QUOTE_\\* 常數 `\\ 且預設為 :" +"const:`QUOTE_MINIMAL`。否則預設為 :const:`QUOTE_NONE`。" -#: ../../library/csv.rst:469 +#: ../../library/csv.rst:470 msgid "" "When :const:`True`, spaces immediately following the *delimiter* are " "ignored. The default is :const:`False`." @@ -750,18 +748,18 @@ msgstr "" "若為 :const:`True`,在緊接著\\ *delimiter*\\ 後的空格會被忽略。預設為 :const:" "`False`。" -#: ../../library/csv.rst:475 +#: ../../library/csv.rst:476 msgid "" "When ``True``, raise exception :exc:`Error` on bad CSV input. The default is " "``False``." msgstr "" "若為 ``True``,若有錯誤的 CSV 輸入則會引發 :exc:`Error`。預設為 ``False``。" -#: ../../library/csv.rst:481 +#: ../../library/csv.rst:482 msgid "Reader Objects" msgstr "讀取器物件" -#: ../../library/csv.rst:483 +#: ../../library/csv.rst:484 msgid "" "Reader objects (:class:`DictReader` instances and objects returned by the :" "func:`reader` function) have the following public methods:" @@ -769,7 +767,7 @@ msgstr "" "讀取器物件(:func:`reader` 函式回傳的 :class:`DictReader` 實例與物件)有下列" "公開方法 (public method):" -#: ../../library/csv.rst:488 +#: ../../library/csv.rst:489 msgid "" "Return the next row of the reader's iterable object as a list (if the object " "was returned from :func:`reader`) or a dict (if it is a :class:`DictReader` " @@ -780,25 +778,25 @@ msgstr "" "傳)或是一個 dict(若為 :class:`DictReader` 實例),會依據目前的 :class:" "`Dialect` 進行剖析。通常會用 ``next(reader)`` 來進行呼叫。" -#: ../../library/csv.rst:494 +#: ../../library/csv.rst:495 msgid "Reader objects have the following public attributes:" msgstr "讀取器物件有下列公開屬性 (public attributes):" -#: ../../library/csv.rst:498 +#: ../../library/csv.rst:499 msgid "A read-only description of the dialect in use by the parser." msgstr "dialect 的唯讀敘述,會被剖析器使用。" -#: ../../library/csv.rst:503 +#: ../../library/csv.rst:504 msgid "" "The number of lines read from the source iterator. This is not the same as " "the number of records returned, as records can span multiple lines." msgstr "來源疊代器所讀取的行數。這與回傳的紀錄數不同,因為可以進行跨行紀錄。" -#: ../../library/csv.rst:507 +#: ../../library/csv.rst:508 msgid "DictReader objects have the following public attribute:" msgstr "DictReader 物件有下列公開屬性:" -#: ../../library/csv.rst:511 +#: ../../library/csv.rst:512 msgid "" "If not passed as a parameter when creating the object, this attribute is " "initialized upon first access or when the first record is read from the file." @@ -806,11 +804,11 @@ msgstr "" "若在建立物件時沒有作為參數傳遞,這個屬性會在第一次存取之前或是第一筆資料被讀" "取之前進行初始化 (initialize)。" -#: ../../library/csv.rst:518 +#: ../../library/csv.rst:519 msgid "Writer Objects" msgstr "寫入器物件" -#: ../../library/csv.rst:520 +#: ../../library/csv.rst:521 msgid "" ":class:`writer` objects (:class:`DictWriter` instances and objects returned " "by the :func:`writer` function) have the following public methods. A *row* " @@ -828,7 +826,7 @@ msgstr "" "遞)。請注意,在寫入複數 (complex number) 時會用小括號 (parens) 包起來。這可" "能在其他程式讀取 CSV 檔案時導致某些問題(假設他們完全支援複雜數字)。" -#: ../../library/csv.rst:531 +#: ../../library/csv.rst:532 msgid "" "Write the *row* parameter to the writer's file object, formatted according " "to the current :class:`Dialect`. Return the return value of the call to the " @@ -837,11 +835,11 @@ msgstr "" "將參數 *row* 寫入至寫入器的檔案物件中,並依照目前的 :class:`Dialect` 進行格式" "化。回傳下層檔案物件 *write* 方法的回傳值。" -#: ../../library/csv.rst:535 +#: ../../library/csv.rst:536 msgid "Added support of arbitrary iterables." msgstr "新增對任意可疊代物件 (arbitrary iterables) 的支援。" -#: ../../library/csv.rst:540 +#: ../../library/csv.rst:541 msgid "" "Write all elements in *rows* (an iterable of *row* objects as described " "above) to the writer's file object, formatted according to the current " @@ -850,19 +848,19 @@ msgstr "" "將 *rows* 中所有元素(為上述的一個可疊代的 *row* 物件)寫入至寫入器的檔案物件" "中,並依照目前的 dialect 進行格式化。" -#: ../../library/csv.rst:544 +#: ../../library/csv.rst:545 msgid "Writer objects have the following public attribute:" msgstr "寫入器物件有下列公開屬性:" -#: ../../library/csv.rst:549 +#: ../../library/csv.rst:550 msgid "A read-only description of the dialect in use by the writer." msgstr "dialect 的唯讀敘述,會被寫入器使用。" -#: ../../library/csv.rst:552 +#: ../../library/csv.rst:553 msgid "DictWriter objects have the following public method:" msgstr "DictWriter 物件有下列公開方法:" -#: ../../library/csv.rst:557 +#: ../../library/csv.rst:558 msgid "" "Write a row with the field names (as specified in the constructor) to the " "writer's file object, formatted according to the current dialect. Return the " @@ -872,7 +870,7 @@ msgstr "" "中,並依照目前的 dialect 進行格式化。回傳內部呼叫 :meth:`csvwriter.writerow` " "的回傳值。" -#: ../../library/csv.rst:562 +#: ../../library/csv.rst:563 msgid "" ":meth:`writeheader` now also returns the value returned by the :meth:" "`csvwriter.writerow` method it uses internally." @@ -880,15 +878,15 @@ msgstr "" ":meth:`writeheader` 現在也會回傳內部呼叫 :meth:`csvwriter.writerow` 的回傳" "值。" -#: ../../library/csv.rst:570 +#: ../../library/csv.rst:571 msgid "Examples" msgstr "範例" -#: ../../library/csv.rst:572 +#: ../../library/csv.rst:573 msgid "The simplest example of reading a CSV file::" msgstr "最簡單的讀取 CSV 檔案範例: ::" -#: ../../library/csv.rst:574 +#: ../../library/csv.rst:575 msgid "" "import csv\n" "with open('some.csv', newline='') as f:\n" @@ -902,11 +900,11 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:580 +#: ../../library/csv.rst:581 msgid "Reading a file with an alternate format::" msgstr "讀取一個其他格式的檔案: ::" -#: ../../library/csv.rst:582 +#: ../../library/csv.rst:583 msgid "" "import csv\n" "with open('passwd', newline='') as f:\n" @@ -920,11 +918,11 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:588 +#: ../../library/csv.rst:589 msgid "The corresponding simplest possible writing example is::" msgstr "相對最簡單、可行的寫入範例為: ::" -#: ../../library/csv.rst:590 +#: ../../library/csv.rst:591 msgid "" "import csv\n" "with open('some.csv', 'w', newline='') as f:\n" @@ -932,7 +930,7 @@ msgid "" " writer.writerows(someiterable)" msgstr "" -#: ../../library/csv.rst:595 +#: ../../library/csv.rst:596 msgid "" "Since :func:`open` is used to open a CSV file for reading, the file will by " "default be decoded into unicode using the system default encoding (see :func:" @@ -943,7 +941,7 @@ msgstr "" "碼格式(請見 :func:`locale.getencoding`),並解碼為 unicode。若要使用不同編碼" "格式進行檔案解碼,請使用 open 函式的 ``encoding`` 引數: ::" -#: ../../library/csv.rst:600 +#: ../../library/csv.rst:601 msgid "" "import csv\n" "with open('some.csv', newline='', encoding='utf-8') as f:\n" @@ -957,7 +955,7 @@ msgstr "" " for row in reader:\n" " print(row)" -#: ../../library/csv.rst:606 +#: ../../library/csv.rst:607 msgid "" "The same applies to writing in something other than the system default " "encoding: specify the encoding argument when opening the output file." @@ -965,11 +963,11 @@ msgstr "" "同理可以應用到使用不同編碼格式進行寫入:當開啟輸出檔案時,指定 ``encoding`` " "引數。" -#: ../../library/csv.rst:609 +#: ../../library/csv.rst:610 msgid "Registering a new dialect::" msgstr "註冊一個新的 dialect : ::" -#: ../../library/csv.rst:611 +#: ../../library/csv.rst:612 msgid "" "import csv\n" "csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)\n" @@ -981,13 +979,13 @@ msgstr "" "with open('passwd', newline='') as f:\n" " reader = csv.reader(f, 'unixpwd')" -#: ../../library/csv.rst:616 +#: ../../library/csv.rst:617 msgid "" "A slightly more advanced use of the reader --- catching and reporting " "errors::" msgstr "稍微進階的讀取器用法 -- 擷取及回報錯誤: ::" -#: ../../library/csv.rst:618 +#: ../../library/csv.rst:619 msgid "" "import csv, sys\n" "filename = 'some.csv'\n" @@ -1009,13 +1007,13 @@ msgstr "" " except csv.Error as e:\n" " sys.exit(f'file {filename}, line {reader.line_num}: {e}')" -#: ../../library/csv.rst:628 +#: ../../library/csv.rst:629 msgid "" "And while the module doesn't directly support parsing strings, it can easily " "be done::" msgstr "而當模組無法直接支援剖析字串時,仍可以輕鬆的解決: ::" -#: ../../library/csv.rst:631 +#: ../../library/csv.rst:632 msgid "" "import csv\n" "for row in csv.reader(['one,two,three']):\n" @@ -1025,11 +1023,11 @@ msgstr "" "for row in csv.reader(['one,two,three']):\n" " print(row)" -#: ../../library/csv.rst:637 +#: ../../library/csv.rst:638 msgid "Footnotes" msgstr "註解" -#: ../../library/csv.rst:638 +#: ../../library/csv.rst:639 msgid "" "If ``newline=''`` is not specified, newlines embedded inside quoted fields " "will not be interpreted correctly, and on platforms that use ``\\r\\n`` " From 7d7d5b1e58af66ba202c7ead3d017cc3d1a7f5cb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 26 Aug 2025 00:17:37 +0000 Subject: [PATCH 4/6] sync with cpython bad7bc49 --- library/functions.po | 866 ++++++++++--------- library/stdtypes.po | 1971 +++++++++++++++++++++--------------------- 2 files changed, 1420 insertions(+), 1417 deletions(-) diff --git a/library/functions.po b/library/functions.po index 8e0ff9c05a..03f2aa77ae 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-14 00:16+0000\n" +"POT-Creation-Date: 2025-08-26 00:16+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-" @@ -498,11 +498,12 @@ msgstr "" "函式生成的字串和 Python 2 的 :func:`repr` 回傳的結果相似。" #: ../../library/functions.rst:124 +#, fuzzy 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:" +"result is a valid Python expression. If *integer* 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." @@ -514,8 +515,8 @@ msgid "" "ways." msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" -#: ../../library/functions.rst:141 ../../library/functions.rst:942 -#: ../../library/functions.rst:1323 +#: ../../library/functions.rst:141 ../../library/functions.rst:940 +#: ../../library/functions.rst:1321 msgid "See also :func:`format` for more information." msgstr "可參考 :func:`format` 取得更多資訊。" @@ -534,7 +535,7 @@ msgstr "" "(參見 :ref:`typesnumeric`),其他 class 不能繼承自它。它只有 ``False`` 和 " "``True`` 兩個實例(參見 :ref:`typebool`)。" -#: ../../library/functions.rst:156 ../../library/functions.rst:807 +#: ../../library/functions.rst:156 ../../library/functions.rst:805 msgid "The parameter is now positional-only." msgstr "現在為僅限位置參數。" @@ -581,7 +582,7 @@ msgstr "" "引發一個附帶引數 ``breakpointhook`` 的\\ :ref:`稽核事件 ` " "``builtins.breakpoint``。" -#: ../../library/functions.rst:190 +#: ../../library/functions.rst:189 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 " @@ -593,13 +594,13 @@ msgstr "" "`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 method,參" "見 :ref:`bytes-methods`。" -#: ../../library/functions.rst:195 +#: ../../library/functions.rst:194 msgid "" "The optional *source* parameter can be used to initialize the array in a few " "different ways:" msgstr "選擇性參數 *source* 可以被用來以不同的方式初始化陣列:" -#: ../../library/functions.rst:198 +#: ../../library/functions.rst:197 msgid "" "If it is a *string*, you must also give the *encoding* (and optionally, " "*errors*) parameters; :func:`bytearray` then converts the string to bytes " @@ -609,14 +610,14 @@ msgstr "" "*errors* );:func:`bytearray` 會使用 :meth:`str.encode` method 來將 string " "轉變成 bytes。" -#: ../../library/functions.rst:202 +#: ../../library/functions.rst:201 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 +#: ../../library/functions.rst:204 msgid "" "If it is an object conforming to the :ref:`buffer interface " "`, a read-only buffer of the object will be used to " @@ -625,7 +626,7 @@ msgstr "" "如果是一個符合 :ref:`buffer 介面 `\\ 的物件,該物件的唯讀 " "buffer 會被用來初始化 bytes 陣列。" -#: ../../library/functions.rst:208 +#: ../../library/functions.rst:207 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." @@ -633,15 +634,15 @@ msgstr "" "如果是一個 *iterable*,它的元素必須是範圍為 ``0 <= x < 256`` 的整數,並且會被" "用作陣列的初始值。" -#: ../../library/functions.rst:211 +#: ../../library/functions.rst:210 msgid "Without an argument, an array of size 0 is created." msgstr "如果沒有引數,則建立長度為 0 的陣列。" -#: ../../library/functions.rst:213 +#: ../../library/functions.rst:212 msgid "See also :ref:`binaryseq` and :ref:`typebytearray`." msgstr "可參考 :ref:`binaryseq` 和 :ref:`typebytearray`。" -#: ../../library/functions.rst:222 +#: ../../library/functions.rst:220 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 :" @@ -652,20 +653,20 @@ msgstr "" "變序列。:class:`bytes` 是 :class:`bytearray` 的不可變版本 — 它的同樣具備不改" "變物件的 method,也有相同的索引和切片操作。" -#: ../../library/functions.rst:227 +#: ../../library/functions.rst:225 msgid "" "Accordingly, constructor arguments are interpreted as for :func:`bytearray`." msgstr "因此,建構函式的引數和 :func:`bytearray` 相同。" -#: ../../library/functions.rst:229 +#: ../../library/functions.rst:227 msgid "Bytes objects can also be created with literals, see :ref:`strings`." msgstr "Bytes 物件還可以用文字建立,參見 :ref:`strings`。" -#: ../../library/functions.rst:231 +#: ../../library/functions.rst:229 msgid "See also :ref:`binaryseq`, :ref:`typebytes`, and :ref:`bytes-methods`." msgstr "可參考 :ref:`binaryseq`、:ref:`typebytes` 和 :ref:`bytes-methods`。" -#: ../../library/functions.rst:236 +#: ../../library/functions.rst:234 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 " @@ -678,34 +679,36 @@ msgstr "" "會失敗。注意 class 是可呼叫的(呼叫 class 會回傳一個新的實例);如果實例的 " "class 有定義 :meth:`~object.__call__` method,則它是可呼叫的。" -#: ../../library/functions.rst:242 +#: ../../library/functions.rst:240 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 +#: ../../library/functions.rst:247 +#, fuzzy msgid "" -"Return the string representing a character whose Unicode code point is the " -"integer *i*. For example, ``chr(97)`` returns the string ``'a'``, while " +"Return the string representing a character with the specified Unicode code " +"point. 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` 的逆函式。" -#: ../../library/functions.rst:253 +#: ../../library/functions.rst:251 +#, fuzzy 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." +"base 16). :exc:`ValueError` will be raised if it is outside that range." msgstr "" "引數的有效範圍是 0 到 1,114,111(16 進制表示為 0x10FFFF)。如果 *i* 超過這個" "範圍,會引發 :exc:`ValueError`。" -#: ../../library/functions.rst:259 +#: ../../library/functions.rst:257 msgid "Transform a method into a class method." msgstr "把一個 method 封裝成 class method(類別方法)。" -#: ../../library/functions.rst:261 +#: ../../library/functions.rst:259 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 " @@ -714,7 +717,7 @@ msgstr "" "一個 class method 把自己的 class 作為第一個引數,就像一個實例 method 把實例自" "己作為第一個引數。請用以下慣例來宣告 class method: ::" -#: ../../library/functions.rst:265 +#: ../../library/functions.rst:263 msgid "" "class C:\n" " @classmethod\n" @@ -724,7 +727,7 @@ msgstr "" " @classmethod\n" " def f(cls, arg1, arg2): ..." -#: ../../library/functions.rst:269 +#: ../../library/functions.rst:267 msgid "" "The ``@classmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -732,7 +735,7 @@ msgstr "" "``@classmethod`` 語法是一個函式 :term:`decorator` — 參見 :ref:`function` 中關" "於函式定義的詳細介紹。" -#: ../../library/functions.rst:272 +#: ../../library/functions.rst:270 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 " @@ -743,7 +746,7 @@ msgstr "" "叫。實例除了它的 class 資訊,其他都會被忽略。如果一個 class method 在 " "subclass 上呼叫,subclass 會作為第一個引數傳入。" -#: ../../library/functions.rst:277 +#: ../../library/functions.rst:275 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 " @@ -753,7 +756,7 @@ msgstr "" "method,請看本節的 :func:`staticmethod`。關於 class method 的更多資訊,請參考" "\\ :ref:`types`。" -#: ../../library/functions.rst:281 +#: ../../library/functions.rst:279 msgid "" "Class methods can now wrap other :term:`descriptors ` such as :" "func:`property`." @@ -761,7 +764,7 @@ msgstr "" "Class methods 現在可以包裝其他\\ :term:`描述器 `,例如 :func:" "`property`" -#: ../../library/functions.rst:285 +#: ../../library/functions.rst:283 msgid "" "Class methods now inherit the method attributes (:attr:`~function." "__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" @@ -773,7 +776,7 @@ msgstr "" "__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " "``__wrapped__`` 屬性。" -#: ../../library/functions.rst:292 +#: ../../library/functions.rst:290 msgid "" "Class methods can no longer wrap other :term:`descriptors ` such " "as :func:`property`." @@ -781,7 +784,7 @@ msgstr "" "Class methods 不能再包裝其他的\\ :term:`描述器 `,例如 :func:" "`property`。" -#: ../../library/functions.rst:299 +#: ../../library/functions.rst:297 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 " @@ -792,7 +795,7 @@ msgstr "" "`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。參見 :mod:" "`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" -#: ../../library/functions.rst:304 +#: ../../library/functions.rst:302 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 (``''`` " @@ -801,7 +804,7 @@ msgstr "" "*filename* 引數必須是程式碼的檔名;如果程式碼不是從檔案中讀取,可以傳入一些可" "辨識的值(經常會使用 ``''`` 來替代)。" -#: ../../library/functions.rst:308 +#: ../../library/functions.rst:306 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 " @@ -814,7 +817,7 @@ msgstr "" "式,可以是 ``'single'``\\ (在最後一種情況下,如果運算式執行結果不是 " "``None`` 則會被印出來)。" -#: ../../library/functions.rst:314 +#: ../../library/functions.rst:312 msgid "" "The optional arguments *flags* and *dont_inherit* control which :ref:" "`compiler options ` should be activated and which :ref:" @@ -834,7 +837,7 @@ msgstr "" "引數所指定的編譯器選項和未來陳述式。如果 *dont_inherit* 是一個非零整數,則使" "用 *flags* 引數 -- 周圍程式碼中的旗標(未來功能和編譯器選項)將被忽略。" -#: ../../library/functions.rst:325 +#: ../../library/functions.rst:323 msgid "" "Compiler options and future statements are specified by bits which can be " "bitwise ORed together to specify multiple options. The bitfield required to " @@ -849,7 +852,7 @@ msgstr "" "compiler_flag` 屬性來獲得。:ref:`編譯器旗標 `\\ 可以在 :" "mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名稱。" -#: ../../library/functions.rst:333 +#: ../../library/functions.rst:331 msgid "" "The argument *optimize* specifies the optimization level of the compiler; " "the default value of ``-1`` selects the optimization level of the " @@ -862,7 +865,7 @@ msgstr "" "``__debug__`` 為真值)、``1``\\ (assert 被刪除,``__debug__`` 為假值)或 " "``2``\\ (說明字串 (docstring) 也被刪除)。" -#: ../../library/functions.rst:339 +#: ../../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." @@ -870,13 +873,13 @@ msgstr "" "如果編譯的原始碼無效,此函式會引發 :exc:`SyntaxError`,如果原始碼包含 null " "bytes,則會引發 :exc:`ValueError`。" -#: ../../library/functions.rst:342 +#: ../../library/functions.rst:340 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 +#: ../../library/functions.rst:343 ../../library/functions.rst:345 msgid "" "Raises an :ref:`auditing event ` ``compile`` with arguments " "``source`` and ``filename``. This event may also be raised by implicit " @@ -885,7 +888,7 @@ msgstr "" "引發一個附帶引數 ``source``、``filename`` 的\\ :ref:`稽核事件 ` " "``compile``。此事件也可能由隱式編譯 (implicit compilation) 所引發。" -#: ../../library/functions.rst:353 +#: ../../library/functions.rst:351 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 " @@ -895,7 +898,7 @@ msgstr "" "在 ``'single'`` 或 ``'eval'`` 模式編譯多行程式碼時,輸入必須以至少一個換行符" "結尾。這使 :mod:`code` module 更容易檢測陳述式的完整性。" -#: ../../library/functions.rst:360 +#: ../../library/functions.rst:358 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 " @@ -904,7 +907,7 @@ msgstr "" "如果編譯足夠大或者足夠複雜的字串成 AST 物件時,Python 直譯器會因為 Python " "AST 編譯器的 stack 深度限制而崩潰。" -#: ../../library/functions.rst:364 +#: ../../library/functions.rst:362 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." @@ -912,13 +915,13 @@ msgstr "" "允許使用 Windows 和 Mac 的換行符號。此外,在 ``'exec'`` 模式不需要以換行符號" "結尾。增加了 *optimize* 參數。" -#: ../../library/functions.rst:368 +#: ../../library/functions.rst:366 msgid "" "Previously, :exc:`TypeError` was raised when null bytes were encountered in " "*source*." msgstr "在之前的版本,*source* 中包含 null bytes 會引發 :exc:`TypeError`。" -#: ../../library/functions.rst:372 +#: ../../library/functions.rst:370 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``." @@ -926,18 +929,18 @@ msgstr "" "``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` 現在可以傳遞旗標以啟用對頂層 ``await``、" "``async for`` 和 ``async with`` 的支援。" -#: ../../library/functions.rst:381 +#: ../../library/functions.rst:379 msgid "" "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:382 ../../library/functions.rst:750 +#: ../../library/functions.rst:996 msgid "Examples:" msgstr "例如: ::" -#: ../../library/functions.rst:386 +#: ../../library/functions.rst:384 msgid "" ">>> complex('+1.23')\n" "(1.23+0j)\n" @@ -973,7 +976,7 @@ msgstr "" ">>> complex(-1.23, 4.5)\n" "(-1.23+4.5j)" -#: ../../library/functions.rst:405 +#: ../../library/functions.rst:403 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 " @@ -988,7 +991,7 @@ msgid "" "parentheses and leading and trailing whitespace characters are removed:" msgstr "" -#: ../../library/functions.rst:424 +#: ../../library/functions.rst:422 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``, " @@ -1003,7 +1006,7 @@ msgstr "" "back) 到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未定義,則會再回" "退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:433 +#: ../../library/functions.rst:431 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 " @@ -1014,20 +1017,20 @@ msgid "" "number, only its real component is used in the above expressions." msgstr "" -#: ../../library/functions.rst:443 +#: ../../library/functions.rst:441 msgid "If all arguments are omitted, returns ``0j``." msgstr "" -#: ../../library/functions.rst:445 +#: ../../library/functions.rst:443 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:445 ../../library/functions.rst:802 +#: ../../library/functions.rst:1045 msgid "Grouping digits with underscores as in code literals is allowed." msgstr "可以使用底線將程式碼文字中的數字進行分組。" -#: ../../library/functions.rst:450 +#: ../../library/functions.rst:448 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :" "meth:`~object.__float__` are not defined." @@ -1035,7 +1038,7 @@ msgstr "" "如果 :meth:`~object.__complex__` 和 :meth:`~object.__float__` 未定義,則會回" "退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:457 +#: ../../library/functions.rst:455 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 " @@ -1048,7 +1051,7 @@ msgstr "" "'foobar')`` 等價於 ``del x.foobar``。*name* 不必是個 Python 識別符 " "(identifier)(請見 :func:`setattr`)。" -#: ../../library/functions.rst:470 +#: ../../library/functions.rst:468 msgid "" "Create a new dictionary. The :class:`dict` object is the dictionary class. " "See :class:`dict` and :ref:`typesmapping` for documentation about this class." @@ -1056,7 +1059,7 @@ msgstr "" "建立一個新的 dictionary(字典)。:class:`dict` 物件是一個 dictionary class。" "參見 :class:`dict` 和 :ref:`typesmapping` 來瞭解這個 class。" -#: ../../library/functions.rst:473 +#: ../../library/functions.rst:471 msgid "" "For other containers see the built-in :class:`list`, :class:`set`, and :" "class:`tuple` classes, as well as the :mod:`collections` module." @@ -1064,7 +1067,7 @@ msgstr "" "其他容器型別,請參見內建的 :class:`list`、:class:`set` 和 :class:`tuple` " "class,以及 :mod:`collections` module。" -#: ../../library/functions.rst:480 +#: ../../library/functions.rst:478 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 " @@ -1073,7 +1076,7 @@ msgstr "" "如果沒有引數,則回傳目前區域作用域 (local scope) 中的名稱列表。如果有引數,它" "會嘗試回傳該物件的有效屬性列表。" -#: ../../library/functions.rst:483 +#: ../../library/functions.rst:481 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 " @@ -1086,7 +1089,7 @@ msgstr "" "或 :func:`~object.__getattribute__` 函式的物件能夠自定義 :func:`dir` 來報告它" "們的屬性。" -#: ../../library/functions.rst:490 +#: ../../library/functions.rst:488 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__` " @@ -1098,7 +1101,7 @@ msgstr "" "`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的,如果物件有" "自定義 :func:`~object.__getattr__`,那結果可能不準確。" -#: ../../library/functions.rst:496 +#: ../../library/functions.rst:494 msgid "" "The default :func:`dir` mechanism behaves differently with different types " "of objects, as it attempts to produce the most relevant, rather than " @@ -1107,13 +1110,13 @@ msgstr "" "預設的 :func:`dir` 機制對不同型別的物件有不同行為,它會試圖回傳最相關而非最完" "整的資訊:" -#: ../../library/functions.rst:500 +#: ../../library/functions.rst:498 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 +#: ../../library/functions.rst:501 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." @@ -1121,7 +1124,7 @@ msgstr "" "如果物件是型別或 class 物件,則列表包含它們的屬性名稱,並且遞迴查詢其基礎的所" "有屬性。" -#: ../../library/functions.rst:506 +#: ../../library/functions.rst:504 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 " @@ -1130,11 +1133,11 @@ msgstr "" "否則,包含物件的屬性名稱列表、它的 class 屬性名稱,並且遞迴查詢它的 class 的" "所有基礎 class 的屬性。" -#: ../../library/functions.rst:510 +#: ../../library/functions.rst:508 msgid "The resulting list is sorted alphabetically. For example:" msgstr "回傳的列表按字母表排序,例如:" -#: ../../library/functions.rst:530 +#: ../../library/functions.rst:528 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 " @@ -1147,7 +1150,7 @@ msgstr "" "版本之間改變。例如,當引數是一個 class 時,metaclass 的屬性不包含在結果列表" "中。" -#: ../../library/functions.rst:540 +#: ../../library/functions.rst:538 msgid "" "Take two (non-complex) numbers as arguments and return a pair of numbers " "consisting of their quotient and remainder when using integer division. " @@ -1165,7 +1168,7 @@ msgstr "" "等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % b) < " "abs(b)``。" -#: ../../library/functions.rst:552 +#: ../../library/functions.rst:550 msgid "" "Return an enumerate object. *iterable* must be a sequence, an :term:" "`iterator`, or some other object which supports iteration. The :meth:" @@ -1178,11 +1181,11 @@ msgstr "" "__next__` method 回傳一個 tuple(元組),裡面包含一個計數值(從 *start* 開" "始,預設為 0)和透過疊代 *iterable* 獲得的值。" -#: ../../library/functions.rst:564 +#: ../../library/functions.rst:562 msgid "Equivalent to::" msgstr "等價於: ::" -#: ../../library/functions.rst:566 +#: ../../library/functions.rst:564 msgid "" "def enumerate(iterable, start=0):\n" " n = start\n" @@ -1200,15 +1203,15 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/functions.rst:576 +#: ../../library/functions.rst:574 msgid "A Python expression." msgstr "" -#: ../../library/functions.rst:580 +#: ../../library/functions.rst:578 msgid "The global namespace (default: ``None``)." msgstr "" -#: ../../library/functions.rst:584 +#: ../../library/functions.rst:582 msgid "The local namespace (default: ``None``)." msgstr "" @@ -1216,7 +1219,7 @@ msgstr "" msgid "Returns" msgstr "" -#: ../../library/functions.rst:588 +#: ../../library/functions.rst:586 msgid "The result of the evaluated expression." msgstr "" @@ -1224,17 +1227,17 @@ msgstr "" msgid "raises" msgstr "引發" -#: ../../library/functions.rst:589 +#: ../../library/functions.rst:587 msgid "Syntax errors are reported as exceptions." msgstr "" -#: ../../library/functions.rst:593 ../../library/functions.rst:654 +#: ../../library/functions.rst:591 ../../library/functions.rst:652 msgid "" "This function executes arbitrary code. Calling it with user-supplied input " "may lead to security vulnerabilities." msgstr "" -#: ../../library/functions.rst:596 +#: ../../library/functions.rst:594 msgid "" "The *expression* argument is parsed and evaluated as a Python expression " "(technically speaking, a condition list) using the *globals* and *locals* " @@ -1264,11 +1267,11 @@ msgstr "" "locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透過 :keyword:" "`nonlocal` 陳述式)。" -#: ../../library/functions.rst:612 +#: ../../library/functions.rst:610 msgid "Example:" msgstr "範例:" -#: ../../library/functions.rst:618 +#: ../../library/functions.rst:616 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 " @@ -1279,7 +1282,7 @@ msgstr "" "情況下,傳入的引數是程式碼物件而不是字串。如果編譯該物件時的 *mode* 引數是 " "``'exec'``,那麼 :func:`eval` 回傳值為 ``None``。" -#: ../../library/functions.rst:623 +#: ../../library/functions.rst:621 msgid "" "Hints: dynamic execution of statements is supported by the :func:`exec` " "function. The :func:`globals` and :func:`locals` functions return the " @@ -1290,13 +1293,13 @@ msgstr "" "函式分別回傳目前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" "`eval` 或 :func:`exec` 可能會方便許多。" -#: ../../library/functions.rst:628 +#: ../../library/functions.rst:626 msgid "" "If the given source is a string, then leading and trailing spaces and tabs " "are stripped." msgstr "如果給定來源是一個字串,那麼其前後的空格和定位字元會被移除。" -#: ../../library/functions.rst:631 +#: ../../library/functions.rst:629 msgid "" "See :func:`ast.literal_eval` for a function that can safely evaluate strings " "with expressions containing only literals." @@ -1304,8 +1307,8 @@ msgstr "" "另外可以參閱 :func:`ast.literal_eval`,該函式可以安全執行僅包含文字的運算式字" "串。" -#: ../../library/functions.rst:634 ../../library/functions.rst:636 -#: ../../library/functions.rst:696 ../../library/functions.rst:698 +#: ../../library/functions.rst:632 ../../library/functions.rst:634 +#: ../../library/functions.rst:694 ../../library/functions.rst:696 msgid "" "Raises an :ref:`auditing event ` ``exec`` with the code object as " "the argument. Code compilation events may also be raised." @@ -1313,17 +1316,17 @@ msgstr "" "引發一個附帶程式碼物件為引數的\\ :ref:`稽核事件 ` ``exec``。也可能" "會引發程式碼編譯事件。" -#: ../../library/functions.rst:641 ../../library/functions.rst:718 +#: ../../library/functions.rst:639 ../../library/functions.rst:716 msgid "The *globals* and *locals* arguments can now be passed as keywords." msgstr "" -#: ../../library/functions.rst:645 ../../library/functions.rst:722 +#: ../../library/functions.rst:643 ../../library/functions.rst:720 msgid "" "The semantics of the default *locals* namespace have been adjusted as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:657 +#: ../../library/functions.rst:655 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 " @@ -1343,7 +1346,7 @@ msgstr "" "`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使" "用。該函式回傳值是 ``None``。" -#: ../../library/functions.rst:668 +#: ../../library/functions.rst:666 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 " @@ -1359,7 +1362,7 @@ msgstr "" "用作全域和區域變數。如果提供了 *locals*,則它可以是任何對映物件。請記住在 " "module 層級中全域和區域變數是相同的 dictionary。" -#: ../../library/functions.rst:678 +#: ../../library/functions.rst:676 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 " @@ -1368,7 +1371,7 @@ msgid "" "are treated as class variables in a class definition)." msgstr "" -#: ../../library/functions.rst:684 +#: ../../library/functions.rst:682 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:" @@ -1381,7 +1384,7 @@ msgstr "" "dictionary 傳入 :func:`exec` 之前,你可以透過將它插入 *globals* 來控制你需要" "哪些內建函式來執行程式碼。" -#: ../../library/functions.rst:690 +#: ../../library/functions.rst:688 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) " @@ -1393,7 +1396,7 @@ msgstr "" "variables) ` 的程式碼物件時,它才有效。Tuple 的長度必須與程" "式碼物件的 :attr:`~codeobject.co_freevars` 屬性完全匹配。" -#: ../../library/functions.rst:703 +#: ../../library/functions.rst:701 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 " @@ -1402,7 +1405,7 @@ msgstr "" "內建 :func:`globals` 和 :func:`locals` 函式各自回傳目前的全域和區域命名空間," "因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數以供後續使用。" -#: ../../library/functions.rst:709 +#: ../../library/functions.rst:707 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 " @@ -1412,11 +1415,11 @@ msgstr "" "func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 *locals* " "dictionary 。" -#: ../../library/functions.rst:713 +#: ../../library/functions.rst:711 msgid "Added the *closure* parameter." msgstr "增加了 *closure* 參數。" -#: ../../library/functions.rst:728 +#: ../../library/functions.rst:726 msgid "" "Construct an iterator from those elements of *iterable* for which *function* " "is true. *iterable* may be either a sequence, a container which supports " @@ -1428,7 +1431,7 @@ msgstr "" "*function* 是 ``None``,則會假設它是一個識別性函式,即 *iterable* 中所有假值" "元素會被移除。" -#: ../../library/functions.rst:734 +#: ../../library/functions.rst:732 msgid "" "Note that ``filter(function, iterable)`` is equivalent to the generator " "expression ``(item for item in iterable if function(item))`` if function is " @@ -1439,7 +1442,7 @@ msgstr "" "是 ``None`` 的時候為 ``(item for item in iterable if function(item))``;" "function 是 ``None`` 的時候為 ``(item for item in iterable if item)``。" -#: ../../library/functions.rst:739 +#: ../../library/functions.rst:737 msgid "" "See :func:`itertools.filterfalse` for the complementary function that " "returns elements of *iterable* for which *function* is false." @@ -1447,11 +1450,11 @@ msgstr "" "請參閱 :func:`itertools.filterfalse`,只有 *function* 為 false 時才選取 " "*iterable* 中元素的互補函式。" -#: ../../library/functions.rst:750 +#: ../../library/functions.rst:748 msgid "Return a floating-point number constructed from a number or a string." msgstr "回傳從數字或字串生成的浮點數。" -#: ../../library/functions.rst:754 +#: ../../library/functions.rst:752 msgid "" ">>> float('+1.23')\n" "1.23\n" @@ -1475,7 +1478,7 @@ msgstr "" ">>> float('-Infinity')\n" "-inf" -#: ../../library/functions.rst:767 +#: ../../library/functions.rst:765 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 " @@ -1490,7 +1493,7 @@ msgstr "" "數也可以是 NaN(非數字)或正負無窮大的字串。確切地說,除去首尾的空格後,輸入" "必須遵循以下語法中 :token:`~float:floatvalue` 的生成規則:" -#: ../../library/functions.rst:788 +#: ../../library/functions.rst:786 msgid "" "Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", " "and \"iNfINity\" are all acceptable spellings for positive infinity." @@ -1498,7 +1501,7 @@ msgstr "" "字母大小寫不影響,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表" "示正無窮大。" -#: ../../library/functions.rst:791 +#: ../../library/functions.rst:789 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 " @@ -1508,7 +1511,7 @@ msgstr "" "否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的" "浮點數。如果引數在 Python 浮點精度範圍外,則會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:796 +#: ../../library/functions.rst:794 msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." "__float__()``. If :meth:`~object.__float__` is not defined then it falls " @@ -1517,22 +1520,22 @@ msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" "定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:800 +#: ../../library/functions.rst:798 msgid "If no argument is given, ``0.0`` is returned." msgstr "如果沒有引數,則回傳 ``0.0``。" -#: ../../library/functions.rst:802 +#: ../../library/functions.rst:800 msgid "The float type is described in :ref:`typesnumeric`." msgstr ":ref:`typesnumeric` 描述了浮點數型別。" -#: ../../library/functions.rst:810 +#: ../../library/functions.rst:808 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 +#: ../../library/functions.rst:818 msgid "" "Convert a *value* to a \"formatted\" representation, as controlled by " "*format_spec*. The interpretation of *format_spec* will depend on the type " @@ -1543,7 +1546,7 @@ msgstr "" "取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" "`formatspec`。" -#: ../../library/functions.rst:825 +#: ../../library/functions.rst:823 msgid "" "The default *format_spec* is an empty string which usually gives the same " "effect as calling :func:`str(value) `." @@ -1551,7 +1554,7 @@ msgstr "" "預設的 *format_spec* 是一個空字串,它通常和呼叫 :func:`str(value) ` 的效" "果相同。" -#: ../../library/functions.rst:828 +#: ../../library/functions.rst:826 msgid "" "A call to ``format(value, format_spec)`` is translated to ``type(value)." "__format__(value, format_spec)`` which bypasses the instance dictionary when " @@ -1565,7 +1568,7 @@ msgstr "" "實例中的字典。如果搜尋到 :mod:`object` 這個 method 但 *format_spec* 不為空," "或是 *format_spec* 或回傳值不是字串,則會引發 :exc:`TypeError`。" -#: ../../library/functions.rst:835 +#: ../../library/functions.rst:833 msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." @@ -1573,7 +1576,7 @@ msgstr "" "當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:844 +#: ../../library/functions.rst:842 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " "*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" @@ -1583,7 +1586,7 @@ msgstr "" "``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" "`frozenset` 和 :ref:`types-set`。" -#: ../../library/functions.rst:848 +#: ../../library/functions.rst:846 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." @@ -1591,7 +1594,7 @@ msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" -#: ../../library/functions.rst:856 +#: ../../library/functions.rst:854 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 " @@ -1606,7 +1609,7 @@ msgstr "" "`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" "`setattr`)。" -#: ../../library/functions.rst:865 +#: ../../library/functions.rst:863 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " @@ -1617,7 +1620,7 @@ msgstr "" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" "使用 :func:`getattr` 來取得它。" -#: ../../library/functions.rst:873 +#: ../../library/functions.rst:871 msgid "" "Return the dictionary implementing the current module namespace. For code " "within functions, this is set when the function is defined and remains the " @@ -1626,7 +1629,7 @@ msgstr "" "回傳代表目前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" "函式時設定且不論該函式是在何處呼叫都會保持相同。" -#: ../../library/functions.rst:880 +#: ../../library/functions.rst:878 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. " @@ -1637,7 +1640,7 @@ msgstr "" "則回傳 ``False``。(此功能是透過呼叫 ``getattr(object, name)`` 並檢查是否引" "發 :exc:`AttributeError` 來實作的。)" -#: ../../library/functions.rst:888 +#: ../../library/functions.rst:886 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 " @@ -1648,7 +1651,7 @@ msgstr "" "時用來快速比較 dictionary 的鍵。相同大小的數字數值有相同的雜湊值(即使它們型" "別不同,如 1 和 1.0)。" -#: ../../library/functions.rst:895 +#: ../../library/functions.rst:893 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." @@ -1656,7 +1659,7 @@ msgstr "" "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" "運行機器的位元長度來截斷回傳值。" -#: ../../library/functions.rst:902 +#: ../../library/functions.rst:900 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 " @@ -1670,7 +1673,7 @@ msgstr "" "關鍵字或說明文件主題中搜尋該字串,並在控制台上列印幫助資訊。如果引數是其他任" "意物件,則會生成該物件的幫助頁。" -#: ../../library/functions.rst:909 +#: ../../library/functions.rst:907 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 " @@ -1681,12 +1684,12 @@ msgstr "" "前面的參數是僅限位置 (positional-only) 參數。有關更多資訊,請參閱\\ :ref:`常" "見問答集中的僅限位置參數條目 `。" -#: ../../library/functions.rst:914 +#: ../../library/functions.rst:912 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." msgstr "此函式會被 :mod:`site` module 加入到內建命名空間。" -#: ../../library/functions.rst:916 +#: ../../library/functions.rst:914 msgid "" "Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " "for callables are now more comprehensive and consistent." @@ -1694,17 +1697,18 @@ msgstr "" "對於 :mod:`pydoc` 和 :mod:`inspect` 的變更,使得可呼叫物件回報的的簽名 " "(signature) 更加全面和一致。" -#: ../../library/functions.rst:923 +#: ../../library/functions.rst:921 +#, fuzzy 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:" +"\"0x\". If *integer* 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 並且回傳一" "個整數。舉例來說:" -#: ../../library/functions.rst:932 +#: ../../library/functions.rst:930 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 " @@ -1713,20 +1717,20 @@ msgstr "" "如果要將整數轉換為大寫或小寫的十六進位制字串,並可選擇有無 \"0x\" 前綴,則可" "以使用如下方法:" -#: ../../library/functions.rst:944 +#: ../../library/functions.rst:942 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 +#: ../../library/functions.rst:947 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 +#: ../../library/functions.rst:953 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. " @@ -1736,18 +1740,18 @@ msgstr "" "回傳物件的 \"識別性\" 。該值是一個整數,在此物件的生命週期中保證是唯一且恆定" "的。兩個生命期不重疊的物件可能具有相同的 :func:`id` 值。" -#: ../../library/functions.rst:960 +#: ../../library/functions.rst:958 msgid "This is the address of the object in memory." msgstr "這是該物件在記憶體中的位址。" -#: ../../library/functions.rst:962 +#: ../../library/functions.rst:960 msgid "" "Raises an :ref:`auditing event ` ``builtins.id`` with argument " "``id``." msgstr "" "引發一個附帶引數 ``id`` 的\\ :ref:`稽核事件 ` ``builtins.id``。" -#: ../../library/functions.rst:968 +#: ../../library/functions.rst:966 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, " @@ -1758,7 +1762,7 @@ msgstr "" "從輸入中讀取一行,將其轉換為字串(去除末尾的換行符)並回傳。當讀取到 EOF 時," "則引發 :exc:`EOFError`。例如: ::" -#: ../../library/functions.rst:973 +#: ../../library/functions.rst:971 msgid "" ">>> s = input('--> ')\n" "--> Monty Python's Flying Circus\n" @@ -1770,7 +1774,7 @@ msgstr "" ">>> s\n" "\"Monty Python's Flying Circus\"" -#: ../../library/functions.rst:978 +#: ../../library/functions.rst:976 msgid "" "If the :mod:`readline` module was loaded, then :func:`input` will use it to " "provide elaborate line editing and history features." @@ -1778,7 +1782,7 @@ msgstr "" "如果載入了 :mod:`readline` module,:func:`input` 將使用它來提供複雜的行編輯和" "歷史記錄功能。" -#: ../../library/functions.rst:981 ../../library/functions.rst:983 +#: ../../library/functions.rst:979 ../../library/functions.rst:981 msgid "" "Raises an :ref:`auditing event ` ``builtins.input`` with argument " "``prompt`` before reading input" @@ -1786,7 +1790,7 @@ msgstr "" "引發一個附帶讀取輸入前的引數 ``prompt`` 的\\ :ref:`稽核事件 ` " "``builtins.input``。" -#: ../../library/functions.rst:986 ../../library/functions.rst:988 +#: ../../library/functions.rst:984 ../../library/functions.rst:986 msgid "" "Raises an :ref:`auditing event ` ``builtins.input/result`` with " "the result after successfully reading input." @@ -1794,13 +1798,13 @@ msgstr "" "引發一個附帶成功讀取結果的\\ :ref:`稽核事件 ` ``builtins.input/" "result``。" -#: ../../library/functions.rst:995 +#: ../../library/functions.rst:993 msgid "" "Return an integer object constructed from a number or a string, or return " "``0`` if no arguments are given." msgstr "" -#: ../../library/functions.rst:1000 +#: ../../library/functions.rst:998 msgid "" ">>> int(123.45)\n" "123\n" @@ -1828,7 +1832,7 @@ msgstr "" ">>> int('01110011', base=2)\n" "115" -#: ../../library/functions.rst:1015 +#: ../../library/functions.rst:1013 msgid "" "If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." "__int__()``. If the argument defines :meth:`~object.__index__`, it returns " @@ -1841,7 +1845,7 @@ msgstr "" "義了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數,則會向零" "的方向無條件捨去。" -#: ../../library/functions.rst:1021 +#: ../../library/functions.rst:1019 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 " @@ -1854,7 +1858,7 @@ msgstr "" "以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在" "數字間有單一底線。" -#: ../../library/functions.rst:1027 +#: ../../library/functions.rst:1025 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 " @@ -1876,11 +1880,11 @@ msgstr "" "進制中的一個,所以 ``int('010', 0)`` 是非法的,但 ``int('010')`` 和 " "``int('010', 8)`` 是有效的。" -#: ../../library/functions.rst:1038 +#: ../../library/functions.rst:1036 msgid "The integer type is described in :ref:`typesnumeric`." msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" -#: ../../library/functions.rst:1040 +#: ../../library/functions.rst:1038 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 " @@ -1892,22 +1896,22 @@ msgstr "" "的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." "__index__ `。" -#: ../../library/functions.rst:1050 +#: ../../library/functions.rst:1048 msgid "The first parameter is now positional-only." msgstr "第一個參數為僅限位置參數。" -#: ../../library/functions.rst:1053 +#: ../../library/functions.rst:1051 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 +#: ../../library/functions.rst:1054 msgid "The delegation to :meth:`~object.__trunc__` is deprecated." msgstr "對 :meth:`~object.__trunc__` 的委派已棄用。" -#: ../../library/functions.rst:1059 +#: ../../library/functions.rst:1057 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 " @@ -1921,7 +1925,7 @@ msgstr "" "`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" "數字串轉換的長度限制 `\\ 說明文件。" -#: ../../library/functions.rst:1069 +#: ../../library/functions.rst:1068 msgid "" "Return ``True`` if the *object* argument is an instance of the *classinfo* " "argument, or of a (direct, indirect, or :term:`virtual `) of *classinfo*. A class is considered a " @@ -1961,20 +1965,21 @@ msgstr "" "是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:1101 +#: ../../library/functions.rst:1100 +#, fuzzy 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." +"second argument, the single argument 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 the first argument must be a " +"callable object. The iterator created in this case will call *callable* " +"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` 協定(有 :" @@ -1985,11 +1990,11 @@ msgstr "" "__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 *sentinel* 則引發 :" "exc:`StopIteration`,否則回傳呼叫結果。" -#: ../../library/functions.rst:1115 +#: ../../library/functions.rst:1114 msgid "See also :ref:`typeiter`." msgstr "另請參閱 :ref:`typeiter`。" -#: ../../library/functions.rst:1117 +#: ../../library/functions.rst:1116 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 " @@ -1998,7 +2003,7 @@ msgstr "" ":func:`iter` 的第二種形式有一個好用的應用,是能夠建立一個區塊閱讀器 (block-" "reader)。例如,從二進位資料庫檔案中讀取固定寬度的區塊,直到檔案的結尾: ::" -#: ../../library/functions.rst:1121 +#: ../../library/functions.rst:1120 msgid "" "from functools import partial\n" "with open('mydata.db', 'rb') as f:\n" @@ -2010,7 +2015,7 @@ msgstr "" " for block in iter(partial(f.read, 64), b''):\n" " process_block(block)" -#: ../../library/functions.rst:1129 +#: ../../library/functions.rst:1128 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 " @@ -2019,7 +2024,7 @@ msgstr "" "回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 " "range)或集合(如 dictionary、set 或 frozen set)。" -#: ../../library/functions.rst:1135 +#: ../../library/functions.rst:1134 msgid "" "``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." "maxsize`, such as :class:`range(2 ** 100) `." @@ -2027,7 +2032,7 @@ msgstr "" "如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," "則 ``len`` 會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:1144 +#: ../../library/functions.rst:1142 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." @@ -2035,33 +2040,33 @@ msgstr "" "除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` " "和 :ref:`typesseq`。" -#: ../../library/functions.rst:1150 +#: ../../library/functions.rst:1148 msgid "" "Return a mapping object representing the current local symbol table, with " "variable names as the keys, and their currently bound references as the " "values." msgstr "" -#: ../../library/functions.rst:1154 +#: ../../library/functions.rst:1152 msgid "" "At module scope, as well as when using :func:`exec` or :func:`eval` with a " "single namespace, this function returns the same namespace as :func:" "`globals`." msgstr "" -#: ../../library/functions.rst:1158 +#: ../../library/functions.rst:1156 msgid "" "At class scope, it returns the namespace that will be passed to the " "metaclass constructor." msgstr "" -#: ../../library/functions.rst:1161 +#: ../../library/functions.rst:1159 msgid "" "When using ``exec()`` or ``eval()`` with separate local and global " "arguments, it returns the local namespace passed in to the function call." msgstr "" -#: ../../library/functions.rst:1164 +#: ../../library/functions.rst:1162 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 " @@ -2071,7 +2076,7 @@ msgid "" "returned mapping object." msgstr "" -#: ../../library/functions.rst:1171 +#: ../../library/functions.rst:1169 msgid "" "In an :term:`optimized scope` (including functions, generators, and " "coroutines), each call to ``locals()`` instead returns a fresh dictionary " @@ -2083,7 +2088,7 @@ msgid "" "previously returned dictionaries." msgstr "" -#: ../../library/functions.rst:1180 +#: ../../library/functions.rst:1178 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 " @@ -2092,19 +2097,19 @@ msgid "" "function." msgstr "" -#: ../../library/functions.rst:1186 +#: ../../library/functions.rst:1184 msgid "" "Calling ``locals()`` as part of a generator expression is equivalent to " "calling it in a nested generator function." msgstr "" -#: ../../library/functions.rst:1189 +#: ../../library/functions.rst:1187 msgid "" "The behaviour of ``locals()`` in a comprehension has been updated as " "described in :pep:`709`." msgstr "" -#: ../../library/functions.rst:1193 +#: ../../library/functions.rst:1191 msgid "" "As part of :pep:`667`, the semantics of mutating the mapping objects " "returned from this function are now defined. The behavior in :term:" @@ -2113,7 +2118,7 @@ msgid "" "versions." msgstr "" -#: ../../library/functions.rst:1203 +#: ../../library/functions.rst:1201 msgid "" "Return an iterator that applies *function* to every item of *iterable*, " "yielding the results. If additional *iterables* arguments are passed, " @@ -2128,13 +2133,13 @@ msgstr "" "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," "請參閱 :func:`itertools.starmap`。" -#: ../../library/functions.rst:1215 +#: ../../library/functions.rst:1213 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." msgstr "回傳 iterable 中最大的元素,或者回傳兩個以上的引數中最大的。" -#: ../../library/functions.rst:1218 +#: ../../library/functions.rst:1216 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 " @@ -2143,7 +2148,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素" "會被回傳。如果提供了兩個或以上的位置引數,則回傳最大的位置引數。" -#: ../../library/functions.rst:1223 ../../library/functions.rst:1261 +#: ../../library/functions.rst:1221 ../../library/functions.rst:1259 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 " @@ -2156,7 +2161,7 @@ msgstr "" "的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" "`ValueError`。" -#: ../../library/functions.rst:1229 +#: ../../library/functions.rst:1227 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2167,15 +2172,15 @@ msgstr "" "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " "iterable, key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1234 ../../library/functions.rst:1272 +#: ../../library/functions.rst:1232 ../../library/functions.rst:1270 msgid "Added the *default* keyword-only parameter." msgstr "新增 *default* 僅限關鍵字參數。" -#: ../../library/functions.rst:1237 ../../library/functions.rst:1275 +#: ../../library/functions.rst:1235 ../../library/functions.rst:1273 msgid "The *key* can be ``None``." msgstr "*key* 可以為 ``None``。" -#: ../../library/functions.rst:1245 +#: ../../library/functions.rst:1243 msgid "" "Return a \"memory view\" object created from the given argument. See :ref:" "`typememoryview` for more information." @@ -2183,13 +2188,13 @@ msgstr "" "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" "閱\\ :ref:`typememoryview`。" -#: ../../library/functions.rst:1253 +#: ../../library/functions.rst:1251 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." msgstr "回傳 iterable 中最小的元素,或者回傳兩個以上的引數中最小的。" -#: ../../library/functions.rst:1256 +#: ../../library/functions.rst:1254 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 " @@ -2198,7 +2203,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" "被回傳。如果提供了兩個以上的位置引數,則回傳最小的位置引數。" -#: ../../library/functions.rst:1267 +#: ../../library/functions.rst:1265 msgid "" "If multiple items are minimal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2209,7 +2214,7 @@ msgstr "" "``sorted(iterable, key=keyfunc)[0]`` 和 ``heapq.nsmallest(1, iterable, " "key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1282 +#: ../../library/functions.rst:1280 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 " @@ -2219,7 +2224,7 @@ msgstr "" "素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" "exc:`StopIteration`。" -#: ../../library/functions.rst:1289 +#: ../../library/functions.rst:1287 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 " @@ -2230,7 +2235,7 @@ msgstr "" "函式被呼叫時,它會回傳一個新的沒有特徵 (featureless) 的物件。這個建構函式不接" "受任何引數。" -#: ../../library/functions.rst:1296 +#: ../../library/functions.rst:1294 msgid "" ":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, " "so you can't assign arbitrary attributes to an instance of :class:`object`." @@ -2238,18 +2243,19 @@ msgstr "" "由於 :class:`object` 實例\\ *沒有* :attr:`~object.__dict__` 屬性,因此無法將" "任意屬性賦給 :class:`object` 的實例。" -#: ../../library/functions.rst:1303 +#: ../../library/functions.rst:1301 +#, fuzzy 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:" +"result is a valid Python expression. If *integer* 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 回傳一個整數。舉例來說:" -#: ../../library/functions.rst:1313 +#: ../../library/functions.rst:1311 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." @@ -2257,7 +2263,7 @@ msgstr "" "如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方" "法。" -#: ../../library/functions.rst:1330 +#: ../../library/functions.rst:1328 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 " @@ -2267,7 +2273,7 @@ msgstr "" "啟,則引發 :exc:`OSError`。關於使用此函式的更多方法,請參閱\\ :ref:`tut-" "files`。" -#: ../../library/functions.rst:1334 +#: ../../library/functions.rst:1332 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 " @@ -2280,7 +2286,7 @@ msgstr "" "器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關" "閉,除非 *closefd* 被設為 ``False``。)" -#: ../../library/functions.rst:1340 +#: ../../library/functions.rst:1338 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. " @@ -2301,71 +2307,71 @@ msgstr "" "getencoding` 來取得目前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" "式且不要指定 *encoding*。)可用的模式有:" -#: ../../library/functions.rst:1357 +#: ../../library/functions.rst:1355 msgid "Character" msgstr "字元" -#: ../../library/functions.rst:1357 +#: ../../library/functions.rst:1355 msgid "Meaning" msgstr "意義" -#: ../../library/functions.rst:1359 +#: ../../library/functions.rst:1357 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/functions.rst:1359 +#: ../../library/functions.rst:1357 msgid "open for reading (default)" msgstr "讀取(預設)" -#: ../../library/functions.rst:1360 +#: ../../library/functions.rst:1358 msgid "``'w'``" msgstr "``'w'``" -#: ../../library/functions.rst:1360 +#: ../../library/functions.rst:1358 msgid "open for writing, truncating the file first" msgstr "寫入,會先清除檔案內容" -#: ../../library/functions.rst:1361 +#: ../../library/functions.rst:1359 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/functions.rst:1361 +#: ../../library/functions.rst:1359 msgid "open for exclusive creation, failing if the file already exists" msgstr "唯一性建立,如果文件已存在則會失敗" -#: ../../library/functions.rst:1362 +#: ../../library/functions.rst:1360 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/functions.rst:1362 +#: ../../library/functions.rst:1360 msgid "open for writing, appending to the end of file if it exists" msgstr "寫入,如果檔案存在則在其末端附加內容" -#: ../../library/functions.rst:1363 +#: ../../library/functions.rst:1361 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/functions.rst:1363 ../../library/functions.rst:1507 +#: ../../library/functions.rst:1361 ../../library/functions.rst:1505 msgid "binary mode" msgstr "二進制模式" -#: ../../library/functions.rst:1364 +#: ../../library/functions.rst:1362 msgid "``'t'``" msgstr "``'t'``" -#: ../../library/functions.rst:1364 +#: ../../library/functions.rst:1362 msgid "text mode (default)" msgstr "文字模式(預設)" -#: ../../library/functions.rst:1365 +#: ../../library/functions.rst:1363 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/functions.rst:1365 +#: ../../library/functions.rst:1363 msgid "open for updating (reading and writing)" msgstr "更新(讀取並寫入)" -#: ../../library/functions.rst:1368 +#: ../../library/functions.rst:1366 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 " @@ -2375,7 +2381,7 @@ msgstr "" "``'w+b'`` 模式會開啟並清除檔案。``'r+'`` 和 ``'r+b'`` 模式會開啟且保留檔案內" "容。" -#: ../../library/functions.rst:1372 +#: ../../library/functions.rst:1370 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* " @@ -2391,7 +2397,7 @@ msgstr "" "``'t'``),檔案的內容會以 :class:`str` 回傳,其位元組已經先被解碼,使用的是取" "決於平台的編碼系統或是給定的 *encoding*。" -#: ../../library/functions.rst:1382 +#: ../../library/functions.rst:1380 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 " @@ -2400,7 +2406,7 @@ msgstr "" "Python 不會使用底層作業系統對於文字檔案的操作概念;所有的處理都是由 Python 獨" "自完成的,因此能獨立於不同平台。" -#: ../../library/functions.rst:1386 +#: ../../library/functions.rst:1384 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 " @@ -2421,7 +2427,7 @@ msgstr "" "``write_through`` 旗標。若未給定 *buffering* 引數,則預設的緩衝策略會運作如" "下:" -#: ../../library/functions.rst:1396 +#: ../../library/functions.rst:1394 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 " @@ -2433,7 +2439,7 @@ msgstr "" "DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 8192 個位元" "組。" -#: ../../library/functions.rst:1401 +#: ../../library/functions.rst:1399 msgid "" "\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " "returns ``True``) use line buffering. Other text files use the policy " @@ -2442,7 +2448,7 @@ msgstr "" "「互動式」文字檔(:meth:`~io.IOBase.isatty` 回傳 ``True`` 的檔案)會使用列緩" "衝。其他文字檔則使用上述的二進制檔案緩衝策略。" -#: ../../library/functions.rst:1405 +#: ../../library/functions.rst:1403 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 " @@ -2455,7 +2461,7 @@ msgstr "" "Python 支援的任何 :term:`text encoding`\\ (文字編碼)都是可以使用的。關於支" "援的編碼系統清單,請參閱 :mod:`codecs` module。" -#: ../../library/functions.rst:1411 +#: ../../library/functions.rst:1409 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 " @@ -2468,7 +2474,7 @@ msgstr "" "handlers`\\ 有列出清單),不過任何已註冊到 :func:`codecs.register_error` 的錯" "誤處理程式名稱也都是有效的。標準的名稱包括:" -#: ../../library/functions.rst:1419 +#: ../../library/functions.rst:1417 msgid "" "``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " "error. The default value of ``None`` has the same effect." @@ -2476,20 +2482,20 @@ msgstr "" "``'strict'`` 如果發生編碼錯誤,則引發 :exc:`ValueError` 例外。預設值 " "``None`` 也有相同的效果。" -#: ../../library/functions.rst:1423 +#: ../../library/functions.rst:1421 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." msgstr "``'ignore'`` 忽略錯誤。請注意,忽略編碼錯誤可能導致資料遺失。" -#: ../../library/functions.rst:1426 +#: ../../library/functions.rst:1424 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." msgstr "" "``'replace'`` 會在格式不正確的資料位置插入一個替換標誌(像是 ``'?'``)。" -#: ../../library/functions.rst:1429 +#: ../../library/functions.rst:1427 msgid "" "``'surrogateescape'`` will represent any incorrect bytes as low surrogate " "code units ranging from U+DC80 to U+DCFF. These surrogate code units will " @@ -2502,7 +2508,7 @@ msgstr "" "被還原回 ``surrogateescape`` 錯誤處理程式當時所處理的那些相同位元組。這對於處" "理未知編碼方式的檔案會很好用。" -#: ../../library/functions.rst:1436 +#: ../../library/functions.rst:1434 msgid "" "``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " "not supported by the encoding are replaced with the appropriate XML " @@ -2511,7 +2517,7 @@ msgstr "" "``'xmlcharrefreplace'`` 僅在寫入檔案時可支援。編碼系統不支援的字元會被替換為" "適當的 XML 字元參考 (character reference) ``&#nnn;``。" -#: ../../library/functions.rst:1440 +#: ../../library/functions.rst:1438 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." @@ -2519,7 +2525,7 @@ msgstr "" "``'backslashreplace'`` 會用 Python 的反斜線跳脫序列 (backslashed escape " "sequence) 替換格式不正確的資料。" -#: ../../library/functions.rst:1443 +#: ../../library/functions.rst:1441 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." @@ -2527,7 +2533,7 @@ msgstr "" "``'namereplace'``\\ (也僅在寫入時支援)會將不支援的字元替換為 ``\\N{...}`` " "跳脫序列。" -#: ../../library/functions.rst:1451 +#: ../../library/functions.rst:1449 msgid "" "*newline* determines how to parse newline characters from the stream. It can " "be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " @@ -2536,7 +2542,7 @@ msgstr "" "*newline* 會決定如何剖析資料串流 (stream) 中的換行字元。它可以是 ``None``、" "``''``、``'\\n'``、``'\\r'`` 或 ``'\\r\\n'``。它的運作規則如下:" -#: ../../library/functions.rst:1455 +#: ../../library/functions.rst:1453 msgid "" "When reading input from the stream, if *newline* is ``None``, universal " "newlines mode is enabled. Lines in the input can end in ``'\\n'``, " @@ -2552,7 +2558,7 @@ msgstr "" "傳給呼叫方時,行尾符號不會被轉換。如果它是任何其他有效的值,則輸入資料的行只" "會由給定的字串做結尾,且在回傳給呼叫方時,行尾符號不會被轉換。" -#: ../../library/functions.rst:1463 +#: ../../library/functions.rst:1461 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -2565,7 +2571,7 @@ msgstr "" "``''`` 或 ``'\\n'``,則不做任何轉換。如果 *newline* 是任何其他有效的值,則寫" "入的任何 ``'\\n'`` 字元都將轉換為給定的字串。" -#: ../../library/functions.rst:1469 +#: ../../library/functions.rst:1467 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 " @@ -2576,7 +2582,7 @@ msgstr "" "則當檔案關閉時,底層的檔案描述器會保持開啟狀態。如果有給定一個檔名,則 " "*closefd* 必須是 ``True``\\ (預設值);否則將引發錯誤。" -#: ../../library/functions.rst:1474 +#: ../../library/functions.rst:1472 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 " @@ -2589,11 +2595,11 @@ msgstr "" "必須回傳一個開啟的檔案描述器(將 :mod:`os.open` 作為 *opener* 傳入,在功能上" "的結果會相當於傳入 ``None``)。" -#: ../../library/functions.rst:1480 +#: ../../library/functions.rst:1478 msgid "The newly created file is :ref:`non-inheritable `." msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" -#: ../../library/functions.rst:1482 +#: ../../library/functions.rst:1480 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::" @@ -2601,7 +2607,7 @@ msgstr "" "下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" -#: ../../library/functions.rst:1485 +#: ../../library/functions.rst:1483 msgid "" ">>> import os\n" ">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" @@ -2614,7 +2620,7 @@ msgid "" ">>> os.close(dir_fd) # don't leak a file descriptor" msgstr "" -#: ../../library/functions.rst:1495 +#: ../../library/functions.rst:1493 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 " @@ -2638,7 +2644,7 @@ msgstr "" "BufferedRandom`。當緩衝被停用時,會回傳原始資料串流 :class:`io.FileIO`,它" "是 :class:`io.RawIOBase` 的一個 subclass。" -#: ../../library/functions.rst:1516 +#: ../../library/functions.rst:1514 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " "(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" @@ -2648,7 +2654,7 @@ msgstr "" "`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" "`shutil`。" -#: ../../library/functions.rst:1520 +#: ../../library/functions.rst:1518 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -2656,25 +2662,25 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/functions.rst:1522 +#: ../../library/functions.rst:1520 msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." msgstr "``mode`` 和 ``flags`` 引數可能會被原始的呼叫所修改或推論 (infer)。" -#: ../../library/functions.rst:1527 +#: ../../library/functions.rst:1525 msgid "The *opener* parameter was added." msgstr "增加了 *opener* 參數。" -#: ../../library/functions.rst:1528 +#: ../../library/functions.rst:1526 msgid "The ``'x'`` mode was added." msgstr "增加了 ``'x'`` 模式。" -#: ../../library/functions.rst:1529 +#: ../../library/functions.rst:1527 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "過去引發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" -#: ../../library/functions.rst:1530 +#: ../../library/functions.rst:1528 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." @@ -2682,11 +2688,11 @@ msgstr "" "如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" "`FileExistsError`。" -#: ../../library/functions.rst:1535 +#: ../../library/functions.rst:1533 msgid "The file is now non-inheritable." msgstr "檔案在此版本開始是不可繼承的。" -#: ../../library/functions.rst:1539 +#: ../../library/functions.rst:1537 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 :" @@ -2695,15 +2701,15 @@ msgstr "" "如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" "不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" -#: ../../library/functions.rst:1542 +#: ../../library/functions.rst:1540 msgid "The ``'namereplace'`` error handler was added." msgstr "增加了 ``'namereplace'`` 錯誤處理程式。" -#: ../../library/functions.rst:1546 +#: ../../library/functions.rst:1544 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" -#: ../../library/functions.rst:1547 +#: ../../library/functions.rst:1545 msgid "" "On Windows, opening a console buffer may return a subclass of :class:`io." "RawIOBase` other than :class:`io.FileIO`." @@ -2711,33 +2717,33 @@ msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" -#: ../../library/functions.rst:1550 +#: ../../library/functions.rst:1548 msgid "The ``'U'`` mode has been removed." msgstr "``'U'`` 模式被移除。" -#: ../../library/functions.rst:1555 +#: ../../library/functions.rst:1553 msgid "Return the ordinal value of a character." msgstr "" -#: ../../library/functions.rst:1557 +#: ../../library/functions.rst:1555 msgid "" "If the argument is a one-character string, return 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 編碼位置。例如 " -"``ord('a')`` 回傳整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這" -"是 :func:`chr` 的逆函式。" +"如果引數是單字元字串,則回傳該字元的 Unicode 編碼位置。例如 ``ord('a')`` 回傳" +"整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這是 :func:`chr` 的逆" +"函式。" -#: ../../library/functions.rst:1562 +#: ../../library/functions.rst:1560 msgid "" "If the argument is a :class:`bytes` or :class:`bytearray` object of length " "1, return its single byte value. For example, ``ord(b'a')`` returns the " "integer ``97``." msgstr "" -#: ../../library/functions.rst:1569 +#: ../../library/functions.rst:1567 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) % " @@ -2748,7 +2754,7 @@ msgstr "" "*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" -#: ../../library/functions.rst:1574 +#: ../../library/functions.rst:1572 msgid "" "When arguments are builtin numeric types with mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " @@ -2772,7 +2778,7 @@ msgstr "" "`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 ``pow(-9, 2.0)`` " "會回傳 ``81.0``。" -#: ../../library/functions.rst:1586 +#: ../../library/functions.rst:1584 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 " @@ -2785,11 +2791,11 @@ msgstr "" "與 *mod* 互質。在這種情況下,會回傳 ``pow(inv_base, -exp, mod)``,其中 " "*inv_base* 是 *base* 對 *mod* 的模倒數 (inverse modulo)。" -#: ../../library/functions.rst:1592 +#: ../../library/functions.rst:1590 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "以下是一個計算 ``38`` 對 ``97`` 取模倒數的範例: ::" -#: ../../library/functions.rst:1594 +#: ../../library/functions.rst:1592 msgid "" ">>> pow(38, -1, mod=97)\n" "23\n" @@ -2801,7 +2807,7 @@ msgstr "" ">>> 23 * 38 % 97 == 1\n" "True" -#: ../../library/functions.rst:1599 +#: ../../library/functions.rst:1597 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." @@ -2809,12 +2815,12 @@ msgstr "" "對於 :class:`int` 運算元,現在 ``pow`` 的三引數形式允許第二個引數為負數,也容" "許模倒數的計算。" -#: ../../library/functions.rst:1604 +#: ../../library/functions.rst:1602 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "允許關鍵字引數。在此之前只支援位置引數。" -#: ../../library/functions.rst:1611 +#: ../../library/functions.rst:1609 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 " @@ -2823,7 +2829,7 @@ msgstr "" "將 *objects* 列印到文字資料串流 *file*,用 *sep* 分隔並以 *end* 結尾。如果有" "給定 *sep*、*end*、*file* 和 *flush*,那麼它們必須是關鍵字引數的形式。" -#: ../../library/functions.rst:1615 +#: ../../library/functions.rst:1613 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* " @@ -2836,7 +2842,7 @@ msgstr "" "以是 ``None``,這表示使用預設值。如果沒有給定 *objects*,:func:`print` 就只會" "寫入 *end*。" -#: ../../library/functions.rst:1621 +#: ../../library/functions.rst:1619 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 " @@ -2848,7 +2854,7 @@ msgstr "" "串,所以 :func:`print` 不能用於二進位模式的檔案物件。對於此類物件,請改用 " "``file.write(...)``。" -#: ../../library/functions.rst:1626 +#: ../../library/functions.rst:1624 msgid "" "Output buffering is usually determined by *file*. However, if *flush* is " "true, the stream is forcibly flushed." @@ -2856,15 +2862,15 @@ msgstr "" "輸出緩衝通常會由 *file* 決定。但是如果 *flush* 為 true,則資料串流會被強制清" "除。" -#: ../../library/functions.rst:1630 +#: ../../library/functions.rst:1628 msgid "Added the *flush* keyword argument." msgstr "增加了 *flush* 關鍵字引數。" -#: ../../library/functions.rst:1636 +#: ../../library/functions.rst:1634 msgid "Return a property attribute." msgstr "回傳 property 屬性。" -#: ../../library/functions.rst:1638 +#: ../../library/functions.rst:1636 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 " @@ -2873,11 +2879,11 @@ msgstr "" "*fget* 是一個用於取得屬性值的函式,*fset* 是一個用於設定屬性值的函式,*fdel* " "是一個用於刪除屬性值的函式,而 *doc* 會為該屬性建立一個說明字串。" -#: ../../library/functions.rst:1642 +#: ../../library/functions.rst:1640 msgid "A typical use is to define a managed attribute ``x``::" msgstr "一個典型的用途是定義一個受管理的屬性 ``x``: ::" -#: ../../library/functions.rst:1644 +#: ../../library/functions.rst:1642 msgid "" "class C:\n" " def __init__(self):\n" @@ -2909,7 +2915,7 @@ msgstr "" "\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" -#: ../../library/functions.rst:1659 +#: ../../library/functions.rst:1657 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." @@ -2917,7 +2923,7 @@ msgstr "" "如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會叫用取得器 (getter),``c.x = " "value`` 會呼叫設定器 (setter),而 ``del c.x`` 會叫用刪除器 (deleter)。" -#: ../../library/functions.rst:1662 +#: ../../library/functions.rst:1660 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 " @@ -2928,7 +2934,7 @@ msgstr "" "*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" "`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" -#: ../../library/functions.rst:1666 +#: ../../library/functions.rst:1664 msgid "" "class Parrot:\n" " def __init__(self):\n" @@ -2940,14 +2946,14 @@ msgid "" " return self._voltage" msgstr "" -#: ../../library/functions.rst:1675 +#: ../../library/functions.rst:1673 msgid "" "The ``@property`` decorator turns the :meth:`!voltage` method into a " "\"getter\" for a read-only attribute with the same name, and it sets the " "docstring for *voltage* to \"Get the current voltage.\"" msgstr "" -#: ../../library/functions.rst:1683 +#: ../../library/functions.rst:1681 msgid "" "A property object has ``getter``, ``setter``, and ``deleter`` methods usable " "as decorators that create a copy of the property with the corresponding " @@ -2955,7 +2961,7 @@ msgid "" "with an example:" msgstr "" -#: ../../library/functions.rst:1688 +#: ../../library/functions.rst:1686 msgid "" "class C:\n" " def __init__(self):\n" @@ -2991,36 +2997,36 @@ msgstr "" " def x(self):\n" " del self._x" -#: ../../library/functions.rst:1707 +#: ../../library/functions.rst:1705 msgid "" "This code is exactly equivalent to the first example. Be sure to give the " "additional functions the same name as the original property (``x`` in this " "case.)" msgstr "" -#: ../../library/functions.rst:1711 +#: ../../library/functions.rst:1709 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." msgstr "" -#: ../../library/functions.rst:1714 +#: ../../library/functions.rst:1712 msgid "The docstrings of property objects are now writeable." msgstr "" -#: ../../library/functions.rst:1719 +#: ../../library/functions.rst:1717 msgid "" "Attribute holding the name of the property. The name of the property can be " "changed at runtime." msgstr "" -#: ../../library/functions.rst:1730 +#: ../../library/functions.rst:1728 msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1736 +#: ../../library/functions.rst:1734 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 " @@ -3033,11 +3039,11 @@ msgid "" "raise :exc:`RuntimeError`." msgstr "" -#: ../../library/functions.rst:1747 +#: ../../library/functions.rst:1745 msgid "This class has a custom representation that can be evaluated::" msgstr "" -#: ../../library/functions.rst:1749 +#: ../../library/functions.rst:1747 msgid "" "class Person:\n" " def __init__(self, name, age):\n" @@ -3055,22 +3061,22 @@ msgstr "" " def __repr__(self):\n" " return f\"Person('{self.name}', {self.age})\"" -#: ../../library/functions.rst:1760 +#: ../../library/functions.rst:1758 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`. The argument 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 "" -#: ../../library/functions.rst:1768 +#: ../../library/functions.rst:1766 msgid "" "Return *number* rounded to *ndigits* precision after the decimal point. If " "*ndigits* is omitted or is ``None``, it returns the nearest integer to its " "input." msgstr "" -#: ../../library/functions.rst:1772 +#: ../../library/functions.rst:1770 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 " @@ -3081,13 +3087,13 @@ msgid "" "``None``. Otherwise, the return value has the same type as *number*." msgstr "" -#: ../../library/functions.rst:1781 +#: ../../library/functions.rst:1779 msgid "" "For a general Python object ``number``, ``round`` delegates to ``number." "__round__``." msgstr "" -#: ../../library/functions.rst:1786 +#: ../../library/functions.rst:1784 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 " @@ -3096,21 +3102,21 @@ msgid "" "information." msgstr "" -#: ../../library/functions.rst:1798 +#: ../../library/functions.rst:1795 msgid "" "Return a new :class:`set` object, optionally with elements taken from " "*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" "set` for documentation about this class." msgstr "" -#: ../../library/functions.rst:1802 +#: ../../library/functions.rst:1799 msgid "" "For other containers see the built-in :class:`frozenset`, :class:`list`, :" "class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " "module." msgstr "" -#: ../../library/functions.rst:1809 +#: ../../library/functions.rst:1806 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 " @@ -3119,7 +3125,7 @@ msgid "" "is equivalent to ``x.foobar = 123``." msgstr "" -#: ../../library/functions.rst:1815 +#: ../../library/functions.rst:1812 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:" @@ -3128,21 +3134,21 @@ msgid "" "notation, but is accessible through :func:`getattr` etc.." msgstr "" -#: ../../library/functions.rst:1823 +#: ../../library/functions.rst:1820 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " "with two leading underscores) name in order to set it with :func:`setattr`." msgstr "" -#: ../../library/functions.rst:1832 +#: ../../library/functions.rst:1829 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " "``None``." msgstr "" -#: ../../library/functions.rst:1836 +#: ../../library/functions.rst:1833 msgid "" "Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, " "and :attr:`!step` which merely return the argument values (or their " @@ -3150,48 +3156,48 @@ msgid "" "by NumPy and other third-party packages." msgstr "" -#: ../../library/functions.rst:1845 +#: ../../library/functions.rst:1842 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " "example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" "`itertools.islice` for an alternate version that returns an :term:`iterator`." msgstr "" -#: ../../library/functions.rst:1850 +#: ../../library/functions.rst:1847 msgid "" "Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" "`~slice.stop`, and :attr:`~slice.step` are hashable)." msgstr "" -#: ../../library/functions.rst:1856 +#: ../../library/functions.rst:1853 msgid "Return a new sorted list from the items in *iterable*." msgstr "" -#: ../../library/functions.rst:1858 +#: ../../library/functions.rst:1855 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" -#: ../../library/functions.rst:1860 +#: ../../library/functions.rst:1857 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each element in *iterable* (for example, ``key=str." "lower``). The default value is ``None`` (compare the elements directly)." msgstr "" -#: ../../library/functions.rst:1864 +#: ../../library/functions.rst:1861 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -#: ../../library/functions.rst:1867 +#: ../../library/functions.rst:1864 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." msgstr "" -#: ../../library/functions.rst:1870 +#: ../../library/functions.rst:1867 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 " @@ -3199,7 +3205,7 @@ msgid "" "example, sort by department, then by salary grade)." msgstr "" -#: ../../library/functions.rst:1875 +#: ../../library/functions.rst:1872 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -3211,22 +3217,22 @@ msgid "" "method." msgstr "" -#: ../../library/functions.rst:1884 +#: ../../library/functions.rst:1881 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functions.rst:1888 +#: ../../library/functions.rst:1885 msgid "Transform a method into a static method." msgstr "" -#: ../../library/functions.rst:1890 +#: ../../library/functions.rst:1887 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -#: ../../library/functions.rst:1893 +#: ../../library/functions.rst:1890 msgid "" "class C:\n" " @staticmethod\n" @@ -3236,7 +3242,7 @@ msgstr "" " @staticmethod\n" " def f(arg1, arg2, argN): ..." -#: ../../library/functions.rst:1897 +#: ../../library/functions.rst:1894 msgid "" "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -3244,7 +3250,7 @@ msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" -#: ../../library/functions.rst:1900 +#: ../../library/functions.rst:1897 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:" @@ -3252,14 +3258,14 @@ msgid "" "(such as ``f()``)." msgstr "" -#: ../../library/functions.rst:1905 +#: ../../library/functions.rst:1902 msgid "" "Static methods in Python are similar to those found in Java or C++. Also, " "see :func:`classmethod` for a variant that is useful for creating alternate " "class constructors." msgstr "" -#: ../../library/functions.rst:1909 +#: ../../library/functions.rst:1906 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 " @@ -3268,7 +3274,7 @@ msgid "" "cases, use this idiom::" msgstr "" -#: ../../library/functions.rst:1915 +#: ../../library/functions.rst:1912 msgid "" "def regular_function():\n" " ...\n" @@ -3282,11 +3288,11 @@ msgstr "" "class C:\n" " method = staticmethod(regular_function)" -#: ../../library/functions.rst:1921 +#: ../../library/functions.rst:1918 msgid "For more information on static methods, see :ref:`types`." msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" -#: ../../library/functions.rst:1923 +#: ../../library/functions.rst:1920 msgid "" "Static methods now inherit the method attributes (:attr:`~function." "__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" @@ -3298,25 +3304,25 @@ msgstr "" "__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " "``__wrapped__`` 屬性,且為如一般函式的可呼叫物件。" -#: ../../library/functions.rst:1939 +#: ../../library/functions.rst:1938 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" -#: ../../library/functions.rst:1941 +#: ../../library/functions.rst:1940 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -#: ../../library/functions.rst:1947 +#: ../../library/functions.rst:1946 msgid "" "Sums *start* and the items of an *iterable* from left to right and returns " "the total. The *iterable*'s items are normally numbers, and the start value " "is not allowed to be a string." msgstr "" -#: ../../library/functions.rst:1951 +#: ../../library/functions.rst:1950 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 ``''." @@ -3325,37 +3331,37 @@ msgid "" "using :func:`itertools.chain`." msgstr "" -#: ../../library/functions.rst:1957 +#: ../../library/functions.rst:1956 msgid "The *start* parameter can be specified as a keyword argument." msgstr "*start* 參數可被指定為關鍵字引數。" -#: ../../library/functions.rst:1960 +#: ../../library/functions.rst:1959 msgid "" "Summation of floats switched to an algorithm that gives higher accuracy and " "better commutativity on most builds." msgstr "" -#: ../../library/functions.rst:1967 +#: ../../library/functions.rst:1966 msgid "" "Return a proxy object that delegates method calls to a parent or sibling " "class of *type*. This is useful for accessing inherited methods that have " "been overridden in a class." msgstr "" -#: ../../library/functions.rst:1971 +#: ../../library/functions.rst:1970 msgid "" "The *object_or_type* determines the :term:`method resolution order` to be " "searched. The search starts from the class right after the *type*." msgstr "" -#: ../../library/functions.rst:1975 +#: ../../library/functions.rst:1974 msgid "" "For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" "> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -#: ../../library/functions.rst:1979 +#: ../../library/functions.rst:1978 msgid "" "The :attr:`~type.__mro__` attribute of the class corresponding to " "*object_or_type* lists the method resolution search order used by both :func:" @@ -3363,7 +3369,7 @@ msgid "" "whenever the inheritance hierarchy is updated." msgstr "" -#: ../../library/functions.rst:1984 +#: ../../library/functions.rst:1983 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. " @@ -3371,7 +3377,7 @@ msgid "" "(this is useful for classmethods)." msgstr "" -#: ../../library/functions.rst:1989 +#: ../../library/functions.rst:1988 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 " @@ -3381,7 +3387,7 @@ msgid "" "including generator expressions, which implicitly create nested functions.)" msgstr "" -#: ../../library/functions.rst:1996 +#: ../../library/functions.rst:1995 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 " @@ -3389,7 +3395,7 @@ msgid "" "closely parallels the use of *super* in other programming languages." msgstr "" -#: ../../library/functions.rst:2001 +#: ../../library/functions.rst:2000 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 " @@ -3402,11 +3408,11 @@ msgid "" "classes that are unknown prior to runtime)." msgstr "" -#: ../../library/functions.rst:2011 +#: ../../library/functions.rst:2010 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" -#: ../../library/functions.rst:2013 +#: ../../library/functions.rst:2012 msgid "" "class C(B):\n" " def method(self, arg):\n" @@ -3414,14 +3420,14 @@ msgid "" " # super(C, self).method(arg)" msgstr "" -#: ../../library/functions.rst:2018 +#: ../../library/functions.rst:2017 msgid "" "In addition to method lookups, :func:`super` also works for attribute " "lookups. One possible use case for this is calling :term:`descriptors " "` in a parent or sibling class." msgstr "" -#: ../../library/functions.rst:2022 +#: ../../library/functions.rst:2021 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -3431,7 +3437,7 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" -#: ../../library/functions.rst:2030 +#: ../../library/functions.rst:2029 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 " @@ -3441,33 +3447,33 @@ msgid "" "accessing the current instance for ordinary methods." msgstr "" -#: ../../library/functions.rst:2037 +#: ../../library/functions.rst:2036 msgid "" "For practical suggestions on how to design cooperative classes using :func:" "`super`, see `guide to using super() `_." msgstr "" -#: ../../library/functions.rst:2047 +#: ../../library/functions.rst:2045 msgid "" "Rather than being a function, :class:`tuple` is actually an immutable " "sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:2056 +#: ../../library/functions.rst:2054 msgid "" "With one argument, return the type of an *object*. The return value is a " "type object and generally the same object as returned by :attr:`object." "__class__`." msgstr "" -#: ../../library/functions.rst:2060 +#: ../../library/functions.rst:2058 msgid "" "The :func:`isinstance` built-in function is recommended for testing the type " "of an object, because it takes subclasses into account." msgstr "" -#: ../../library/functions.rst:2063 +#: ../../library/functions.rst:2061 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 " @@ -3480,21 +3486,21 @@ msgid "" "type` objects:" msgstr "" -#: ../../library/functions.rst:2078 +#: ../../library/functions.rst:2076 msgid "See also:" msgstr "" -#: ../../library/functions.rst:2080 +#: ../../library/functions.rst:2078 msgid "" ":ref:`Documentation on attributes and methods on classes `." msgstr "" -#: ../../library/functions.rst:2081 +#: ../../library/functions.rst:2079 msgid ":ref:`bltin-type-objects`" msgstr ":ref:`bltin-type-objects`" -#: ../../library/functions.rst:2083 +#: ../../library/functions.rst:2081 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -3502,23 +3508,23 @@ msgid "" "would." msgstr "" -#: ../../library/functions.rst:2088 +#: ../../library/functions.rst:2086 msgid "See also :ref:`class-customization`." msgstr "另請參閱 :ref:`class-customization`。" -#: ../../library/functions.rst:2090 +#: ../../library/functions.rst:2088 msgid "" "Subclasses of :class:`!type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" -#: ../../library/functions.rst:2097 +#: ../../library/functions.rst:2095 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " "or any other object with a :attr:`!__dict__` attribute." msgstr "" -#: ../../library/functions.rst:2100 +#: ../../library/functions.rst:2098 msgid "" "Objects such as modules and instances have an updateable :attr:`~object." "__dict__` attribute; however, other objects may have write restrictions on " @@ -3526,34 +3532,34 @@ msgid "" "MappingProxyType` to prevent direct dictionary updates)." msgstr "" -#: ../../library/functions.rst:2105 +#: ../../library/functions.rst:2103 msgid "Without an argument, :func:`vars` acts like :func:`locals`." msgstr "" -#: ../../library/functions.rst:2107 +#: ../../library/functions.rst:2105 msgid "" "A :exc:`TypeError` exception is raised if an object is specified but it " "doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " "defines the :attr:`~object.__slots__` attribute)." msgstr "" -#: ../../library/functions.rst:2113 +#: ../../library/functions.rst:2111 msgid "" "The result of calling this function without an argument has been updated as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:2119 +#: ../../library/functions.rst:2117 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." msgstr "" -#: ../../library/functions.rst:2122 +#: ../../library/functions.rst:2120 msgid "Example::" msgstr "例如: ::" -#: ../../library/functions.rst:2124 +#: ../../library/functions.rst:2122 msgid "" ">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" "... print(item)\n" @@ -3569,27 +3575,27 @@ msgstr "" "(2, 'spice')\n" "(3, 'everything nice')" -#: ../../library/functions.rst:2131 +#: ../../library/functions.rst:2129 msgid "" "More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " "tuple contains the *i*-th element from each of the argument iterables." msgstr "" -#: ../../library/functions.rst:2134 +#: ../../library/functions.rst:2132 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " "columns into rows. This is similar to `transposing a matrix `_." msgstr "" -#: ../../library/functions.rst:2138 +#: ../../library/functions.rst:2136 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " "iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" "`list`." msgstr "" -#: ../../library/functions.rst:2142 +#: ../../library/functions.rst:2140 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 " @@ -3597,14 +3603,14 @@ msgid "" "approaches to dealing with this issue:" msgstr "" -#: ../../library/functions.rst:2147 +#: ../../library/functions.rst:2145 msgid "" "By default, :func:`zip` stops when the shortest iterable is exhausted. It " "will ignore the remaining items in the longer iterables, cutting off the " "result to the length of the shortest iterable::" msgstr "" -#: ../../library/functions.rst:2151 +#: ../../library/functions.rst:2149 msgid "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" @@ -3612,14 +3618,14 @@ msgstr "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" -#: ../../library/functions.rst:2154 +#: ../../library/functions.rst:2152 msgid "" ":func:`zip` is often used in cases where the iterables are assumed to be of " "equal length. In such cases, it's recommended to use the ``strict=True`` " "option. Its output is the same as regular :func:`zip`::" msgstr "" -#: ../../library/functions.rst:2158 +#: ../../library/functions.rst:2156 msgid "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" @@ -3627,37 +3633,37 @@ msgstr "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" -#: ../../library/functions.rst:2161 +#: ../../library/functions.rst:2159 msgid "" "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " "is exhausted before the others:" msgstr "" -#: ../../library/functions.rst:2179 +#: ../../library/functions.rst:2177 msgid "" "Without the ``strict=True`` argument, any bug that results in iterables of " "different lengths will be silenced, possibly manifesting as a hard-to-find " "bug in another part of the program." msgstr "" -#: ../../library/functions.rst:2183 +#: ../../library/functions.rst:2181 msgid "" "Shorter iterables can be padded with a constant value to make all the " "iterables have the same length. This is done by :func:`itertools." "zip_longest`." msgstr "" -#: ../../library/functions.rst:2187 +#: ../../library/functions.rst:2185 msgid "" "Edge cases: With a single iterable argument, :func:`zip` returns an iterator " "of 1-tuples. With no arguments, it returns an empty iterator." msgstr "" -#: ../../library/functions.rst:2190 +#: ../../library/functions.rst:2188 msgid "Tips and tricks:" msgstr "" -#: ../../library/functions.rst:2192 +#: ../../library/functions.rst:2190 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 " @@ -3666,13 +3672,13 @@ msgid "" "iterator. This has the effect of dividing the input into n-length chunks." msgstr "" -#: ../../library/functions.rst:2198 +#: ../../library/functions.rst:2196 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -#: ../../library/functions.rst:2201 +#: ../../library/functions.rst:2199 msgid "" ">>> x = [1, 2, 3]\n" ">>> y = [4, 5, 6]\n" @@ -3690,17 +3696,17 @@ msgstr "" ">>> x == list(x2) and y == list(y2)\n" "True" -#: ../../library/functions.rst:2209 +#: ../../library/functions.rst:2207 msgid "Added the ``strict`` argument." msgstr "增加了 ``strict`` 引數。" -#: ../../library/functions.rst:2221 +#: ../../library/functions.rst:2219 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2224 +#: ../../library/functions.rst:2222 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -3712,7 +3718,7 @@ msgid "" "discouraged in favor of :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2233 +#: ../../library/functions.rst:2231 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -3722,7 +3728,7 @@ msgid "" "determine the package context of the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2240 +#: ../../library/functions.rst:2238 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -3731,7 +3737,7 @@ msgid "" "details)." msgstr "" -#: ../../library/functions.rst:2246 +#: ../../library/functions.rst:2244 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 " @@ -3739,37 +3745,37 @@ msgid "" "given, the module named by *name* is returned." msgstr "" -#: ../../library/functions.rst:2251 +#: ../../library/functions.rst:2249 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" msgstr "" -#: ../../library/functions.rst:2254 +#: ../../library/functions.rst:2252 msgid "spam = __import__('spam', globals(), locals(), [], 0)" msgstr "spam = __import__('spam', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2256 +#: ../../library/functions.rst:2254 msgid "The statement ``import spam.ham`` results in this call::" msgstr "" -#: ../../library/functions.rst:2258 +#: ../../library/functions.rst:2256 msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2260 +#: ../../library/functions.rst:2258 msgid "" "Note how :func:`__import__` returns the toplevel module here because this is " "the object that is bound to a name by the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2263 +#: ../../library/functions.rst:2261 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" msgstr "" -#: ../../library/functions.rst:2266 +#: ../../library/functions.rst:2264 msgid "" "_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" "eggs = _temp.eggs\n" @@ -3779,36 +3785,36 @@ msgstr "" "eggs = _temp.eggs\n" "saus = _temp.sausage" -#: ../../library/functions.rst:2270 +#: ../../library/functions.rst:2268 msgid "" "Here, the ``spam.ham`` module is returned from :func:`__import__`. From " "this object, the names to import are retrieved and assigned to their " "respective names." msgstr "" -#: ../../library/functions.rst:2274 +#: ../../library/functions.rst:2272 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2277 +#: ../../library/functions.rst:2275 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." msgstr "" -#: ../../library/functions.rst:2281 +#: ../../library/functions.rst:2279 msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." msgstr "" -#: ../../library/functions.rst:2286 +#: ../../library/functions.rst:2284 msgid "Footnotes" msgstr "註解" -#: ../../library/functions.rst:2287 +#: ../../library/functions.rst:2285 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 " @@ -3821,106 +3827,106 @@ msgstr "" msgid "Boolean" msgstr "Boolean(布林值)" -#: ../../library/functions.rst:154 ../../library/functions.rst:2054 +#: ../../library/functions.rst:154 ../../library/functions.rst:2052 msgid "type" msgstr "type(型別)" -#: ../../library/functions.rst:648 +#: ../../library/functions.rst:646 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/functions.rst:648 +#: ../../library/functions.rst:646 msgid "exec" msgstr "exec" -#: ../../library/functions.rst:746 +#: ../../library/functions.rst:744 msgid "NaN" msgstr "NaN" -#: ../../library/functions.rst:746 +#: ../../library/functions.rst:744 msgid "Infinity" msgstr "Infinity(無窮)" -#: ../../library/functions.rst:814 +#: ../../library/functions.rst:812 msgid "__format__" msgstr "__format__" -#: ../../library/functions.rst:814 ../../library/functions.rst:1931 +#: ../../library/functions.rst:812 ../../library/functions.rst:1928 msgid "string" msgstr "string(字串)" -#: ../../library/functions.rst:814 +#: ../../library/functions.rst:812 msgid "format() (built-in function)" msgstr "format()(內建函式)" -#: ../../library/functions.rst:1325 +#: ../../library/functions.rst:1323 msgid "file object" msgstr "file object(檔案物件)" -#: ../../library/functions.rst:1325 ../../library/functions.rst:1446 +#: ../../library/functions.rst:1323 ../../library/functions.rst:1444 msgid "open() built-in function" msgstr "open() 內建函式" -#: ../../library/functions.rst:1353 +#: ../../library/functions.rst:1351 msgid "file" msgstr "file(檔案)" -#: ../../library/functions.rst:1353 +#: ../../library/functions.rst:1351 msgid "modes" msgstr "modes(模式)" -#: ../../library/functions.rst:1446 +#: ../../library/functions.rst:1444 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/functions.rst:1507 +#: ../../library/functions.rst:1505 msgid "line-buffered I/O" msgstr "line-buffered I/O(行緩衝 I/O)" -#: ../../library/functions.rst:1507 +#: ../../library/functions.rst:1505 msgid "unbuffered I/O" msgstr "unbuffered I/O(非緩衝 I/O)" -#: ../../library/functions.rst:1507 +#: ../../library/functions.rst:1505 msgid "buffer size, I/O" msgstr "buffer size, I/O(緩衝區大小、I/O)" -#: ../../library/functions.rst:1507 +#: ../../library/functions.rst:1505 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/functions.rst:1507 +#: ../../library/functions.rst:1505 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/functions.rst:1507 +#: ../../library/functions.rst:1505 msgid "text mode" msgstr "text mode(文字模式)" -#: ../../library/functions.rst:1507 ../../library/functions.rst:2215 +#: ../../library/functions.rst:1505 ../../library/functions.rst:2213 msgid "module" msgstr "module(模組)" -#: ../../library/functions.rst:1507 +#: ../../library/functions.rst:1505 msgid "sys" msgstr "sys" -#: ../../library/functions.rst:1931 +#: ../../library/functions.rst:1928 msgid "str() (built-in function)" msgstr "str() (內建函式)" -#: ../../library/functions.rst:2054 +#: ../../library/functions.rst:2052 msgid "object" msgstr "object(物件)" -#: ../../library/functions.rst:2215 +#: ../../library/functions.rst:2213 msgid "statement" msgstr "statement(陳述式)" -#: ../../library/functions.rst:2215 +#: ../../library/functions.rst:2213 msgid "import" msgstr "import(引入)" -#: ../../library/functions.rst:2215 +#: ../../library/functions.rst:2213 msgid "builtins" msgstr "builtins(內建)" diff --git a/library/stdtypes.po b/library/stdtypes.po index f8065e1a26..55c0b31741 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-13 07:25+0000\n" +"POT-Creation-Date: 2025-08-26 00:16+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -135,8 +135,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:276 #: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:965 -#: ../../library/stdtypes.rst:1173 ../../library/stdtypes.rst:2636 -#: ../../library/stdtypes.rst:3855 +#: ../../library/stdtypes.rst:1173 ../../library/stdtypes.rst:2639 +#: ../../library/stdtypes.rst:3859 msgid "Notes" msgstr "註解" @@ -150,7 +150,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:967 #: ../../library/stdtypes.rst:970 ../../library/stdtypes.rst:1188 -#: ../../library/stdtypes.rst:2642 ../../library/stdtypes.rst:3861 +#: ../../library/stdtypes.rst:2645 ../../library/stdtypes.rst:3865 msgid "\\(1)" msgstr "\\(1)" @@ -164,8 +164,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:289 #: ../../library/stdtypes.rst:309 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:2646 ../../library/stdtypes.rst:2648 -#: ../../library/stdtypes.rst:3865 ../../library/stdtypes.rst:3867 +#: ../../library/stdtypes.rst:2649 ../../library/stdtypes.rst:2651 +#: ../../library/stdtypes.rst:3869 ../../library/stdtypes.rst:3871 msgid "\\(2)" msgstr "\\(2)" @@ -178,17 +178,17 @@ msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" #: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:1219 -#: ../../library/stdtypes.rst:2650 ../../library/stdtypes.rst:2652 -#: ../../library/stdtypes.rst:2654 ../../library/stdtypes.rst:2656 -#: ../../library/stdtypes.rst:3869 ../../library/stdtypes.rst:3871 +#: ../../library/stdtypes.rst:2653 ../../library/stdtypes.rst:2655 +#: ../../library/stdtypes.rst:2657 ../../library/stdtypes.rst:2659 #: ../../library/stdtypes.rst:3873 ../../library/stdtypes.rst:3875 +#: ../../library/stdtypes.rst:3877 ../../library/stdtypes.rst:3879 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:320 #: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:1016 -#: ../../library/stdtypes.rst:1228 ../../library/stdtypes.rst:2682 -#: ../../library/stdtypes.rst:3905 +#: ../../library/stdtypes.rst:1228 ../../library/stdtypes.rst:2685 +#: ../../library/stdtypes.rst:3909 msgid "Notes:" msgstr "註解:" @@ -235,9 +235,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2468 -#: ../../library/stdtypes.rst:2613 ../../library/stdtypes.rst:2636 -#: ../../library/stdtypes.rst:3832 ../../library/stdtypes.rst:3855 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2471 +#: ../../library/stdtypes.rst:2616 ../../library/stdtypes.rst:2639 +#: ../../library/stdtypes.rst:3836 ../../library/stdtypes.rst:3859 msgid "Meaning" msgstr "含義" @@ -558,7 +558,7 @@ msgid "" msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" #: ../../library/stdtypes.rst:302 ../../library/stdtypes.rst:1209 -#: ../../library/stdtypes.rst:2644 ../../library/stdtypes.rst:3892 +#: ../../library/stdtypes.rst:2647 ../../library/stdtypes.rst:3896 msgid "\\(6)" msgstr "\\(6)" @@ -596,9 +596,9 @@ msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313 #: ../../library/stdtypes.rst:1198 ../../library/stdtypes.rst:1201 -#: ../../library/stdtypes.rst:2669 ../../library/stdtypes.rst:2672 -#: ../../library/stdtypes.rst:2675 ../../library/stdtypes.rst:3888 -#: ../../library/stdtypes.rst:3895 +#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:2675 +#: ../../library/stdtypes.rst:2678 ../../library/stdtypes.rst:3892 +#: ../../library/stdtypes.rst:3899 msgid "\\(5)" msgstr "\\(5)" @@ -757,8 +757,8 @@ msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:418 ../../library/stdtypes.rst:421 #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:1223 -#: ../../library/stdtypes.rst:2658 ../../library/stdtypes.rst:2662 -#: ../../library/stdtypes.rst:3877 ../../library/stdtypes.rst:3881 +#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:2665 +#: ../../library/stdtypes.rst:3881 ../../library/stdtypes.rst:3885 msgid "\\(4)" msgstr "\\(4)" @@ -1687,7 +1687,7 @@ msgid "" "before index *j*)" msgstr "" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3863 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3867 msgid "\\(8)" msgstr "\\(8)" @@ -2496,14 +2496,14 @@ msgid "" "string literals and cannot be combined with the ``r`` prefix." msgstr "" -#: ../../library/stdtypes.rst:1566 +#: ../../library/stdtypes.rst:1568 msgid "" "Return a :ref:`string ` version of *object*. If *object* is not " "provided, returns the empty string. Otherwise, the behavior of ``str()`` " "depends on whether *encoding* or *errors* is given, as follows." msgstr "" -#: ../../library/stdtypes.rst:1570 +#: ../../library/stdtypes.rst:1572 msgid "" "If neither *encoding* nor *errors* is given, ``str(object)`` returns :meth:" "`type(object).__str__(object) `, which is the \"informal\" " @@ -2513,7 +2513,7 @@ msgid "" "`repr(object) `." msgstr "" -#: ../../library/stdtypes.rst:1582 +#: ../../library/stdtypes.rst:1584 msgid "" "If at least one of *encoding* or *errors* is given, *object* should be a :" "term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " @@ -2525,7 +2525,7 @@ msgid "" "buffer objects." msgstr "" -#: ../../library/stdtypes.rst:1591 +#: ../../library/stdtypes.rst:1593 msgid "" "Passing a :class:`bytes` object to :func:`str` without the *encoding* or " "*errors* arguments falls under the first case of returning the informal " @@ -2533,7 +2533,7 @@ msgid "" "Python). For example::" msgstr "" -#: ../../library/stdtypes.rst:1596 +#: ../../library/stdtypes.rst:1598 msgid "" ">>> str(b'Zoot!')\n" "\"b'Zoot!'\"" @@ -2541,7 +2541,7 @@ msgstr "" ">>> str(b'Zoot!')\n" "\"b'Zoot!'\"" -#: ../../library/stdtypes.rst:1599 +#: ../../library/stdtypes.rst:1601 msgid "" "For more information on the ``str`` class and its methods, see :ref:" "`textseq` and the :ref:`string-methods` section below. To output formatted " @@ -2549,17 +2549,17 @@ msgid "" "addition, see the :ref:`stringservices` section." msgstr "" -#: ../../library/stdtypes.rst:1611 +#: ../../library/stdtypes.rst:1613 msgid "String Methods" msgstr "" -#: ../../library/stdtypes.rst:1616 +#: ../../library/stdtypes.rst:1618 msgid "" "Strings implement all of the :ref:`common ` sequence " "operations, along with the additional methods described below." msgstr "" -#: ../../library/stdtypes.rst:1619 +#: ../../library/stdtypes.rst:1621 msgid "" "Strings also support two styles of string formatting, one providing a large " "degree of flexibility and customization (see :meth:`str.format`, :ref:" @@ -2569,33 +2569,33 @@ msgid "" "handle (:ref:`old-string-formatting`)." msgstr "" -#: ../../library/stdtypes.rst:1626 +#: ../../library/stdtypes.rst:1628 msgid "" "The :ref:`textservices` section of the standard library covers a number of " "other modules that provide various text related utilities (including regular " "expression support in the :mod:`re` module)." msgstr "" -#: ../../library/stdtypes.rst:1632 +#: ../../library/stdtypes.rst:1634 msgid "" "Return a copy of the string with its first character capitalized and the " "rest lowercased." msgstr "" -#: ../../library/stdtypes.rst:1635 +#: ../../library/stdtypes.rst:1637 msgid "" "The first character is now put into titlecase rather than uppercase. This " "means that characters like digraphs will only have their first letter " "capitalized, instead of the full character." msgstr "" -#: ../../library/stdtypes.rst:1642 +#: ../../library/stdtypes.rst:1644 msgid "" "Return a casefolded copy of the string. Casefolded strings may be used for " "caseless matching." msgstr "" -#: ../../library/stdtypes.rst:1645 +#: ../../library/stdtypes.rst:1647 msgid "" "Casefolding is similar to lowercasing but more aggressive because it is " "intended to remove all case distinctions in a string. For example, the " @@ -2604,21 +2604,21 @@ msgid "" "`casefold` converts it to ``\"ss\"``." msgstr "" -#: ../../library/stdtypes.rst:1651 +#: ../../library/stdtypes.rst:1653 msgid "" "The casefolding algorithm is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:1660 +#: ../../library/stdtypes.rst:1662 msgid "" "Return centered in a string of length *width*. Padding is done using the " "specified *fillchar* (default is an ASCII space). The original string is " "returned if *width* is less than or equal to ``len(s)``. For example::" msgstr "" -#: ../../library/stdtypes.rst:1664 +#: ../../library/stdtypes.rst:1666 msgid "" ">>> 'Python'.center(10)\n" "' Python '\n" @@ -2634,20 +2634,20 @@ msgstr "" ">>> 'Python'.center(4)\n" "'Python'" -#: ../../library/stdtypes.rst:1674 +#: ../../library/stdtypes.rst:1676 msgid "" "Return the number of non-overlapping occurrences of substring *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:1678 +#: ../../library/stdtypes.rst:1680 msgid "" "If *sub* is empty, returns the number of empty strings between characters " "which is the length of the string plus one. For example::" msgstr "" -#: ../../library/stdtypes.rst:1681 +#: ../../library/stdtypes.rst:1683 msgid "" ">>> 'spam, spam, spam'.count('spam')\n" "3\n" @@ -2671,17 +2671,17 @@ msgstr "" ">>> 'spam, spam, spam'.count('')\n" "17" -#: ../../library/stdtypes.rst:1694 +#: ../../library/stdtypes.rst:1696 msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1696 ../../library/stdtypes.rst:3028 +#: ../../library/stdtypes.rst:1698 ../../library/stdtypes.rst:3035 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." msgstr "" -#: ../../library/stdtypes.rst:1699 +#: ../../library/stdtypes.rst:1701 msgid "" "*errors* controls how encoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -2690,14 +2690,14 @@ msgid "" "register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:1706 +#: ../../library/stdtypes.rst:1708 msgid "" "For performance reasons, the value of *errors* is not checked for validity " "unless an encoding error actually occurs, :ref:`devmode` is enabled or a :" "ref:`debug build ` is used. For example::" msgstr "" -#: ../../library/stdtypes.rst:1712 +#: ../../library/stdtypes.rst:1714 msgid "" ">>> encoded_str_to_bytes = 'Python'.encode()\n" ">>> type(encoded_str_to_bytes)\n" @@ -2711,17 +2711,17 @@ msgstr "" ">>> encoded_str_to_bytes\n" "b'Python'" -#: ../../library/stdtypes.rst:1719 ../../library/stdtypes.rst:3047 +#: ../../library/stdtypes.rst:1721 ../../library/stdtypes.rst:3054 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1722 ../../library/stdtypes.rst:3050 +#: ../../library/stdtypes.rst:1724 ../../library/stdtypes.rst:3057 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." msgstr "" -#: ../../library/stdtypes.rst:1729 +#: ../../library/stdtypes.rst:1731 msgid "" "Return ``True`` if the string ends with the specified *suffix*, otherwise " "return ``False``. *suffix* can also be a tuple of suffixes to look for. " @@ -2730,7 +2730,7 @@ msgid "" "equivalent to ``str[start:end].endswith(suffix)``. For example::" msgstr "" -#: ../../library/stdtypes.rst:1735 +#: ../../library/stdtypes.rst:1737 msgid "" ">>> 'Python'.endswith('on')\n" "True\n" @@ -2750,11 +2750,11 @@ msgstr "" ">>> 'Python is amazing'.endswith('is', 0, 9)\n" "True" -#: ../../library/stdtypes.rst:1744 +#: ../../library/stdtypes.rst:1746 msgid "See also :meth:`startswith` and :meth:`removesuffix`." msgstr "另請參閱 :meth:`startswith` 和 :meth:`removesuffix`。" -#: ../../library/stdtypes.rst:1749 +#: ../../library/stdtypes.rst:1751 msgid "" "Return a copy of the string where all tab characters are replaced by one or " "more spaces, depending on the current column and the given tab size. Tab " @@ -2770,7 +2770,7 @@ msgid "" "printed. For example::" msgstr "" -#: ../../library/stdtypes.rst:1762 +#: ../../library/stdtypes.rst:1764 msgid "" ">>> '01\\t012\\t0123\\t01234'.expandtabs()\n" "'01 012 0123 01234'\n" @@ -2788,21 +2788,21 @@ msgstr "" "01 012\n" "0123 01234" -#: ../../library/stdtypes.rst:1773 +#: ../../library/stdtypes.rst:1775 msgid "" "Return the lowest index in the string where substring *sub* is found within " "the slice ``s[start:end]``. Optional arguments *start* and *end* are " "interpreted as in slice notation. Return ``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:1779 +#: ../../library/stdtypes.rst:1781 msgid "" "The :meth:`~str.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:1783 +#: ../../library/stdtypes.rst:1785 msgid "" ">>> 'Py' in 'Python'\n" "True" @@ -2810,7 +2810,7 @@ msgstr "" ">>> 'Py' in 'Python'\n" "True" -#: ../../library/stdtypes.rst:1789 +#: ../../library/stdtypes.rst:1791 msgid "" "Perform a string formatting operation. The string on which this method is " "called can contain literal text or replacement fields delimited by braces " @@ -2820,13 +2820,13 @@ msgid "" "the corresponding argument." msgstr "" -#: ../../library/stdtypes.rst:1799 +#: ../../library/stdtypes.rst:1801 msgid "" "See :ref:`formatstrings` for a description of the various formatting options " "that can be specified in format strings." msgstr "" -#: ../../library/stdtypes.rst:1803 +#: ../../library/stdtypes.rst:1805 msgid "" "When formatting a number (:class:`int`, :class:`float`, :class:`complex`, :" "class:`decimal.Decimal` and subclasses) with the ``n`` type (ex: ``'{:n}'." @@ -2837,26 +2837,26 @@ msgid "" "This temporary change affects other threads." msgstr "" -#: ../../library/stdtypes.rst:1812 +#: ../../library/stdtypes.rst:1814 msgid "" "When formatting a number with the ``n`` type, the function sets temporarily " "the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` locale in some cases." msgstr "" -#: ../../library/stdtypes.rst:1820 +#: ../../library/stdtypes.rst:1822 msgid "" "Similar to ``str.format(**mapping)``, except that ``mapping`` is used " "directly and not copied to a :class:`dict`. This is useful if for example " "``mapping`` is a dict subclass:" msgstr "" -#: ../../library/stdtypes.rst:1836 +#: ../../library/stdtypes.rst:1838 msgid "" "Like :meth:`~str.find`, but raise :exc:`ValueError` when the substring is " "not found." msgstr "" -#: ../../library/stdtypes.rst:1842 +#: ../../library/stdtypes.rst:1844 msgid "" "Return ``True`` if all characters in the string are alphanumeric and there " "is at least one character, ``False`` otherwise. A character ``c`` is " @@ -2864,7 +2864,7 @@ msgid "" "isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." msgstr "" -#: ../../library/stdtypes.rst:1850 +#: ../../library/stdtypes.rst:1852 msgid "" "Return ``True`` if all characters in the string are alphabetic and there is " "at least one character, ``False`` otherwise. Alphabetic characters are " @@ -2876,14 +2876,14 @@ msgid "" "pdf>`_." msgstr "" -#: ../../library/stdtypes.rst:1861 +#: ../../library/stdtypes.rst:1863 msgid "" "Return ``True`` if the string is empty or all characters in the string are " "ASCII, ``False`` otherwise. ASCII characters have code points in the range " "U+0000-U+007F." msgstr "" -#: ../../library/stdtypes.rst:1870 +#: ../../library/stdtypes.rst:1872 msgid "" "Return ``True`` if all characters in the string are decimal characters and " "there is at least one character, ``False`` otherwise. Decimal characters are " @@ -2892,7 +2892,7 @@ msgid "" "General Category \"Nd\"." msgstr "" -#: ../../library/stdtypes.rst:1880 +#: ../../library/stdtypes.rst:1882 msgid "" "Return ``True`` if all characters in the string are digits and there is at " "least one character, ``False`` otherwise. Digits include decimal characters " @@ -2902,23 +2902,23 @@ msgid "" "property value Numeric_Type=Digit or Numeric_Type=Decimal." msgstr "" -#: ../../library/stdtypes.rst:1890 +#: ../../library/stdtypes.rst:1892 msgid "" "Return ``True`` if the string is a valid identifier according to the " "language definition, section :ref:`identifiers`." msgstr "" -#: ../../library/stdtypes.rst:1893 +#: ../../library/stdtypes.rst:1895 msgid "" ":func:`keyword.iskeyword` can be used to test whether string ``s`` is a " "reserved identifier, such as :keyword:`def` and :keyword:`class`." msgstr "" -#: ../../library/stdtypes.rst:1896 +#: ../../library/stdtypes.rst:1898 msgid "Example: ::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:1899 +#: ../../library/stdtypes.rst:1901 msgid "" ">>> from keyword import iskeyword\n" "\n" @@ -2934,13 +2934,13 @@ msgstr "" ">>> 'def'.isidentifier(), iskeyword('def')\n" "(True, True)" -#: ../../library/stdtypes.rst:1909 +#: ../../library/stdtypes.rst:1911 msgid "" "Return ``True`` if all cased characters [4]_ in the string are lowercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1915 +#: ../../library/stdtypes.rst:1917 msgid "" "Return ``True`` if all characters in the string are numeric characters, and " "there is at least one character, ``False`` otherwise. Numeric characters " @@ -2950,13 +2950,13 @@ msgid "" "Numeric_Type=Decimal or Numeric_Type=Numeric." msgstr "" -#: ../../library/stdtypes.rst:1925 +#: ../../library/stdtypes.rst:1927 msgid "" "Return ``True`` if all characters in the string are printable, ``False`` if " "it contains at least one non-printable character." msgstr "" -#: ../../library/stdtypes.rst:1928 +#: ../../library/stdtypes.rst:1930 msgid "" "Here \"printable\" means the character is suitable for :func:`repr` to use " "in its output; \"non-printable\" means that :func:`repr` on built-in types " @@ -2964,7 +2964,7 @@ msgid "" "written to :data:`sys.stdout` or :data:`sys.stderr`." msgstr "" -#: ../../library/stdtypes.rst:1933 +#: ../../library/stdtypes.rst:1935 msgid "" "The printable characters are those which in the Unicode character database " "(see :mod:`unicodedata`) have a general category in group Letter, Mark, " @@ -2973,20 +2973,20 @@ msgid "" "C), except the ASCII space." msgstr "" -#: ../../library/stdtypes.rst:1942 +#: ../../library/stdtypes.rst:1944 msgid "" "Return ``True`` if there are only whitespace characters in the string and " "there is at least one character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1945 +#: ../../library/stdtypes.rst:1947 msgid "" "A character is *whitespace* if in the Unicode character database (see :mod:" "`unicodedata`), either its general category is ``Zs`` (\"Separator, " "space\"), or its bidirectional class is one of ``WS``, ``B``, or ``S``." msgstr "" -#: ../../library/stdtypes.rst:1953 +#: ../../library/stdtypes.rst:1955 msgid "" "Return ``True`` if the string is a titlecased string and there is at least " "one character, for example uppercase characters may only follow uncased " @@ -2994,13 +2994,13 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:1960 +#: ../../library/stdtypes.rst:1962 msgid "" "Return ``True`` if all cased characters [4]_ in the string are uppercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1978 +#: ../../library/stdtypes.rst:1980 msgid "" "Return a string which is the concatenation of the strings in *iterable*. A :" "exc:`TypeError` will be raised if there are any non-string values in " @@ -3008,27 +3008,27 @@ msgid "" "elements is the string providing this method." msgstr "" -#: ../../library/stdtypes.rst:1986 +#: ../../library/stdtypes.rst:1988 msgid "" "Return the string left justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:1993 +#: ../../library/stdtypes.rst:1995 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "lowercase." msgstr "" -#: ../../library/stdtypes.rst:1996 +#: ../../library/stdtypes.rst:1998 msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2003 +#: ../../library/stdtypes.rst:2005 msgid "" "Return a copy of the string with leading characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3037,7 +3037,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2008 +#: ../../library/stdtypes.rst:2010 msgid "" ">>> ' spacious '.lstrip()\n" "'spacious '\n" @@ -3049,13 +3049,13 @@ msgstr "" ">>> 'www.example.com'.lstrip('cmowz.')\n" "'example.com'" -#: ../../library/stdtypes.rst:2013 +#: ../../library/stdtypes.rst:2015 msgid "" "See :meth:`str.removeprefix` for a method that will remove a single prefix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2016 +#: ../../library/stdtypes.rst:2018 msgid "" ">>> 'Arthur: three!'.lstrip('Arthur: ')\n" "'ee!'\n" @@ -3067,13 +3067,13 @@ msgstr "" ">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" "'three!'" -#: ../../library/stdtypes.rst:2024 +#: ../../library/stdtypes.rst:2027 msgid "" "This static method returns a translation table usable for :meth:`str." "translate`." msgstr "" -#: ../../library/stdtypes.rst:2026 +#: ../../library/stdtypes.rst:2029 msgid "" "If there is only one argument, it must be a dictionary mapping Unicode " "ordinals (integers) or characters (strings of length 1) to Unicode ordinals, " @@ -3081,15 +3081,15 @@ msgid "" "converted to ordinals." msgstr "" -#: ../../library/stdtypes.rst:2031 +#: ../../library/stdtypes.rst:2034 msgid "" "If there are two arguments, they must be strings of equal length, and in the " -"resulting dictionary, each character in x will be mapped to the character at " -"the same position in y. If there is a third argument, it must be a string, " -"whose characters will be mapped to ``None`` in the result." +"resulting dictionary, each character in *from* will be mapped to the " +"character at the same position in *to*. If there is a third argument, it " +"must be a string, whose characters will be mapped to ``None`` in the result." msgstr "" -#: ../../library/stdtypes.rst:2039 +#: ../../library/stdtypes.rst:2042 msgid "" "Split the string at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3097,13 +3097,13 @@ msgid "" "containing the string itself, followed by two empty strings." msgstr "" -#: ../../library/stdtypes.rst:2047 +#: ../../library/stdtypes.rst:2050 msgid "" "If the string starts with the *prefix* string, return " "``string[len(prefix):]``. Otherwise, return a copy of the original string::" msgstr "" -#: ../../library/stdtypes.rst:2051 +#: ../../library/stdtypes.rst:2054 msgid "" ">>> 'TestHook'.removeprefix('Test')\n" "'Hook'\n" @@ -3115,14 +3115,14 @@ msgstr "" ">>> 'BaseTestCase'.removeprefix('Test')\n" "'BaseTestCase'" -#: ../../library/stdtypes.rst:2061 +#: ../../library/stdtypes.rst:2064 msgid "" "If the string ends with the *suffix* string and that *suffix* is not empty, " "return ``string[:-len(suffix)]``. Otherwise, return a copy of the original " "string::" msgstr "" -#: ../../library/stdtypes.rst:2065 +#: ../../library/stdtypes.rst:2068 msgid "" ">>> 'MiscTests'.removesuffix('Tests')\n" "'Misc'\n" @@ -3134,7 +3134,7 @@ msgstr "" ">>> 'TmpDirMixin'.removesuffix('Tests')\n" "'TmpDirMixin'" -#: ../../library/stdtypes.rst:2075 +#: ../../library/stdtypes.rst:2078 msgid "" "Return a copy of the string with all occurrences of substring *old* replaced " "by *new*. If *count* is given, only the first *count* occurrences are " @@ -3142,31 +3142,31 @@ msgid "" "replaced." msgstr "" -#: ../../library/stdtypes.rst:2079 +#: ../../library/stdtypes.rst:2082 msgid "*count* is now supported as a keyword argument." msgstr "*count* 現在作為關鍵字引數被支援。" -#: ../../library/stdtypes.rst:2085 +#: ../../library/stdtypes.rst:2088 msgid "" "Return the highest index in the string where substring *sub* is found, such " "that *sub* is contained within ``s[start:end]``. Optional arguments *start* " "and *end* are interpreted as in slice notation. Return ``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2092 +#: ../../library/stdtypes.rst:2095 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found." msgstr "" -#: ../../library/stdtypes.rst:2098 +#: ../../library/stdtypes.rst:2101 msgid "" "Return the string right justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2105 +#: ../../library/stdtypes.rst:2108 msgid "" "Split the string at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3174,7 +3174,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2113 +#: ../../library/stdtypes.rst:2116 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done, the " @@ -3183,7 +3183,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2122 +#: ../../library/stdtypes.rst:2125 msgid "" "Return a copy of the string with trailing characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3192,7 +3192,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2127 +#: ../../library/stdtypes.rst:2130 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -3204,13 +3204,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2132 +#: ../../library/stdtypes.rst:2135 msgid "" "See :meth:`str.removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2135 +#: ../../library/stdtypes.rst:2138 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -3222,7 +3222,7 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2142 +#: ../../library/stdtypes.rst:2145 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -3231,7 +3231,7 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2148 +#: ../../library/stdtypes.rst:2151 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " @@ -3241,20 +3241,20 @@ msgid "" "``['']``." msgstr "" -#: ../../library/stdtypes.rst:2155 ../../library/stdtypes.rst:2173 -#: ../../library/stdtypes.rst:2185 ../../library/stdtypes.rst:2237 -#: ../../library/stdtypes.rst:2305 ../../library/stdtypes.rst:2373 -#: ../../library/stdtypes.rst:3365 ../../library/stdtypes.rst:3383 -#: ../../library/stdtypes.rst:3474 ../../library/stdtypes.rst:3490 -#: ../../library/stdtypes.rst:3515 ../../library/stdtypes.rst:3529 -#: ../../library/stdtypes.rst:3557 ../../library/stdtypes.rst:3571 -#: ../../library/stdtypes.rst:3589 ../../library/stdtypes.rst:3616 -#: ../../library/stdtypes.rst:3639 ../../library/stdtypes.rst:3666 -#: ../../library/stdtypes.rst:3708 ../../library/stdtypes.rst:3732 +#: ../../library/stdtypes.rst:2158 ../../library/stdtypes.rst:2176 +#: ../../library/stdtypes.rst:2188 ../../library/stdtypes.rst:2240 +#: ../../library/stdtypes.rst:2308 ../../library/stdtypes.rst:2376 +#: ../../library/stdtypes.rst:3370 ../../library/stdtypes.rst:3388 +#: ../../library/stdtypes.rst:3478 ../../library/stdtypes.rst:3494 +#: ../../library/stdtypes.rst:3519 ../../library/stdtypes.rst:3533 +#: ../../library/stdtypes.rst:3561 ../../library/stdtypes.rst:3575 +#: ../../library/stdtypes.rst:3593 ../../library/stdtypes.rst:3620 +#: ../../library/stdtypes.rst:3643 ../../library/stdtypes.rst:3670 +#: ../../library/stdtypes.rst:3712 ../../library/stdtypes.rst:3736 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2157 +#: ../../library/stdtypes.rst:2160 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -3274,7 +3274,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2166 +#: ../../library/stdtypes.rst:2169 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive whitespace are regarded as a single separator, " @@ -3284,7 +3284,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2175 +#: ../../library/stdtypes.rst:2178 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -3300,13 +3300,13 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2182 +#: ../../library/stdtypes.rst:2185 msgid "" "If *sep* is not specified or is ``None`` and *maxsplit* is ``0``, only " "leading runs of consecutive whitespace are considered." msgstr "" -#: ../../library/stdtypes.rst:2187 +#: ../../library/stdtypes.rst:2190 msgid "" ">>> \"\".split(None, 0)\n" "[]\n" @@ -3322,120 +3322,120 @@ msgstr "" ">>> \" foo \".split(maxsplit=0)\n" "['foo ']" -#: ../../library/stdtypes.rst:2200 +#: ../../library/stdtypes.rst:2203 msgid "" "Return a list of the lines in the string, breaking at line boundaries. Line " "breaks are not included in the resulting list unless *keepends* is given and " "true." msgstr "" -#: ../../library/stdtypes.rst:2204 +#: ../../library/stdtypes.rst:2207 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2208 +#: ../../library/stdtypes.rst:2211 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2208 +#: ../../library/stdtypes.rst:2211 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2210 +#: ../../library/stdtypes.rst:2213 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2210 +#: ../../library/stdtypes.rst:2213 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2212 +#: ../../library/stdtypes.rst:2215 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2212 +#: ../../library/stdtypes.rst:2215 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2214 +#: ../../library/stdtypes.rst:2217 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2214 +#: ../../library/stdtypes.rst:2217 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2216 +#: ../../library/stdtypes.rst:2219 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2216 +#: ../../library/stdtypes.rst:2219 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2218 +#: ../../library/stdtypes.rst:2221 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2218 +#: ../../library/stdtypes.rst:2221 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2220 +#: ../../library/stdtypes.rst:2223 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2220 +#: ../../library/stdtypes.rst:2223 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2222 +#: ../../library/stdtypes.rst:2225 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2222 +#: ../../library/stdtypes.rst:2225 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2224 +#: ../../library/stdtypes.rst:2227 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2224 +#: ../../library/stdtypes.rst:2227 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2226 +#: ../../library/stdtypes.rst:2229 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2226 +#: ../../library/stdtypes.rst:2229 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2228 +#: ../../library/stdtypes.rst:2231 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2228 +#: ../../library/stdtypes.rst:2231 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2230 +#: ../../library/stdtypes.rst:2233 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2230 +#: ../../library/stdtypes.rst:2233 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2235 +#: ../../library/stdtypes.rst:2238 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2239 +#: ../../library/stdtypes.rst:2242 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -3447,14 +3447,14 @@ msgstr "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" -#: ../../library/stdtypes.rst:2244 +#: ../../library/stdtypes.rst:2247 msgid "" "Unlike :meth:`~str.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:2248 +#: ../../library/stdtypes.rst:2251 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -3466,11 +3466,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2253 +#: ../../library/stdtypes.rst:2256 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2255 +#: ../../library/stdtypes.rst:2258 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -3482,7 +3482,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2263 +#: ../../library/stdtypes.rst:2266 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -3490,7 +3490,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2271 +#: ../../library/stdtypes.rst:2274 msgid "" "Return a copy of the string with the leading and trailing characters " "removed. The *chars* argument is a string specifying the set of characters " @@ -3499,7 +3499,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2277 +#: ../../library/stdtypes.rst:2280 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -3511,7 +3511,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2282 +#: ../../library/stdtypes.rst:2285 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -3519,7 +3519,7 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2288 +#: ../../library/stdtypes.rst:2291 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -3529,20 +3529,20 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2295 +#: ../../library/stdtypes.rst:2298 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " "and vice versa. Note that it is not necessarily true that ``s.swapcase()." "swapcase() == s``." msgstr "" -#: ../../library/stdtypes.rst:2302 +#: ../../library/stdtypes.rst:2305 msgid "" "Return a titlecased version of the string where words start with an " "uppercase character and the remaining characters are lowercase." msgstr "" -#: ../../library/stdtypes.rst:2307 +#: ../../library/stdtypes.rst:2310 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -3550,7 +3550,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2310 ../../library/stdtypes.rst:3676 +#: ../../library/stdtypes.rst:2313 ../../library/stdtypes.rst:3680 msgid "" "The algorithm uses a simple language-independent definition of a word as " "groups of consecutive letters. The definition works in many contexts but it " @@ -3558,7 +3558,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2315 +#: ../../library/stdtypes.rst:2318 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -3566,19 +3566,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2318 +#: ../../library/stdtypes.rst:2321 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2321 +#: ../../library/stdtypes.rst:2324 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2324 +#: ../../library/stdtypes.rst:2327 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -3598,7 +3598,7 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2336 +#: ../../library/stdtypes.rst:2339 msgid "" "Return a copy of the string in which each character has been mapped through " "the given translation table. The table must be an object that implements " @@ -3610,19 +3610,19 @@ msgid "" "exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2345 +#: ../../library/stdtypes.rst:2348 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2348 +#: ../../library/stdtypes.rst:2351 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2354 +#: ../../library/stdtypes.rst:2357 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s`` " @@ -3631,14 +3631,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2360 +#: ../../library/stdtypes.rst:2363 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2367 +#: ../../library/stdtypes.rst:2370 msgid "" "Return a copy of the string left filled with ASCII ``'0'`` digits to make a " "string of length *width*. A leading sign prefix (``'+'``/``'-'``) is handled " @@ -3646,7 +3646,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2375 +#: ../../library/stdtypes.rst:2378 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -3658,27 +3658,27 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2396 +#: ../../library/stdtypes.rst:2399 msgid "Formatted String Literals (f-strings)" msgstr "" -#: ../../library/stdtypes.rst:2399 +#: ../../library/stdtypes.rst:2402 msgid "" "The :keyword:`await` and :keyword:`async for` can be used in expressions " "within f-strings." msgstr "" -#: ../../library/stdtypes.rst:2402 +#: ../../library/stdtypes.rst:2405 msgid "Added the debugging operator (``=``)" msgstr "" -#: ../../library/stdtypes.rst:2404 +#: ../../library/stdtypes.rst:2407 msgid "" "Many restrictions on expressions within f-strings have been removed. " "Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../library/stdtypes.rst:2408 +#: ../../library/stdtypes.rst:2411 msgid "" "An :dfn:`f-string` (formally a :dfn:`formatted string literal`) is a string " "literal that is prefixed with ``f`` or ``F``. This type of string literal " @@ -3688,7 +3688,7 @@ msgid "" "into regular :class:`str` objects. For example:" msgstr "" -#: ../../library/stdtypes.rst:2416 +#: ../../library/stdtypes.rst:2419 msgid "" ">>> who = 'nobody'\n" ">>> nationality = 'Spanish'\n" @@ -3700,11 +3700,11 @@ msgstr "" ">>> f'{who.title()} expects the {nationality} Inquisition!'\n" "'Nobody expects the Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2423 +#: ../../library/stdtypes.rst:2426 msgid "It is also possible to use a multi line f-string:" msgstr "" -#: ../../library/stdtypes.rst:2425 +#: ../../library/stdtypes.rst:2428 msgid "" ">>> f'''This is a string\n" "... on two lines'''\n" @@ -3714,13 +3714,13 @@ msgstr "" "... on two lines'''\n" "'This is a string\\non two lines'" -#: ../../library/stdtypes.rst:2431 +#: ../../library/stdtypes.rst:2434 msgid "" "A single opening curly bracket, ``'{'``, marks a *replacement field* that " "can contain any Python expression:" msgstr "" -#: ../../library/stdtypes.rst:2434 +#: ../../library/stdtypes.rst:2437 msgid "" ">>> nationality = 'Spanish'\n" ">>> f'The {nationality} Inquisition!'\n" @@ -3730,11 +3730,11 @@ msgstr "" ">>> f'The {nationality} Inquisition!'\n" "'The Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2440 +#: ../../library/stdtypes.rst:2443 msgid "To include a literal ``{`` or ``}``, use a double bracket:" msgstr "" -#: ../../library/stdtypes.rst:2442 +#: ../../library/stdtypes.rst:2445 msgid "" ">>> x = 42\n" ">>> f'{{x}} is {x}'\n" @@ -3744,12 +3744,12 @@ msgstr "" ">>> f'{{x}} is {x}'\n" "'{x} is 42'" -#: ../../library/stdtypes.rst:2448 +#: ../../library/stdtypes.rst:2451 msgid "" "Functions can also be used, and :ref:`format specifiers `:" msgstr "" -#: ../../library/stdtypes.rst:2450 +#: ../../library/stdtypes.rst:2453 msgid "" ">>> from math import sqrt\n" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" @@ -3759,11 +3759,11 @@ msgstr "" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" "'√2 ≈ 1.41421'" -#: ../../library/stdtypes.rst:2456 +#: ../../library/stdtypes.rst:2459 msgid "Any non-string expression is converted using :func:`str`, by default:" msgstr "" -#: ../../library/stdtypes.rst:2458 +#: ../../library/stdtypes.rst:2461 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)}'\n" @@ -3773,46 +3773,46 @@ msgstr "" ">>> f'{Fraction(1, 3)}'\n" "'1/3'" -#: ../../library/stdtypes.rst:2464 +#: ../../library/stdtypes.rst:2467 msgid "" "To use an explicit conversion, use the ``!`` (exclamation mark) operator, " "followed by any of the valid formats, which are:" msgstr "" -#: ../../library/stdtypes.rst:2468 ../../library/stdtypes.rst:2636 -#: ../../library/stdtypes.rst:3855 +#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:2639 +#: ../../library/stdtypes.rst:3859 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:2470 +#: ../../library/stdtypes.rst:2473 msgid "``!a``" msgstr "``!a``" -#: ../../library/stdtypes.rst:2470 +#: ../../library/stdtypes.rst:2473 msgid ":func:`ascii`" msgstr ":func:`ascii`" -#: ../../library/stdtypes.rst:2471 +#: ../../library/stdtypes.rst:2474 msgid "``!r``" msgstr "``!r``" -#: ../../library/stdtypes.rst:2471 +#: ../../library/stdtypes.rst:2474 msgid ":func:`repr`" msgstr ":func:`repr`" -#: ../../library/stdtypes.rst:2472 +#: ../../library/stdtypes.rst:2475 msgid "``!s``" msgstr "``!s``" -#: ../../library/stdtypes.rst:2472 +#: ../../library/stdtypes.rst:2475 msgid ":func:`str`" msgstr ":func:`str`" -#: ../../library/stdtypes.rst:2475 +#: ../../library/stdtypes.rst:2478 msgid "For example:" msgstr "舉例來說:" -#: ../../library/stdtypes.rst:2477 +#: ../../library/stdtypes.rst:2480 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)!s}'\n" @@ -3832,7 +3832,7 @@ msgstr "" ">>> print(f'{question!a}')\n" "'\\xbfD\\xf3nde est\\xe1 el Presidente?'" -#: ../../library/stdtypes.rst:2488 +#: ../../library/stdtypes.rst:2491 msgid "" "While debugging it may be helpful to see both the expression and its value, " "by using the equals sign (``=``) after the expression. This preserves spaces " @@ -3840,7 +3840,7 @@ msgid "" "debugging operator uses the :func:`repr` (``!r``) conversion. For example:" msgstr "" -#: ../../library/stdtypes.rst:2494 +#: ../../library/stdtypes.rst:2497 msgid "" ">>> from fractions import Fraction\n" ">>> calculation = Fraction(1, 3)\n" @@ -3860,7 +3860,7 @@ msgstr "" ">>> f'{calculation = !s}'\n" "'calculation = 1/3'" -#: ../../library/stdtypes.rst:2505 +#: ../../library/stdtypes.rst:2508 msgid "" "Once the output has been evaluated, it can be formatted using a :ref:`format " "specifier ` following a colon (``':'``). After the expression " @@ -3870,7 +3870,7 @@ msgid "" "used as the final value for the replacement field. For example:" msgstr "" -#: ../../library/stdtypes.rst:2513 +#: ../../library/stdtypes.rst:2516 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 7):.6f}'\n" @@ -3879,11 +3879,11 @@ msgid "" "'___+1/7___'" msgstr "" -#: ../../library/stdtypes.rst:2525 +#: ../../library/stdtypes.rst:2528 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2538 +#: ../../library/stdtypes.rst:2541 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -3894,7 +3894,7 @@ msgid "" "or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2546 +#: ../../library/stdtypes.rst:2549 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -3904,13 +3904,13 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:2553 +#: ../../library/stdtypes.rst:2556 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." msgstr "" -#: ../../library/stdtypes.rst:2558 +#: ../../library/stdtypes.rst:2561 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -3918,36 +3918,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2568 ../../library/stdtypes.rst:3787 +#: ../../library/stdtypes.rst:2571 ../../library/stdtypes.rst:3791 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2571 ../../library/stdtypes.rst:3790 +#: ../../library/stdtypes.rst:2574 ../../library/stdtypes.rst:3794 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2573 ../../library/stdtypes.rst:3792 +#: ../../library/stdtypes.rst:2576 ../../library/stdtypes.rst:3796 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2576 ../../library/stdtypes.rst:3795 +#: ../../library/stdtypes.rst:2579 ../../library/stdtypes.rst:3799 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2579 ../../library/stdtypes.rst:3798 +#: ../../library/stdtypes.rst:2582 ../../library/stdtypes.rst:3802 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is read from the next element of the tuple in *values*, and the " "object to convert comes after the minimum field width and optional precision." msgstr "" -#: ../../library/stdtypes.rst:2583 ../../library/stdtypes.rst:3802 +#: ../../library/stdtypes.rst:2586 ../../library/stdtypes.rst:3806 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -3955,15 +3955,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2588 ../../library/stdtypes.rst:3807 +#: ../../library/stdtypes.rst:2591 ../../library/stdtypes.rst:3811 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2590 ../../library/stdtypes.rst:3809 +#: ../../library/stdtypes.rst:2593 ../../library/stdtypes.rst:3813 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2592 +#: ../../library/stdtypes.rst:2595 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the string *must* include a parenthesised mapping key into that " @@ -3971,275 +3971,275 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2601 ../../library/stdtypes.rst:3820 +#: ../../library/stdtypes.rst:2604 ../../library/stdtypes.rst:3824 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2604 ../../library/stdtypes.rst:3823 +#: ../../library/stdtypes.rst:2607 ../../library/stdtypes.rst:3827 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2613 ../../library/stdtypes.rst:3832 +#: ../../library/stdtypes.rst:2616 ../../library/stdtypes.rst:3836 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2615 ../../library/stdtypes.rst:3834 +#: ../../library/stdtypes.rst:2618 ../../library/stdtypes.rst:3838 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2615 ../../library/stdtypes.rst:3834 +#: ../../library/stdtypes.rst:2618 ../../library/stdtypes.rst:3838 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2618 ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:2621 ../../library/stdtypes.rst:3841 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2618 ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:2621 ../../library/stdtypes.rst:3841 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2620 ../../library/stdtypes.rst:3839 +#: ../../library/stdtypes.rst:2623 ../../library/stdtypes.rst:3843 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2620 ../../library/stdtypes.rst:3839 +#: ../../library/stdtypes.rst:2623 ../../library/stdtypes.rst:3843 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2623 ../../library/stdtypes.rst:3842 +#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3846 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2623 ../../library/stdtypes.rst:3842 +#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3846 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3845 +#: ../../library/stdtypes.rst:2629 ../../library/stdtypes.rst:3849 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3845 +#: ../../library/stdtypes.rst:2629 ../../library/stdtypes.rst:3849 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2630 ../../library/stdtypes.rst:3849 +#: ../../library/stdtypes.rst:2633 ../../library/stdtypes.rst:3853 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" -#: ../../library/stdtypes.rst:2633 ../../library/stdtypes.rst:3852 +#: ../../library/stdtypes.rst:2636 ../../library/stdtypes.rst:3856 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2638 ../../library/stdtypes.rst:3857 +#: ../../library/stdtypes.rst:2641 ../../library/stdtypes.rst:3861 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2638 ../../library/stdtypes.rst:2640 -#: ../../library/stdtypes.rst:3857 ../../library/stdtypes.rst:3859 +#: ../../library/stdtypes.rst:2641 ../../library/stdtypes.rst:2643 +#: ../../library/stdtypes.rst:3861 ../../library/stdtypes.rst:3863 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2640 ../../library/stdtypes.rst:3859 +#: ../../library/stdtypes.rst:2643 ../../library/stdtypes.rst:3863 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2642 ../../library/stdtypes.rst:3861 +#: ../../library/stdtypes.rst:2645 ../../library/stdtypes.rst:3865 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2642 ../../library/stdtypes.rst:3861 +#: ../../library/stdtypes.rst:2645 ../../library/stdtypes.rst:3865 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2644 ../../library/stdtypes.rst:3863 +#: ../../library/stdtypes.rst:2647 ../../library/stdtypes.rst:3867 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2644 ../../library/stdtypes.rst:3863 +#: ../../library/stdtypes.rst:2647 ../../library/stdtypes.rst:3867 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2646 ../../library/stdtypes.rst:3865 +#: ../../library/stdtypes.rst:2649 ../../library/stdtypes.rst:3869 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2646 ../../library/stdtypes.rst:3865 +#: ../../library/stdtypes.rst:2649 ../../library/stdtypes.rst:3869 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2648 ../../library/stdtypes.rst:3867 +#: ../../library/stdtypes.rst:2651 ../../library/stdtypes.rst:3871 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2648 ../../library/stdtypes.rst:3867 +#: ../../library/stdtypes.rst:2651 ../../library/stdtypes.rst:3871 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2650 ../../library/stdtypes.rst:3869 +#: ../../library/stdtypes.rst:2653 ../../library/stdtypes.rst:3873 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2650 ../../library/stdtypes.rst:3869 +#: ../../library/stdtypes.rst:2653 ../../library/stdtypes.rst:3873 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:3871 +#: ../../library/stdtypes.rst:2655 ../../library/stdtypes.rst:3875 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:3871 +#: ../../library/stdtypes.rst:2655 ../../library/stdtypes.rst:3875 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2654 ../../library/stdtypes.rst:3873 +#: ../../library/stdtypes.rst:2657 ../../library/stdtypes.rst:3877 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2654 ../../library/stdtypes.rst:2656 -#: ../../library/stdtypes.rst:3873 ../../library/stdtypes.rst:3875 +#: ../../library/stdtypes.rst:2657 ../../library/stdtypes.rst:2659 +#: ../../library/stdtypes.rst:3877 ../../library/stdtypes.rst:3879 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2656 ../../library/stdtypes.rst:3875 +#: ../../library/stdtypes.rst:2659 ../../library/stdtypes.rst:3879 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2658 ../../library/stdtypes.rst:3877 +#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:3881 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2658 ../../library/stdtypes.rst:3877 +#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:3881 msgid "" "Floating-point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2662 ../../library/stdtypes.rst:3881 +#: ../../library/stdtypes.rst:2665 ../../library/stdtypes.rst:3885 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2662 ../../library/stdtypes.rst:3881 +#: ../../library/stdtypes.rst:2665 ../../library/stdtypes.rst:3885 msgid "" "Floating-point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2666 ../../library/stdtypes.rst:3885 +#: ../../library/stdtypes.rst:2669 ../../library/stdtypes.rst:3889 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2666 +#: ../../library/stdtypes.rst:2669 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2669 ../../library/stdtypes.rst:3898 +#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:3902 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2669 +#: ../../library/stdtypes.rst:2672 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:3892 +#: ../../library/stdtypes.rst:2675 ../../library/stdtypes.rst:3896 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2672 +#: ../../library/stdtypes.rst:2675 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2675 ../../library/stdtypes.rst:3895 +#: ../../library/stdtypes.rst:2678 ../../library/stdtypes.rst:3899 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2675 +#: ../../library/stdtypes.rst:2678 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2678 ../../library/stdtypes.rst:3901 +#: ../../library/stdtypes.rst:2681 ../../library/stdtypes.rst:3905 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2678 ../../library/stdtypes.rst:3901 +#: ../../library/stdtypes.rst:2681 ../../library/stdtypes.rst:3905 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2685 ../../library/stdtypes.rst:3908 +#: ../../library/stdtypes.rst:2688 ../../library/stdtypes.rst:3912 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2689 ../../library/stdtypes.rst:3912 +#: ../../library/stdtypes.rst:2692 ../../library/stdtypes.rst:3916 msgid "" "The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on " "whether the ``'x'`` or ``'X'`` format was used) to be inserted before the " "first digit." msgstr "" -#: ../../library/stdtypes.rst:2693 ../../library/stdtypes.rst:3916 +#: ../../library/stdtypes.rst:2696 ../../library/stdtypes.rst:3920 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2696 ../../library/stdtypes.rst:3919 +#: ../../library/stdtypes.rst:2699 ../../library/stdtypes.rst:3923 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2700 ../../library/stdtypes.rst:3923 +#: ../../library/stdtypes.rst:2703 ../../library/stdtypes.rst:3927 msgid "" "The alternate form causes the result to always contain a decimal point, and " "trailing zeroes are not removed as they would otherwise be." msgstr "" -#: ../../library/stdtypes.rst:2703 ../../library/stdtypes.rst:3926 +#: ../../library/stdtypes.rst:2706 ../../library/stdtypes.rst:3930 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2707 ../../library/stdtypes.rst:3930 +#: ../../library/stdtypes.rst:2710 ../../library/stdtypes.rst:3934 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2710 ../../library/stdtypes.rst:3939 +#: ../../library/stdtypes.rst:2713 ../../library/stdtypes.rst:3943 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2712 +#: ../../library/stdtypes.rst:2715 msgid "" "Since Python strings have an explicit length, ``%s`` conversions do not " "assume that ``'\\0'`` is the end of the string." msgstr "" -#: ../../library/stdtypes.rst:2717 +#: ../../library/stdtypes.rst:2720 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2728 +#: ../../library/stdtypes.rst:2731 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2736 +#: ../../library/stdtypes.rst:2739 msgid "" "The core built-in types for manipulating binary data are :class:`bytes` and :" "class:`bytearray`. They are supported by :class:`memoryview` which uses the :" @@ -4247,17 +4247,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2741 +#: ../../library/stdtypes.rst:2744 msgid "" "The :mod:`array` module supports efficient storage of basic data types like " "32-bit integers and IEEE754 double-precision floating values." msgstr "" -#: ../../library/stdtypes.rst:2747 +#: ../../library/stdtypes.rst:2750 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2751 +#: ../../library/stdtypes.rst:2754 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -4265,40 +4265,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2758 +#: ../../library/stdtypes.rst:2762 msgid "" "Firstly, the syntax for bytes literals is largely the same as that for " "string literals, except that a ``b`` prefix is added:" msgstr "" -#: ../../library/stdtypes.rst:2761 +#: ../../library/stdtypes.rst:2765 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2762 +#: ../../library/stdtypes.rst:2766 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2763 +#: ../../library/stdtypes.rst:2767 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2765 +#: ../../library/stdtypes.rst:2769 msgid "" "Only ASCII characters are permitted in bytes literals (regardless of the " "declared source code encoding). Any binary values over 127 must be entered " "into bytes literals using the appropriate escape sequence." msgstr "" -#: ../../library/stdtypes.rst:2769 +#: ../../library/stdtypes.rst:2773 msgid "" "As with string literals, bytes literals may also use a ``r`` prefix to " "disable processing of escape sequences. See :ref:`strings` for more about " "the various forms of bytes literal, including supported escape sequences." msgstr "" -#: ../../library/stdtypes.rst:2773 +#: ../../library/stdtypes.rst:2777 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -4311,29 +4311,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2783 +#: ../../library/stdtypes.rst:2787 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2786 +#: ../../library/stdtypes.rst:2790 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2787 +#: ../../library/stdtypes.rst:2791 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2788 +#: ../../library/stdtypes.rst:2792 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2790 +#: ../../library/stdtypes.rst:2794 msgid "Also see the :ref:`bytes ` built-in." msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:2792 +#: ../../library/stdtypes.rst:2796 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4341,32 +4341,32 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:2798 +#: ../../library/stdtypes.rst:2802 msgid "" "This :class:`bytes` class method returns a bytes object, decoding the given " "string object. The string must contain two hexadecimal digits per byte, " "with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2805 +#: ../../library/stdtypes.rst:2809 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:2809 +#: ../../library/stdtypes.rst:2813 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2814 ../../library/stdtypes.rst:2899 +#: ../../library/stdtypes.rst:2819 ../../library/stdtypes.rst:2906 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:2820 +#: ../../library/stdtypes.rst:2825 msgid "" "If you want to make the hex string easier to read, you can specify a single " "character separator *sep* parameter to include in the output. By default, " @@ -4375,13 +4375,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:2837 +#: ../../library/stdtypes.rst:2842 msgid "" ":meth:`bytes.hex` now supports optional *sep* and *bytes_per_sep* parameters " "to insert separators between bytes in the hex output." msgstr "" -#: ../../library/stdtypes.rst:2841 +#: ../../library/stdtypes.rst:2846 msgid "" "Since bytes objects are sequences of integers (akin to a tuple), for a bytes " "object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes " @@ -4389,58 +4389,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2846 +#: ../../library/stdtypes.rst:2851 msgid "" "The representation of bytes objects uses the literal format (``b'...'``) " "since it is often more useful than e.g. ``bytes([46, 46, 46])``. You can " "always convert a bytes object into a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2854 +#: ../../library/stdtypes.rst:2859 msgid "Bytearray Objects" msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:2858 +#: ../../library/stdtypes.rst:2863 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:2863 +#: ../../library/stdtypes.rst:2869 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:2866 +#: ../../library/stdtypes.rst:2872 msgid "Creating an empty instance: ``bytearray()``" msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:2867 +#: ../../library/stdtypes.rst:2873 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:2868 +#: ../../library/stdtypes.rst:2874 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2869 +#: ../../library/stdtypes.rst:2875 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:2871 +#: ../../library/stdtypes.rst:2877 msgid "" "As bytearray objects are mutable, they support the :ref:`mutable ` sequence operations in addition to the common bytes and bytearray " "operations described in :ref:`bytes-methods`." msgstr "" -#: ../../library/stdtypes.rst:2875 +#: ../../library/stdtypes.rst:2881 msgid "Also see the :ref:`bytearray ` built-in." msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:2877 +#: ../../library/stdtypes.rst:2883 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4448,33 +4448,33 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:2883 +#: ../../library/stdtypes.rst:2889 msgid "" "This :class:`bytearray` class method returns bytearray object, decoding the " "given string object. The string must contain two hexadecimal digits per " "byte, with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2890 +#: ../../library/stdtypes.rst:2896 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:2894 +#: ../../library/stdtypes.rst:2900 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2907 +#: ../../library/stdtypes.rst:2914 msgid "" "Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:2912 +#: ../../library/stdtypes.rst:2919 msgid "" "Since bytearray objects are sequences of integers (akin to a list), for a " "bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be " @@ -4482,7 +4482,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2917 +#: ../../library/stdtypes.rst:2924 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -4490,11 +4490,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2926 +#: ../../library/stdtypes.rst:2933 msgid "Bytes and Bytearray Operations" msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:2931 +#: ../../library/stdtypes.rst:2938 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -4503,14 +4503,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:2939 +#: ../../library/stdtypes.rst:2946 msgid "" "The methods on bytes and bytearray objects don't accept strings as their " "arguments, just as the methods on strings don't accept bytes as their " "arguments. For example, you have to write::" msgstr "" -#: ../../library/stdtypes.rst:2943 +#: ../../library/stdtypes.rst:2950 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -4518,11 +4518,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:2946 +#: ../../library/stdtypes.rst:2953 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:2948 +#: ../../library/stdtypes.rst:2955 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -4530,60 +4530,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:2951 +#: ../../library/stdtypes.rst:2958 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" -#: ../../library/stdtypes.rst:2956 +#: ../../library/stdtypes.rst:2963 msgid "" "Using these ASCII based operations to manipulate binary data that is not " "stored in an ASCII based format may lead to data corruption." msgstr "" -#: ../../library/stdtypes.rst:2959 +#: ../../library/stdtypes.rst:2966 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:2965 +#: ../../library/stdtypes.rst:2972 msgid "" "Return the number of non-overlapping occurrences of subsequence *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:2969 ../../library/stdtypes.rst:3074 -#: ../../library/stdtypes.rst:3096 ../../library/stdtypes.rst:3162 -#: ../../library/stdtypes.rst:3175 +#: ../../library/stdtypes.rst:2976 ../../library/stdtypes.rst:3081 +#: ../../library/stdtypes.rst:3103 ../../library/stdtypes.rst:3169 +#: ../../library/stdtypes.rst:3182 msgid "" "The subsequence to search for may be any :term:`bytes-like object` or an " "integer in the range 0 to 255." msgstr "" -#: ../../library/stdtypes.rst:2972 +#: ../../library/stdtypes.rst:2979 msgid "" "If *sub* is empty, returns the number of empty slices between characters " "which is the length of the bytes object plus one." msgstr "" -#: ../../library/stdtypes.rst:2975 ../../library/stdtypes.rst:3086 -#: ../../library/stdtypes.rst:3099 ../../library/stdtypes.rst:3165 -#: ../../library/stdtypes.rst:3178 +#: ../../library/stdtypes.rst:2982 ../../library/stdtypes.rst:3093 +#: ../../library/stdtypes.rst:3106 ../../library/stdtypes.rst:3172 +#: ../../library/stdtypes.rst:3185 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:2982 +#: ../../library/stdtypes.rst:2989 msgid "" "If the binary data starts with the *prefix* string, return " "``bytes[len(prefix):]``. Otherwise, return a copy of the original binary " "data::" msgstr "" -#: ../../library/stdtypes.rst:2986 +#: ../../library/stdtypes.rst:2993 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -4595,32 +4595,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:2991 +#: ../../library/stdtypes.rst:2998 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" -#: ../../library/stdtypes.rst:2995 ../../library/stdtypes.rst:3017 -#: ../../library/stdtypes.rst:3150 ../../library/stdtypes.rst:3243 -#: ../../library/stdtypes.rst:3257 ../../library/stdtypes.rst:3288 -#: ../../library/stdtypes.rst:3302 ../../library/stdtypes.rst:3344 -#: ../../library/stdtypes.rst:3415 ../../library/stdtypes.rst:3433 -#: ../../library/stdtypes.rst:3461 ../../library/stdtypes.rst:3600 -#: ../../library/stdtypes.rst:3655 ../../library/stdtypes.rst:3698 -#: ../../library/stdtypes.rst:3719 ../../library/stdtypes.rst:3741 -#: ../../library/stdtypes.rst:3943 +#: ../../library/stdtypes.rst:3002 ../../library/stdtypes.rst:3024 +#: ../../library/stdtypes.rst:3157 ../../library/stdtypes.rst:3250 +#: ../../library/stdtypes.rst:3264 ../../library/stdtypes.rst:3294 +#: ../../library/stdtypes.rst:3308 ../../library/stdtypes.rst:3349 +#: ../../library/stdtypes.rst:3419 ../../library/stdtypes.rst:3437 +#: ../../library/stdtypes.rst:3465 ../../library/stdtypes.rst:3604 +#: ../../library/stdtypes.rst:3659 ../../library/stdtypes.rst:3702 +#: ../../library/stdtypes.rst:3723 ../../library/stdtypes.rst:3745 +#: ../../library/stdtypes.rst:3947 msgid "" "The bytearray version of this method does *not* operate in place - it always " "produces a new object, even if no changes were made." msgstr "" -#: ../../library/stdtypes.rst:3004 +#: ../../library/stdtypes.rst:3011 msgid "" "If the binary data ends with the *suffix* string and that *suffix* is not " "empty, return ``bytes[:-len(suffix)]``. Otherwise, return a copy of the " "original binary data::" msgstr "" -#: ../../library/stdtypes.rst:3008 +#: ../../library/stdtypes.rst:3015 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -4632,15 +4632,15 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:3013 +#: ../../library/stdtypes.rst:3020 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3026 +#: ../../library/stdtypes.rst:3033 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:3031 +#: ../../library/stdtypes.rst:3038 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -4648,21 +4648,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:3037 +#: ../../library/stdtypes.rst:3044 msgid "" "For performance reasons, the value of *errors* is not checked for validity " "unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" "`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:3043 +#: ../../library/stdtypes.rst:3050 msgid "" "Passing the *encoding* argument to :class:`str` allows decoding any :term:" "`bytes-like object` directly, without needing to make a temporary :class:`!" "bytes` or :class:`!bytearray` object." msgstr "" -#: ../../library/stdtypes.rst:3058 +#: ../../library/stdtypes.rst:3065 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -4670,11 +4670,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3063 +#: ../../library/stdtypes.rst:3070 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3069 +#: ../../library/stdtypes.rst:3076 msgid "" "Return the lowest index in the data where the subsequence *sub* is found, " "such that *sub* is contained in the slice ``s[start:end]``. Optional " @@ -4682,14 +4682,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3079 +#: ../../library/stdtypes.rst:3086 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:3083 +#: ../../library/stdtypes.rst:3090 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -4697,13 +4697,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:3093 +#: ../../library/stdtypes.rst:3100 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:3106 +#: ../../library/stdtypes.rst:3113 msgid "" "Return a bytes or bytearray object which is the concatenation of the binary " "data sequences in *iterable*. A :exc:`TypeError` will be raised if there " @@ -4713,7 +4713,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:3117 +#: ../../library/stdtypes.rst:3124 msgid "" "This static method returns a translation table usable for :meth:`bytes." "translate` that will map each character in *from* into the character at the " @@ -4721,7 +4721,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:3128 +#: ../../library/stdtypes.rst:3135 msgid "" "Split the sequence at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4730,24 +4730,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:3135 ../../library/stdtypes.rst:3192 +#: ../../library/stdtypes.rst:3142 ../../library/stdtypes.rst:3199 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3141 +#: ../../library/stdtypes.rst:3148 msgid "" "Return a copy of the sequence with all occurrences of subsequence *old* " "replaced by *new*. If the optional argument *count* is given, only the " "first *count* occurrences are replaced." msgstr "" -#: ../../library/stdtypes.rst:3145 +#: ../../library/stdtypes.rst:3152 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3157 +#: ../../library/stdtypes.rst:3164 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -4755,13 +4755,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:3172 +#: ../../library/stdtypes.rst:3179 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3185 +#: ../../library/stdtypes.rst:3192 msgid "" "Split the sequence at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4770,7 +4770,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:3198 +#: ../../library/stdtypes.rst:3205 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -4778,11 +4778,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3203 +#: ../../library/stdtypes.rst:3210 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3209 +#: ../../library/stdtypes.rst:3216 msgid "" "Return a copy of the bytes or bytearray object where all bytes occurring in " "the optional argument *delete* are removed, and the remaining bytes have " @@ -4790,18 +4790,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3214 +#: ../../library/stdtypes.rst:3221 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3217 +#: ../../library/stdtypes.rst:3224 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3220 +#: ../../library/stdtypes.rst:3227 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -4809,11 +4809,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3223 +#: ../../library/stdtypes.rst:3230 msgid "*delete* is now supported as a keyword argument." msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3227 +#: ../../library/stdtypes.rst:3234 msgid "" "The following methods on bytes and bytearray objects have default behaviours " "that assume the use of ASCII compatible binary formats, but can still be " @@ -4822,7 +4822,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3236 +#: ../../library/stdtypes.rst:3243 msgid "" "Return a copy of the object centered in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4830,7 +4830,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3250 +#: ../../library/stdtypes.rst:3257 msgid "" "Return a copy of the object left justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4838,17 +4838,16 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3264 +#: ../../library/stdtypes.rst:3271 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " -"*chars* argument is a binary sequence specifying the set of byte values to " -"be removed - the name refers to the fact this method is usually used with " -"ASCII characters. If omitted or ``None``, the *chars* argument defaults to " -"removing ASCII whitespace. The *chars* argument is not a prefix; rather, " +"*bytes* argument is a binary sequence specifying the set of byte values to " +"be removed. If omitted or ``None``, the *bytes* argument defaults to " +"removing ASCII whitespace. The *bytes* argument is not a prefix; rather, " "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3271 +#: ../../library/stdtypes.rst:3277 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -4860,14 +4859,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3276 +#: ../../library/stdtypes.rst:3282 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removeprefix` for a method that will remove a " "single prefix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3281 +#: ../../library/stdtypes.rst:3287 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -4879,7 +4878,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3295 +#: ../../library/stdtypes.rst:3301 msgid "" "Return a copy of the object right justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4887,7 +4886,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3309 +#: ../../library/stdtypes.rst:3315 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are " @@ -4897,17 +4896,16 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3320 +#: ../../library/stdtypes.rst:3326 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " -"*chars* argument is a binary sequence specifying the set of byte values to " -"be removed - the name refers to the fact this method is usually used with " -"ASCII characters. If omitted or ``None``, the *chars* argument defaults to " -"removing ASCII whitespace. The *chars* argument is not a suffix; rather, " +"*bytes* argument is a binary sequence specifying the set of byte values to " +"be removed. If omitted or ``None``, the *bytes* argument defaults to " +"removing ASCII whitespace. The *bytes* argument is not a suffix; rather, " "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3327 +#: ../../library/stdtypes.rst:3332 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -4919,14 +4917,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3332 +#: ../../library/stdtypes.rst:3337 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removesuffix` for a method that will remove a " "single suffix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3337 +#: ../../library/stdtypes.rst:3342 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -4938,7 +4936,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3351 +#: ../../library/stdtypes.rst:3356 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given and non-negative, at most " @@ -4947,7 +4945,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3357 +#: ../../library/stdtypes.rst:3362 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " @@ -4958,7 +4956,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3367 +#: ../../library/stdtypes.rst:3372 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -4978,7 +4976,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3376 +#: ../../library/stdtypes.rst:3381 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive ASCII whitespace are regarded as a single " @@ -4988,7 +4986,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3386 +#: ../../library/stdtypes.rst:3391 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -5004,17 +5002,16 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3397 +#: ../../library/stdtypes.rst:3402 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " -"removed. The *chars* argument is a binary sequence specifying the set of " -"byte values to be removed - the name refers to the fact this method is " -"usually used with ASCII characters. If omitted or ``None``, the *chars* " -"argument defaults to removing ASCII whitespace. The *chars* argument is not " -"a prefix or suffix; rather, all combinations of its values are stripped::" +"removed. The *bytes* argument is a binary sequence specifying the set of " +"byte values to be removed. If omitted or ``None``, the *bytes* argument " +"defaults to removing ASCII whitespace. The *bytes* argument is not a prefix " +"or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3405 +#: ../../library/stdtypes.rst:3409 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -5026,13 +5023,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3410 +#: ../../library/stdtypes.rst:3414 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3419 +#: ../../library/stdtypes.rst:3423 msgid "" "The following methods on bytes and bytearray objects assume the use of ASCII " "compatible binary formats and should not be applied to arbitrary binary " @@ -5040,14 +5037,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3427 +#: ../../library/stdtypes.rst:3431 msgid "" "Return a copy of the sequence with each byte interpreted as an ASCII " "character, and the first byte capitalized and the rest lowercased. Non-ASCII " "byte values are passed through unchanged." msgstr "" -#: ../../library/stdtypes.rst:3440 +#: ../../library/stdtypes.rst:3444 msgid "" "Return a copy of the sequence where all ASCII tab characters are replaced by " "one or more ASCII spaces, depending on the current column and the given tab " @@ -5063,7 +5060,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3454 +#: ../../library/stdtypes.rst:3458 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -5075,7 +5072,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3468 +#: ../../library/stdtypes.rst:3472 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -5084,7 +5081,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3476 +#: ../../library/stdtypes.rst:3480 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -5096,7 +5093,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3485 +#: ../../library/stdtypes.rst:3489 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -5104,7 +5101,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3492 +#: ../../library/stdtypes.rst:3496 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -5116,20 +5113,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3501 +#: ../../library/stdtypes.rst:3505 msgid "" "Return ``True`` if the sequence is empty or all bytes in the sequence are " "ASCII, ``False`` otherwise. ASCII bytes are in the range 0-0x7F." msgstr "" -#: ../../library/stdtypes.rst:3511 +#: ../../library/stdtypes.rst:3515 msgid "" "Return ``True`` if all bytes in the sequence are ASCII decimal digits and " "the sequence is not empty, ``False`` otherwise. ASCII decimal digits are " "those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3517 +#: ../../library/stdtypes.rst:3521 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -5141,13 +5138,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3526 +#: ../../library/stdtypes.rst:3530 msgid "" "Return ``True`` if there is at least one lowercase ASCII character in the " "sequence and no uppercase ASCII characters, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:3531 +#: ../../library/stdtypes.rst:3535 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -5159,16 +5156,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3536 ../../library/stdtypes.rst:3578 -#: ../../library/stdtypes.rst:3594 ../../library/stdtypes.rst:3644 -#: ../../library/stdtypes.rst:3713 +#: ../../library/stdtypes.rst:3540 ../../library/stdtypes.rst:3582 +#: ../../library/stdtypes.rst:3598 ../../library/stdtypes.rst:3648 +#: ../../library/stdtypes.rst:3717 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3544 +#: ../../library/stdtypes.rst:3548 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -5176,14 +5173,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3553 +#: ../../library/stdtypes.rst:3557 msgid "" "Return ``True`` if the sequence is ASCII titlecase and the sequence is not " "empty, ``False`` otherwise. See :meth:`bytes.title` for more details on the " "definition of \"titlecase\"." msgstr "" -#: ../../library/stdtypes.rst:3559 +#: ../../library/stdtypes.rst:3563 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -5195,14 +5192,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3568 +#: ../../library/stdtypes.rst:3572 msgid "" "Return ``True`` if there is at least one uppercase alphabetic ASCII " "character in the sequence and no lowercase ASCII characters, ``False`` " "otherwise." msgstr "" -#: ../../library/stdtypes.rst:3573 +#: ../../library/stdtypes.rst:3577 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -5214,13 +5211,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3586 +#: ../../library/stdtypes.rst:3590 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3591 +#: ../../library/stdtypes.rst:3595 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -5228,7 +5225,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3611 +#: ../../library/stdtypes.rst:3615 msgid "" "Return a list of the lines in the binary sequence, breaking at ASCII line " "boundaries. This method uses the :term:`universal newlines` approach to " @@ -5236,7 +5233,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3618 +#: ../../library/stdtypes.rst:3622 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -5248,14 +5245,14 @@ msgstr "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: ../../library/stdtypes.rst:3623 +#: ../../library/stdtypes.rst:3627 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:3627 +#: ../../library/stdtypes.rst:3631 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -5267,13 +5264,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3636 +#: ../../library/stdtypes.rst:3640 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" -#: ../../library/stdtypes.rst:3641 +#: ../../library/stdtypes.rst:3645 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -5281,7 +5278,7 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3648 +#: ../../library/stdtypes.rst:3652 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -5289,14 +5286,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3662 +#: ../../library/stdtypes.rst:3666 msgid "" "Return a titlecased version of the binary sequence where words start with an " "uppercase ASCII character and the remaining characters are lowercase. " "Uncased byte values are left unmodified." msgstr "" -#: ../../library/stdtypes.rst:3668 +#: ../../library/stdtypes.rst:3672 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -5304,7 +5301,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3671 +#: ../../library/stdtypes.rst:3675 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -5312,7 +5309,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3681 +#: ../../library/stdtypes.rst:3685 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -5320,12 +5317,12 @@ msgstr "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:3684 +#: ../../library/stdtypes.rst:3688 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3686 +#: ../../library/stdtypes.rst:3690 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -5347,13 +5344,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:3705 +#: ../../library/stdtypes.rst:3709 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3710 +#: ../../library/stdtypes.rst:3714 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -5361,7 +5358,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:3726 +#: ../../library/stdtypes.rst:3730 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -5370,7 +5367,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3734 +#: ../../library/stdtypes.rst:3738 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5382,11 +5379,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:3748 +#: ../../library/stdtypes.rst:3752 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:3765 +#: ../../library/stdtypes.rst:3769 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -5394,7 +5391,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:3770 +#: ../../library/stdtypes.rst:3774 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -5404,7 +5401,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:3777 +#: ../../library/stdtypes.rst:3781 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -5412,7 +5409,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3811 +#: ../../library/stdtypes.rst:3815 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the bytes object *must* include a parenthesised mapping key into " @@ -5420,73 +5417,73 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3885 +#: ../../library/stdtypes.rst:3889 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:3888 +#: ../../library/stdtypes.rst:3892 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:3888 +#: ../../library/stdtypes.rst:3892 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:3892 +#: ../../library/stdtypes.rst:3896 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3895 +#: ../../library/stdtypes.rst:3899 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:3898 +#: ../../library/stdtypes.rst:3902 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3898 +#: ../../library/stdtypes.rst:3902 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:3933 +#: ../../library/stdtypes.rst:3937 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3936 +#: ../../library/stdtypes.rst:3940 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3948 +#: ../../library/stdtypes.rst:3952 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:3955 +#: ../../library/stdtypes.rst:3959 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:3957 +#: ../../library/stdtypes.rst:3961 msgid "" ":class:`memoryview` objects allow Python code to access the internal data of " "an object that supports the :ref:`buffer protocol ` without " "copying." msgstr "" -#: ../../library/stdtypes.rst:3963 +#: ../../library/stdtypes.rst:3967 msgid "" "Create a :class:`memoryview` that references *object*. *object* must " "support the buffer protocol. Built-in objects that support the buffer " "protocol include :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/stdtypes.rst:3967 +#: ../../library/stdtypes.rst:3971 msgid "" "A :class:`memoryview` has the notion of an *element*, which is the atomic " "memory unit handled by the originating *object*. For many simple types such " @@ -5494,32 +5491,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:3972 +#: ../../library/stdtypes.rst:3976 msgid "" "``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which " "is the nested list representation of the view. If ``view.ndim = 1``, this is " "equal to the number of elements in the view." msgstr "" -#: ../../library/stdtypes.rst:3976 +#: ../../library/stdtypes.rst:3980 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:3979 +#: ../../library/stdtypes.rst:3983 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:3982 +#: ../../library/stdtypes.rst:3986 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:3985 +#: ../../library/stdtypes.rst:3989 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -5541,7 +5538,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:3995 +#: ../../library/stdtypes.rst:3999 msgid "" "If :class:`~memoryview.format` is one of the native format specifiers from " "the :mod:`struct` module, indexing with an integer or a tuple of integers is " @@ -5552,11 +5549,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:4004 +#: ../../library/stdtypes.rst:4008 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:4006 +#: ../../library/stdtypes.rst:4010 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -5578,13 +5575,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:4016 +#: ../../library/stdtypes.rst:4020 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:4019 +#: ../../library/stdtypes.rst:4023 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -5624,14 +5621,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:4037 +#: ../../library/stdtypes.rst:4041 msgid "" "One-dimensional memoryviews of :term:`hashable` (read-only) types with " "formats 'B', 'b' or 'c' are also hashable. The hash is defined as ``hash(m) " "== hash(m.tobytes())``::" msgstr "" -#: ../../library/stdtypes.rst:4041 +#: ../../library/stdtypes.rst:4045 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -5649,40 +5646,40 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:4049 +#: ../../library/stdtypes.rst:4053 msgid "" "One-dimensional memoryviews can now be sliced. One-dimensional memoryviews " "with formats 'B', 'b' or 'c' are now :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4053 +#: ../../library/stdtypes.rst:4057 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:4057 +#: ../../library/stdtypes.rst:4061 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:4060 +#: ../../library/stdtypes.rst:4064 msgid ":class:`memoryview` has several methods:" msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:4064 +#: ../../library/stdtypes.rst:4068 msgid "" "A memoryview and a :pep:`3118` exporter are equal if their shapes are " "equivalent and if all corresponding values are equal when the operands' " "respective format codes are interpreted using :mod:`struct` syntax." msgstr "" -#: ../../library/stdtypes.rst:4068 +#: ../../library/stdtypes.rst:4072 msgid "" "For the subset of :mod:`struct` format strings currently supported by :meth:" "`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" msgstr "" -#: ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:4075 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -5716,14 +5713,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:4087 +#: ../../library/stdtypes.rst:4091 msgid "" "If either format string is not supported by the :mod:`struct` module, then " "the objects will always compare as unequal (even if the format strings and " "buffer contents are identical)::" msgstr "" -#: ../../library/stdtypes.rst:4091 +#: ../../library/stdtypes.rst:4095 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -5749,25 +5746,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:4103 +#: ../../library/stdtypes.rst:4107 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:4106 +#: ../../library/stdtypes.rst:4110 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:4112 +#: ../../library/stdtypes.rst:4116 msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" -#: ../../library/stdtypes.rst:4115 +#: ../../library/stdtypes.rst:4119 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -5781,7 +5778,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:4121 +#: ../../library/stdtypes.rst:4125 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -5789,7 +5786,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:4126 +#: ../../library/stdtypes.rst:4130 msgid "" "*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the " "original array is converted to C or Fortran order. For contiguous views, 'A' " @@ -5798,13 +5795,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:4135 +#: ../../library/stdtypes.rst:4140 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:4138 +#: ../../library/stdtypes.rst:4143 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -5814,18 +5811,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:4144 +#: ../../library/stdtypes.rst:4149 msgid "" "Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:4151 +#: ../../library/stdtypes.rst:4156 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:4153 +#: ../../library/stdtypes.rst:4158 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -5843,19 +5840,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:4161 +#: ../../library/stdtypes.rst:4166 msgid "" ":meth:`tolist` now supports all single character native formats in :mod:" "`struct` module syntax as well as multi-dimensional representations." msgstr "" -#: ../../library/stdtypes.rst:4168 +#: ../../library/stdtypes.rst:4173 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:4171 +#: ../../library/stdtypes.rst:4176 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -5881,7 +5878,7 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:4187 +#: ../../library/stdtypes.rst:4192 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " "objects take special actions when a view is held on them (for example, a :" @@ -5890,14 +5887,14 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:4193 +#: ../../library/stdtypes.rst:4198 msgid "" "After this method has been called, any further operation on the view raises " "a :class:`ValueError` (except :meth:`release` itself which can be called " "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:4197 +#: ../../library/stdtypes.rst:4202 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -5913,13 +5910,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4204 +#: ../../library/stdtypes.rst:4209 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4207 +#: ../../library/stdtypes.rst:4212 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -5939,7 +5936,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4220 +#: ../../library/stdtypes.rst:4226 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -5948,7 +5945,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4226 +#: ../../library/stdtypes.rst:4232 msgid "" "The destination format is restricted to a single element native format in :" "mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " @@ -5956,11 +5953,11 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4232 +#: ../../library/stdtypes.rst:4238 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4234 +#: ../../library/stdtypes.rst:4240 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -6004,11 +6001,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4255 +#: ../../library/stdtypes.rst:4261 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4257 +#: ../../library/stdtypes.rst:4263 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -6032,11 +6029,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4268 +#: ../../library/stdtypes.rst:4274 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4270 +#: ../../library/stdtypes.rst:4276 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -6086,11 +6083,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4294 +#: ../../library/stdtypes.rst:4300 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4296 +#: ../../library/stdtypes.rst:4302 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -6112,19 +6109,19 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4308 +#: ../../library/stdtypes.rst:4314 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4311 +#: ../../library/stdtypes.rst:4317 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4315 +#: ../../library/stdtypes.rst:4321 msgid "The underlying object of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4317 +#: ../../library/stdtypes.rst:4323 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -6136,14 +6133,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4326 +#: ../../library/stdtypes.rst:4332 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" -#: ../../library/stdtypes.rst:4330 +#: ../../library/stdtypes.rst:4336 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -6175,11 +6172,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4345 +#: ../../library/stdtypes.rst:4351 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4347 +#: ../../library/stdtypes.rst:4353 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -6203,11 +6200,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4362 +#: ../../library/stdtypes.rst:4368 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4366 +#: ../../library/stdtypes.rst:4372 msgid "" "A string containing the format (in :mod:`struct` module style) for each " "element in the view. A memoryview can be created from exporters with " @@ -6215,17 +6212,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4371 +#: ../../library/stdtypes.rst:4377 msgid "" "format ``'B'`` is now handled according to the struct module syntax. This " "means that ``memoryview(b'abc')[0] == b'abc'[0] == 97``." msgstr "" -#: ../../library/stdtypes.rst:4377 +#: ../../library/stdtypes.rst:4383 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4379 +#: ../../library/stdtypes.rst:4385 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -6245,49 +6242,49 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4390 +#: ../../library/stdtypes.rst:4396 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4395 +#: ../../library/stdtypes.rst:4401 msgid "" "A tuple of integers the length of :attr:`ndim` giving the shape of the " "memory as an N-dimensional array." msgstr "" -#: ../../library/stdtypes.rst:4398 ../../library/stdtypes.rst:4406 +#: ../../library/stdtypes.rst:4404 ../../library/stdtypes.rst:4412 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4403 +#: ../../library/stdtypes.rst:4409 msgid "" "A tuple of integers the length of :attr:`ndim` giving the size in bytes to " "access each element for each dimension of the array." msgstr "" -#: ../../library/stdtypes.rst:4411 +#: ../../library/stdtypes.rst:4417 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4415 +#: ../../library/stdtypes.rst:4421 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:4427 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4427 +#: ../../library/stdtypes.rst:4433 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4441 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4439 +#: ../../library/stdtypes.rst:4445 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -6297,7 +6294,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4446 +#: ../../library/stdtypes.rst:4452 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " @@ -6305,7 +6302,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4451 +#: ../../library/stdtypes.rst:4457 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -6317,18 +6314,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:4459 +#: ../../library/stdtypes.rst:4465 msgid "" "Non-empty sets (not frozensets) can be created by placing a comma-separated " "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" -#: ../../library/stdtypes.rst:4463 +#: ../../library/stdtypes.rst:4469 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4468 +#: ../../library/stdtypes.rst:4474 msgid "" "Return a new set or frozenset object whose elements are taken from " "*iterable*. The elements of a set must be :term:`hashable`. To represent " @@ -6336,92 +6333,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4474 +#: ../../library/stdtypes.rst:4480 msgid "Sets can be created by several means:" msgstr "集合可以以多種方式建立:" -#: ../../library/stdtypes.rst:4476 +#: ../../library/stdtypes.rst:4482 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4477 +#: ../../library/stdtypes.rst:4483 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4478 +#: ../../library/stdtypes.rst:4484 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4480 +#: ../../library/stdtypes.rst:4486 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4485 +#: ../../library/stdtypes.rst:4491 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4489 +#: ../../library/stdtypes.rst:4495 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4493 +#: ../../library/stdtypes.rst:4499 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4497 +#: ../../library/stdtypes.rst:4503 msgid "" "Return ``True`` if the set has no elements in common with *other*. Sets are " "disjoint if and only if their intersection is the empty set." msgstr "" -#: ../../library/stdtypes.rst:4503 +#: ../../library/stdtypes.rst:4509 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4507 +#: ../../library/stdtypes.rst:4513 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4513 +#: ../../library/stdtypes.rst:4519 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4517 +#: ../../library/stdtypes.rst:4523 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4523 +#: ../../library/stdtypes.rst:4529 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4528 +#: ../../library/stdtypes.rst:4534 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4533 +#: ../../library/stdtypes.rst:4539 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4538 +#: ../../library/stdtypes.rst:4544 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4542 +#: ../../library/stdtypes.rst:4548 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4545 +#: ../../library/stdtypes.rst:4551 msgid "" "Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" "meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" @@ -6431,7 +6428,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4552 +#: ../../library/stdtypes.rst:4558 msgid "" "Both :class:`set` and :class:`frozenset` support set to set comparisons. Two " "sets are equal if and only if every element of each set is contained in the " @@ -6441,14 +6438,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4559 +#: ../../library/stdtypes.rst:4565 msgid "" "Instances of :class:`set` are compared to instances of :class:`frozenset` " "based on their members. For example, ``set('abc') == frozenset('abc')`` " "returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``." msgstr "" -#: ../../library/stdtypes.rst:4563 +#: ../../library/stdtypes.rst:4569 msgid "" "The subset and equality comparisons do not generalize to a total ordering " "function. For example, any two nonempty disjoint sets are not equal and are " @@ -6456,71 +6453,71 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4568 +#: ../../library/stdtypes.rst:4574 msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" -#: ../../library/stdtypes.rst:4571 +#: ../../library/stdtypes.rst:4577 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4573 +#: ../../library/stdtypes.rst:4579 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" -#: ../../library/stdtypes.rst:4577 +#: ../../library/stdtypes.rst:4583 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4583 +#: ../../library/stdtypes.rst:4589 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4588 +#: ../../library/stdtypes.rst:4594 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4593 +#: ../../library/stdtypes.rst:4599 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4598 +#: ../../library/stdtypes.rst:4604 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4602 +#: ../../library/stdtypes.rst:4608 msgid "Add element *elem* to the set." msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:4606 +#: ../../library/stdtypes.rst:4612 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4611 +#: ../../library/stdtypes.rst:4617 msgid "Remove element *elem* from the set if it is present." msgstr "如果 *elem* 存在於集合中則將其移除。" -#: ../../library/stdtypes.rst:4615 +#: ../../library/stdtypes.rst:4621 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4620 +#: ../../library/stdtypes.rst:4626 msgid "Remove all elements from the set." msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:4623 +#: ../../library/stdtypes.rst:4629 msgid "" "Note, the non-operator versions of the :meth:`update`, :meth:" "`intersection_update`, :meth:`difference_update`, and :meth:" @@ -6528,18 +6525,18 @@ msgid "" "argument." msgstr "" -#: ../../library/stdtypes.rst:4628 +#: ../../library/stdtypes.rst:4634 msgid "" "Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" "`remove`, and :meth:`discard` methods may be a set. To support searching " "for an equivalent frozenset, a temporary one is created from *elem*." msgstr "" -#: ../../library/stdtypes.rst:4637 +#: ../../library/stdtypes.rst:4643 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4647 +#: ../../library/stdtypes.rst:4653 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -6548,7 +6545,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:4659 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -6557,33 +6554,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4664 +#: ../../library/stdtypes.rst:4670 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4667 +#: ../../library/stdtypes.rst:4673 msgid "Dictionaries can be created by several means:" msgstr "字典可以用數種方式建立:" -#: ../../library/stdtypes.rst:4669 +#: ../../library/stdtypes.rst:4675 msgid "" "Use a comma-separated list of ``key: value`` pairs within braces: ``{'jack': " "4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4671 +#: ../../library/stdtypes.rst:4677 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4672 +#: ../../library/stdtypes.rst:4678 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4675 +#: ../../library/stdtypes.rst:4681 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it defines a ``keys()`` method, a " @@ -6596,7 +6593,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4685 +#: ../../library/stdtypes.rst:4691 msgid "" "If keyword arguments are given, the keyword arguments and their values are " "added to the dictionary created from the positional argument. If a key " @@ -6604,13 +6601,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4690 ../../library/stdtypes.rst:4708 +#: ../../library/stdtypes.rst:4696 ../../library/stdtypes.rst:4714 msgid "" "Providing keyword arguments as in the first example only works for keys that " "are valid Python identifiers. Otherwise, any valid keys can be used." msgstr "" -#: ../../library/stdtypes.rst:4693 +#: ../../library/stdtypes.rst:4699 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " @@ -6619,7 +6616,7 @@ msgid "" "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4699 +#: ../../library/stdtypes.rst:4705 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -6639,13 +6636,13 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:4711 +#: ../../library/stdtypes.rst:4717 msgid "" "Dictionaries preserve insertion order. Note that updating a key does not " "affect the order. Keys added after deletion are inserted at the end. ::" msgstr "" -#: ../../library/stdtypes.rst:4714 +#: ../../library/stdtypes.rst:4720 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6677,33 +6674,33 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:4729 +#: ../../library/stdtypes.rst:4735 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4733 +#: ../../library/stdtypes.rst:4739 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:4738 +#: ../../library/stdtypes.rst:4744 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4742 +#: ../../library/stdtypes.rst:4748 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4746 +#: ../../library/stdtypes.rst:4752 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:4751 +#: ../../library/stdtypes.rst:4757 msgid "" "If a subclass of dict defines a method :meth:`__missing__` and *key* is not " "present, the ``d[key]`` operation calls that method with the key *key* as " @@ -6714,7 +6711,7 @@ msgid "" "an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:4759 +#: ../../library/stdtypes.rst:4765 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -6738,51 +6735,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:4770 +#: ../../library/stdtypes.rst:4776 msgid "" "The example above shows part of the implementation of :class:`collections." "Counter`. A different ``__missing__`` method is used by :class:`collections." "defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:4776 +#: ../../library/stdtypes.rst:4782 msgid "Set ``d[key]`` to *value*." msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:4780 +#: ../../library/stdtypes.rst:4786 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "從 *d* 中移除 ``d[key]``。若 *key* 不在對映中則引發 :exc:`KeyError`。" -#: ../../library/stdtypes.rst:4785 +#: ../../library/stdtypes.rst:4791 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:4789 +#: ../../library/stdtypes.rst:4795 msgid "Equivalent to ``not key in d``." msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:4793 +#: ../../library/stdtypes.rst:4799 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4798 +#: ../../library/stdtypes.rst:4804 msgid "Remove all items from the dictionary." msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:4802 +#: ../../library/stdtypes.rst:4808 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4806 +#: ../../library/stdtypes.rst:4812 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:4808 +#: ../../library/stdtypes.rst:4814 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -6791,70 +6788,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:4816 +#: ../../library/stdtypes.rst:4822 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4822 +#: ../../library/stdtypes.rst:4828 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4827 +#: ../../library/stdtypes.rst:4833 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:4832 +#: ../../library/stdtypes.rst:4839 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " "*default*. If *default* is not given and *key* is not in the dictionary, a :" "exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:4838 +#: ../../library/stdtypes.rst:4845 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -#: ../../library/stdtypes.rst:4841 +#: ../../library/stdtypes.rst:4848 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " "often used in set algorithms. If the dictionary is empty, calling :meth:" "`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4845 +#: ../../library/stdtypes.rst:4852 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:4851 +#: ../../library/stdtypes.rst:4858 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4858 +#: ../../library/stdtypes.rst:4865 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" -#: ../../library/stdtypes.rst:4864 +#: ../../library/stdtypes.rst:4873 msgid "" -"Update the dictionary with the key/value pairs from *other*, overwriting " -"existing keys. Return ``None``." +"Update the dictionary with the key/value pairs from *mapping* or *iterable* " +"and *kwargs*, overwriting existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:4867 +#: ../../library/stdtypes.rst:4876 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -6863,20 +6860,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4875 +#: ../../library/stdtypes.rst:4884 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4878 +#: ../../library/stdtypes.rst:4887 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:4882 +#: ../../library/stdtypes.rst:4891 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -6886,25 +6883,25 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:4888 +#: ../../library/stdtypes.rst:4897 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4896 +#: ../../library/stdtypes.rst:4905 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4902 +#: ../../library/stdtypes.rst:4911 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4904 +#: ../../library/stdtypes.rst:4913 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6926,21 +6923,21 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:4914 +#: ../../library/stdtypes.rst:4923 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4919 +#: ../../library/stdtypes.rst:4928 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4926 +#: ../../library/stdtypes.rst:4935 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4928 +#: ../../library/stdtypes.rst:4937 msgid "" "The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" "`dict.items` are *view objects*. They provide a dynamic view on the " @@ -6948,23 +6945,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4933 +#: ../../library/stdtypes.rst:4942 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4938 +#: ../../library/stdtypes.rst:4947 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4942 +#: ../../library/stdtypes.rst:4951 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4945 +#: ../../library/stdtypes.rst:4954 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -6972,39 +6969,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4950 +#: ../../library/stdtypes.rst:4959 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:4953 +#: ../../library/stdtypes.rst:4962 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4958 +#: ../../library/stdtypes.rst:4967 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:4963 +#: ../../library/stdtypes.rst:4972 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:4975 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4971 +#: ../../library/stdtypes.rst:4980 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4976 +#: ../../library/stdtypes.rst:4985 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -7018,11 +7015,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:4988 +#: ../../library/stdtypes.rst:4997 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:4990 +#: ../../library/stdtypes.rst:4999 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -7063,11 +7060,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:5032 +#: ../../library/stdtypes.rst:5041 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:5039 +#: ../../library/stdtypes.rst:5048 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -7078,7 +7075,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:5047 +#: ../../library/stdtypes.rst:5056 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -7089,7 +7086,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:5052 +#: ../../library/stdtypes.rst:5061 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -7098,7 +7095,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5065 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -7112,7 +7109,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:5066 +#: ../../library/stdtypes.rst:5075 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -7124,7 +7121,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:5071 +#: ../../library/stdtypes.rst:5080 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -7139,7 +7136,7 @@ msgstr "" "(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" "的任何例外。" -#: ../../library/stdtypes.rst:5078 +#: ../../library/stdtypes.rst:5087 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -7151,7 +7148,7 @@ msgstr "" "已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" "`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:5084 +#: ../../library/stdtypes.rst:5093 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -7163,7 +7160,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:5090 +#: ../../library/stdtypes.rst:5099 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -7178,7 +7175,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:5097 +#: ../../library/stdtypes.rst:5106 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -7190,7 +7187,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:5105 +#: ../../library/stdtypes.rst:5114 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -7198,7 +7195,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:5110 +#: ../../library/stdtypes.rst:5119 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -7206,11 +7203,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:5117 +#: ../../library/stdtypes.rst:5126 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:5123 +#: ../../library/stdtypes.rst:5132 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -7226,7 +7223,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:5133 +#: ../../library/stdtypes.rst:5142 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -7234,7 +7231,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:5136 +#: ../../library/stdtypes.rst:5145 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -7242,7 +7239,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:5139 +#: ../../library/stdtypes.rst:5148 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " @@ -7254,7 +7251,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:5145 +#: ../../library/stdtypes.rst:5154 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -7266,7 +7263,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:5151 +#: ../../library/stdtypes.rst:5160 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -7278,7 +7275,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:5157 +#: ../../library/stdtypes.rst:5166 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " "``y`` will also be an instance of ``re.Match``, but the return values of ``y." @@ -7291,7 +7288,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:5163 +#: ../../library/stdtypes.rst:5172 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -7300,7 +7297,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:5169 +#: ../../library/stdtypes.rst:5178 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -7310,7 +7307,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:5174 +#: ../../library/stdtypes.rst:5183 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -7318,7 +7315,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:5177 +#: ../../library/stdtypes.rst:5186 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -7329,7 +7326,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:5182 +#: ../../library/stdtypes.rst:5191 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -7337,7 +7334,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:5185 +#: ../../library/stdtypes.rst:5194 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -7345,7 +7342,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:5188 +#: ../../library/stdtypes.rst:5197 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -7357,7 +7354,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5193 +#: ../../library/stdtypes.rst:5202 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7369,7 +7366,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:5199 +#: ../../library/stdtypes.rst:5208 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7379,13 +7376,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:5203 +#: ../../library/stdtypes.rst:5212 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5206 +#: ../../library/stdtypes.rst:5215 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7403,13 +7400,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5214 +#: ../../library/stdtypes.rst:5223 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5216 +#: ../../library/stdtypes.rst:5225 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7423,7 +7420,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5222 +#: ../../library/stdtypes.rst:5231 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -7431,7 +7428,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5225 +#: ../../library/stdtypes.rst:5234 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7443,7 +7440,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5230 +#: ../../library/stdtypes.rst:5239 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -7453,7 +7450,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5234 +#: ../../library/stdtypes.rst:5243 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7465,253 +7462,253 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5241 +#: ../../library/stdtypes.rst:5250 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5243 +#: ../../library/stdtypes.rst:5252 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5246 +#: ../../library/stdtypes.rst:5255 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5247 +#: ../../library/stdtypes.rst:5256 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5248 +#: ../../library/stdtypes.rst:5257 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5249 +#: ../../library/stdtypes.rst:5258 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5250 +#: ../../library/stdtypes.rst:5259 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5251 +#: ../../library/stdtypes.rst:5260 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5252 +#: ../../library/stdtypes.rst:5261 msgid ":class:`asyncio.Future`" msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5253 +#: ../../library/stdtypes.rst:5262 msgid ":class:`asyncio.Task`" msgstr ":class:`asyncio.Task`" -#: ../../library/stdtypes.rst:5254 +#: ../../library/stdtypes.rst:5263 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5255 +#: ../../library/stdtypes.rst:5264 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5256 +#: ../../library/stdtypes.rst:5265 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5257 +#: ../../library/stdtypes.rst:5266 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5258 +#: ../../library/stdtypes.rst:5267 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5259 +#: ../../library/stdtypes.rst:5268 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5260 +#: ../../library/stdtypes.rst:5269 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5261 +#: ../../library/stdtypes.rst:5270 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5262 +#: ../../library/stdtypes.rst:5271 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5263 +#: ../../library/stdtypes.rst:5272 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5264 +#: ../../library/stdtypes.rst:5273 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5265 +#: ../../library/stdtypes.rst:5274 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5266 +#: ../../library/stdtypes.rst:5275 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5267 +#: ../../library/stdtypes.rst:5276 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5268 +#: ../../library/stdtypes.rst:5277 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5269 +#: ../../library/stdtypes.rst:5278 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5270 +#: ../../library/stdtypes.rst:5279 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5271 +#: ../../library/stdtypes.rst:5280 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5272 +#: ../../library/stdtypes.rst:5281 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5273 +#: ../../library/stdtypes.rst:5282 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5274 +#: ../../library/stdtypes.rst:5283 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5275 +#: ../../library/stdtypes.rst:5284 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5276 +#: ../../library/stdtypes.rst:5285 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5277 +#: ../../library/stdtypes.rst:5286 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5278 +#: ../../library/stdtypes.rst:5287 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5279 +#: ../../library/stdtypes.rst:5288 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5280 +#: ../../library/stdtypes.rst:5289 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5281 +#: ../../library/stdtypes.rst:5290 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5282 +#: ../../library/stdtypes.rst:5291 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5283 +#: ../../library/stdtypes.rst:5292 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5284 +#: ../../library/stdtypes.rst:5293 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5285 +#: ../../library/stdtypes.rst:5294 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5286 +#: ../../library/stdtypes.rst:5295 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5287 +#: ../../library/stdtypes.rst:5296 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5288 +#: ../../library/stdtypes.rst:5297 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5289 +#: ../../library/stdtypes.rst:5298 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5290 +#: ../../library/stdtypes.rst:5299 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5291 +#: ../../library/stdtypes.rst:5300 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5292 +#: ../../library/stdtypes.rst:5301 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5293 +#: ../../library/stdtypes.rst:5302 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5294 +#: ../../library/stdtypes.rst:5303 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5295 +#: ../../library/stdtypes.rst:5304 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5296 +#: ../../library/stdtypes.rst:5305 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5297 +#: ../../library/stdtypes.rst:5306 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5298 +#: ../../library/stdtypes.rst:5307 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5299 +#: ../../library/stdtypes.rst:5308 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5300 +#: ../../library/stdtypes.rst:5309 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5301 +#: ../../library/stdtypes.rst:5310 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5306 +#: ../../library/stdtypes.rst:5315 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5308 +#: ../../library/stdtypes.rst:5317 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5312 +#: ../../library/stdtypes.rst:5321 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5314 +#: ../../library/stdtypes.rst:5323 msgid "" ">>> list[int].__origin__\n" "" @@ -7719,7 +7716,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5320 +#: ../../library/stdtypes.rst:5329 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " @@ -7728,7 +7725,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5324 +#: ../../library/stdtypes.rst:5333 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -7736,7 +7733,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5330 +#: ../../library/stdtypes.rst:5339 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -7744,7 +7741,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5333 +#: ../../library/stdtypes.rst:5342 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -7758,7 +7755,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5341 +#: ../../library/stdtypes.rst:5350 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -7768,7 +7765,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5348 +#: ../../library/stdtypes.rst:5357 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -7776,19 +7773,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5356 +#: ../../library/stdtypes.rst:5365 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5357 +#: ../../library/stdtypes.rst:5366 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5359 +#: ../../library/stdtypes.rst:5368 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5360 +#: ../../library/stdtypes.rst:5369 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -7797,7 +7794,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5364 +#: ../../library/stdtypes.rst:5373 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -7805,18 +7802,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5374 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5374 +#: ../../library/stdtypes.rst:5383 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5380 +#: ../../library/stdtypes.rst:5389 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -7829,7 +7826,7 @@ msgstr "" "釋 (type annotation) `。與 :data:`typing.Union` 相比,聯合型別運" "算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5387 +#: ../../library/stdtypes.rst:5396 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " @@ -7840,7 +7837,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5392 +#: ../../library/stdtypes.rst:5401 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -7848,7 +7845,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5397 +#: ../../library/stdtypes.rst:5406 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -7861,58 +7858,58 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5405 +#: ../../library/stdtypes.rst:5414 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5407 +#: ../../library/stdtypes.rst:5416 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:5418 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5411 +#: ../../library/stdtypes.rst:5420 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5413 +#: ../../library/stdtypes.rst:5422 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5415 +#: ../../library/stdtypes.rst:5424 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5417 +#: ../../library/stdtypes.rst:5426 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:5428 msgid "It is compatible with :data:`typing.Union`::" msgstr "它與 :data:`typing.Union` 相容: ::" -#: ../../library/stdtypes.rst:5421 +#: ../../library/stdtypes.rst:5430 msgid "int | str == typing.Union[int, str]" msgstr "int | str == typing.Union[int, str]" -#: ../../library/stdtypes.rst:5423 +#: ../../library/stdtypes.rst:5432 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5425 +#: ../../library/stdtypes.rst:5434 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5430 +#: ../../library/stdtypes.rst:5439 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5433 +#: ../../library/stdtypes.rst:5442 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -7920,14 +7917,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5436 +#: ../../library/stdtypes.rst:5445 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5439 +#: ../../library/stdtypes.rst:5448 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -7937,7 +7934,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5446 +#: ../../library/stdtypes.rst:5455 msgid "" "The user-exposed type for the union object can be accessed from :data:`types." "UnionType` and used for :func:`isinstance` checks. An object cannot be " @@ -7946,7 +7943,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." "UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別來實例化: ::" -#: ../../library/stdtypes.rst:5450 +#: ../../library/stdtypes.rst:5459 msgid "" ">>> import types\n" ">>> isinstance(int | str, types.UnionType)\n" @@ -7964,7 +7961,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'types.UnionType' instances" -#: ../../library/stdtypes.rst:5459 +#: ../../library/stdtypes.rst:5468 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -7973,7 +7970,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5463 +#: ../../library/stdtypes.rst:5472 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -7999,25 +7996,25 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5479 +#: ../../library/stdtypes.rst:5488 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5487 +#: ../../library/stdtypes.rst:5496 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:5489 +#: ../../library/stdtypes.rst:5498 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5496 +#: ../../library/stdtypes.rst:5505 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5498 +#: ../../library/stdtypes.rst:5507 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " @@ -8028,7 +8025,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5505 +#: ../../library/stdtypes.rst:5514 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -8039,32 +8036,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5513 +#: ../../library/stdtypes.rst:5522 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5521 +#: ../../library/stdtypes.rst:5530 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:5523 +#: ../../library/stdtypes.rst:5532 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:5529 +#: ../../library/stdtypes.rst:5538 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5531 +#: ../../library/stdtypes.rst:5540 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5534 +#: ../../library/stdtypes.rst:5543 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -8072,15 +8069,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5538 +#: ../../library/stdtypes.rst:5547 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5544 +#: ../../library/stdtypes.rst:5553 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:5548 +#: ../../library/stdtypes.rst:5557 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -8088,7 +8085,7 @@ msgid "" "Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5553 +#: ../../library/stdtypes.rst:5562 msgid "" "If you access a method (a function defined in a class namespace) through an " "instance, you get a special object: a :dfn:`bound method` (also called :ref:" @@ -8101,7 +8098,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5564 +#: ../../library/stdtypes.rst:5573 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -8112,7 +8109,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5572 +#: ../../library/stdtypes.rst:5581 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -8140,15 +8137,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5587 +#: ../../library/stdtypes.rst:5596 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5595 +#: ../../library/stdtypes.rst:5604 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5601 +#: ../../library/stdtypes.rst:5610 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -8158,7 +8155,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5608 +#: ../../library/stdtypes.rst:5617 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -8167,21 +8164,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5615 +#: ../../library/stdtypes.rst:5624 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5618 +#: ../../library/stdtypes.rst:5627 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5624 +#: ../../library/stdtypes.rst:5633 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5630 +#: ../../library/stdtypes.rst:5639 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -8189,30 +8186,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5635 +#: ../../library/stdtypes.rst:5644 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5641 +#: ../../library/stdtypes.rst:5650 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5643 +#: ../../library/stdtypes.rst:5652 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5647 +#: ../../library/stdtypes.rst:5656 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5654 +#: ../../library/stdtypes.rst:5663 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:5656 +#: ../../library/stdtypes.rst:5665 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " "no special operations. There is exactly one ellipsis object, named :const:" @@ -8220,15 +8217,15 @@ msgid "" "`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5661 +#: ../../library/stdtypes.rst:5670 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5667 +#: ../../library/stdtypes.rst:5676 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5669 +#: ../../library/stdtypes.rst:5678 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " @@ -8236,64 +8233,64 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5674 +#: ../../library/stdtypes.rst:5683 msgid "It is written as :code:`NotImplemented`." msgstr "" -#: ../../library/stdtypes.rst:5680 +#: ../../library/stdtypes.rst:5689 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:5682 +#: ../../library/stdtypes.rst:5691 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5690 +#: ../../library/stdtypes.rst:5699 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5692 +#: ../../library/stdtypes.rst:5701 msgid "" "The implementation adds a few special read-only attributes to several object " "types, where they are relevant. Some of these are not reported by the :func:" "`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5699 +#: ../../library/stdtypes.rst:5708 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5705 +#: ../../library/stdtypes.rst:5714 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5713 +#: ../../library/stdtypes.rst:5722 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5718 +#: ../../library/stdtypes.rst:5727 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5723 +#: ../../library/stdtypes.rst:5732 msgid "" "The :ref:`type parameters ` of generic classes, functions, and :" "ref:`type aliases `. For classes and functions that are not " "generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:5733 +#: ../../library/stdtypes.rst:5742 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5735 +#: ../../library/stdtypes.rst:5744 msgid "" "CPython has a global limit for converting between :class:`int` and :class:" "`str` to mitigate denial of service attacks. This limit *only* applies to " @@ -8301,7 +8298,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5740 +#: ../../library/stdtypes.rst:5749 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -8311,24 +8308,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5747 +#: ../../library/stdtypes.rst:5756 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5749 +#: ../../library/stdtypes.rst:5758 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:5753 +#: ../../library/stdtypes.rst:5762 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5755 +#: ../../library/stdtypes.rst:5764 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8352,7 +8349,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:5775 +#: ../../library/stdtypes.rst:5784 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -8360,11 +8357,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5780 +#: ../../library/stdtypes.rst:5789 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5782 +#: ../../library/stdtypes.rst:5791 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8382,84 +8379,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:5795 +#: ../../library/stdtypes.rst:5804 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:5797 +#: ../../library/stdtypes.rst:5806 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5800 +#: ../../library/stdtypes.rst:5809 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:5801 +#: ../../library/stdtypes.rst:5810 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5802 +#: ../../library/stdtypes.rst:5811 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5803 +#: ../../library/stdtypes.rst:5812 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5804 +#: ../../library/stdtypes.rst:5813 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5807 +#: ../../library/stdtypes.rst:5816 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5809 +#: ../../library/stdtypes.rst:5818 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5810 +#: ../../library/stdtypes.rst:5819 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:5811 +#: ../../library/stdtypes.rst:5820 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:5812 +#: ../../library/stdtypes.rst:5821 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5813 +#: ../../library/stdtypes.rst:5822 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5814 +#: ../../library/stdtypes.rst:5823 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5817 +#: ../../library/stdtypes.rst:5826 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:5819 +#: ../../library/stdtypes.rst:5828 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:5822 +#: ../../library/stdtypes.rst:5831 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:5825 +#: ../../library/stdtypes.rst:5834 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8467,7 +8464,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:5827 +#: ../../library/stdtypes.rst:5836 msgid "" ":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" "`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " @@ -8476,38 +8473,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:5833 +#: ../../library/stdtypes.rst:5842 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5836 +#: ../../library/stdtypes.rst:5845 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:5840 +#: ../../library/stdtypes.rst:5849 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5842 +#: ../../library/stdtypes.rst:5851 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5844 +#: ../../library/stdtypes.rst:5853 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:5851 +#: ../../library/stdtypes.rst:5860 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -8519,7 +8516,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5860 +#: ../../library/stdtypes.rst:5869 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -8527,11 +8524,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5866 +#: ../../library/stdtypes.rst:5875 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:5868 +#: ../../library/stdtypes.rst:5877 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -8539,11 +8536,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5873 +#: ../../library/stdtypes.rst:5882 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5875 +#: ../../library/stdtypes.rst:5884 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -8565,38 +8562,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:5885 +#: ../../library/stdtypes.rst:5894 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5889 +#: ../../library/stdtypes.rst:5898 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:5890 +#: ../../library/stdtypes.rst:5899 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5893 +#: ../../library/stdtypes.rst:5902 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5896 +#: ../../library/stdtypes.rst:5905 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5898 +#: ../../library/stdtypes.rst:5907 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:5901 +#: ../../library/stdtypes.rst:5910 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -8609,13 +8606,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:316 #: ../../library/stdtypes.rst:393 ../../library/stdtypes.rst:950 #: ../../library/stdtypes.rst:1120 ../../library/stdtypes.rst:1142 -#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4639 -#: ../../library/stdtypes.rst:5626 +#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4645 +#: ../../library/stdtypes.rst:5635 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1157 -#: ../../library/stdtypes.rst:4639 +#: ../../library/stdtypes.rst:4645 msgid "statement" msgstr "statement(陳述式)" @@ -8737,11 +8734,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1142 ../../library/stdtypes.rst:1267 #: ../../library/stdtypes.rst:1346 ../../library/stdtypes.rst:1390 #: ../../library/stdtypes.rst:1511 ../../library/stdtypes.rst:1547 -#: ../../library/stdtypes.rst:2730 ../../library/stdtypes.rst:2749 -#: ../../library/stdtypes.rst:2856 ../../library/stdtypes.rst:4437 -#: ../../library/stdtypes.rst:4639 ../../library/stdtypes.rst:5119 -#: ../../library/stdtypes.rst:5376 ../../library/stdtypes.rst:5546 -#: ../../library/stdtypes.rst:5590 +#: ../../library/stdtypes.rst:2733 ../../library/stdtypes.rst:2752 +#: ../../library/stdtypes.rst:2861 ../../library/stdtypes.rst:4443 +#: ../../library/stdtypes.rst:4645 ../../library/stdtypes.rst:5128 +#: ../../library/stdtypes.rst:5385 ../../library/stdtypes.rst:5555 +#: ../../library/stdtypes.rst:5599 msgid "object" msgstr "object(物件)" @@ -8833,9 +8830,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:950 -#: ../../library/stdtypes.rst:1120 ../../library/stdtypes.rst:4639 -#: ../../library/stdtypes.rst:5597 ../../library/stdtypes.rst:5611 -#: ../../library/stdtypes.rst:5626 +#: ../../library/stdtypes.rst:1120 ../../library/stdtypes.rst:4645 +#: ../../library/stdtypes.rst:5606 ../../library/stdtypes.rst:5620 +#: ../../library/stdtypes.rst:5635 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -8851,8 +8848,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2606 -#: ../../library/stdtypes.rst:3825 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2609 +#: ../../library/stdtypes.rst:3829 msgid "+ (plus)" msgstr "+ (加號)" @@ -8864,13 +8861,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2606 -#: ../../library/stdtypes.rst:3825 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2609 +#: ../../library/stdtypes.rst:3829 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2563 -#: ../../library/stdtypes.rst:3782 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2566 +#: ../../library/stdtypes.rst:3786 msgid "* (asterisk)" msgstr "* (星號)" @@ -8882,8 +8879,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2527 -#: ../../library/stdtypes.rst:3750 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2530 +#: ../../library/stdtypes.rst:3754 msgid "% (percent)" msgstr "% (百分號)" @@ -8893,7 +8890,7 @@ msgstr "**" #: ../../library/stdtypes.rst:316 ../../library/stdtypes.rst:393 #: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1157 -#: ../../library/stdtypes.rst:4639 +#: ../../library/stdtypes.rst:4645 msgid "operations on" msgstr "operations on(操作於)" @@ -8901,8 +8898,8 @@ msgstr "operations on(操作於)" msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" -#: ../../library/stdtypes.rst:335 ../../library/stdtypes.rst:1613 -#: ../../library/stdtypes.rst:2730 ../../library/stdtypes.rst:5626 +#: ../../library/stdtypes.rst:335 ../../library/stdtypes.rst:1615 +#: ../../library/stdtypes.rst:2733 ../../library/stdtypes.rst:5635 msgid "module" msgstr "模組" @@ -8970,7 +8967,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:5034 +#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:5043 msgid "protocol" msgstr "protocol(協定)" @@ -8996,7 +8993,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4639 +#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4645 msgid "len" msgstr "len" @@ -9073,14 +9070,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1142 ../../library/stdtypes.rst:2730 -#: ../../library/stdtypes.rst:2856 ../../library/stdtypes.rst:2928 -#: ../../library/stdtypes.rst:3750 +#: ../../library/stdtypes.rst:1142 ../../library/stdtypes.rst:2733 +#: ../../library/stdtypes.rst:2861 ../../library/stdtypes.rst:2935 +#: ../../library/stdtypes.rst:3754 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4639 -#: ../../library/stdtypes.rst:5376 ../../library/stdtypes.rst:5626 +#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4645 +#: ../../library/stdtypes.rst:5385 ../../library/stdtypes.rst:5635 msgid "type" msgstr "type(型別)" @@ -9088,7 +9085,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4639 +#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4645 msgid "del" msgstr "del" @@ -9129,8 +9126,8 @@ msgid "range" msgstr "range" #: ../../library/stdtypes.rst:1511 ../../library/stdtypes.rst:1560 -#: ../../library/stdtypes.rst:1605 ../../library/stdtypes.rst:2381 -#: ../../library/stdtypes.rst:2527 +#: ../../library/stdtypes.rst:1607 ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2530 msgid "string" msgstr "string(字串)" @@ -9139,7 +9136,7 @@ msgid "text sequence type" msgstr "text sequence type(文字序列型別)" #: ../../library/stdtypes.rst:1511 ../../library/stdtypes.rst:1560 -#: ../../library/stdtypes.rst:1578 +#: ../../library/stdtypes.rst:1580 msgid "str (built-in class)" msgstr "str(內建類別)" @@ -9151,258 +9148,258 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1578 ../../library/stdtypes.rst:2722 +#: ../../library/stdtypes.rst:1580 ../../library/stdtypes.rst:2725 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1578 ../../library/stdtypes.rst:2730 -#: ../../library/stdtypes.rst:2749 ../../library/stdtypes.rst:2928 -#: ../../library/stdtypes.rst:3750 +#: ../../library/stdtypes.rst:1580 ../../library/stdtypes.rst:2733 +#: ../../library/stdtypes.rst:2752 ../../library/stdtypes.rst:2935 +#: ../../library/stdtypes.rst:3754 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1605 ../../library/stdtypes.rst:2928 +#: ../../library/stdtypes.rst:1607 ../../library/stdtypes.rst:2935 msgid "methods" msgstr "methods(方法)" -#: ../../library/stdtypes.rst:1613 +#: ../../library/stdtypes.rst:1615 msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2195 ../../library/stdtypes.rst:3604 +#: ../../library/stdtypes.rst:2198 ../../library/stdtypes.rst:3608 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2195 +#: ../../library/stdtypes.rst:2198 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid "! formatted string literal" msgstr "! formatted string literals(! 格式化字串常數)" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid "formatted string literals" msgstr "formatted string literals(格式化字串常數)" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid "! f-string" msgstr "! f-string(! f 字串)" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid "! (exclamation mark)" msgstr "! (驚嘆號)" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid "= (equals)" msgstr "= (等號)" -#: ../../library/stdtypes.rst:2381 +#: ../../library/stdtypes.rst:2384 msgid "for help in debugging using string literals" msgstr "" -#: ../../library/stdtypes.rst:2527 +#: ../../library/stdtypes.rst:2530 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2527 +#: ../../library/stdtypes.rst:2530 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2527 +#: ../../library/stdtypes.rst:2530 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2527 +#: ../../library/stdtypes.rst:2530 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2527 ../../library/stdtypes.rst:3750 +#: ../../library/stdtypes.rst:2530 ../../library/stdtypes.rst:3754 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2527 ../../library/stdtypes.rst:3750 +#: ../../library/stdtypes.rst:2530 ../../library/stdtypes.rst:3754 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2563 ../../library/stdtypes.rst:3782 +#: ../../library/stdtypes.rst:2566 ../../library/stdtypes.rst:3786 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2563 ../../library/stdtypes.rst:2606 -#: ../../library/stdtypes.rst:3782 ../../library/stdtypes.rst:3825 +#: ../../library/stdtypes.rst:2566 ../../library/stdtypes.rst:2609 +#: ../../library/stdtypes.rst:3786 ../../library/stdtypes.rst:3829 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2563 ../../library/stdtypes.rst:3782 +#: ../../library/stdtypes.rst:2566 ../../library/stdtypes.rst:3786 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2606 ../../library/stdtypes.rst:3825 +#: ../../library/stdtypes.rst:2609 ../../library/stdtypes.rst:3829 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2606 ../../library/stdtypes.rst:3825 +#: ../../library/stdtypes.rst:2609 ../../library/stdtypes.rst:3829 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2722 +#: ../../library/stdtypes.rst:2725 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2730 +#: ../../library/stdtypes.rst:2733 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2730 +#: ../../library/stdtypes.rst:2733 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3604 +#: ../../library/stdtypes.rst:3608 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3604 +#: ../../library/stdtypes.rst:3608 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:3750 +#: ../../library/stdtypes.rst:3754 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:3750 +#: ../../library/stdtypes.rst:3754 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:3750 +#: ../../library/stdtypes.rst:3754 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:3750 +#: ../../library/stdtypes.rst:3754 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4437 +#: ../../library/stdtypes.rst:4443 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4639 +#: ../../library/stdtypes.rst:4645 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4639 +#: ../../library/stdtypes.rst:4645 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:4749 +#: ../../library/stdtypes.rst:4755 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:5034 +#: ../../library/stdtypes.rst:5043 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:5034 +#: ../../library/stdtypes.rst:5043 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:5034 +#: ../../library/stdtypes.rst:5043 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:5107 +#: ../../library/stdtypes.rst:5116 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:5107 +#: ../../library/stdtypes.rst:5116 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:5119 +#: ../../library/stdtypes.rst:5128 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:5119 +#: ../../library/stdtypes.rst:5128 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:5119 +#: ../../library/stdtypes.rst:5128 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5376 +#: ../../library/stdtypes.rst:5385 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5376 +#: ../../library/stdtypes.rst:5385 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5546 +#: ../../library/stdtypes.rst:5555 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5590 +#: ../../library/stdtypes.rst:5599 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5590 +#: ../../library/stdtypes.rst:5599 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5597 +#: ../../library/stdtypes.rst:5606 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5597 +#: ../../library/stdtypes.rst:5606 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5611 +#: ../../library/stdtypes.rst:5620 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5611 +#: ../../library/stdtypes.rst:5620 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5650 +#: ../../library/stdtypes.rst:5659 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5650 +#: ../../library/stdtypes.rst:5659 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" From 769201fdc2d03b673ca56f0926f0aa91d07302d3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 27 Aug 2025 00:16:58 +0000 Subject: [PATCH 5/6] sync with cpython 238a1ca7 --- c-api/init.po | 56 ++++++++++++--------- extending/extending.po | 109 ++++++++++++++++++++++------------------- glossary.po | 10 ++-- 3 files changed, 97 insertions(+), 78 deletions(-) diff --git a/c-api/init.po b/c-api/init.po index d6bebdf113..cc5d9d5c5f 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-18 00:18+0000\n" +"POT-Creation-Date: 2025-08-27 00:15+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2874,23 +2874,33 @@ msgstr "" #: ../../c-api/init.rst:2399 msgid "" -"Critical sections avoid deadlocks by implicitly suspending active critical " -"sections and releasing the locks during calls to :c:func:" -"`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is called, the most " -"recent critical section is resumed, and its locks reacquired. This means " -"the critical section API provides weaker guarantees than traditional locks " -"-- they are useful because their behavior is similar to the :term:`GIL`." +"Critical sections are intended to be used for custom types implemented in C-" +"API extensions. They should generally not be used with built-in types like :" +"class:`list` and :class:`dict` because their public C-APIs already use " +"critical sections internally, with the notable exception of :c:func:" +"`PyDict_Next`, which requires critical section to be acquired externally." msgstr "" #: ../../c-api/init.rst:2406 msgid "" +"Critical sections avoid deadlocks by implicitly suspending active critical " +"sections, hence, they do not provide exclusive access such as provided by " +"traditional locks like :c:type:`PyMutex`. When a critical section is " +"started, the per-object lock for the object is acquired. If the code " +"executed inside the critical section calls C-API functions then it can " +"suspend the critical section thereby releasing the per-object lock, so other " +"threads can acquire the per-object lock for the same object." +msgstr "" + +#: ../../c-api/init.rst:2414 +msgid "" "The functions and structs used by the macros are exposed for cases where C " "macros are not available. They should only be used as in the given macro " "expansions. Note that the sizes and contents of the structures may change in " "future Python versions." msgstr "" -#: ../../c-api/init.rst:2413 +#: ../../c-api/init.rst:2421 msgid "" "Operations that need to lock two objects at once must use :c:macro:" "`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " @@ -2899,11 +2909,11 @@ msgid "" "lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2419 +#: ../../c-api/init.rst:2427 msgid "Example usage::" msgstr "範例用法: ::" -#: ../../c-api/init.rst:2421 +#: ../../c-api/init.rst:2429 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -2923,7 +2933,7 @@ msgstr "" " Py_RETURN_NONE;\n" "}" -#: ../../c-api/init.rst:2430 +#: ../../c-api/init.rst:2438 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " @@ -2933,18 +2943,18 @@ msgid "" "`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2438 +#: ../../c-api/init.rst:2446 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2441 ../../c-api/init.rst:2455 -#: ../../c-api/init.rst:2470 ../../c-api/init.rst:2484 +#: ../../c-api/init.rst:2449 ../../c-api/init.rst:2463 +#: ../../c-api/init.rst:2478 ../../c-api/init.rst:2492 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2443 +#: ../../c-api/init.rst:2451 msgid "" "{\n" " PyCriticalSection _py_cs;\n" @@ -2954,15 +2964,15 @@ msgstr "" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" -#: ../../c-api/init.rst:2447 ../../c-api/init.rst:2476 +#: ../../c-api/init.rst:2455 ../../c-api/init.rst:2484 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2453 +#: ../../c-api/init.rst:2461 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2457 +#: ../../c-api/init.rst:2465 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" @@ -2970,18 +2980,18 @@ msgstr "" " PyCriticalSection_End(&_py_cs);\n" "}" -#: ../../c-api/init.rst:2460 ../../c-api/init.rst:2489 +#: ../../c-api/init.rst:2468 ../../c-api/init.rst:2497 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2466 +#: ../../c-api/init.rst:2474 msgid "" "Acquires the per-objects locks for the objects *a* and *b* and begins a " "critical section. The locks are acquired in a consistent order (lowest " "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2472 +#: ../../c-api/init.rst:2480 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" @@ -2991,11 +3001,11 @@ msgstr "" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" -#: ../../c-api/init.rst:2482 +#: ../../c-api/init.rst:2490 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2486 +#: ../../c-api/init.rst:2494 msgid "" " PyCriticalSection2_End(&_py_cs2);\n" "}" diff --git a/extending/extending.po b/extending/extending.po index 81aee7cf27..ec20dea8d4 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-09 00:16+0000\n" +"POT-Creation-Date: 2025-08-27 00:15+0000\n" "PO-Revision-Date: 2025-02-17 14:34+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1791,10 +1791,17 @@ msgid "" "of the original item 1. Now let's suppose the original item 1 was an " "instance of a user-defined class, and let's further suppose that the class " "defined a :meth:`!__del__` method. If this class instance has a reference " -"count of 1, disposing of it will call its :meth:`!__del__` method." +"count of 1, disposing of it will call its :meth:`!__del__` method. " +"Internally, :c:func:`PyList_SetItem` calls :c:func:`Py_DECREF` on the " +"replaced item, which invokes replaced item's corresponding :c:member:" +"`~PyTypeObject.tp_dealloc` function. During deallocation, :c:member:" +"`~PyTypeObject.tp_dealloc` calls :c:member:`~PyTypeObject.tp_finalize`, " +"which is mapped to the :meth:`!__del__` method for class instances (see :pep:" +"`442`). This entire sequence happens synchronously within the :c:func:" +"`PyList_SetItem` call." msgstr "" -#: ../../extending/extending.rst:1089 +#: ../../extending/extending.rst:1096 msgid "" "Since it is written in Python, the :meth:`!__del__` method can execute " "arbitrary Python code. Could it perhaps do something to invalidate the " @@ -1805,13 +1812,13 @@ msgid "" "associated with it, thereby invalidating ``item``." msgstr "" -#: ../../extending/extending.rst:1097 +#: ../../extending/extending.rst:1104 msgid "" "The solution, once you know the source of the problem, is easy: temporarily " "increment the reference count. The correct version of the function reads::" msgstr "" -#: ../../extending/extending.rst:1100 +#: ../../extending/extending.rst:1107 msgid "" "void\n" "no_bug(PyObject *list)\n" @@ -1835,14 +1842,14 @@ msgstr "" " Py_DECREF(item);\n" "}" -#: ../../extending/extending.rst:1111 +#: ../../extending/extending.rst:1118 msgid "" "This is a true story. An older version of Python contained variants of this " "bug and someone spent a considerable amount of time in a C debugger to " "figure out why his :meth:`!__del__` methods would fail..." msgstr "" -#: ../../extending/extending.rst:1115 +#: ../../extending/extending.rst:1122 msgid "" "The second case of problems with a borrowed reference is a variant involving " "threads. Normally, multiple threads in the Python interpreter can't get in " @@ -1855,7 +1862,7 @@ msgid "" "Obviously, the following function has the same problem as the previous one::" msgstr "" -#: ../../extending/extending.rst:1125 +#: ../../extending/extending.rst:1132 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1868,11 +1875,11 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1139 +#: ../../extending/extending.rst:1146 msgid "NULL Pointers" msgstr "NULL 指標" -#: ../../extending/extending.rst:1141 +#: ../../extending/extending.rst:1148 msgid "" "In general, functions that take object references as arguments do not expect " "you to pass them ``NULL`` pointers, and will dump core (or cause later core " @@ -1884,21 +1891,21 @@ msgid "" "more slowly." msgstr "" -#: ../../extending/extending.rst:1149 +#: ../../extending/extending.rst:1156 msgid "" "It is better to test for ``NULL`` only at the \"source:\" when a pointer " "that may be ``NULL`` is received, for example, from :c:func:`malloc` or from " "a function that may raise an exception." msgstr "" -#: ../../extending/extending.rst:1153 +#: ../../extending/extending.rst:1160 msgid "" "The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " "``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and :c:" "func:`Py_XDECREF` do." msgstr "" -#: ../../extending/extending.rst:1157 +#: ../../extending/extending.rst:1164 msgid "" "The macros for checking for a particular object type (``Pytype_Check()``) " "don't check for ``NULL`` pointers --- again, there is much code that calls " @@ -1907,24 +1914,24 @@ msgid "" "variants with ``NULL`` checking." msgstr "" -#: ../../extending/extending.rst:1163 +#: ../../extending/extending.rst:1170 msgid "" "The C function calling mechanism guarantees that the argument list passed to " "C functions (``args`` in the examples) is never ``NULL`` --- in fact it " "guarantees that it is always a tuple [#]_." msgstr "" -#: ../../extending/extending.rst:1167 +#: ../../extending/extending.rst:1174 msgid "" "It is a severe error to ever let a ``NULL`` pointer \"escape\" to the Python " "user." msgstr "" -#: ../../extending/extending.rst:1178 +#: ../../extending/extending.rst:1185 msgid "Writing Extensions in C++" msgstr "" -#: ../../extending/extending.rst:1180 +#: ../../extending/extending.rst:1187 msgid "" "It is possible to write extension modules in C++. Some restrictions apply. " "If the main program (the Python interpreter) is compiled and linked by the C " @@ -1937,11 +1944,11 @@ msgid "" "(all recent C++ compilers define this symbol)." msgstr "" -#: ../../extending/extending.rst:1194 +#: ../../extending/extending.rst:1201 msgid "Providing a C API for an Extension Module" msgstr "" -#: ../../extending/extending.rst:1199 +#: ../../extending/extending.rst:1206 msgid "" "Many extension modules just provide new functions and types to be used from " "Python, but sometimes the code in an extension module can be useful for " @@ -1952,7 +1959,7 @@ msgid "" "functions for direct manipulation from other extension modules." msgstr "" -#: ../../extending/extending.rst:1207 +#: ../../extending/extending.rst:1214 msgid "" "At first sight this seems easy: just write the functions (without declaring " "them ``static``, of course), provide an appropriate header file, and " @@ -1968,7 +1975,7 @@ msgid "" "call might not have been loaded yet!" msgstr "" -#: ../../extending/extending.rst:1219 +#: ../../extending/extending.rst:1226 msgid "" "Portability therefore requires not to make any assumptions about symbol " "visibility. This means that all symbols in extension modules should be " @@ -1978,7 +1985,7 @@ msgid "" "accessible from other extension modules must be exported in a different way." msgstr "" -#: ../../extending/extending.rst:1226 +#: ../../extending/extending.rst:1233 msgid "" "Python provides a special mechanism to pass C-level information (pointers) " "from one extension module to another one: Capsules. A Capsule is a Python " @@ -1990,7 +1997,7 @@ msgid "" "the Capsule." msgstr "" -#: ../../extending/extending.rst:1234 +#: ../../extending/extending.rst:1241 msgid "" "There are many ways in which Capsules can be used to export the C API of an " "extension module. Each function could get its own Capsule, or all C API " @@ -2000,7 +2007,7 @@ msgid "" "client modules." msgstr "" -#: ../../extending/extending.rst:1240 +#: ../../extending/extending.rst:1247 msgid "" "Whichever method you choose, it's important to name your Capsules properly. " "The function :c:func:`PyCapsule_New` takes a name parameter (:c:expr:`const " @@ -2010,17 +2017,17 @@ msgid "" "from another." msgstr "" -#: ../../extending/extending.rst:1247 +#: ../../extending/extending.rst:1254 msgid "" "In particular, Capsules used to expose C APIs should be given a name " "following this convention::" msgstr "" -#: ../../extending/extending.rst:1250 +#: ../../extending/extending.rst:1257 msgid "modulename.attributename" msgstr "modulename.attributename" -#: ../../extending/extending.rst:1252 +#: ../../extending/extending.rst:1259 msgid "" "The convenience function :c:func:`PyCapsule_Import` makes it easy to load a " "C API provided via a Capsule, but only if the Capsule's name matches this " @@ -2028,7 +2035,7 @@ msgid "" "the Capsule they load contains the correct C API." msgstr "" -#: ../../extending/extending.rst:1257 +#: ../../extending/extending.rst:1264 msgid "" "The following example demonstrates an approach that puts most of the burden " "on the writer of the exporting module, which is appropriate for commonly " @@ -2039,7 +2046,7 @@ msgid "" "modules only have to call this macro before accessing the C API." msgstr "" -#: ../../extending/extending.rst:1265 +#: ../../extending/extending.rst:1272 msgid "" "The exporting module is a modification of the :mod:`!spam` module from " "section :ref:`extending-simpleexample`. The function :func:`!spam.system` " @@ -2050,13 +2057,13 @@ msgid "" "modules." msgstr "" -#: ../../extending/extending.rst:1272 +#: ../../extending/extending.rst:1279 msgid "" "The function :c:func:`!PySpam_System` is a plain C function, declared " "``static`` like everything else::" msgstr "" -#: ../../extending/extending.rst:1275 +#: ../../extending/extending.rst:1282 msgid "" "static int\n" "PySpam_System(const char *command)\n" @@ -2070,11 +2077,11 @@ msgstr "" " return system(command);\n" "}" -#: ../../extending/extending.rst:1281 +#: ../../extending/extending.rst:1288 msgid "The function :c:func:`!spam_system` is modified in a trivial way::" msgstr "" -#: ../../extending/extending.rst:1283 +#: ../../extending/extending.rst:1290 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -2100,19 +2107,19 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:1295 +#: ../../extending/extending.rst:1302 msgid "In the beginning of the module, right after the line ::" msgstr "" -#: ../../extending/extending.rst:1297 +#: ../../extending/extending.rst:1304 msgid "#include " msgstr "#include " -#: ../../extending/extending.rst:1299 +#: ../../extending/extending.rst:1306 msgid "two more lines must be added::" msgstr "" -#: ../../extending/extending.rst:1301 +#: ../../extending/extending.rst:1308 msgid "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" @@ -2120,7 +2127,7 @@ msgstr "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" -#: ../../extending/extending.rst:1304 +#: ../../extending/extending.rst:1311 msgid "" "The ``#define`` is used to tell the header file that it is being included in " "the exporting module, not a client module. Finally, the module's :c:data:" @@ -2128,7 +2135,7 @@ msgid "" "pointer array::" msgstr "" -#: ../../extending/extending.rst:1308 +#: ../../extending/extending.rst:1315 msgid "" "static int\n" "spam_module_exec(PyObject *m)\n" @@ -2151,19 +2158,19 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1327 +#: ../../extending/extending.rst:1334 msgid "" "Note that ``PySpam_API`` is declared ``static``; otherwise the pointer array " "would disappear when :c:func:`!PyInit_spam` terminates!" msgstr "" -#: ../../extending/extending.rst:1330 +#: ../../extending/extending.rst:1337 msgid "" "The bulk of the work is in the header file :file:`spammodule.h`, which looks " "like this::" msgstr "" -#: ../../extending/extending.rst:1333 +#: ../../extending/extending.rst:1340 msgid "" "#ifndef Py_SPAMMODULE_H\n" "#define Py_SPAMMODULE_H\n" @@ -2215,14 +2222,14 @@ msgid "" "#endif /* !defined(Py_SPAMMODULE_H) */" msgstr "" -#: ../../extending/extending.rst:1381 +#: ../../extending/extending.rst:1388 msgid "" "All that a client module must do in order to have access to the function :c:" "func:`!PySpam_System` is to call the function (or rather macro) :c:func:`!" "import_spam` in its :c:data:`mod_exec ` function::" msgstr "" -#: ../../extending/extending.rst:1385 +#: ../../extending/extending.rst:1392 msgid "" "static int\n" "client_module_exec(PyObject *m)\n" @@ -2235,14 +2242,14 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1395 +#: ../../extending/extending.rst:1402 msgid "" "The main disadvantage of this approach is that the file :file:`spammodule.h` " "is rather complicated. However, the basic structure is the same for each " "function that is exported, so it has to be learned only once." msgstr "" -#: ../../extending/extending.rst:1399 +#: ../../extending/extending.rst:1406 msgid "" "Finally it should be mentioned that Capsules offer additional functionality, " "which is especially useful for memory allocation and deallocation of the " @@ -2252,30 +2259,30 @@ msgid "" "in the Python source code distribution)." msgstr "" -#: ../../extending/extending.rst:1407 +#: ../../extending/extending.rst:1414 msgid "Footnotes" msgstr "註腳" -#: ../../extending/extending.rst:1408 +#: ../../extending/extending.rst:1415 msgid "" "An interface for this function already exists in the standard module :mod:" "`os` --- it was chosen as a simple and straightforward example." msgstr "" -#: ../../extending/extending.rst:1411 +#: ../../extending/extending.rst:1418 msgid "" "The metaphor of \"borrowing\" a reference is not completely correct: the " "owner still has a copy of the reference." msgstr "" -#: ../../extending/extending.rst:1414 +#: ../../extending/extending.rst:1421 msgid "" "Checking that the reference count is at least 1 **does not work** --- the " "reference count itself could be in freed memory and may thus be reused for " "another object!" msgstr "" -#: ../../extending/extending.rst:1418 +#: ../../extending/extending.rst:1425 msgid "" "These guarantees don't hold when you use the \"old\" style calling " "convention --- this is still found in much existing code." diff --git a/glossary.po b/glossary.po index fa1699332a..b4ad9b3e53 100644 --- a/glossary.po +++ b/glossary.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-06 00:17+0000\n" +"POT-Creation-Date: 2025-08-27 00:15+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -242,7 +242,8 @@ msgid "asynchronous generator iterator" msgstr "asynchronous generator iterator(非同步產生器疊代器)" #: ../../glossary.rst:105 -msgid "An object created by a :term:`asynchronous generator` function." +#, fuzzy +msgid "An object created by an :term:`asynchronous generator` function." msgstr "" "一個由 :term:`asynchronous generator`\\ (非同步產生器)函式所建立的物件。" @@ -933,8 +934,9 @@ msgid "" "term:`special method`. For example, ``__init__`` is often pronounced " "\"dunder init\"." msgstr "" -"一個非正式的縮寫,代表「雙底線 (double underscore)」,當談論到\\ :term:`特殊方法" -" `\\ 時使用。例如,``__init__`` 通常被叫做 \"dunder init\"。" +"一個非正式的縮寫,代表「雙底線 (double underscore)」,當談論到\\ :term:`特殊" +"方法 `\\ 時使用。例如,``__init__`` 通常被叫做 \"dunder " +"init\"。" #: ../../glossary.rst:409 msgid "EAFP" From e71ae0d86bc97dc80b5167f6769dc82d7a7d3c15 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 28 Aug 2025 00:17:25 +0000 Subject: [PATCH 6/6] sync with cpython 502ca0d1 --- library/shutil.po | 5 +- library/stdtypes.po | 1890 ++++++++++++++++++++++--------------------- 2 files changed, 955 insertions(+), 940 deletions(-) diff --git a/library/shutil.po b/library/shutil.po index 75d187b484..b8dd7e8695 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-27 07:36+0000\n" +"POT-Creation-Date: 2025-08-28 00:16+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1151,6 +1151,7 @@ msgid "" msgstr "" #: ../../library/shutil.rst:829 +#, fuzzy msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1161,7 +1162,7 @@ msgid "" "... root_dir='tmp/root',\n" "... base_dir='structure/content',\n" "... )\n" -"'/Users/tarek/my_archive.tar'" +"'/Users/tarek/myarchive.tar'" msgstr "" ">>> from shutil import make_archive\n" ">>> import os\n" diff --git a/library/stdtypes.po b/library/stdtypes.po index 55c0b31741..30dc147e5b 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-08-26 00:16+0000\n" +"POT-Creation-Date: 2025-08-28 00:16+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -135,8 +135,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:276 #: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:965 -#: ../../library/stdtypes.rst:1173 ../../library/stdtypes.rst:2639 -#: ../../library/stdtypes.rst:3859 +#: ../../library/stdtypes.rst:1173 ../../library/stdtypes.rst:2647 +#: ../../library/stdtypes.rst:3867 msgid "Notes" msgstr "註解" @@ -150,7 +150,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:967 #: ../../library/stdtypes.rst:970 ../../library/stdtypes.rst:1188 -#: ../../library/stdtypes.rst:2645 ../../library/stdtypes.rst:3865 +#: ../../library/stdtypes.rst:2653 ../../library/stdtypes.rst:3873 msgid "\\(1)" msgstr "\\(1)" @@ -164,8 +164,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:289 #: ../../library/stdtypes.rst:309 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:2649 ../../library/stdtypes.rst:2651 -#: ../../library/stdtypes.rst:3869 ../../library/stdtypes.rst:3871 +#: ../../library/stdtypes.rst:2657 ../../library/stdtypes.rst:2659 +#: ../../library/stdtypes.rst:3877 ../../library/stdtypes.rst:3879 msgid "\\(2)" msgstr "\\(2)" @@ -178,17 +178,17 @@ msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" #: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:1219 -#: ../../library/stdtypes.rst:2653 ../../library/stdtypes.rst:2655 -#: ../../library/stdtypes.rst:2657 ../../library/stdtypes.rst:2659 -#: ../../library/stdtypes.rst:3873 ../../library/stdtypes.rst:3875 -#: ../../library/stdtypes.rst:3877 ../../library/stdtypes.rst:3879 +#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:2663 +#: ../../library/stdtypes.rst:2665 ../../library/stdtypes.rst:2667 +#: ../../library/stdtypes.rst:3881 ../../library/stdtypes.rst:3883 +#: ../../library/stdtypes.rst:3885 ../../library/stdtypes.rst:3887 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:320 #: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:1016 -#: ../../library/stdtypes.rst:1228 ../../library/stdtypes.rst:2685 -#: ../../library/stdtypes.rst:3909 +#: ../../library/stdtypes.rst:1228 ../../library/stdtypes.rst:2693 +#: ../../library/stdtypes.rst:3917 msgid "Notes:" msgstr "註解:" @@ -235,9 +235,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2471 -#: ../../library/stdtypes.rst:2616 ../../library/stdtypes.rst:2639 -#: ../../library/stdtypes.rst:3836 ../../library/stdtypes.rst:3859 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2479 +#: ../../library/stdtypes.rst:2624 ../../library/stdtypes.rst:2647 +#: ../../library/stdtypes.rst:3844 ../../library/stdtypes.rst:3867 msgid "Meaning" msgstr "含義" @@ -558,7 +558,7 @@ msgid "" msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" #: ../../library/stdtypes.rst:302 ../../library/stdtypes.rst:1209 -#: ../../library/stdtypes.rst:2647 ../../library/stdtypes.rst:3896 +#: ../../library/stdtypes.rst:2655 ../../library/stdtypes.rst:3904 msgid "\\(6)" msgstr "\\(6)" @@ -596,9 +596,9 @@ msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313 #: ../../library/stdtypes.rst:1198 ../../library/stdtypes.rst:1201 -#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:2675 -#: ../../library/stdtypes.rst:2678 ../../library/stdtypes.rst:3892 -#: ../../library/stdtypes.rst:3899 +#: ../../library/stdtypes.rst:2680 ../../library/stdtypes.rst:2683 +#: ../../library/stdtypes.rst:2686 ../../library/stdtypes.rst:3900 +#: ../../library/stdtypes.rst:3907 msgid "\\(5)" msgstr "\\(5)" @@ -757,8 +757,8 @@ msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:418 ../../library/stdtypes.rst:421 #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:1223 -#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:2665 -#: ../../library/stdtypes.rst:3881 ../../library/stdtypes.rst:3885 +#: ../../library/stdtypes.rst:2669 ../../library/stdtypes.rst:2673 +#: ../../library/stdtypes.rst:3889 ../../library/stdtypes.rst:3893 msgid "\\(4)" msgstr "\\(4)" @@ -1687,7 +1687,7 @@ msgid "" "before index *j*)" msgstr "" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3867 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3875 msgid "\\(8)" msgstr "\\(8)" @@ -2675,7 +2675,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1698 ../../library/stdtypes.rst:3035 +#: ../../library/stdtypes.rst:1698 ../../library/stdtypes.rst:3043 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -2711,11 +2711,11 @@ msgstr "" ">>> encoded_str_to_bytes\n" "b'Python'" -#: ../../library/stdtypes.rst:1721 ../../library/stdtypes.rst:3054 +#: ../../library/stdtypes.rst:1721 ../../library/stdtypes.rst:3062 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1724 ../../library/stdtypes.rst:3057 +#: ../../library/stdtypes.rst:1724 ../../library/stdtypes.rst:3065 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." @@ -2792,17 +2792,31 @@ msgstr "" msgid "" "Return the lowest index in the string where substring *sub* is found within " "the slice ``s[start:end]``. Optional arguments *start* and *end* are " -"interpreted as in slice notation. Return ``-1`` if *sub* is not found." +"interpreted as in slice notation. Return ``-1`` if *sub* is not found. For " +"example::" +msgstr "" + +#: ../../library/stdtypes.rst:1780 +msgid "" +">>> 'spam, spam, spam'.find('sp')\n" +"0\n" +">>> 'spam, spam, spam'.find('sp', 5)\n" +"6" msgstr "" -#: ../../library/stdtypes.rst:1781 +#: ../../library/stdtypes.rst:1785 +#, fuzzy +msgid "See also :meth:`rfind` and :meth:`index`." +msgstr "另請參閱 :meth:`startswith` 和 :meth:`removesuffix`。" + +#: ../../library/stdtypes.rst:1789 msgid "" "The :meth:`~str.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:1785 +#: ../../library/stdtypes.rst:1793 msgid "" ">>> 'Py' in 'Python'\n" "True" @@ -2810,7 +2824,7 @@ msgstr "" ">>> 'Py' in 'Python'\n" "True" -#: ../../library/stdtypes.rst:1791 +#: ../../library/stdtypes.rst:1799 msgid "" "Perform a string formatting operation. The string on which this method is " "called can contain literal text or replacement fields delimited by braces " @@ -2820,13 +2834,13 @@ msgid "" "the corresponding argument." msgstr "" -#: ../../library/stdtypes.rst:1801 +#: ../../library/stdtypes.rst:1809 msgid "" "See :ref:`formatstrings` for a description of the various formatting options " "that can be specified in format strings." msgstr "" -#: ../../library/stdtypes.rst:1805 +#: ../../library/stdtypes.rst:1813 msgid "" "When formatting a number (:class:`int`, :class:`float`, :class:`complex`, :" "class:`decimal.Decimal` and subclasses) with the ``n`` type (ex: ``'{:n}'." @@ -2837,26 +2851,26 @@ msgid "" "This temporary change affects other threads." msgstr "" -#: ../../library/stdtypes.rst:1814 +#: ../../library/stdtypes.rst:1822 msgid "" "When formatting a number with the ``n`` type, the function sets temporarily " "the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` locale in some cases." msgstr "" -#: ../../library/stdtypes.rst:1822 +#: ../../library/stdtypes.rst:1830 msgid "" "Similar to ``str.format(**mapping)``, except that ``mapping`` is used " "directly and not copied to a :class:`dict`. This is useful if for example " "``mapping`` is a dict subclass:" msgstr "" -#: ../../library/stdtypes.rst:1838 +#: ../../library/stdtypes.rst:1846 msgid "" "Like :meth:`~str.find`, but raise :exc:`ValueError` when the substring is " "not found." msgstr "" -#: ../../library/stdtypes.rst:1844 +#: ../../library/stdtypes.rst:1852 msgid "" "Return ``True`` if all characters in the string are alphanumeric and there " "is at least one character, ``False`` otherwise. A character ``c`` is " @@ -2864,7 +2878,7 @@ msgid "" "isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." msgstr "" -#: ../../library/stdtypes.rst:1852 +#: ../../library/stdtypes.rst:1860 msgid "" "Return ``True`` if all characters in the string are alphabetic and there is " "at least one character, ``False`` otherwise. Alphabetic characters are " @@ -2876,14 +2890,14 @@ msgid "" "pdf>`_." msgstr "" -#: ../../library/stdtypes.rst:1863 +#: ../../library/stdtypes.rst:1871 msgid "" "Return ``True`` if the string is empty or all characters in the string are " "ASCII, ``False`` otherwise. ASCII characters have code points in the range " "U+0000-U+007F." msgstr "" -#: ../../library/stdtypes.rst:1872 +#: ../../library/stdtypes.rst:1880 msgid "" "Return ``True`` if all characters in the string are decimal characters and " "there is at least one character, ``False`` otherwise. Decimal characters are " @@ -2892,7 +2906,7 @@ msgid "" "General Category \"Nd\"." msgstr "" -#: ../../library/stdtypes.rst:1882 +#: ../../library/stdtypes.rst:1890 msgid "" "Return ``True`` if all characters in the string are digits and there is at " "least one character, ``False`` otherwise. Digits include decimal characters " @@ -2902,23 +2916,23 @@ msgid "" "property value Numeric_Type=Digit or Numeric_Type=Decimal." msgstr "" -#: ../../library/stdtypes.rst:1892 +#: ../../library/stdtypes.rst:1900 msgid "" "Return ``True`` if the string is a valid identifier according to the " "language definition, section :ref:`identifiers`." msgstr "" -#: ../../library/stdtypes.rst:1895 +#: ../../library/stdtypes.rst:1903 msgid "" ":func:`keyword.iskeyword` can be used to test whether string ``s`` is a " "reserved identifier, such as :keyword:`def` and :keyword:`class`." msgstr "" -#: ../../library/stdtypes.rst:1898 +#: ../../library/stdtypes.rst:1906 msgid "Example: ::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:1901 +#: ../../library/stdtypes.rst:1909 msgid "" ">>> from keyword import iskeyword\n" "\n" @@ -2934,13 +2948,13 @@ msgstr "" ">>> 'def'.isidentifier(), iskeyword('def')\n" "(True, True)" -#: ../../library/stdtypes.rst:1911 +#: ../../library/stdtypes.rst:1919 msgid "" "Return ``True`` if all cased characters [4]_ in the string are lowercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1917 +#: ../../library/stdtypes.rst:1925 msgid "" "Return ``True`` if all characters in the string are numeric characters, and " "there is at least one character, ``False`` otherwise. Numeric characters " @@ -2950,13 +2964,13 @@ msgid "" "Numeric_Type=Decimal or Numeric_Type=Numeric." msgstr "" -#: ../../library/stdtypes.rst:1927 +#: ../../library/stdtypes.rst:1935 msgid "" "Return ``True`` if all characters in the string are printable, ``False`` if " "it contains at least one non-printable character." msgstr "" -#: ../../library/stdtypes.rst:1930 +#: ../../library/stdtypes.rst:1938 msgid "" "Here \"printable\" means the character is suitable for :func:`repr` to use " "in its output; \"non-printable\" means that :func:`repr` on built-in types " @@ -2964,7 +2978,7 @@ msgid "" "written to :data:`sys.stdout` or :data:`sys.stderr`." msgstr "" -#: ../../library/stdtypes.rst:1935 +#: ../../library/stdtypes.rst:1943 msgid "" "The printable characters are those which in the Unicode character database " "(see :mod:`unicodedata`) have a general category in group Letter, Mark, " @@ -2973,20 +2987,20 @@ msgid "" "C), except the ASCII space." msgstr "" -#: ../../library/stdtypes.rst:1944 +#: ../../library/stdtypes.rst:1952 msgid "" "Return ``True`` if there are only whitespace characters in the string and " "there is at least one character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1947 +#: ../../library/stdtypes.rst:1955 msgid "" "A character is *whitespace* if in the Unicode character database (see :mod:" "`unicodedata`), either its general category is ``Zs`` (\"Separator, " "space\"), or its bidirectional class is one of ``WS``, ``B``, or ``S``." msgstr "" -#: ../../library/stdtypes.rst:1955 +#: ../../library/stdtypes.rst:1963 msgid "" "Return ``True`` if the string is a titlecased string and there is at least " "one character, for example uppercase characters may only follow uncased " @@ -2994,13 +3008,13 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:1962 +#: ../../library/stdtypes.rst:1970 msgid "" "Return ``True`` if all cased characters [4]_ in the string are uppercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1980 +#: ../../library/stdtypes.rst:1988 msgid "" "Return a string which is the concatenation of the strings in *iterable*. A :" "exc:`TypeError` will be raised if there are any non-string values in " @@ -3008,27 +3022,27 @@ msgid "" "elements is the string providing this method." msgstr "" -#: ../../library/stdtypes.rst:1988 +#: ../../library/stdtypes.rst:1996 msgid "" "Return the string left justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:1995 +#: ../../library/stdtypes.rst:2003 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "lowercase." msgstr "" -#: ../../library/stdtypes.rst:1998 +#: ../../library/stdtypes.rst:2006 msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2005 +#: ../../library/stdtypes.rst:2013 msgid "" "Return a copy of the string with leading characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3037,7 +3051,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2010 +#: ../../library/stdtypes.rst:2018 msgid "" ">>> ' spacious '.lstrip()\n" "'spacious '\n" @@ -3049,13 +3063,13 @@ msgstr "" ">>> 'www.example.com'.lstrip('cmowz.')\n" "'example.com'" -#: ../../library/stdtypes.rst:2015 +#: ../../library/stdtypes.rst:2023 msgid "" "See :meth:`str.removeprefix` for a method that will remove a single prefix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2018 +#: ../../library/stdtypes.rst:2026 msgid "" ">>> 'Arthur: three!'.lstrip('Arthur: ')\n" "'ee!'\n" @@ -3067,13 +3081,13 @@ msgstr "" ">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" "'three!'" -#: ../../library/stdtypes.rst:2027 +#: ../../library/stdtypes.rst:2035 msgid "" "This static method returns a translation table usable for :meth:`str." "translate`." msgstr "" -#: ../../library/stdtypes.rst:2029 +#: ../../library/stdtypes.rst:2037 msgid "" "If there is only one argument, it must be a dictionary mapping Unicode " "ordinals (integers) or characters (strings of length 1) to Unicode ordinals, " @@ -3081,7 +3095,7 @@ msgid "" "converted to ordinals." msgstr "" -#: ../../library/stdtypes.rst:2034 +#: ../../library/stdtypes.rst:2042 msgid "" "If there are two arguments, they must be strings of equal length, and in the " "resulting dictionary, each character in *from* will be mapped to the " @@ -3089,7 +3103,7 @@ msgid "" "must be a string, whose characters will be mapped to ``None`` in the result." msgstr "" -#: ../../library/stdtypes.rst:2042 +#: ../../library/stdtypes.rst:2050 msgid "" "Split the string at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3097,13 +3111,13 @@ msgid "" "containing the string itself, followed by two empty strings." msgstr "" -#: ../../library/stdtypes.rst:2050 +#: ../../library/stdtypes.rst:2058 msgid "" "If the string starts with the *prefix* string, return " "``string[len(prefix):]``. Otherwise, return a copy of the original string::" msgstr "" -#: ../../library/stdtypes.rst:2054 +#: ../../library/stdtypes.rst:2062 msgid "" ">>> 'TestHook'.removeprefix('Test')\n" "'Hook'\n" @@ -3115,14 +3129,14 @@ msgstr "" ">>> 'BaseTestCase'.removeprefix('Test')\n" "'BaseTestCase'" -#: ../../library/stdtypes.rst:2064 +#: ../../library/stdtypes.rst:2072 msgid "" "If the string ends with the *suffix* string and that *suffix* is not empty, " "return ``string[:-len(suffix)]``. Otherwise, return a copy of the original " "string::" msgstr "" -#: ../../library/stdtypes.rst:2068 +#: ../../library/stdtypes.rst:2076 msgid "" ">>> 'MiscTests'.removesuffix('Tests')\n" "'Misc'\n" @@ -3134,7 +3148,7 @@ msgstr "" ">>> 'TmpDirMixin'.removesuffix('Tests')\n" "'TmpDirMixin'" -#: ../../library/stdtypes.rst:2078 +#: ../../library/stdtypes.rst:2086 msgid "" "Return a copy of the string with all occurrences of substring *old* replaced " "by *new*. If *count* is given, only the first *count* occurrences are " @@ -3142,31 +3156,31 @@ msgid "" "replaced." msgstr "" -#: ../../library/stdtypes.rst:2082 +#: ../../library/stdtypes.rst:2090 msgid "*count* is now supported as a keyword argument." msgstr "*count* 現在作為關鍵字引數被支援。" -#: ../../library/stdtypes.rst:2088 +#: ../../library/stdtypes.rst:2096 msgid "" "Return the highest index in the string where substring *sub* is found, such " "that *sub* is contained within ``s[start:end]``. Optional arguments *start* " "and *end* are interpreted as in slice notation. Return ``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2095 +#: ../../library/stdtypes.rst:2103 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found." msgstr "" -#: ../../library/stdtypes.rst:2101 +#: ../../library/stdtypes.rst:2109 msgid "" "Return the string right justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2108 +#: ../../library/stdtypes.rst:2116 msgid "" "Split the string at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3174,7 +3188,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2116 +#: ../../library/stdtypes.rst:2124 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done, the " @@ -3183,7 +3197,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2125 +#: ../../library/stdtypes.rst:2133 msgid "" "Return a copy of the string with trailing characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3192,7 +3206,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2130 +#: ../../library/stdtypes.rst:2138 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -3204,13 +3218,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2135 +#: ../../library/stdtypes.rst:2143 msgid "" "See :meth:`str.removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2138 +#: ../../library/stdtypes.rst:2146 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -3222,7 +3236,7 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2145 +#: ../../library/stdtypes.rst:2153 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -3231,7 +3245,7 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2151 +#: ../../library/stdtypes.rst:2159 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " @@ -3241,20 +3255,20 @@ msgid "" "``['']``." msgstr "" -#: ../../library/stdtypes.rst:2158 ../../library/stdtypes.rst:2176 -#: ../../library/stdtypes.rst:2188 ../../library/stdtypes.rst:2240 -#: ../../library/stdtypes.rst:2308 ../../library/stdtypes.rst:2376 -#: ../../library/stdtypes.rst:3370 ../../library/stdtypes.rst:3388 -#: ../../library/stdtypes.rst:3478 ../../library/stdtypes.rst:3494 -#: ../../library/stdtypes.rst:3519 ../../library/stdtypes.rst:3533 -#: ../../library/stdtypes.rst:3561 ../../library/stdtypes.rst:3575 -#: ../../library/stdtypes.rst:3593 ../../library/stdtypes.rst:3620 -#: ../../library/stdtypes.rst:3643 ../../library/stdtypes.rst:3670 -#: ../../library/stdtypes.rst:3712 ../../library/stdtypes.rst:3736 +#: ../../library/stdtypes.rst:2166 ../../library/stdtypes.rst:2184 +#: ../../library/stdtypes.rst:2196 ../../library/stdtypes.rst:2248 +#: ../../library/stdtypes.rst:2316 ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:3378 ../../library/stdtypes.rst:3396 +#: ../../library/stdtypes.rst:3486 ../../library/stdtypes.rst:3502 +#: ../../library/stdtypes.rst:3527 ../../library/stdtypes.rst:3541 +#: ../../library/stdtypes.rst:3569 ../../library/stdtypes.rst:3583 +#: ../../library/stdtypes.rst:3601 ../../library/stdtypes.rst:3628 +#: ../../library/stdtypes.rst:3651 ../../library/stdtypes.rst:3678 +#: ../../library/stdtypes.rst:3720 ../../library/stdtypes.rst:3744 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2160 +#: ../../library/stdtypes.rst:2168 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -3274,7 +3288,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2169 +#: ../../library/stdtypes.rst:2177 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive whitespace are regarded as a single separator, " @@ -3284,7 +3298,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2178 +#: ../../library/stdtypes.rst:2186 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -3300,13 +3314,13 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2185 +#: ../../library/stdtypes.rst:2193 msgid "" "If *sep* is not specified or is ``None`` and *maxsplit* is ``0``, only " "leading runs of consecutive whitespace are considered." msgstr "" -#: ../../library/stdtypes.rst:2190 +#: ../../library/stdtypes.rst:2198 msgid "" ">>> \"\".split(None, 0)\n" "[]\n" @@ -3322,120 +3336,120 @@ msgstr "" ">>> \" foo \".split(maxsplit=0)\n" "['foo ']" -#: ../../library/stdtypes.rst:2203 +#: ../../library/stdtypes.rst:2211 msgid "" "Return a list of the lines in the string, breaking at line boundaries. Line " "breaks are not included in the resulting list unless *keepends* is given and " "true." msgstr "" -#: ../../library/stdtypes.rst:2207 +#: ../../library/stdtypes.rst:2215 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2211 +#: ../../library/stdtypes.rst:2219 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2211 +#: ../../library/stdtypes.rst:2219 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2213 +#: ../../library/stdtypes.rst:2221 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2213 +#: ../../library/stdtypes.rst:2221 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2215 +#: ../../library/stdtypes.rst:2223 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2215 +#: ../../library/stdtypes.rst:2223 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2217 +#: ../../library/stdtypes.rst:2225 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2217 +#: ../../library/stdtypes.rst:2225 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2219 +#: ../../library/stdtypes.rst:2227 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2219 +#: ../../library/stdtypes.rst:2227 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2221 +#: ../../library/stdtypes.rst:2229 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2221 +#: ../../library/stdtypes.rst:2229 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2223 +#: ../../library/stdtypes.rst:2231 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2223 +#: ../../library/stdtypes.rst:2231 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2225 +#: ../../library/stdtypes.rst:2233 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2225 +#: ../../library/stdtypes.rst:2233 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2227 +#: ../../library/stdtypes.rst:2235 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2227 +#: ../../library/stdtypes.rst:2235 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2229 +#: ../../library/stdtypes.rst:2237 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2229 +#: ../../library/stdtypes.rst:2237 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2231 +#: ../../library/stdtypes.rst:2239 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2231 +#: ../../library/stdtypes.rst:2239 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2233 +#: ../../library/stdtypes.rst:2241 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2233 +#: ../../library/stdtypes.rst:2241 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2238 +#: ../../library/stdtypes.rst:2246 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2242 +#: ../../library/stdtypes.rst:2250 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -3447,14 +3461,14 @@ msgstr "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" -#: ../../library/stdtypes.rst:2247 +#: ../../library/stdtypes.rst:2255 msgid "" "Unlike :meth:`~str.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:2251 +#: ../../library/stdtypes.rst:2259 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -3466,11 +3480,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2256 +#: ../../library/stdtypes.rst:2264 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2258 +#: ../../library/stdtypes.rst:2266 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -3482,7 +3496,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2266 +#: ../../library/stdtypes.rst:2274 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -3490,7 +3504,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2274 +#: ../../library/stdtypes.rst:2282 msgid "" "Return a copy of the string with the leading and trailing characters " "removed. The *chars* argument is a string specifying the set of characters " @@ -3499,7 +3513,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2280 +#: ../../library/stdtypes.rst:2288 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -3511,7 +3525,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2285 +#: ../../library/stdtypes.rst:2293 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -3519,7 +3533,7 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2291 +#: ../../library/stdtypes.rst:2299 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -3529,20 +3543,20 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2298 +#: ../../library/stdtypes.rst:2306 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " "and vice versa. Note that it is not necessarily true that ``s.swapcase()." "swapcase() == s``." msgstr "" -#: ../../library/stdtypes.rst:2305 +#: ../../library/stdtypes.rst:2313 msgid "" "Return a titlecased version of the string where words start with an " "uppercase character and the remaining characters are lowercase." msgstr "" -#: ../../library/stdtypes.rst:2310 +#: ../../library/stdtypes.rst:2318 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -3550,7 +3564,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2313 ../../library/stdtypes.rst:3680 +#: ../../library/stdtypes.rst:2321 ../../library/stdtypes.rst:3688 msgid "" "The algorithm uses a simple language-independent definition of a word as " "groups of consecutive letters. The definition works in many contexts but it " @@ -3558,7 +3572,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2318 +#: ../../library/stdtypes.rst:2326 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -3566,19 +3580,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2321 +#: ../../library/stdtypes.rst:2329 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2324 +#: ../../library/stdtypes.rst:2332 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2327 +#: ../../library/stdtypes.rst:2335 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -3598,7 +3612,7 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2339 +#: ../../library/stdtypes.rst:2347 msgid "" "Return a copy of the string in which each character has been mapped through " "the given translation table. The table must be an object that implements " @@ -3610,19 +3624,19 @@ msgid "" "exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2348 +#: ../../library/stdtypes.rst:2356 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2351 +#: ../../library/stdtypes.rst:2359 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2357 +#: ../../library/stdtypes.rst:2365 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s`` " @@ -3631,14 +3645,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2363 +#: ../../library/stdtypes.rst:2371 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2370 +#: ../../library/stdtypes.rst:2378 msgid "" "Return a copy of the string left filled with ASCII ``'0'`` digits to make a " "string of length *width*. A leading sign prefix (``'+'``/``'-'``) is handled " @@ -3646,7 +3660,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2378 +#: ../../library/stdtypes.rst:2386 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -3658,27 +3672,27 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2399 +#: ../../library/stdtypes.rst:2407 msgid "Formatted String Literals (f-strings)" msgstr "" -#: ../../library/stdtypes.rst:2402 +#: ../../library/stdtypes.rst:2410 msgid "" "The :keyword:`await` and :keyword:`async for` can be used in expressions " "within f-strings." msgstr "" -#: ../../library/stdtypes.rst:2405 +#: ../../library/stdtypes.rst:2413 msgid "Added the debugging operator (``=``)" msgstr "" -#: ../../library/stdtypes.rst:2407 +#: ../../library/stdtypes.rst:2415 msgid "" "Many restrictions on expressions within f-strings have been removed. " "Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../library/stdtypes.rst:2411 +#: ../../library/stdtypes.rst:2419 msgid "" "An :dfn:`f-string` (formally a :dfn:`formatted string literal`) is a string " "literal that is prefixed with ``f`` or ``F``. This type of string literal " @@ -3688,7 +3702,7 @@ msgid "" "into regular :class:`str` objects. For example:" msgstr "" -#: ../../library/stdtypes.rst:2419 +#: ../../library/stdtypes.rst:2427 msgid "" ">>> who = 'nobody'\n" ">>> nationality = 'Spanish'\n" @@ -3700,11 +3714,11 @@ msgstr "" ">>> f'{who.title()} expects the {nationality} Inquisition!'\n" "'Nobody expects the Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2426 +#: ../../library/stdtypes.rst:2434 msgid "It is also possible to use a multi line f-string:" msgstr "" -#: ../../library/stdtypes.rst:2428 +#: ../../library/stdtypes.rst:2436 msgid "" ">>> f'''This is a string\n" "... on two lines'''\n" @@ -3714,13 +3728,13 @@ msgstr "" "... on two lines'''\n" "'This is a string\\non two lines'" -#: ../../library/stdtypes.rst:2434 +#: ../../library/stdtypes.rst:2442 msgid "" "A single opening curly bracket, ``'{'``, marks a *replacement field* that " "can contain any Python expression:" msgstr "" -#: ../../library/stdtypes.rst:2437 +#: ../../library/stdtypes.rst:2445 msgid "" ">>> nationality = 'Spanish'\n" ">>> f'The {nationality} Inquisition!'\n" @@ -3730,11 +3744,11 @@ msgstr "" ">>> f'The {nationality} Inquisition!'\n" "'The Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2443 +#: ../../library/stdtypes.rst:2451 msgid "To include a literal ``{`` or ``}``, use a double bracket:" msgstr "" -#: ../../library/stdtypes.rst:2445 +#: ../../library/stdtypes.rst:2453 msgid "" ">>> x = 42\n" ">>> f'{{x}} is {x}'\n" @@ -3744,12 +3758,12 @@ msgstr "" ">>> f'{{x}} is {x}'\n" "'{x} is 42'" -#: ../../library/stdtypes.rst:2451 +#: ../../library/stdtypes.rst:2459 msgid "" "Functions can also be used, and :ref:`format specifiers `:" msgstr "" -#: ../../library/stdtypes.rst:2453 +#: ../../library/stdtypes.rst:2461 msgid "" ">>> from math import sqrt\n" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" @@ -3759,11 +3773,11 @@ msgstr "" ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" "'√2 ≈ 1.41421'" -#: ../../library/stdtypes.rst:2459 +#: ../../library/stdtypes.rst:2467 msgid "Any non-string expression is converted using :func:`str`, by default:" msgstr "" -#: ../../library/stdtypes.rst:2461 +#: ../../library/stdtypes.rst:2469 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)}'\n" @@ -3773,46 +3787,46 @@ msgstr "" ">>> f'{Fraction(1, 3)}'\n" "'1/3'" -#: ../../library/stdtypes.rst:2467 +#: ../../library/stdtypes.rst:2475 msgid "" "To use an explicit conversion, use the ``!`` (exclamation mark) operator, " "followed by any of the valid formats, which are:" msgstr "" -#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:2639 -#: ../../library/stdtypes.rst:3859 +#: ../../library/stdtypes.rst:2479 ../../library/stdtypes.rst:2647 +#: ../../library/stdtypes.rst:3867 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:2473 +#: ../../library/stdtypes.rst:2481 msgid "``!a``" msgstr "``!a``" -#: ../../library/stdtypes.rst:2473 +#: ../../library/stdtypes.rst:2481 msgid ":func:`ascii`" msgstr ":func:`ascii`" -#: ../../library/stdtypes.rst:2474 +#: ../../library/stdtypes.rst:2482 msgid "``!r``" msgstr "``!r``" -#: ../../library/stdtypes.rst:2474 +#: ../../library/stdtypes.rst:2482 msgid ":func:`repr`" msgstr ":func:`repr`" -#: ../../library/stdtypes.rst:2475 +#: ../../library/stdtypes.rst:2483 msgid "``!s``" msgstr "``!s``" -#: ../../library/stdtypes.rst:2475 +#: ../../library/stdtypes.rst:2483 msgid ":func:`str`" msgstr ":func:`str`" -#: ../../library/stdtypes.rst:2478 +#: ../../library/stdtypes.rst:2486 msgid "For example:" msgstr "舉例來說:" -#: ../../library/stdtypes.rst:2480 +#: ../../library/stdtypes.rst:2488 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)!s}'\n" @@ -3832,7 +3846,7 @@ msgstr "" ">>> print(f'{question!a}')\n" "'\\xbfD\\xf3nde est\\xe1 el Presidente?'" -#: ../../library/stdtypes.rst:2491 +#: ../../library/stdtypes.rst:2499 msgid "" "While debugging it may be helpful to see both the expression and its value, " "by using the equals sign (``=``) after the expression. This preserves spaces " @@ -3840,7 +3854,7 @@ msgid "" "debugging operator uses the :func:`repr` (``!r``) conversion. For example:" msgstr "" -#: ../../library/stdtypes.rst:2497 +#: ../../library/stdtypes.rst:2505 msgid "" ">>> from fractions import Fraction\n" ">>> calculation = Fraction(1, 3)\n" @@ -3860,7 +3874,7 @@ msgstr "" ">>> f'{calculation = !s}'\n" "'calculation = 1/3'" -#: ../../library/stdtypes.rst:2508 +#: ../../library/stdtypes.rst:2516 msgid "" "Once the output has been evaluated, it can be formatted using a :ref:`format " "specifier ` following a colon (``':'``). After the expression " @@ -3870,7 +3884,7 @@ msgid "" "used as the final value for the replacement field. For example:" msgstr "" -#: ../../library/stdtypes.rst:2516 +#: ../../library/stdtypes.rst:2524 msgid "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 7):.6f}'\n" @@ -3879,11 +3893,11 @@ msgid "" "'___+1/7___'" msgstr "" -#: ../../library/stdtypes.rst:2528 +#: ../../library/stdtypes.rst:2536 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2541 +#: ../../library/stdtypes.rst:2549 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -3894,7 +3908,7 @@ msgid "" "or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2549 +#: ../../library/stdtypes.rst:2557 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -3904,13 +3918,13 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:2556 +#: ../../library/stdtypes.rst:2564 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." msgstr "" -#: ../../library/stdtypes.rst:2561 +#: ../../library/stdtypes.rst:2569 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -3918,36 +3932,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2571 ../../library/stdtypes.rst:3791 +#: ../../library/stdtypes.rst:2579 ../../library/stdtypes.rst:3799 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2574 ../../library/stdtypes.rst:3794 +#: ../../library/stdtypes.rst:2582 ../../library/stdtypes.rst:3802 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2576 ../../library/stdtypes.rst:3796 +#: ../../library/stdtypes.rst:2584 ../../library/stdtypes.rst:3804 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2579 ../../library/stdtypes.rst:3799 +#: ../../library/stdtypes.rst:2587 ../../library/stdtypes.rst:3807 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2582 ../../library/stdtypes.rst:3802 +#: ../../library/stdtypes.rst:2590 ../../library/stdtypes.rst:3810 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is read from the next element of the tuple in *values*, and the " "object to convert comes after the minimum field width and optional precision." msgstr "" -#: ../../library/stdtypes.rst:2586 ../../library/stdtypes.rst:3806 +#: ../../library/stdtypes.rst:2594 ../../library/stdtypes.rst:3814 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -3955,15 +3969,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2591 ../../library/stdtypes.rst:3811 +#: ../../library/stdtypes.rst:2599 ../../library/stdtypes.rst:3819 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2593 ../../library/stdtypes.rst:3813 +#: ../../library/stdtypes.rst:2601 ../../library/stdtypes.rst:3821 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2595 +#: ../../library/stdtypes.rst:2603 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the string *must* include a parenthesised mapping key into that " @@ -3971,275 +3985,275 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2604 ../../library/stdtypes.rst:3824 +#: ../../library/stdtypes.rst:2612 ../../library/stdtypes.rst:3832 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2607 ../../library/stdtypes.rst:3827 +#: ../../library/stdtypes.rst:2615 ../../library/stdtypes.rst:3835 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2616 ../../library/stdtypes.rst:3836 +#: ../../library/stdtypes.rst:2624 ../../library/stdtypes.rst:3844 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2618 ../../library/stdtypes.rst:3838 +#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3846 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2618 ../../library/stdtypes.rst:3838 +#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3846 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2621 ../../library/stdtypes.rst:3841 +#: ../../library/stdtypes.rst:2629 ../../library/stdtypes.rst:3849 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2621 ../../library/stdtypes.rst:3841 +#: ../../library/stdtypes.rst:2629 ../../library/stdtypes.rst:3849 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2623 ../../library/stdtypes.rst:3843 +#: ../../library/stdtypes.rst:2631 ../../library/stdtypes.rst:3851 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2623 ../../library/stdtypes.rst:3843 +#: ../../library/stdtypes.rst:2631 ../../library/stdtypes.rst:3851 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3846 +#: ../../library/stdtypes.rst:2634 ../../library/stdtypes.rst:3854 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2626 ../../library/stdtypes.rst:3846 +#: ../../library/stdtypes.rst:2634 ../../library/stdtypes.rst:3854 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2629 ../../library/stdtypes.rst:3849 +#: ../../library/stdtypes.rst:2637 ../../library/stdtypes.rst:3857 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2629 ../../library/stdtypes.rst:3849 +#: ../../library/stdtypes.rst:2637 ../../library/stdtypes.rst:3857 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2633 ../../library/stdtypes.rst:3853 +#: ../../library/stdtypes.rst:2641 ../../library/stdtypes.rst:3861 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" -#: ../../library/stdtypes.rst:2636 ../../library/stdtypes.rst:3856 +#: ../../library/stdtypes.rst:2644 ../../library/stdtypes.rst:3864 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2641 ../../library/stdtypes.rst:3861 +#: ../../library/stdtypes.rst:2649 ../../library/stdtypes.rst:3869 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2641 ../../library/stdtypes.rst:2643 -#: ../../library/stdtypes.rst:3861 ../../library/stdtypes.rst:3863 +#: ../../library/stdtypes.rst:2649 ../../library/stdtypes.rst:2651 +#: ../../library/stdtypes.rst:3869 ../../library/stdtypes.rst:3871 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2643 ../../library/stdtypes.rst:3863 +#: ../../library/stdtypes.rst:2651 ../../library/stdtypes.rst:3871 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2645 ../../library/stdtypes.rst:3865 +#: ../../library/stdtypes.rst:2653 ../../library/stdtypes.rst:3873 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2645 ../../library/stdtypes.rst:3865 +#: ../../library/stdtypes.rst:2653 ../../library/stdtypes.rst:3873 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2647 ../../library/stdtypes.rst:3867 +#: ../../library/stdtypes.rst:2655 ../../library/stdtypes.rst:3875 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2647 ../../library/stdtypes.rst:3867 +#: ../../library/stdtypes.rst:2655 ../../library/stdtypes.rst:3875 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2649 ../../library/stdtypes.rst:3869 +#: ../../library/stdtypes.rst:2657 ../../library/stdtypes.rst:3877 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2649 ../../library/stdtypes.rst:3869 +#: ../../library/stdtypes.rst:2657 ../../library/stdtypes.rst:3877 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2651 ../../library/stdtypes.rst:3871 +#: ../../library/stdtypes.rst:2659 ../../library/stdtypes.rst:3879 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2651 ../../library/stdtypes.rst:3871 +#: ../../library/stdtypes.rst:2659 ../../library/stdtypes.rst:3879 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2653 ../../library/stdtypes.rst:3873 +#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:3881 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2653 ../../library/stdtypes.rst:3873 +#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:3881 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2655 ../../library/stdtypes.rst:3875 +#: ../../library/stdtypes.rst:2663 ../../library/stdtypes.rst:3883 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2655 ../../library/stdtypes.rst:3875 +#: ../../library/stdtypes.rst:2663 ../../library/stdtypes.rst:3883 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2657 ../../library/stdtypes.rst:3877 +#: ../../library/stdtypes.rst:2665 ../../library/stdtypes.rst:3885 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2657 ../../library/stdtypes.rst:2659 -#: ../../library/stdtypes.rst:3877 ../../library/stdtypes.rst:3879 +#: ../../library/stdtypes.rst:2665 ../../library/stdtypes.rst:2667 +#: ../../library/stdtypes.rst:3885 ../../library/stdtypes.rst:3887 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2659 ../../library/stdtypes.rst:3879 +#: ../../library/stdtypes.rst:2667 ../../library/stdtypes.rst:3887 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:3881 +#: ../../library/stdtypes.rst:2669 ../../library/stdtypes.rst:3889 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2661 ../../library/stdtypes.rst:3881 +#: ../../library/stdtypes.rst:2669 ../../library/stdtypes.rst:3889 msgid "" "Floating-point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2665 ../../library/stdtypes.rst:3885 +#: ../../library/stdtypes.rst:2673 ../../library/stdtypes.rst:3893 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2665 ../../library/stdtypes.rst:3885 +#: ../../library/stdtypes.rst:2673 ../../library/stdtypes.rst:3893 msgid "" "Floating-point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2669 ../../library/stdtypes.rst:3889 +#: ../../library/stdtypes.rst:2677 ../../library/stdtypes.rst:3897 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2669 +#: ../../library/stdtypes.rst:2677 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:3902 +#: ../../library/stdtypes.rst:2680 ../../library/stdtypes.rst:3910 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2672 +#: ../../library/stdtypes.rst:2680 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2675 ../../library/stdtypes.rst:3896 +#: ../../library/stdtypes.rst:2683 ../../library/stdtypes.rst:3904 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2675 +#: ../../library/stdtypes.rst:2683 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2678 ../../library/stdtypes.rst:3899 +#: ../../library/stdtypes.rst:2686 ../../library/stdtypes.rst:3907 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2678 +#: ../../library/stdtypes.rst:2686 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2681 ../../library/stdtypes.rst:3905 +#: ../../library/stdtypes.rst:2689 ../../library/stdtypes.rst:3913 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2681 ../../library/stdtypes.rst:3905 +#: ../../library/stdtypes.rst:2689 ../../library/stdtypes.rst:3913 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2688 ../../library/stdtypes.rst:3912 +#: ../../library/stdtypes.rst:2696 ../../library/stdtypes.rst:3920 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2692 ../../library/stdtypes.rst:3916 +#: ../../library/stdtypes.rst:2700 ../../library/stdtypes.rst:3924 msgid "" "The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on " "whether the ``'x'`` or ``'X'`` format was used) to be inserted before the " "first digit." msgstr "" -#: ../../library/stdtypes.rst:2696 ../../library/stdtypes.rst:3920 +#: ../../library/stdtypes.rst:2704 ../../library/stdtypes.rst:3928 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2699 ../../library/stdtypes.rst:3923 +#: ../../library/stdtypes.rst:2707 ../../library/stdtypes.rst:3931 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2703 ../../library/stdtypes.rst:3927 +#: ../../library/stdtypes.rst:2711 ../../library/stdtypes.rst:3935 msgid "" "The alternate form causes the result to always contain a decimal point, and " "trailing zeroes are not removed as they would otherwise be." msgstr "" -#: ../../library/stdtypes.rst:2706 ../../library/stdtypes.rst:3930 +#: ../../library/stdtypes.rst:2714 ../../library/stdtypes.rst:3938 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2710 ../../library/stdtypes.rst:3934 +#: ../../library/stdtypes.rst:2718 ../../library/stdtypes.rst:3942 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2713 ../../library/stdtypes.rst:3943 +#: ../../library/stdtypes.rst:2721 ../../library/stdtypes.rst:3951 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2715 +#: ../../library/stdtypes.rst:2723 msgid "" "Since Python strings have an explicit length, ``%s`` conversions do not " "assume that ``'\\0'`` is the end of the string." msgstr "" -#: ../../library/stdtypes.rst:2720 +#: ../../library/stdtypes.rst:2728 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2731 +#: ../../library/stdtypes.rst:2739 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2739 +#: ../../library/stdtypes.rst:2747 msgid "" "The core built-in types for manipulating binary data are :class:`bytes` and :" "class:`bytearray`. They are supported by :class:`memoryview` which uses the :" @@ -4247,17 +4261,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2744 +#: ../../library/stdtypes.rst:2752 msgid "" "The :mod:`array` module supports efficient storage of basic data types like " "32-bit integers and IEEE754 double-precision floating values." msgstr "" -#: ../../library/stdtypes.rst:2750 +#: ../../library/stdtypes.rst:2758 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2754 +#: ../../library/stdtypes.rst:2762 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -4265,40 +4279,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2762 +#: ../../library/stdtypes.rst:2770 msgid "" "Firstly, the syntax for bytes literals is largely the same as that for " "string literals, except that a ``b`` prefix is added:" msgstr "" -#: ../../library/stdtypes.rst:2765 +#: ../../library/stdtypes.rst:2773 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2766 +#: ../../library/stdtypes.rst:2774 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2767 +#: ../../library/stdtypes.rst:2775 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2769 +#: ../../library/stdtypes.rst:2777 msgid "" "Only ASCII characters are permitted in bytes literals (regardless of the " "declared source code encoding). Any binary values over 127 must be entered " "into bytes literals using the appropriate escape sequence." msgstr "" -#: ../../library/stdtypes.rst:2773 +#: ../../library/stdtypes.rst:2781 msgid "" "As with string literals, bytes literals may also use a ``r`` prefix to " "disable processing of escape sequences. See :ref:`strings` for more about " "the various forms of bytes literal, including supported escape sequences." msgstr "" -#: ../../library/stdtypes.rst:2777 +#: ../../library/stdtypes.rst:2785 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -4311,29 +4325,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2787 +#: ../../library/stdtypes.rst:2795 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2790 +#: ../../library/stdtypes.rst:2798 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2799 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2792 +#: ../../library/stdtypes.rst:2800 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2794 +#: ../../library/stdtypes.rst:2802 msgid "Also see the :ref:`bytes ` built-in." msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:2796 +#: ../../library/stdtypes.rst:2804 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4341,32 +4355,32 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:2802 +#: ../../library/stdtypes.rst:2810 msgid "" "This :class:`bytes` class method returns a bytes object, decoding the given " "string object. The string must contain two hexadecimal digits per byte, " "with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2809 +#: ../../library/stdtypes.rst:2817 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:2813 +#: ../../library/stdtypes.rst:2821 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2819 ../../library/stdtypes.rst:2906 +#: ../../library/stdtypes.rst:2827 ../../library/stdtypes.rst:2914 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:2825 +#: ../../library/stdtypes.rst:2833 msgid "" "If you want to make the hex string easier to read, you can specify a single " "character separator *sep* parameter to include in the output. By default, " @@ -4375,13 +4389,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:2842 +#: ../../library/stdtypes.rst:2850 msgid "" ":meth:`bytes.hex` now supports optional *sep* and *bytes_per_sep* parameters " "to insert separators between bytes in the hex output." msgstr "" -#: ../../library/stdtypes.rst:2846 +#: ../../library/stdtypes.rst:2854 msgid "" "Since bytes objects are sequences of integers (akin to a tuple), for a bytes " "object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes " @@ -4389,58 +4403,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2851 +#: ../../library/stdtypes.rst:2859 msgid "" "The representation of bytes objects uses the literal format (``b'...'``) " "since it is often more useful than e.g. ``bytes([46, 46, 46])``. You can " "always convert a bytes object into a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2859 +#: ../../library/stdtypes.rst:2867 msgid "Bytearray Objects" msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:2863 +#: ../../library/stdtypes.rst:2871 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:2869 +#: ../../library/stdtypes.rst:2877 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:2872 +#: ../../library/stdtypes.rst:2880 msgid "Creating an empty instance: ``bytearray()``" msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:2873 +#: ../../library/stdtypes.rst:2881 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:2874 +#: ../../library/stdtypes.rst:2882 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2875 +#: ../../library/stdtypes.rst:2883 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:2877 +#: ../../library/stdtypes.rst:2885 msgid "" "As bytearray objects are mutable, they support the :ref:`mutable ` sequence operations in addition to the common bytes and bytearray " "operations described in :ref:`bytes-methods`." msgstr "" -#: ../../library/stdtypes.rst:2881 +#: ../../library/stdtypes.rst:2889 msgid "Also see the :ref:`bytearray ` built-in." msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:2883 +#: ../../library/stdtypes.rst:2891 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4448,33 +4462,33 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:2889 +#: ../../library/stdtypes.rst:2897 msgid "" "This :class:`bytearray` class method returns bytearray object, decoding the " "given string object. The string must contain two hexadecimal digits per " "byte, with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2896 +#: ../../library/stdtypes.rst:2904 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:2900 +#: ../../library/stdtypes.rst:2908 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2914 +#: ../../library/stdtypes.rst:2922 msgid "" "Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:2919 +#: ../../library/stdtypes.rst:2927 msgid "" "Since bytearray objects are sequences of integers (akin to a list), for a " "bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be " @@ -4482,7 +4496,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2924 +#: ../../library/stdtypes.rst:2932 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -4490,11 +4504,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2933 +#: ../../library/stdtypes.rst:2941 msgid "Bytes and Bytearray Operations" msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:2938 +#: ../../library/stdtypes.rst:2946 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -4503,14 +4517,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:2946 +#: ../../library/stdtypes.rst:2954 msgid "" "The methods on bytes and bytearray objects don't accept strings as their " "arguments, just as the methods on strings don't accept bytes as their " "arguments. For example, you have to write::" msgstr "" -#: ../../library/stdtypes.rst:2950 +#: ../../library/stdtypes.rst:2958 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -4518,11 +4532,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:2953 +#: ../../library/stdtypes.rst:2961 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:2955 +#: ../../library/stdtypes.rst:2963 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -4530,60 +4544,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:2958 +#: ../../library/stdtypes.rst:2966 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" -#: ../../library/stdtypes.rst:2963 +#: ../../library/stdtypes.rst:2971 msgid "" "Using these ASCII based operations to manipulate binary data that is not " "stored in an ASCII based format may lead to data corruption." msgstr "" -#: ../../library/stdtypes.rst:2966 +#: ../../library/stdtypes.rst:2974 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:2972 +#: ../../library/stdtypes.rst:2980 msgid "" "Return the number of non-overlapping occurrences of subsequence *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:2976 ../../library/stdtypes.rst:3081 -#: ../../library/stdtypes.rst:3103 ../../library/stdtypes.rst:3169 -#: ../../library/stdtypes.rst:3182 +#: ../../library/stdtypes.rst:2984 ../../library/stdtypes.rst:3089 +#: ../../library/stdtypes.rst:3111 ../../library/stdtypes.rst:3177 +#: ../../library/stdtypes.rst:3190 msgid "" "The subsequence to search for may be any :term:`bytes-like object` or an " "integer in the range 0 to 255." msgstr "" -#: ../../library/stdtypes.rst:2979 +#: ../../library/stdtypes.rst:2987 msgid "" "If *sub* is empty, returns the number of empty slices between characters " "which is the length of the bytes object plus one." msgstr "" -#: ../../library/stdtypes.rst:2982 ../../library/stdtypes.rst:3093 -#: ../../library/stdtypes.rst:3106 ../../library/stdtypes.rst:3172 -#: ../../library/stdtypes.rst:3185 +#: ../../library/stdtypes.rst:2990 ../../library/stdtypes.rst:3101 +#: ../../library/stdtypes.rst:3114 ../../library/stdtypes.rst:3180 +#: ../../library/stdtypes.rst:3193 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:2989 +#: ../../library/stdtypes.rst:2997 msgid "" "If the binary data starts with the *prefix* string, return " "``bytes[len(prefix):]``. Otherwise, return a copy of the original binary " "data::" msgstr "" -#: ../../library/stdtypes.rst:2993 +#: ../../library/stdtypes.rst:3001 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -4595,32 +4609,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:2998 +#: ../../library/stdtypes.rst:3006 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" -#: ../../library/stdtypes.rst:3002 ../../library/stdtypes.rst:3024 -#: ../../library/stdtypes.rst:3157 ../../library/stdtypes.rst:3250 -#: ../../library/stdtypes.rst:3264 ../../library/stdtypes.rst:3294 -#: ../../library/stdtypes.rst:3308 ../../library/stdtypes.rst:3349 -#: ../../library/stdtypes.rst:3419 ../../library/stdtypes.rst:3437 -#: ../../library/stdtypes.rst:3465 ../../library/stdtypes.rst:3604 -#: ../../library/stdtypes.rst:3659 ../../library/stdtypes.rst:3702 -#: ../../library/stdtypes.rst:3723 ../../library/stdtypes.rst:3745 -#: ../../library/stdtypes.rst:3947 +#: ../../library/stdtypes.rst:3010 ../../library/stdtypes.rst:3032 +#: ../../library/stdtypes.rst:3165 ../../library/stdtypes.rst:3258 +#: ../../library/stdtypes.rst:3272 ../../library/stdtypes.rst:3302 +#: ../../library/stdtypes.rst:3316 ../../library/stdtypes.rst:3357 +#: ../../library/stdtypes.rst:3427 ../../library/stdtypes.rst:3445 +#: ../../library/stdtypes.rst:3473 ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:3667 ../../library/stdtypes.rst:3710 +#: ../../library/stdtypes.rst:3731 ../../library/stdtypes.rst:3753 +#: ../../library/stdtypes.rst:3955 msgid "" "The bytearray version of this method does *not* operate in place - it always " "produces a new object, even if no changes were made." msgstr "" -#: ../../library/stdtypes.rst:3011 +#: ../../library/stdtypes.rst:3019 msgid "" "If the binary data ends with the *suffix* string and that *suffix* is not " "empty, return ``bytes[:-len(suffix)]``. Otherwise, return a copy of the " "original binary data::" msgstr "" -#: ../../library/stdtypes.rst:3015 +#: ../../library/stdtypes.rst:3023 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -4632,15 +4646,15 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:3020 +#: ../../library/stdtypes.rst:3028 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3033 +#: ../../library/stdtypes.rst:3041 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:3038 +#: ../../library/stdtypes.rst:3046 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -4648,21 +4662,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:3044 +#: ../../library/stdtypes.rst:3052 msgid "" "For performance reasons, the value of *errors* is not checked for validity " "unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" "`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:3050 +#: ../../library/stdtypes.rst:3058 msgid "" "Passing the *encoding* argument to :class:`str` allows decoding any :term:" "`bytes-like object` directly, without needing to make a temporary :class:`!" "bytes` or :class:`!bytearray` object." msgstr "" -#: ../../library/stdtypes.rst:3065 +#: ../../library/stdtypes.rst:3073 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -4670,11 +4684,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3070 +#: ../../library/stdtypes.rst:3078 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3076 +#: ../../library/stdtypes.rst:3084 msgid "" "Return the lowest index in the data where the subsequence *sub* is found, " "such that *sub* is contained in the slice ``s[start:end]``. Optional " @@ -4682,14 +4696,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3086 +#: ../../library/stdtypes.rst:3094 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:3090 +#: ../../library/stdtypes.rst:3098 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -4697,13 +4711,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:3100 +#: ../../library/stdtypes.rst:3108 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:3113 +#: ../../library/stdtypes.rst:3121 msgid "" "Return a bytes or bytearray object which is the concatenation of the binary " "data sequences in *iterable*. A :exc:`TypeError` will be raised if there " @@ -4713,7 +4727,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:3124 +#: ../../library/stdtypes.rst:3132 msgid "" "This static method returns a translation table usable for :meth:`bytes." "translate` that will map each character in *from* into the character at the " @@ -4721,7 +4735,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:3135 +#: ../../library/stdtypes.rst:3143 msgid "" "Split the sequence at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4730,24 +4744,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:3142 ../../library/stdtypes.rst:3199 +#: ../../library/stdtypes.rst:3150 ../../library/stdtypes.rst:3207 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3148 +#: ../../library/stdtypes.rst:3156 msgid "" "Return a copy of the sequence with all occurrences of subsequence *old* " "replaced by *new*. If the optional argument *count* is given, only the " "first *count* occurrences are replaced." msgstr "" -#: ../../library/stdtypes.rst:3152 +#: ../../library/stdtypes.rst:3160 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3164 +#: ../../library/stdtypes.rst:3172 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -4755,13 +4769,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:3179 +#: ../../library/stdtypes.rst:3187 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3192 +#: ../../library/stdtypes.rst:3200 msgid "" "Split the sequence at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4770,7 +4784,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:3205 +#: ../../library/stdtypes.rst:3213 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -4778,11 +4792,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3210 +#: ../../library/stdtypes.rst:3218 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3216 +#: ../../library/stdtypes.rst:3224 msgid "" "Return a copy of the bytes or bytearray object where all bytes occurring in " "the optional argument *delete* are removed, and the remaining bytes have " @@ -4790,18 +4804,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3221 +#: ../../library/stdtypes.rst:3229 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3224 +#: ../../library/stdtypes.rst:3232 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3227 +#: ../../library/stdtypes.rst:3235 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -4809,11 +4823,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3230 +#: ../../library/stdtypes.rst:3238 msgid "*delete* is now supported as a keyword argument." msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3234 +#: ../../library/stdtypes.rst:3242 msgid "" "The following methods on bytes and bytearray objects have default behaviours " "that assume the use of ASCII compatible binary formats, but can still be " @@ -4822,7 +4836,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3243 +#: ../../library/stdtypes.rst:3251 msgid "" "Return a copy of the object centered in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4830,7 +4844,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3257 +#: ../../library/stdtypes.rst:3265 msgid "" "Return a copy of the object left justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4838,7 +4852,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3271 +#: ../../library/stdtypes.rst:3279 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -4847,7 +4861,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3277 +#: ../../library/stdtypes.rst:3285 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -4859,14 +4873,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3282 +#: ../../library/stdtypes.rst:3290 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removeprefix` for a method that will remove a " "single prefix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3287 +#: ../../library/stdtypes.rst:3295 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -4878,7 +4892,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3301 +#: ../../library/stdtypes.rst:3309 msgid "" "Return a copy of the object right justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4886,7 +4900,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3315 +#: ../../library/stdtypes.rst:3323 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are " @@ -4896,7 +4910,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3326 +#: ../../library/stdtypes.rst:3334 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -4905,7 +4919,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3332 +#: ../../library/stdtypes.rst:3340 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -4917,14 +4931,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3337 +#: ../../library/stdtypes.rst:3345 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removesuffix` for a method that will remove a " "single suffix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3342 +#: ../../library/stdtypes.rst:3350 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -4936,7 +4950,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3356 +#: ../../library/stdtypes.rst:3364 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given and non-negative, at most " @@ -4945,7 +4959,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3362 +#: ../../library/stdtypes.rst:3370 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " @@ -4956,7 +4970,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3372 +#: ../../library/stdtypes.rst:3380 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -4976,7 +4990,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3381 +#: ../../library/stdtypes.rst:3389 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive ASCII whitespace are regarded as a single " @@ -4986,7 +5000,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3391 +#: ../../library/stdtypes.rst:3399 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -5002,7 +5016,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3402 +#: ../../library/stdtypes.rst:3410 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *bytes* argument is a binary sequence specifying the set of " @@ -5011,7 +5025,7 @@ msgid "" "or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3409 +#: ../../library/stdtypes.rst:3417 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -5023,13 +5037,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3414 +#: ../../library/stdtypes.rst:3422 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3423 +#: ../../library/stdtypes.rst:3431 msgid "" "The following methods on bytes and bytearray objects assume the use of ASCII " "compatible binary formats and should not be applied to arbitrary binary " @@ -5037,14 +5051,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3431 +#: ../../library/stdtypes.rst:3439 msgid "" "Return a copy of the sequence with each byte interpreted as an ASCII " "character, and the first byte capitalized and the rest lowercased. Non-ASCII " "byte values are passed through unchanged." msgstr "" -#: ../../library/stdtypes.rst:3444 +#: ../../library/stdtypes.rst:3452 msgid "" "Return a copy of the sequence where all ASCII tab characters are replaced by " "one or more ASCII spaces, depending on the current column and the given tab " @@ -5060,7 +5074,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3458 +#: ../../library/stdtypes.rst:3466 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -5072,7 +5086,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3472 +#: ../../library/stdtypes.rst:3480 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -5081,7 +5095,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3480 +#: ../../library/stdtypes.rst:3488 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -5093,7 +5107,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3489 +#: ../../library/stdtypes.rst:3497 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -5101,7 +5115,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3496 +#: ../../library/stdtypes.rst:3504 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -5113,20 +5127,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3505 +#: ../../library/stdtypes.rst:3513 msgid "" "Return ``True`` if the sequence is empty or all bytes in the sequence are " "ASCII, ``False`` otherwise. ASCII bytes are in the range 0-0x7F." msgstr "" -#: ../../library/stdtypes.rst:3515 +#: ../../library/stdtypes.rst:3523 msgid "" "Return ``True`` if all bytes in the sequence are ASCII decimal digits and " "the sequence is not empty, ``False`` otherwise. ASCII decimal digits are " "those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3521 +#: ../../library/stdtypes.rst:3529 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -5138,13 +5152,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3530 +#: ../../library/stdtypes.rst:3538 msgid "" "Return ``True`` if there is at least one lowercase ASCII character in the " "sequence and no uppercase ASCII characters, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:3535 +#: ../../library/stdtypes.rst:3543 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -5156,16 +5170,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3540 ../../library/stdtypes.rst:3582 -#: ../../library/stdtypes.rst:3598 ../../library/stdtypes.rst:3648 -#: ../../library/stdtypes.rst:3717 +#: ../../library/stdtypes.rst:3548 ../../library/stdtypes.rst:3590 +#: ../../library/stdtypes.rst:3606 ../../library/stdtypes.rst:3656 +#: ../../library/stdtypes.rst:3725 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3548 +#: ../../library/stdtypes.rst:3556 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -5173,14 +5187,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3557 +#: ../../library/stdtypes.rst:3565 msgid "" "Return ``True`` if the sequence is ASCII titlecase and the sequence is not " "empty, ``False`` otherwise. See :meth:`bytes.title` for more details on the " "definition of \"titlecase\"." msgstr "" -#: ../../library/stdtypes.rst:3563 +#: ../../library/stdtypes.rst:3571 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -5192,14 +5206,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3572 +#: ../../library/stdtypes.rst:3580 msgid "" "Return ``True`` if there is at least one uppercase alphabetic ASCII " "character in the sequence and no lowercase ASCII characters, ``False`` " "otherwise." msgstr "" -#: ../../library/stdtypes.rst:3577 +#: ../../library/stdtypes.rst:3585 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -5211,13 +5225,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3590 +#: ../../library/stdtypes.rst:3598 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3595 +#: ../../library/stdtypes.rst:3603 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -5225,7 +5239,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3615 +#: ../../library/stdtypes.rst:3623 msgid "" "Return a list of the lines in the binary sequence, breaking at ASCII line " "boundaries. This method uses the :term:`universal newlines` approach to " @@ -5233,7 +5247,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3622 +#: ../../library/stdtypes.rst:3630 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -5245,14 +5259,14 @@ msgstr "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: ../../library/stdtypes.rst:3627 +#: ../../library/stdtypes.rst:3635 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:3631 +#: ../../library/stdtypes.rst:3639 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -5264,13 +5278,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3640 +#: ../../library/stdtypes.rst:3648 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" -#: ../../library/stdtypes.rst:3645 +#: ../../library/stdtypes.rst:3653 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -5278,7 +5292,7 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3652 +#: ../../library/stdtypes.rst:3660 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -5286,14 +5300,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3666 +#: ../../library/stdtypes.rst:3674 msgid "" "Return a titlecased version of the binary sequence where words start with an " "uppercase ASCII character and the remaining characters are lowercase. " "Uncased byte values are left unmodified." msgstr "" -#: ../../library/stdtypes.rst:3672 +#: ../../library/stdtypes.rst:3680 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -5301,7 +5315,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3675 +#: ../../library/stdtypes.rst:3683 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -5309,7 +5323,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3685 +#: ../../library/stdtypes.rst:3693 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -5317,12 +5331,12 @@ msgstr "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:3696 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3690 +#: ../../library/stdtypes.rst:3698 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -5344,13 +5358,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:3709 +#: ../../library/stdtypes.rst:3717 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3714 +#: ../../library/stdtypes.rst:3722 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -5358,7 +5372,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:3730 +#: ../../library/stdtypes.rst:3738 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -5367,7 +5381,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3738 +#: ../../library/stdtypes.rst:3746 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5379,11 +5393,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:3752 +#: ../../library/stdtypes.rst:3760 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:3769 +#: ../../library/stdtypes.rst:3777 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -5391,7 +5405,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:3774 +#: ../../library/stdtypes.rst:3782 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -5401,7 +5415,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:3781 +#: ../../library/stdtypes.rst:3789 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -5409,7 +5423,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3815 +#: ../../library/stdtypes.rst:3823 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the bytes object *must* include a parenthesised mapping key into " @@ -5417,73 +5431,73 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3889 +#: ../../library/stdtypes.rst:3897 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:3892 +#: ../../library/stdtypes.rst:3900 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:3892 +#: ../../library/stdtypes.rst:3900 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:3896 +#: ../../library/stdtypes.rst:3904 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3899 +#: ../../library/stdtypes.rst:3907 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:3902 +#: ../../library/stdtypes.rst:3910 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3902 +#: ../../library/stdtypes.rst:3910 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:3937 +#: ../../library/stdtypes.rst:3945 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3940 +#: ../../library/stdtypes.rst:3948 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3952 +#: ../../library/stdtypes.rst:3960 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:3959 +#: ../../library/stdtypes.rst:3967 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:3961 +#: ../../library/stdtypes.rst:3969 msgid "" ":class:`memoryview` objects allow Python code to access the internal data of " "an object that supports the :ref:`buffer protocol ` without " "copying." msgstr "" -#: ../../library/stdtypes.rst:3967 +#: ../../library/stdtypes.rst:3975 msgid "" "Create a :class:`memoryview` that references *object*. *object* must " "support the buffer protocol. Built-in objects that support the buffer " "protocol include :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/stdtypes.rst:3971 +#: ../../library/stdtypes.rst:3979 msgid "" "A :class:`memoryview` has the notion of an *element*, which is the atomic " "memory unit handled by the originating *object*. For many simple types such " @@ -5491,32 +5505,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:3976 +#: ../../library/stdtypes.rst:3984 msgid "" "``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which " "is the nested list representation of the view. If ``view.ndim = 1``, this is " "equal to the number of elements in the view." msgstr "" -#: ../../library/stdtypes.rst:3980 +#: ../../library/stdtypes.rst:3988 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:3983 +#: ../../library/stdtypes.rst:3991 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:3986 +#: ../../library/stdtypes.rst:3994 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:3989 +#: ../../library/stdtypes.rst:3997 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -5538,7 +5552,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:3999 +#: ../../library/stdtypes.rst:4007 msgid "" "If :class:`~memoryview.format` is one of the native format specifiers from " "the :mod:`struct` module, indexing with an integer or a tuple of integers is " @@ -5549,11 +5563,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:4008 +#: ../../library/stdtypes.rst:4016 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:4010 +#: ../../library/stdtypes.rst:4018 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -5575,13 +5589,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:4020 +#: ../../library/stdtypes.rst:4028 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:4023 +#: ../../library/stdtypes.rst:4031 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -5621,14 +5635,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:4041 +#: ../../library/stdtypes.rst:4049 msgid "" "One-dimensional memoryviews of :term:`hashable` (read-only) types with " "formats 'B', 'b' or 'c' are also hashable. The hash is defined as ``hash(m) " "== hash(m.tobytes())``::" msgstr "" -#: ../../library/stdtypes.rst:4045 +#: ../../library/stdtypes.rst:4053 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -5646,40 +5660,40 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:4053 +#: ../../library/stdtypes.rst:4061 msgid "" "One-dimensional memoryviews can now be sliced. One-dimensional memoryviews " "with formats 'B', 'b' or 'c' are now :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4057 +#: ../../library/stdtypes.rst:4065 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:4061 +#: ../../library/stdtypes.rst:4069 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:4064 +#: ../../library/stdtypes.rst:4072 msgid ":class:`memoryview` has several methods:" msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:4068 +#: ../../library/stdtypes.rst:4076 msgid "" "A memoryview and a :pep:`3118` exporter are equal if their shapes are " "equivalent and if all corresponding values are equal when the operands' " "respective format codes are interpreted using :mod:`struct` syntax." msgstr "" -#: ../../library/stdtypes.rst:4072 +#: ../../library/stdtypes.rst:4080 msgid "" "For the subset of :mod:`struct` format strings currently supported by :meth:" "`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" msgstr "" -#: ../../library/stdtypes.rst:4075 +#: ../../library/stdtypes.rst:4083 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -5713,14 +5727,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:4091 +#: ../../library/stdtypes.rst:4099 msgid "" "If either format string is not supported by the :mod:`struct` module, then " "the objects will always compare as unequal (even if the format strings and " "buffer contents are identical)::" msgstr "" -#: ../../library/stdtypes.rst:4095 +#: ../../library/stdtypes.rst:4103 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -5746,25 +5760,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:4107 +#: ../../library/stdtypes.rst:4115 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:4110 +#: ../../library/stdtypes.rst:4118 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:4116 +#: ../../library/stdtypes.rst:4124 msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" -#: ../../library/stdtypes.rst:4119 +#: ../../library/stdtypes.rst:4127 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -5778,7 +5792,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:4125 +#: ../../library/stdtypes.rst:4133 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -5786,7 +5800,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:4130 +#: ../../library/stdtypes.rst:4138 msgid "" "*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the " "original array is converted to C or Fortran order. For contiguous views, 'A' " @@ -5795,13 +5809,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:4140 +#: ../../library/stdtypes.rst:4148 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:4143 +#: ../../library/stdtypes.rst:4151 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -5811,18 +5825,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:4149 +#: ../../library/stdtypes.rst:4157 msgid "" "Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:4156 +#: ../../library/stdtypes.rst:4164 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:4166 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -5840,19 +5854,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:4166 +#: ../../library/stdtypes.rst:4174 msgid "" ":meth:`tolist` now supports all single character native formats in :mod:" "`struct` module syntax as well as multi-dimensional representations." msgstr "" -#: ../../library/stdtypes.rst:4173 +#: ../../library/stdtypes.rst:4181 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:4176 +#: ../../library/stdtypes.rst:4184 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -5878,7 +5892,7 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:4192 +#: ../../library/stdtypes.rst:4200 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " "objects take special actions when a view is held on them (for example, a :" @@ -5887,14 +5901,14 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:4198 +#: ../../library/stdtypes.rst:4206 msgid "" "After this method has been called, any further operation on the view raises " "a :class:`ValueError` (except :meth:`release` itself which can be called " "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:4202 +#: ../../library/stdtypes.rst:4210 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -5910,13 +5924,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4209 +#: ../../library/stdtypes.rst:4217 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4212 +#: ../../library/stdtypes.rst:4220 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -5936,7 +5950,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4226 +#: ../../library/stdtypes.rst:4234 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -5945,7 +5959,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4232 +#: ../../library/stdtypes.rst:4240 msgid "" "The destination format is restricted to a single element native format in :" "mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " @@ -5953,11 +5967,11 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4238 +#: ../../library/stdtypes.rst:4246 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4240 +#: ../../library/stdtypes.rst:4248 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -6001,11 +6015,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4261 +#: ../../library/stdtypes.rst:4269 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4263 +#: ../../library/stdtypes.rst:4271 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -6029,11 +6043,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4274 +#: ../../library/stdtypes.rst:4282 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4276 +#: ../../library/stdtypes.rst:4284 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -6083,11 +6097,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4300 +#: ../../library/stdtypes.rst:4308 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4302 +#: ../../library/stdtypes.rst:4310 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -6109,19 +6123,19 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4314 +#: ../../library/stdtypes.rst:4322 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4317 +#: ../../library/stdtypes.rst:4325 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4321 +#: ../../library/stdtypes.rst:4329 msgid "The underlying object of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4323 +#: ../../library/stdtypes.rst:4331 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -6133,14 +6147,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4332 +#: ../../library/stdtypes.rst:4340 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" -#: ../../library/stdtypes.rst:4336 +#: ../../library/stdtypes.rst:4344 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -6172,11 +6186,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4351 +#: ../../library/stdtypes.rst:4359 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4353 +#: ../../library/stdtypes.rst:4361 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -6200,11 +6214,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4368 +#: ../../library/stdtypes.rst:4376 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4372 +#: ../../library/stdtypes.rst:4380 msgid "" "A string containing the format (in :mod:`struct` module style) for each " "element in the view. A memoryview can be created from exporters with " @@ -6212,17 +6226,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4377 +#: ../../library/stdtypes.rst:4385 msgid "" "format ``'B'`` is now handled according to the struct module syntax. This " "means that ``memoryview(b'abc')[0] == b'abc'[0] == 97``." msgstr "" -#: ../../library/stdtypes.rst:4383 +#: ../../library/stdtypes.rst:4391 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4385 +#: ../../library/stdtypes.rst:4393 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -6242,49 +6256,49 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4396 +#: ../../library/stdtypes.rst:4404 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4401 +#: ../../library/stdtypes.rst:4409 msgid "" "A tuple of integers the length of :attr:`ndim` giving the shape of the " "memory as an N-dimensional array." msgstr "" -#: ../../library/stdtypes.rst:4404 ../../library/stdtypes.rst:4412 +#: ../../library/stdtypes.rst:4412 ../../library/stdtypes.rst:4420 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4409 +#: ../../library/stdtypes.rst:4417 msgid "" "A tuple of integers the length of :attr:`ndim` giving the size in bytes to " "access each element for each dimension of the array." msgstr "" -#: ../../library/stdtypes.rst:4417 +#: ../../library/stdtypes.rst:4425 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:4429 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4427 +#: ../../library/stdtypes.rst:4435 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4433 +#: ../../library/stdtypes.rst:4441 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4441 +#: ../../library/stdtypes.rst:4449 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4445 +#: ../../library/stdtypes.rst:4453 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -6294,7 +6308,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4452 +#: ../../library/stdtypes.rst:4460 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " @@ -6302,7 +6316,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4457 +#: ../../library/stdtypes.rst:4465 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -6314,18 +6328,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:4465 +#: ../../library/stdtypes.rst:4473 msgid "" "Non-empty sets (not frozensets) can be created by placing a comma-separated " "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" -#: ../../library/stdtypes.rst:4469 +#: ../../library/stdtypes.rst:4477 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4474 +#: ../../library/stdtypes.rst:4482 msgid "" "Return a new set or frozenset object whose elements are taken from " "*iterable*. The elements of a set must be :term:`hashable`. To represent " @@ -6333,92 +6347,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4480 +#: ../../library/stdtypes.rst:4488 msgid "Sets can be created by several means:" msgstr "集合可以以多種方式建立:" -#: ../../library/stdtypes.rst:4482 +#: ../../library/stdtypes.rst:4490 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4483 +#: ../../library/stdtypes.rst:4491 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4484 +#: ../../library/stdtypes.rst:4492 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4486 +#: ../../library/stdtypes.rst:4494 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4491 +#: ../../library/stdtypes.rst:4499 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4495 +#: ../../library/stdtypes.rst:4503 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4499 +#: ../../library/stdtypes.rst:4507 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4503 +#: ../../library/stdtypes.rst:4511 msgid "" "Return ``True`` if the set has no elements in common with *other*. Sets are " "disjoint if and only if their intersection is the empty set." msgstr "" -#: ../../library/stdtypes.rst:4509 +#: ../../library/stdtypes.rst:4517 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4513 +#: ../../library/stdtypes.rst:4521 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4519 +#: ../../library/stdtypes.rst:4527 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4523 +#: ../../library/stdtypes.rst:4531 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4529 +#: ../../library/stdtypes.rst:4537 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4534 +#: ../../library/stdtypes.rst:4542 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4539 +#: ../../library/stdtypes.rst:4547 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4544 +#: ../../library/stdtypes.rst:4552 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4548 +#: ../../library/stdtypes.rst:4556 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4551 +#: ../../library/stdtypes.rst:4559 msgid "" "Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" "meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" @@ -6428,7 +6442,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4558 +#: ../../library/stdtypes.rst:4566 msgid "" "Both :class:`set` and :class:`frozenset` support set to set comparisons. Two " "sets are equal if and only if every element of each set is contained in the " @@ -6438,14 +6452,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4565 +#: ../../library/stdtypes.rst:4573 msgid "" "Instances of :class:`set` are compared to instances of :class:`frozenset` " "based on their members. For example, ``set('abc') == frozenset('abc')`` " "returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``." msgstr "" -#: ../../library/stdtypes.rst:4569 +#: ../../library/stdtypes.rst:4577 msgid "" "The subset and equality comparisons do not generalize to a total ordering " "function. For example, any two nonempty disjoint sets are not equal and are " @@ -6453,71 +6467,71 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4574 +#: ../../library/stdtypes.rst:4582 msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" -#: ../../library/stdtypes.rst:4577 +#: ../../library/stdtypes.rst:4585 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4579 +#: ../../library/stdtypes.rst:4587 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" -#: ../../library/stdtypes.rst:4583 +#: ../../library/stdtypes.rst:4591 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4589 +#: ../../library/stdtypes.rst:4597 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4594 +#: ../../library/stdtypes.rst:4602 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4599 +#: ../../library/stdtypes.rst:4607 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4604 +#: ../../library/stdtypes.rst:4612 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4608 +#: ../../library/stdtypes.rst:4616 msgid "Add element *elem* to the set." msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:4612 +#: ../../library/stdtypes.rst:4620 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4617 +#: ../../library/stdtypes.rst:4625 msgid "Remove element *elem* from the set if it is present." msgstr "如果 *elem* 存在於集合中則將其移除。" -#: ../../library/stdtypes.rst:4621 +#: ../../library/stdtypes.rst:4629 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4626 +#: ../../library/stdtypes.rst:4634 msgid "Remove all elements from the set." msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:4629 +#: ../../library/stdtypes.rst:4637 msgid "" "Note, the non-operator versions of the :meth:`update`, :meth:" "`intersection_update`, :meth:`difference_update`, and :meth:" @@ -6525,18 +6539,18 @@ msgid "" "argument." msgstr "" -#: ../../library/stdtypes.rst:4634 +#: ../../library/stdtypes.rst:4642 msgid "" "Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" "`remove`, and :meth:`discard` methods may be a set. To support searching " "for an equivalent frozenset, a temporary one is created from *elem*." msgstr "" -#: ../../library/stdtypes.rst:4643 +#: ../../library/stdtypes.rst:4651 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:4661 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -6545,7 +6559,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:4659 +#: ../../library/stdtypes.rst:4667 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -6554,33 +6568,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4670 +#: ../../library/stdtypes.rst:4678 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4673 +#: ../../library/stdtypes.rst:4681 msgid "Dictionaries can be created by several means:" msgstr "字典可以用數種方式建立:" -#: ../../library/stdtypes.rst:4675 +#: ../../library/stdtypes.rst:4683 msgid "" "Use a comma-separated list of ``key: value`` pairs within braces: ``{'jack': " "4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4677 +#: ../../library/stdtypes.rst:4685 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4678 +#: ../../library/stdtypes.rst:4686 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4681 +#: ../../library/stdtypes.rst:4689 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it defines a ``keys()`` method, a " @@ -6593,7 +6607,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4691 +#: ../../library/stdtypes.rst:4699 msgid "" "If keyword arguments are given, the keyword arguments and their values are " "added to the dictionary created from the positional argument. If a key " @@ -6601,13 +6615,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4696 ../../library/stdtypes.rst:4714 +#: ../../library/stdtypes.rst:4704 ../../library/stdtypes.rst:4722 msgid "" "Providing keyword arguments as in the first example only works for keys that " "are valid Python identifiers. Otherwise, any valid keys can be used." msgstr "" -#: ../../library/stdtypes.rst:4699 +#: ../../library/stdtypes.rst:4707 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " @@ -6616,7 +6630,7 @@ msgid "" "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4705 +#: ../../library/stdtypes.rst:4713 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -6636,13 +6650,13 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:4717 +#: ../../library/stdtypes.rst:4725 msgid "" "Dictionaries preserve insertion order. Note that updating a key does not " "affect the order. Keys added after deletion are inserted at the end. ::" msgstr "" -#: ../../library/stdtypes.rst:4720 +#: ../../library/stdtypes.rst:4728 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6674,33 +6688,33 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:4735 +#: ../../library/stdtypes.rst:4743 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4739 +#: ../../library/stdtypes.rst:4747 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:4744 +#: ../../library/stdtypes.rst:4752 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4748 +#: ../../library/stdtypes.rst:4756 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4752 +#: ../../library/stdtypes.rst:4760 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:4757 +#: ../../library/stdtypes.rst:4765 msgid "" "If a subclass of dict defines a method :meth:`__missing__` and *key* is not " "present, the ``d[key]`` operation calls that method with the key *key* as " @@ -6711,7 +6725,7 @@ msgid "" "an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:4765 +#: ../../library/stdtypes.rst:4773 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -6735,51 +6749,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:4776 +#: ../../library/stdtypes.rst:4784 msgid "" "The example above shows part of the implementation of :class:`collections." "Counter`. A different ``__missing__`` method is used by :class:`collections." "defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:4782 +#: ../../library/stdtypes.rst:4790 msgid "Set ``d[key]`` to *value*." msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:4786 +#: ../../library/stdtypes.rst:4794 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "從 *d* 中移除 ``d[key]``。若 *key* 不在對映中則引發 :exc:`KeyError`。" -#: ../../library/stdtypes.rst:4791 +#: ../../library/stdtypes.rst:4799 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:4795 +#: ../../library/stdtypes.rst:4803 msgid "Equivalent to ``not key in d``." msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:4799 +#: ../../library/stdtypes.rst:4807 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4804 +#: ../../library/stdtypes.rst:4812 msgid "Remove all items from the dictionary." msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:4808 +#: ../../library/stdtypes.rst:4816 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4812 +#: ../../library/stdtypes.rst:4820 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:4814 +#: ../../library/stdtypes.rst:4822 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -6788,70 +6802,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:4822 +#: ../../library/stdtypes.rst:4830 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4828 +#: ../../library/stdtypes.rst:4836 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4833 +#: ../../library/stdtypes.rst:4841 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:4839 +#: ../../library/stdtypes.rst:4847 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " "*default*. If *default* is not given and *key* is not in the dictionary, a :" "exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:4845 +#: ../../library/stdtypes.rst:4853 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -#: ../../library/stdtypes.rst:4848 +#: ../../library/stdtypes.rst:4856 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " "often used in set algorithms. If the dictionary is empty, calling :meth:" "`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4852 +#: ../../library/stdtypes.rst:4860 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:4858 +#: ../../library/stdtypes.rst:4866 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4865 +#: ../../library/stdtypes.rst:4873 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" -#: ../../library/stdtypes.rst:4873 +#: ../../library/stdtypes.rst:4881 msgid "" "Update the dictionary with the key/value pairs from *mapping* or *iterable* " "and *kwargs*, overwriting existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:4876 +#: ../../library/stdtypes.rst:4884 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -6860,20 +6874,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4884 +#: ../../library/stdtypes.rst:4892 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4887 +#: ../../library/stdtypes.rst:4895 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:4891 +#: ../../library/stdtypes.rst:4899 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -6883,25 +6897,25 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:4897 +#: ../../library/stdtypes.rst:4905 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:4913 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4911 +#: ../../library/stdtypes.rst:4919 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4913 +#: ../../library/stdtypes.rst:4921 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6923,21 +6937,21 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:4923 +#: ../../library/stdtypes.rst:4931 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4928 +#: ../../library/stdtypes.rst:4936 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4935 +#: ../../library/stdtypes.rst:4943 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4937 +#: ../../library/stdtypes.rst:4945 msgid "" "The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" "`dict.items` are *view objects*. They provide a dynamic view on the " @@ -6945,23 +6959,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4942 +#: ../../library/stdtypes.rst:4950 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4947 +#: ../../library/stdtypes.rst:4955 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4951 +#: ../../library/stdtypes.rst:4959 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4954 +#: ../../library/stdtypes.rst:4962 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -6969,39 +6983,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4959 +#: ../../library/stdtypes.rst:4967 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:4962 +#: ../../library/stdtypes.rst:4970 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4967 +#: ../../library/stdtypes.rst:4975 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:4972 +#: ../../library/stdtypes.rst:4980 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:4975 +#: ../../library/stdtypes.rst:4983 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4980 +#: ../../library/stdtypes.rst:4988 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4985 +#: ../../library/stdtypes.rst:4993 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -7015,11 +7029,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:4997 +#: ../../library/stdtypes.rst:5005 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:4999 +#: ../../library/stdtypes.rst:5007 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -7060,11 +7074,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:5041 +#: ../../library/stdtypes.rst:5049 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:5048 +#: ../../library/stdtypes.rst:5056 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -7075,7 +7089,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5064 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -7086,7 +7100,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5069 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -7095,7 +7109,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5073 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -7109,7 +7123,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:5075 +#: ../../library/stdtypes.rst:5083 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -7121,7 +7135,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:5080 +#: ../../library/stdtypes.rst:5088 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -7136,7 +7150,7 @@ msgstr "" "(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" "的任何例外。" -#: ../../library/stdtypes.rst:5087 +#: ../../library/stdtypes.rst:5095 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -7148,7 +7162,7 @@ msgstr "" "已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" "`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:5093 +#: ../../library/stdtypes.rst:5101 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -7160,7 +7174,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:5099 +#: ../../library/stdtypes.rst:5107 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -7175,7 +7189,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:5106 +#: ../../library/stdtypes.rst:5114 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -7187,7 +7201,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:5114 +#: ../../library/stdtypes.rst:5122 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -7195,7 +7209,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:5119 +#: ../../library/stdtypes.rst:5127 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -7203,11 +7217,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:5126 +#: ../../library/stdtypes.rst:5134 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:5132 +#: ../../library/stdtypes.rst:5140 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -7223,7 +7237,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:5142 +#: ../../library/stdtypes.rst:5150 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -7231,7 +7245,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:5145 +#: ../../library/stdtypes.rst:5153 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -7239,7 +7253,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:5148 +#: ../../library/stdtypes.rst:5156 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " @@ -7251,7 +7265,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:5154 +#: ../../library/stdtypes.rst:5162 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -7263,7 +7277,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:5160 +#: ../../library/stdtypes.rst:5168 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -7275,7 +7289,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:5166 +#: ../../library/stdtypes.rst:5174 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " "``y`` will also be an instance of ``re.Match``, but the return values of ``y." @@ -7288,7 +7302,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:5172 +#: ../../library/stdtypes.rst:5180 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -7297,7 +7311,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:5178 +#: ../../library/stdtypes.rst:5186 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -7307,7 +7321,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:5183 +#: ../../library/stdtypes.rst:5191 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -7315,7 +7329,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:5186 +#: ../../library/stdtypes.rst:5194 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -7326,7 +7340,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:5191 +#: ../../library/stdtypes.rst:5199 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -7334,7 +7348,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:5194 +#: ../../library/stdtypes.rst:5202 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -7342,7 +7356,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:5197 +#: ../../library/stdtypes.rst:5205 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -7354,7 +7368,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5202 +#: ../../library/stdtypes.rst:5210 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7366,7 +7380,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5216 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7376,13 +7390,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:5212 +#: ../../library/stdtypes.rst:5220 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5215 +#: ../../library/stdtypes.rst:5223 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7400,13 +7414,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5223 +#: ../../library/stdtypes.rst:5231 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5225 +#: ../../library/stdtypes.rst:5233 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7420,7 +7434,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5231 +#: ../../library/stdtypes.rst:5239 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -7428,7 +7442,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5234 +#: ../../library/stdtypes.rst:5242 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7440,7 +7454,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5239 +#: ../../library/stdtypes.rst:5247 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -7450,7 +7464,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5243 +#: ../../library/stdtypes.rst:5251 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7462,253 +7476,253 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5250 +#: ../../library/stdtypes.rst:5258 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5252 +#: ../../library/stdtypes.rst:5260 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5255 +#: ../../library/stdtypes.rst:5263 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5256 +#: ../../library/stdtypes.rst:5264 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5257 +#: ../../library/stdtypes.rst:5265 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5258 +#: ../../library/stdtypes.rst:5266 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5259 +#: ../../library/stdtypes.rst:5267 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5260 +#: ../../library/stdtypes.rst:5268 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5261 +#: ../../library/stdtypes.rst:5269 msgid ":class:`asyncio.Future`" msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5262 +#: ../../library/stdtypes.rst:5270 msgid ":class:`asyncio.Task`" msgstr ":class:`asyncio.Task`" -#: ../../library/stdtypes.rst:5263 +#: ../../library/stdtypes.rst:5271 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5264 +#: ../../library/stdtypes.rst:5272 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5265 +#: ../../library/stdtypes.rst:5273 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5266 +#: ../../library/stdtypes.rst:5274 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5267 +#: ../../library/stdtypes.rst:5275 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5268 +#: ../../library/stdtypes.rst:5276 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5269 +#: ../../library/stdtypes.rst:5277 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5270 +#: ../../library/stdtypes.rst:5278 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5271 +#: ../../library/stdtypes.rst:5279 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5272 +#: ../../library/stdtypes.rst:5280 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5273 +#: ../../library/stdtypes.rst:5281 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5274 +#: ../../library/stdtypes.rst:5282 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5275 +#: ../../library/stdtypes.rst:5283 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5276 +#: ../../library/stdtypes.rst:5284 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5277 +#: ../../library/stdtypes.rst:5285 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5278 +#: ../../library/stdtypes.rst:5286 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5279 +#: ../../library/stdtypes.rst:5287 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5280 +#: ../../library/stdtypes.rst:5288 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5281 +#: ../../library/stdtypes.rst:5289 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5282 +#: ../../library/stdtypes.rst:5290 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5283 +#: ../../library/stdtypes.rst:5291 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5284 +#: ../../library/stdtypes.rst:5292 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5285 +#: ../../library/stdtypes.rst:5293 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5286 +#: ../../library/stdtypes.rst:5294 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5287 +#: ../../library/stdtypes.rst:5295 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5288 +#: ../../library/stdtypes.rst:5296 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5289 +#: ../../library/stdtypes.rst:5297 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5290 +#: ../../library/stdtypes.rst:5298 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5291 +#: ../../library/stdtypes.rst:5299 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5292 +#: ../../library/stdtypes.rst:5300 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5293 +#: ../../library/stdtypes.rst:5301 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5294 +#: ../../library/stdtypes.rst:5302 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5295 +#: ../../library/stdtypes.rst:5303 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5296 +#: ../../library/stdtypes.rst:5304 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5297 +#: ../../library/stdtypes.rst:5305 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5298 +#: ../../library/stdtypes.rst:5306 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5299 +#: ../../library/stdtypes.rst:5307 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5300 +#: ../../library/stdtypes.rst:5308 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5301 +#: ../../library/stdtypes.rst:5309 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5302 +#: ../../library/stdtypes.rst:5310 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5303 +#: ../../library/stdtypes.rst:5311 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5304 +#: ../../library/stdtypes.rst:5312 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5305 +#: ../../library/stdtypes.rst:5313 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5306 +#: ../../library/stdtypes.rst:5314 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5307 +#: ../../library/stdtypes.rst:5315 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5308 +#: ../../library/stdtypes.rst:5316 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5309 +#: ../../library/stdtypes.rst:5317 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5310 +#: ../../library/stdtypes.rst:5318 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5315 +#: ../../library/stdtypes.rst:5323 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5317 +#: ../../library/stdtypes.rst:5325 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5321 +#: ../../library/stdtypes.rst:5329 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5323 +#: ../../library/stdtypes.rst:5331 msgid "" ">>> list[int].__origin__\n" "" @@ -7716,7 +7730,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5329 +#: ../../library/stdtypes.rst:5337 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " @@ -7725,7 +7739,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5333 +#: ../../library/stdtypes.rst:5341 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -7733,7 +7747,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5339 +#: ../../library/stdtypes.rst:5347 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -7741,7 +7755,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5342 +#: ../../library/stdtypes.rst:5350 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -7755,7 +7769,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5350 +#: ../../library/stdtypes.rst:5358 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -7765,7 +7779,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5357 +#: ../../library/stdtypes.rst:5365 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -7773,19 +7787,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5373 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5366 +#: ../../library/stdtypes.rst:5374 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5368 +#: ../../library/stdtypes.rst:5376 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5369 +#: ../../library/stdtypes.rst:5377 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -7794,7 +7808,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5373 +#: ../../library/stdtypes.rst:5381 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -7802,18 +7816,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:5374 +#: ../../library/stdtypes.rst:5382 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5383 +#: ../../library/stdtypes.rst:5391 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5389 +#: ../../library/stdtypes.rst:5397 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -7826,7 +7840,7 @@ msgstr "" "釋 (type annotation) `。與 :data:`typing.Union` 相比,聯合型別運" "算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5396 +#: ../../library/stdtypes.rst:5404 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " @@ -7837,7 +7851,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5401 +#: ../../library/stdtypes.rst:5409 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -7845,7 +7859,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5406 +#: ../../library/stdtypes.rst:5414 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -7858,58 +7872,58 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5414 +#: ../../library/stdtypes.rst:5422 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5416 +#: ../../library/stdtypes.rst:5424 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5418 +#: ../../library/stdtypes.rst:5426 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5420 +#: ../../library/stdtypes.rst:5428 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5422 +#: ../../library/stdtypes.rst:5430 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5424 +#: ../../library/stdtypes.rst:5432 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5426 +#: ../../library/stdtypes.rst:5434 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5428 +#: ../../library/stdtypes.rst:5436 msgid "It is compatible with :data:`typing.Union`::" msgstr "它與 :data:`typing.Union` 相容: ::" -#: ../../library/stdtypes.rst:5430 +#: ../../library/stdtypes.rst:5438 msgid "int | str == typing.Union[int, str]" msgstr "int | str == typing.Union[int, str]" -#: ../../library/stdtypes.rst:5432 +#: ../../library/stdtypes.rst:5440 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5434 +#: ../../library/stdtypes.rst:5442 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5439 +#: ../../library/stdtypes.rst:5447 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5442 +#: ../../library/stdtypes.rst:5450 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -7917,14 +7931,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5445 +#: ../../library/stdtypes.rst:5453 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5448 +#: ../../library/stdtypes.rst:5456 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -7934,7 +7948,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5455 +#: ../../library/stdtypes.rst:5463 msgid "" "The user-exposed type for the union object can be accessed from :data:`types." "UnionType` and used for :func:`isinstance` checks. An object cannot be " @@ -7943,7 +7957,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." "UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別來實例化: ::" -#: ../../library/stdtypes.rst:5459 +#: ../../library/stdtypes.rst:5467 msgid "" ">>> import types\n" ">>> isinstance(int | str, types.UnionType)\n" @@ -7961,7 +7975,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'types.UnionType' instances" -#: ../../library/stdtypes.rst:5468 +#: ../../library/stdtypes.rst:5476 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -7970,7 +7984,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5472 +#: ../../library/stdtypes.rst:5480 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -7996,25 +8010,25 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5488 +#: ../../library/stdtypes.rst:5496 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5496 +#: ../../library/stdtypes.rst:5504 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:5498 +#: ../../library/stdtypes.rst:5506 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5505 +#: ../../library/stdtypes.rst:5513 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5507 +#: ../../library/stdtypes.rst:5515 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " @@ -8025,7 +8039,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5514 +#: ../../library/stdtypes.rst:5522 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -8036,32 +8050,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5522 +#: ../../library/stdtypes.rst:5530 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5530 +#: ../../library/stdtypes.rst:5538 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:5532 +#: ../../library/stdtypes.rst:5540 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:5538 +#: ../../library/stdtypes.rst:5546 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5540 +#: ../../library/stdtypes.rst:5548 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5543 +#: ../../library/stdtypes.rst:5551 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -8069,15 +8083,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5547 +#: ../../library/stdtypes.rst:5555 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5553 +#: ../../library/stdtypes.rst:5561 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:5557 +#: ../../library/stdtypes.rst:5565 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -8085,7 +8099,7 @@ msgid "" "Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5562 +#: ../../library/stdtypes.rst:5570 msgid "" "If you access a method (a function defined in a class namespace) through an " "instance, you get a special object: a :dfn:`bound method` (also called :ref:" @@ -8098,7 +8112,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5573 +#: ../../library/stdtypes.rst:5581 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -8109,7 +8123,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5581 +#: ../../library/stdtypes.rst:5589 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -8137,15 +8151,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5596 +#: ../../library/stdtypes.rst:5604 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5612 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5610 +#: ../../library/stdtypes.rst:5618 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -8155,7 +8169,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5617 +#: ../../library/stdtypes.rst:5625 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -8164,21 +8178,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5624 +#: ../../library/stdtypes.rst:5632 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5627 +#: ../../library/stdtypes.rst:5635 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5633 +#: ../../library/stdtypes.rst:5641 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5639 +#: ../../library/stdtypes.rst:5647 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -8186,30 +8200,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5644 +#: ../../library/stdtypes.rst:5652 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5650 +#: ../../library/stdtypes.rst:5658 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5652 +#: ../../library/stdtypes.rst:5660 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5656 +#: ../../library/stdtypes.rst:5664 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5663 +#: ../../library/stdtypes.rst:5671 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:5665 +#: ../../library/stdtypes.rst:5673 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " "no special operations. There is exactly one ellipsis object, named :const:" @@ -8217,15 +8231,15 @@ msgid "" "`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5670 +#: ../../library/stdtypes.rst:5678 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5676 +#: ../../library/stdtypes.rst:5684 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5678 +#: ../../library/stdtypes.rst:5686 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " @@ -8233,64 +8247,64 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5683 +#: ../../library/stdtypes.rst:5691 msgid "It is written as :code:`NotImplemented`." msgstr "" -#: ../../library/stdtypes.rst:5689 +#: ../../library/stdtypes.rst:5697 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5699 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5699 +#: ../../library/stdtypes.rst:5707 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5701 +#: ../../library/stdtypes.rst:5709 msgid "" "The implementation adds a few special read-only attributes to several object " "types, where they are relevant. Some of these are not reported by the :func:" "`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5708 +#: ../../library/stdtypes.rst:5716 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5714 +#: ../../library/stdtypes.rst:5722 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5722 +#: ../../library/stdtypes.rst:5730 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5727 +#: ../../library/stdtypes.rst:5735 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5732 +#: ../../library/stdtypes.rst:5740 msgid "" "The :ref:`type parameters ` of generic classes, functions, and :" "ref:`type aliases `. For classes and functions that are not " "generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:5742 +#: ../../library/stdtypes.rst:5750 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5744 +#: ../../library/stdtypes.rst:5752 msgid "" "CPython has a global limit for converting between :class:`int` and :class:" "`str` to mitigate denial of service attacks. This limit *only* applies to " @@ -8298,7 +8312,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5749 +#: ../../library/stdtypes.rst:5757 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -8308,24 +8322,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5756 +#: ../../library/stdtypes.rst:5764 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5758 +#: ../../library/stdtypes.rst:5766 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:5762 +#: ../../library/stdtypes.rst:5770 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5764 +#: ../../library/stdtypes.rst:5772 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8349,7 +8363,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:5784 +#: ../../library/stdtypes.rst:5792 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -8357,11 +8371,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5789 +#: ../../library/stdtypes.rst:5797 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5791 +#: ../../library/stdtypes.rst:5799 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8379,84 +8393,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:5804 +#: ../../library/stdtypes.rst:5812 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:5806 +#: ../../library/stdtypes.rst:5814 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5809 +#: ../../library/stdtypes.rst:5817 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:5810 +#: ../../library/stdtypes.rst:5818 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5811 +#: ../../library/stdtypes.rst:5819 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5812 +#: ../../library/stdtypes.rst:5820 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5813 +#: ../../library/stdtypes.rst:5821 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5816 +#: ../../library/stdtypes.rst:5824 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5818 +#: ../../library/stdtypes.rst:5826 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5819 +#: ../../library/stdtypes.rst:5827 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:5820 +#: ../../library/stdtypes.rst:5828 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:5821 +#: ../../library/stdtypes.rst:5829 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5822 +#: ../../library/stdtypes.rst:5830 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5823 +#: ../../library/stdtypes.rst:5831 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5826 +#: ../../library/stdtypes.rst:5834 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:5828 +#: ../../library/stdtypes.rst:5836 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:5831 +#: ../../library/stdtypes.rst:5839 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:5834 +#: ../../library/stdtypes.rst:5842 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8464,7 +8478,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:5836 +#: ../../library/stdtypes.rst:5844 msgid "" ":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" "`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " @@ -8473,38 +8487,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:5842 +#: ../../library/stdtypes.rst:5850 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5845 +#: ../../library/stdtypes.rst:5853 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:5849 +#: ../../library/stdtypes.rst:5857 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5851 +#: ../../library/stdtypes.rst:5859 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5853 +#: ../../library/stdtypes.rst:5861 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:5860 +#: ../../library/stdtypes.rst:5868 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -8516,7 +8530,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5869 +#: ../../library/stdtypes.rst:5877 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -8524,11 +8538,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5875 +#: ../../library/stdtypes.rst:5883 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:5877 +#: ../../library/stdtypes.rst:5885 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -8536,11 +8550,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5882 +#: ../../library/stdtypes.rst:5890 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5884 +#: ../../library/stdtypes.rst:5892 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -8562,38 +8576,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:5894 +#: ../../library/stdtypes.rst:5902 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5898 +#: ../../library/stdtypes.rst:5906 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:5899 +#: ../../library/stdtypes.rst:5907 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5902 +#: ../../library/stdtypes.rst:5910 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5905 +#: ../../library/stdtypes.rst:5913 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5907 +#: ../../library/stdtypes.rst:5915 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:5910 +#: ../../library/stdtypes.rst:5918 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -8606,13 +8620,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:316 #: ../../library/stdtypes.rst:393 ../../library/stdtypes.rst:950 #: ../../library/stdtypes.rst:1120 ../../library/stdtypes.rst:1142 -#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4645 -#: ../../library/stdtypes.rst:5635 +#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:5643 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1157 -#: ../../library/stdtypes.rst:4645 +#: ../../library/stdtypes.rst:4653 msgid "statement" msgstr "statement(陳述式)" @@ -8734,11 +8748,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1142 ../../library/stdtypes.rst:1267 #: ../../library/stdtypes.rst:1346 ../../library/stdtypes.rst:1390 #: ../../library/stdtypes.rst:1511 ../../library/stdtypes.rst:1547 -#: ../../library/stdtypes.rst:2733 ../../library/stdtypes.rst:2752 -#: ../../library/stdtypes.rst:2861 ../../library/stdtypes.rst:4443 -#: ../../library/stdtypes.rst:4645 ../../library/stdtypes.rst:5128 -#: ../../library/stdtypes.rst:5385 ../../library/stdtypes.rst:5555 -#: ../../library/stdtypes.rst:5599 +#: ../../library/stdtypes.rst:2741 ../../library/stdtypes.rst:2760 +#: ../../library/stdtypes.rst:2869 ../../library/stdtypes.rst:4451 +#: ../../library/stdtypes.rst:4653 ../../library/stdtypes.rst:5136 +#: ../../library/stdtypes.rst:5393 ../../library/stdtypes.rst:5563 +#: ../../library/stdtypes.rst:5607 msgid "object" msgstr "object(物件)" @@ -8830,9 +8844,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:950 -#: ../../library/stdtypes.rst:1120 ../../library/stdtypes.rst:4645 -#: ../../library/stdtypes.rst:5606 ../../library/stdtypes.rst:5620 -#: ../../library/stdtypes.rst:5635 +#: ../../library/stdtypes.rst:1120 ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:5614 ../../library/stdtypes.rst:5628 +#: ../../library/stdtypes.rst:5643 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -8848,8 +8862,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2609 -#: ../../library/stdtypes.rst:3829 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2617 +#: ../../library/stdtypes.rst:3837 msgid "+ (plus)" msgstr "+ (加號)" @@ -8861,13 +8875,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2609 -#: ../../library/stdtypes.rst:3829 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2617 +#: ../../library/stdtypes.rst:3837 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2566 -#: ../../library/stdtypes.rst:3786 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2574 +#: ../../library/stdtypes.rst:3794 msgid "* (asterisk)" msgstr "* (星號)" @@ -8879,8 +8893,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2530 -#: ../../library/stdtypes.rst:3754 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2538 +#: ../../library/stdtypes.rst:3762 msgid "% (percent)" msgstr "% (百分號)" @@ -8890,7 +8904,7 @@ msgstr "**" #: ../../library/stdtypes.rst:316 ../../library/stdtypes.rst:393 #: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1157 -#: ../../library/stdtypes.rst:4645 +#: ../../library/stdtypes.rst:4653 msgid "operations on" msgstr "operations on(操作於)" @@ -8899,7 +8913,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:335 ../../library/stdtypes.rst:1615 -#: ../../library/stdtypes.rst:2733 ../../library/stdtypes.rst:5635 +#: ../../library/stdtypes.rst:2741 ../../library/stdtypes.rst:5643 msgid "module" msgstr "模組" @@ -8967,7 +8981,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:5051 msgid "protocol" msgstr "protocol(協定)" @@ -8993,7 +9007,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4645 +#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4653 msgid "len" msgstr "len" @@ -9070,14 +9084,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1142 ../../library/stdtypes.rst:2733 -#: ../../library/stdtypes.rst:2861 ../../library/stdtypes.rst:2935 -#: ../../library/stdtypes.rst:3754 +#: ../../library/stdtypes.rst:1142 ../../library/stdtypes.rst:2741 +#: ../../library/stdtypes.rst:2869 ../../library/stdtypes.rst:2943 +#: ../../library/stdtypes.rst:3762 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4645 -#: ../../library/stdtypes.rst:5385 ../../library/stdtypes.rst:5635 +#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4653 +#: ../../library/stdtypes.rst:5393 ../../library/stdtypes.rst:5643 msgid "type" msgstr "type(型別)" @@ -9085,7 +9099,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4645 +#: ../../library/stdtypes.rst:1157 ../../library/stdtypes.rst:4653 msgid "del" msgstr "del" @@ -9126,8 +9140,8 @@ msgid "range" msgstr "range" #: ../../library/stdtypes.rst:1511 ../../library/stdtypes.rst:1560 -#: ../../library/stdtypes.rst:1607 ../../library/stdtypes.rst:2384 -#: ../../library/stdtypes.rst:2530 +#: ../../library/stdtypes.rst:1607 ../../library/stdtypes.rst:2392 +#: ../../library/stdtypes.rst:2538 msgid "string" msgstr "string(字串)" @@ -9148,17 +9162,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1580 ../../library/stdtypes.rst:2725 +#: ../../library/stdtypes.rst:1580 ../../library/stdtypes.rst:2733 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1580 ../../library/stdtypes.rst:2733 -#: ../../library/stdtypes.rst:2752 ../../library/stdtypes.rst:2935 -#: ../../library/stdtypes.rst:3754 +#: ../../library/stdtypes.rst:1580 ../../library/stdtypes.rst:2741 +#: ../../library/stdtypes.rst:2760 ../../library/stdtypes.rst:2943 +#: ../../library/stdtypes.rst:3762 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1607 ../../library/stdtypes.rst:2935 +#: ../../library/stdtypes.rst:1607 ../../library/stdtypes.rst:2943 msgid "methods" msgstr "methods(方法)" @@ -9166,240 +9180,240 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2198 ../../library/stdtypes.rst:3608 +#: ../../library/stdtypes.rst:2206 ../../library/stdtypes.rst:3616 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2198 +#: ../../library/stdtypes.rst:2206 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid "! formatted string literal" msgstr "! formatted string literals(! 格式化字串常數)" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid "formatted string literals" msgstr "formatted string literals(格式化字串常數)" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid "! f-string" msgstr "! f-string(! f 字串)" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid "! (exclamation mark)" msgstr "! (驚嘆號)" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid "= (equals)" msgstr "= (等號)" -#: ../../library/stdtypes.rst:2384 +#: ../../library/stdtypes.rst:2392 msgid "for help in debugging using string literals" msgstr "" -#: ../../library/stdtypes.rst:2530 +#: ../../library/stdtypes.rst:2538 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2530 +#: ../../library/stdtypes.rst:2538 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2530 +#: ../../library/stdtypes.rst:2538 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2530 +#: ../../library/stdtypes.rst:2538 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2530 ../../library/stdtypes.rst:3754 +#: ../../library/stdtypes.rst:2538 ../../library/stdtypes.rst:3762 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2530 ../../library/stdtypes.rst:3754 +#: ../../library/stdtypes.rst:2538 ../../library/stdtypes.rst:3762 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2566 ../../library/stdtypes.rst:3786 +#: ../../library/stdtypes.rst:2574 ../../library/stdtypes.rst:3794 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2566 ../../library/stdtypes.rst:2609 -#: ../../library/stdtypes.rst:3786 ../../library/stdtypes.rst:3829 +#: ../../library/stdtypes.rst:2574 ../../library/stdtypes.rst:2617 +#: ../../library/stdtypes.rst:3794 ../../library/stdtypes.rst:3837 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2566 ../../library/stdtypes.rst:3786 +#: ../../library/stdtypes.rst:2574 ../../library/stdtypes.rst:3794 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2609 ../../library/stdtypes.rst:3829 +#: ../../library/stdtypes.rst:2617 ../../library/stdtypes.rst:3837 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2609 ../../library/stdtypes.rst:3829 +#: ../../library/stdtypes.rst:2617 ../../library/stdtypes.rst:3837 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2725 +#: ../../library/stdtypes.rst:2733 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2733 +#: ../../library/stdtypes.rst:2741 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2733 +#: ../../library/stdtypes.rst:2741 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3608 +#: ../../library/stdtypes.rst:3616 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3608 +#: ../../library/stdtypes.rst:3616 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:3754 +#: ../../library/stdtypes.rst:3762 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:3754 +#: ../../library/stdtypes.rst:3762 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:3754 +#: ../../library/stdtypes.rst:3762 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:3754 +#: ../../library/stdtypes.rst:3762 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4443 +#: ../../library/stdtypes.rst:4451 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4645 +#: ../../library/stdtypes.rst:4653 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4645 +#: ../../library/stdtypes.rst:4653 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:4755 +#: ../../library/stdtypes.rst:4763 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:5051 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:5051 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:5051 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:5116 +#: ../../library/stdtypes.rst:5124 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:5116 +#: ../../library/stdtypes.rst:5124 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:5128 +#: ../../library/stdtypes.rst:5136 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:5128 +#: ../../library/stdtypes.rst:5136 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:5128 +#: ../../library/stdtypes.rst:5136 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5385 +#: ../../library/stdtypes.rst:5393 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5385 +#: ../../library/stdtypes.rst:5393 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5555 +#: ../../library/stdtypes.rst:5563 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5599 +#: ../../library/stdtypes.rst:5607 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5599 +#: ../../library/stdtypes.rst:5607 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5606 +#: ../../library/stdtypes.rst:5614 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5606 +#: ../../library/stdtypes.rst:5614 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5620 +#: ../../library/stdtypes.rst:5628 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5620 +#: ../../library/stdtypes.rst:5628 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5659 +#: ../../library/stdtypes.rst:5667 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5659 +#: ../../library/stdtypes.rst:5667 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)"