diff --git a/c-api/arg.po b/c-api/arg.po index 33e118b052..d00a73959f 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-06 00:23+0000\n" +"POT-Creation-Date: 2022-12-24 00:13+0000\n" "PO-Revision-Date: 2022-10-16 03:21+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -66,36 +66,55 @@ msgid "" msgstr "" #: ../../c-api/arg.rst:37 +msgid "Unless otherwise stated, buffers are not NUL-terminated." +msgstr "" + +#: ../../c-api/arg.rst:39 +msgid "There are three ways strings and buffers can be converted to C:" +msgstr "" + +#: ../../c-api/arg.rst:41 msgid "" -"In general, when a format sets a pointer to a buffer, the buffer is managed " -"by the corresponding Python object, and the buffer shares the lifetime of " -"this object. You won't have to release any memory yourself. The only " -"exceptions are ``es``, ``es#``, ``et`` and ``et#``." +"Formats such as ``y*`` and ``s*`` fill a :c:type:`Py_buffer` structure. This " +"locks the underlying buffer so that the caller can subsequently use the " +"buffer even inside a :c:type:`Py_BEGIN_ALLOW_THREADS` block without the risk " +"of mutable data being resized or destroyed. As a result, **you have to " +"call** :c:func:`PyBuffer_Release` after you have finished processing the " +"data (or in any early abort case)." msgstr "" -#: ../../c-api/arg.rst:42 +#: ../../c-api/arg.rst:48 msgid "" -"However, when a :c:type:`Py_buffer` structure gets filled, the underlying " -"buffer is locked so that the caller can subsequently use the buffer even " -"inside a :c:type:`Py_BEGIN_ALLOW_THREADS` block without the risk of mutable " -"data being resized or destroyed. As a result, **you have to call** :c:func:" -"`PyBuffer_Release` after you have finished processing the data (or in any " -"early abort case)." +"The ``es``, ``es#``, ``et`` and ``et#`` formats allocate the result buffer. " +"**You have to call** :c:func:`PyMem_Free` after you have finished processing " +"the data (or in any early abort case)." msgstr "" -#: ../../c-api/arg.rst:49 -msgid "Unless otherwise stated, buffers are not NUL-terminated." +#: ../../c-api/arg.rst:54 +msgid "" +"Other formats take a :class:`str` or a read-only :term:`bytes-like object`, " +"such as :class:`bytes`, and provide a ``const char *`` pointer to its " +"buffer. In this case the buffer is \"borrowed\": it is managed by the " +"corresponding Python object, and shares the lifetime of this object. You " +"won't have to release any memory yourself." msgstr "" -#: ../../c-api/arg.rst:51 +#: ../../c-api/arg.rst:61 msgid "" -"Some formats require a read-only :term:`bytes-like object`, and set a " -"pointer instead of a buffer structure. They work by checking that the " -"object's :c:member:`PyBufferProcs.bf_releasebuffer` field is ``NULL``, which " -"disallows mutable objects such as :class:`bytearray`." +"To ensure that the underlying buffer may be safely borrowed, the object's :c:" +"member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. This " +"disallows common mutable objects such as :class:`bytearray`, but also some " +"read-only objects such as :class:`memoryview` of :class:`bytes`." msgstr "" -#: ../../c-api/arg.rst:58 +#: ../../c-api/arg.rst:67 +msgid "" +"Besides this ``bf_releasebuffer`` requirement, there is no check to verify " +"whether the input object is immutable (e.g. whether it would honor a request " +"for a writable buffer, or whether another thread can mutate the data)." +msgstr "" + +#: ../../c-api/arg.rst:73 msgid "" "For all ``#`` variants of formats (``s#``, ``y#``, etc.), the macro :c:macro:" "`PY_SSIZE_T_CLEAN` must be defined before including :file:`Python.h`. On " @@ -104,11 +123,11 @@ msgid "" "otherwise." msgstr "" -#: ../../c-api/arg.rst:83 +#: ../../c-api/arg.rst:98 msgid "``s`` (:class:`str`) [const char \\*]" msgstr "``s`` (:class:`str`) [const char \\*]" -#: ../../c-api/arg.rst:66 +#: ../../c-api/arg.rst:81 msgid "" "Convert a Unicode object to a C pointer to a character string. A pointer to " "an existing string is stored in the character pointer variable whose address " @@ -118,7 +137,7 @@ msgid "" "encoding. If this conversion fails, a :exc:`UnicodeError` is raised." msgstr "" -#: ../../c-api/arg.rst:75 +#: ../../c-api/arg.rst:90 msgid "" "This format does not accept :term:`bytes-like objects `. " "If you want to accept filesystem paths and convert them to C character " @@ -126,17 +145,17 @@ msgid "" "`PyUnicode_FSConverter` as *converter*." msgstr "" -#: ../../c-api/arg.rst:81 ../../c-api/arg.rst:148 +#: ../../c-api/arg.rst:96 ../../c-api/arg.rst:164 msgid "" "Previously, :exc:`TypeError` was raised when embedded null code points were " "encountered in the Python string." msgstr "" -#: ../../c-api/arg.rst:89 +#: ../../c-api/arg.rst:104 msgid "``s*`` (:class:`str` or :term:`bytes-like object`) [Py_buffer]" msgstr "``s*``\\ (:class:`str` 或 :term:`bytes-like object`)[Py_buffer]" -#: ../../c-api/arg.rst:86 +#: ../../c-api/arg.rst:101 msgid "" "This format accepts Unicode objects as well as bytes-like objects. It fills " "a :c:type:`Py_buffer` structure provided by the caller. In this case the " @@ -144,111 +163,112 @@ msgid "" "converted to C strings using ``'utf-8'`` encoding." msgstr "" -#: ../../c-api/arg.rst:96 +#: ../../c-api/arg.rst:111 msgid "" "``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char \\*, :" "c:type:`Py_ssize_t`]" msgstr "" -#: ../../c-api/arg.rst:92 +#: ../../c-api/arg.rst:107 msgid "" -"Like ``s*``, except that it doesn't accept mutable objects. The result is " -"stored into two C variables, the first one a pointer to a C string, the " -"second one its length. The string may contain embedded null bytes. Unicode " -"objects are converted to C strings using ``'utf-8'`` encoding." +"Like ``s*``, except that it provides a :ref:`borrowed buffer `. The result is stored into two C variables, the first one a pointer " +"to a C string, the second one its length. The string may contain embedded " +"null bytes. Unicode objects are converted to C strings using ``'utf-8'`` " +"encoding." msgstr "" -#: ../../c-api/arg.rst:100 ../../c-api/arg.rst:565 +#: ../../c-api/arg.rst:115 ../../c-api/arg.rst:581 msgid "``z`` (:class:`str` or ``None``) [const char \\*]" msgstr "``z``\\ (:class:`str` 或 ``None``)[const char \\*]" -#: ../../c-api/arg.rst:99 +#: ../../c-api/arg.rst:114 msgid "" "Like ``s``, but the Python object may also be ``None``, in which case the C " "pointer is set to ``NULL``." msgstr "" -#: ../../c-api/arg.rst:104 +#: ../../c-api/arg.rst:119 msgid "" "``z*`` (:class:`str`, :term:`bytes-like object` or ``None``) [Py_buffer]" msgstr "" "``z*``\\ (:class:`str`\\ 、\\ :term:`bytes-like object` 或 ``None``)" "[Py_buffer]" -#: ../../c-api/arg.rst:103 +#: ../../c-api/arg.rst:118 msgid "" "Like ``s*``, but the Python object may also be ``None``, in which case the " "``buf`` member of the :c:type:`Py_buffer` structure is set to ``NULL``." msgstr "" -#: ../../c-api/arg.rst:108 +#: ../../c-api/arg.rst:123 msgid "" "``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) " "[const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -#: ../../c-api/arg.rst:107 +#: ../../c-api/arg.rst:122 msgid "" "Like ``s#``, but the Python object may also be ``None``, in which case the C " "pointer is set to ``NULL``." msgstr "" -#: ../../c-api/arg.rst:118 +#: ../../c-api/arg.rst:134 msgid "``y`` (read-only :term:`bytes-like object`) [const char \\*]" msgstr "``y``\\ (唯讀 :term:`bytes-like object`)[const char \\*]" -#: ../../c-api/arg.rst:111 +#: ../../c-api/arg.rst:126 msgid "" -"This format converts a bytes-like object to a C pointer to a character " -"string; it does not accept Unicode objects. The bytes buffer must not " -"contain embedded null bytes; if it does, a :exc:`ValueError` exception is " -"raised." +"This format converts a bytes-like object to a C pointer to a :ref:`borrowed " +"` character string; it does not accept Unicode " +"objects. The bytes buffer must not contain embedded null bytes; if it does, " +"a :exc:`ValueError` exception is raised." msgstr "" -#: ../../c-api/arg.rst:116 +#: ../../c-api/arg.rst:132 msgid "" "Previously, :exc:`TypeError` was raised when embedded null bytes were " "encountered in the bytes buffer." msgstr "" -#: ../../c-api/arg.rst:123 +#: ../../c-api/arg.rst:139 msgid "``y*`` (:term:`bytes-like object`) [Py_buffer]" msgstr "``y*`` (:term:`bytes-like object`) [Py_buffer]" -#: ../../c-api/arg.rst:121 +#: ../../c-api/arg.rst:137 msgid "" "This variant on ``s*`` doesn't accept Unicode objects, only bytes-like " "objects. **This is the recommended way to accept binary data.**" msgstr "" -#: ../../c-api/arg.rst:127 +#: ../../c-api/arg.rst:143 msgid "" "``y#`` (read-only :term:`bytes-like object`) [const char \\*, :c:type:" "`Py_ssize_t`]" msgstr "" -#: ../../c-api/arg.rst:126 +#: ../../c-api/arg.rst:142 msgid "" "This variant on ``s#`` doesn't accept Unicode objects, only bytes-like " "objects." msgstr "" -#: ../../c-api/arg.rst:132 +#: ../../c-api/arg.rst:148 msgid "``S`` (:class:`bytes`) [PyBytesObject \\*]" msgstr "``S`` (:class:`bytes`) [PyBytesObject \\*]" -#: ../../c-api/arg.rst:130 +#: ../../c-api/arg.rst:146 msgid "" "Requires that the Python object is a :class:`bytes` object, without " "attempting any conversion. Raises :exc:`TypeError` if the object is not a " "bytes object. The C variable may also be declared as :c:expr:`PyObject*`." msgstr "" -#: ../../c-api/arg.rst:137 +#: ../../c-api/arg.rst:153 msgid "``Y`` (:class:`bytearray`) [PyByteArrayObject \\*]" msgstr "``Y`` (:class:`bytearray`) [PyByteArrayObject \\*]" -#: ../../c-api/arg.rst:135 +#: ../../c-api/arg.rst:151 msgid "" "Requires that the Python object is a :class:`bytearray` object, without " "attempting any conversion. Raises :exc:`TypeError` if the object is not a :" @@ -256,11 +276,11 @@ msgid "" "`PyObject*`." msgstr "" -#: ../../c-api/arg.rst:154 +#: ../../c-api/arg.rst:170 msgid "``u`` (:class:`str`) [const Py_UNICODE \\*]" msgstr "``u`` (:class:`str`) [const Py_UNICODE \\*]" -#: ../../c-api/arg.rst:140 +#: ../../c-api/arg.rst:156 msgid "" "Convert a Python Unicode object to a C pointer to a NUL-terminated buffer of " "Unicode characters. You must pass the address of a :c:type:`Py_UNICODE` " @@ -271,62 +291,62 @@ msgid "" "`ValueError` exception is raised." msgstr "" -#: ../../c-api/arg.rst:155 ../../c-api/arg.rst:164 ../../c-api/arg.rst:172 -#: ../../c-api/arg.rst:180 +#: ../../c-api/arg.rst:171 ../../c-api/arg.rst:180 ../../c-api/arg.rst:188 +#: ../../c-api/arg.rst:196 msgid "" "Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:" "func:`PyUnicode_AsWideCharString`." msgstr "" -#: ../../c-api/arg.rst:163 +#: ../../c-api/arg.rst:179 msgid "``u#`` (:class:`str`) [const Py_UNICODE \\*, :c:type:`Py_ssize_t`]" msgstr "``u#`` (:class:`str`) [const Py_UNICODE \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:157 +#: ../../c-api/arg.rst:173 msgid "" "This variant on ``u`` stores into two C variables, the first one a pointer " "to a Unicode data buffer, the second one its length. This variant allows " "null code points." msgstr "" -#: ../../c-api/arg.rst:171 +#: ../../c-api/arg.rst:187 msgid "``Z`` (:class:`str` or ``None``) [const Py_UNICODE \\*]" msgstr "``Z`` (:class:`str` 或 ``None``) [const Py_UNICODE \\*]" -#: ../../c-api/arg.rst:166 +#: ../../c-api/arg.rst:182 msgid "" "Like ``u``, but the Python object may also be ``None``, in which case the :c:" "type:`Py_UNICODE` pointer is set to ``NULL``." msgstr "" -#: ../../c-api/arg.rst:179 +#: ../../c-api/arg.rst:195 msgid "" "``Z#`` (:class:`str` or ``None``) [const Py_UNICODE \\*, :c:type:" "`Py_ssize_t`]" msgstr "" -#: ../../c-api/arg.rst:174 +#: ../../c-api/arg.rst:190 msgid "" "Like ``u#``, but the Python object may also be ``None``, in which case the :" "c:type:`Py_UNICODE` pointer is set to ``NULL``." msgstr "" -#: ../../c-api/arg.rst:184 +#: ../../c-api/arg.rst:200 msgid "``U`` (:class:`str`) [PyObject \\*]" msgstr "``U`` (:class:`str`) [PyObject \\*]" -#: ../../c-api/arg.rst:182 +#: ../../c-api/arg.rst:198 msgid "" "Requires that the Python object is a Unicode object, without attempting any " "conversion. Raises :exc:`TypeError` if the object is not a Unicode object. " "The C variable may also be declared as :c:expr:`PyObject*`." msgstr "" -#: ../../c-api/arg.rst:190 +#: ../../c-api/arg.rst:206 msgid "``w*`` (read-write :term:`bytes-like object`) [Py_buffer]" msgstr "``w*`` (可讀寫 :term:`bytes-like object`) [Py_buffer]" -#: ../../c-api/arg.rst:187 +#: ../../c-api/arg.rst:203 msgid "" "This format accepts any object which implements the read-write buffer " "interface. It fills a :c:type:`Py_buffer` structure provided by the caller. " @@ -334,17 +354,17 @@ msgid "" "`PyBuffer_Release` when it is done with the buffer." msgstr "" -#: ../../c-api/arg.rst:207 +#: ../../c-api/arg.rst:223 msgid "``es`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer]" msgstr "``es`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer]" -#: ../../c-api/arg.rst:193 +#: ../../c-api/arg.rst:209 msgid "" "This variant on ``s`` is used for encoding Unicode into a character buffer. " "It only works for encoded data without embedded NUL bytes." msgstr "" -#: ../../c-api/arg.rst:196 +#: ../../c-api/arg.rst:212 msgid "" "This format requires two arguments. The first is only used as input, and " "must be a :c:expr:`const char*` which points to the name of an encoding as a " @@ -355,7 +375,7 @@ msgid "" "The text will be encoded in the encoding specified by the first argument." msgstr "" -#: ../../c-api/arg.rst:204 +#: ../../c-api/arg.rst:220 msgid "" ":c:func:`PyArg_ParseTuple` will allocate a buffer of the needed size, copy " "the encoded data into this buffer and adjust *\\*buffer* to reference the " @@ -363,33 +383,33 @@ msgid "" "`PyMem_Free` to free the allocated buffer after use." msgstr "" -#: ../../c-api/arg.rst:212 +#: ../../c-api/arg.rst:228 msgid "" "``et`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char " "\\*encoding, char \\*\\*buffer]" msgstr "" -#: ../../c-api/arg.rst:210 +#: ../../c-api/arg.rst:226 msgid "" "Same as ``es`` except that byte string objects are passed through without " "recoding them. Instead, the implementation assumes that the byte string " "object uses the encoding passed in as parameter." msgstr "" -#: ../../c-api/arg.rst:243 +#: ../../c-api/arg.rst:259 msgid "" "``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" "`Py_ssize_t` \\*buffer_length]" msgstr "" -#: ../../c-api/arg.rst:215 +#: ../../c-api/arg.rst:231 msgid "" "This variant on ``s#`` is used for encoding Unicode into a character buffer. " "Unlike the ``es`` format, this variant allows input data which contains NUL " "characters." msgstr "" -#: ../../c-api/arg.rst:219 +#: ../../c-api/arg.rst:235 msgid "" "It requires three arguments. The first is only used as input, and must be " "a :c:expr:`const char*` which points to the name of an encoding as a NUL-" @@ -402,20 +422,20 @@ msgid "" "will be set to the number of bytes in the output buffer." msgstr "" -#: ../../c-api/arg.rst:229 +#: ../../c-api/arg.rst:245 msgid "There are two modes of operation:" msgstr "" -#: ../../c-api/arg.rst:231 +#: ../../c-api/arg.rst:247 msgid "" "If *\\*buffer* points a ``NULL`` pointer, the function will allocate a " -"buffer of the needed size, copy the encoded data into this buffer and set *" -"\\*buffer* to reference the newly allocated storage. The caller is " +"buffer of the needed size, copy the encoded data into this buffer and set " +"*\\*buffer* to reference the newly allocated storage. The caller is " "responsible for calling :c:func:`PyMem_Free` to free the allocated buffer " "after usage." msgstr "" -#: ../../c-api/arg.rst:236 +#: ../../c-api/arg.rst:252 msgid "" "If *\\*buffer* points to a non-``NULL`` pointer (an already allocated " "buffer), :c:func:`PyArg_ParseTuple` will use this location as the buffer and " @@ -424,62 +444,62 @@ msgid "" "the buffer is not large enough, a :exc:`ValueError` will be set." msgstr "" -#: ../../c-api/arg.rst:242 +#: ../../c-api/arg.rst:258 msgid "" "In both cases, *\\*buffer_length* is set to the length of the encoded data " "without the trailing NUL byte." msgstr "" -#: ../../c-api/arg.rst:248 +#: ../../c-api/arg.rst:264 msgid "" "``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char " "\\*encoding, char \\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" msgstr "" -#: ../../c-api/arg.rst:246 +#: ../../c-api/arg.rst:262 msgid "" "Same as ``es#`` except that byte string objects are passed through without " "recoding them. Instead, the implementation assumes that the byte string " "object uses the encoding passed in as parameter." msgstr "" -#: ../../c-api/arg.rst:251 +#: ../../c-api/arg.rst:267 msgid "Numbers" msgstr "數字" -#: ../../c-api/arg.rst:255 +#: ../../c-api/arg.rst:271 msgid "``b`` (:class:`int`) [unsigned char]" msgstr "``b`` (:class:`int`) [unsigned char]" -#: ../../c-api/arg.rst:254 +#: ../../c-api/arg.rst:270 msgid "" "Convert a nonnegative Python integer to an unsigned tiny int, stored in a C :" "c:expr:`unsigned char`." msgstr "" -#: ../../c-api/arg.rst:259 ../../c-api/arg.rst:599 +#: ../../c-api/arg.rst:275 ../../c-api/arg.rst:615 msgid "``B`` (:class:`int`) [unsigned char]" msgstr "``B`` (:class:`int`) [unsigned char]" -#: ../../c-api/arg.rst:258 +#: ../../c-api/arg.rst:274 msgid "" "Convert a Python integer to a tiny int without overflow checking, stored in " "a C :c:expr:`unsigned char`." msgstr "" -#: ../../c-api/arg.rst:262 ../../c-api/arg.rst:593 +#: ../../c-api/arg.rst:278 ../../c-api/arg.rst:609 msgid "``h`` (:class:`int`) [short int]" msgstr "``h`` (:class:`int`) [short int]" -#: ../../c-api/arg.rst:262 +#: ../../c-api/arg.rst:278 msgid "Convert a Python integer to a C :c:expr:`short int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`short int`。" -#: ../../c-api/arg.rst:266 ../../c-api/arg.rst:602 +#: ../../c-api/arg.rst:282 ../../c-api/arg.rst:618 msgid "``H`` (:class:`int`) [unsigned short int]" msgstr "``H`` (:class:`int`) [unsigned short int]" -#: ../../c-api/arg.rst:265 +#: ../../c-api/arg.rst:281 msgid "" "Convert a Python integer to a C :c:expr:`unsigned short int`, without " "overflow checking." @@ -487,57 +507,57 @@ msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned short int`,轉換過程無溢位檢" "查。" -#: ../../c-api/arg.rst:269 ../../c-api/arg.rst:587 +#: ../../c-api/arg.rst:285 ../../c-api/arg.rst:603 msgid "``i`` (:class:`int`) [int]" msgstr "``i`` (:class:`int`) [int]" -#: ../../c-api/arg.rst:269 +#: ../../c-api/arg.rst:285 msgid "Convert a Python integer to a plain C :c:expr:`int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`int`。" -#: ../../c-api/arg.rst:273 ../../c-api/arg.rst:605 +#: ../../c-api/arg.rst:289 ../../c-api/arg.rst:621 msgid "``I`` (:class:`int`) [unsigned int]" msgstr "``I`` (:class:`int`) [unsigned int]" -#: ../../c-api/arg.rst:272 +#: ../../c-api/arg.rst:288 msgid "" "Convert a Python integer to a C :c:expr:`unsigned int`, without overflow " "checking." msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned int`,轉換過程無溢位檢查。" -#: ../../c-api/arg.rst:276 ../../c-api/arg.rst:596 +#: ../../c-api/arg.rst:292 ../../c-api/arg.rst:612 msgid "``l`` (:class:`int`) [long int]" msgstr "``l`` (:class:`int`) [long int]" -#: ../../c-api/arg.rst:276 +#: ../../c-api/arg.rst:292 msgid "Convert a Python integer to a C :c:expr:`long int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`long int`。" -#: ../../c-api/arg.rst:280 ../../c-api/arg.rst:608 +#: ../../c-api/arg.rst:296 ../../c-api/arg.rst:624 msgid "``k`` (:class:`int`) [unsigned long]" msgstr "``k`` (:class:`int`) [unsigned long]" -#: ../../c-api/arg.rst:279 +#: ../../c-api/arg.rst:295 msgid "" "Convert a Python integer to a C :c:expr:`unsigned long` without overflow " "checking." msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned long`,轉換過程無溢位檢查。" -#: ../../c-api/arg.rst:283 ../../c-api/arg.rst:611 +#: ../../c-api/arg.rst:299 ../../c-api/arg.rst:627 msgid "``L`` (:class:`int`) [long long]" msgstr "``L`` (:class:`int`) [long long]" -#: ../../c-api/arg.rst:283 +#: ../../c-api/arg.rst:299 msgid "Convert a Python integer to a C :c:expr:`long long`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`long long`。" -#: ../../c-api/arg.rst:287 ../../c-api/arg.rst:614 +#: ../../c-api/arg.rst:303 ../../c-api/arg.rst:630 msgid "``K`` (:class:`int`) [unsigned long long]" msgstr "``K`` (:class:`int`) [unsigned long long]" -#: ../../c-api/arg.rst:286 +#: ../../c-api/arg.rst:302 msgid "" "Convert a Python integer to a C :c:expr:`unsigned long long` without " "overflow checking." @@ -545,82 +565,82 @@ msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned long long`,轉換過程無溢位檢" "查。" -#: ../../c-api/arg.rst:290 ../../c-api/arg.rst:617 +#: ../../c-api/arg.rst:306 ../../c-api/arg.rst:633 msgid "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" msgstr "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:290 +#: ../../c-api/arg.rst:306 msgid "Convert a Python integer to a C :c:type:`Py_ssize_t`." msgstr "將一個 Python 整數轉換成 C 的 :c:type:`Py_ssize_t`。" -#: ../../c-api/arg.rst:297 +#: ../../c-api/arg.rst:313 msgid "``c`` (:class:`bytes` or :class:`bytearray` of length 1) [char]" msgstr "``c``\\ (:class:`bytes` 或長度為 1 的 :class:`bytearray`)[char]" -#: ../../c-api/arg.rst:293 +#: ../../c-api/arg.rst:309 msgid "" "Convert a Python byte, represented as a :class:`bytes` or :class:`bytearray` " "object of length 1, to a C :c:expr:`char`." msgstr "" -#: ../../c-api/arg.rst:296 +#: ../../c-api/arg.rst:312 msgid "Allow :class:`bytearray` objects." msgstr "允許 :class:`bytearray` 物件。" -#: ../../c-api/arg.rst:301 ../../c-api/arg.rst:625 +#: ../../c-api/arg.rst:317 ../../c-api/arg.rst:641 msgid "``C`` (:class:`str` of length 1) [int]" msgstr "``C``\\ (長度為 1 的 :class:`str`)[int]" -#: ../../c-api/arg.rst:300 +#: ../../c-api/arg.rst:316 msgid "" "Convert a Python character, represented as a :class:`str` object of length " "1, to a C :c:expr:`int`." msgstr "" -#: ../../c-api/arg.rst:304 ../../c-api/arg.rst:631 +#: ../../c-api/arg.rst:320 ../../c-api/arg.rst:647 msgid "``f`` (:class:`float`) [float]" msgstr "``f`` (:class:`float`) [float]" -#: ../../c-api/arg.rst:304 +#: ../../c-api/arg.rst:320 msgid "Convert a Python floating point number to a C :c:expr:`float`." msgstr "將一個 Python 浮點數轉換成 C 的 :c:type::c:expr:`float`。" -#: ../../c-api/arg.rst:307 ../../c-api/arg.rst:628 +#: ../../c-api/arg.rst:323 ../../c-api/arg.rst:644 msgid "``d`` (:class:`float`) [double]" msgstr "``d`` (:class:`float`) [double]" -#: ../../c-api/arg.rst:307 +#: ../../c-api/arg.rst:323 msgid "Convert a Python floating point number to a C :c:expr:`double`." msgstr "將一個 Python 浮點數轉換成 C 的 :c:type::c:expr:`double`。" -#: ../../c-api/arg.rst:310 +#: ../../c-api/arg.rst:326 msgid "``D`` (:class:`complex`) [Py_complex]" msgstr "``D`` (:class:`complex`) [Py_complex]" -#: ../../c-api/arg.rst:310 +#: ../../c-api/arg.rst:326 msgid "Convert a Python complex number to a C :c:type:`Py_complex` structure." msgstr "將一個 Python 複數轉換成 C 的 :c:type:`Py_complex` 結構。" -#: ../../c-api/arg.rst:313 +#: ../../c-api/arg.rst:329 msgid "Other objects" msgstr "其他物件" -#: ../../c-api/arg.rst:318 ../../c-api/arg.rst:642 +#: ../../c-api/arg.rst:334 ../../c-api/arg.rst:658 msgid "``O`` (object) [PyObject \\*]" msgstr "``O``\\ (物件)[PyObject \\*]" -#: ../../c-api/arg.rst:316 +#: ../../c-api/arg.rst:332 msgid "" "Store a Python object (without any conversion) in a C object pointer. The C " "program thus receives the actual object that was passed. The object's " "reference count is not increased. The pointer stored is not ``NULL``." msgstr "" -#: ../../c-api/arg.rst:325 +#: ../../c-api/arg.rst:341 msgid "``O!`` (object) [*typeobject*, PyObject \\*]" msgstr "``O!``\\ (物件)[*typeobject*, PyObject \\*]" -#: ../../c-api/arg.rst:321 +#: ../../c-api/arg.rst:337 msgid "" "Store a Python object in a C object pointer. This is similar to ``O``, but " "takes two C arguments: the first is the address of a Python type object, the " @@ -629,11 +649,11 @@ msgid "" "required type, :exc:`TypeError` is raised." msgstr "" -#: ../../c-api/arg.rst:350 ../../c-api/arg.rst:656 +#: ../../c-api/arg.rst:366 ../../c-api/arg.rst:672 msgid "``O&`` (object) [*converter*, *anything*]" msgstr "``O&``\\ (物件)[*converter*, *anything*]" -#: ../../c-api/arg.rst:330 +#: ../../c-api/arg.rst:346 msgid "" "Convert a Python object to a C variable through a *converter* function. " "This takes two arguments: the first is a function, the second is the address " @@ -641,7 +661,7 @@ msgid "" "*converter* function in turn is called as follows::" msgstr "" -#: ../../c-api/arg.rst:337 +#: ../../c-api/arg.rst:353 msgid "" "where *object* is the Python object to be converted and *address* is the :c:" "expr:`void*` argument that was passed to the ``PyArg_Parse*`` function. The " @@ -651,7 +671,7 @@ msgid "" "unmodified." msgstr "" -#: ../../c-api/arg.rst:343 +#: ../../c-api/arg.rst:359 msgid "" "If the *converter* returns ``Py_CLEANUP_SUPPORTED``, it may get called a " "second time if the argument parsing eventually fails, giving the converter a " @@ -660,15 +680,15 @@ msgid "" "value as in the original call." msgstr "" -#: ../../c-api/arg.rst:349 +#: ../../c-api/arg.rst:365 msgid "``Py_CLEANUP_SUPPORTED`` was added." msgstr "加入 ``Py_CLEANUP_SUPPORTED``。" -#: ../../c-api/arg.rst:359 +#: ../../c-api/arg.rst:375 msgid "``p`` (:class:`bool`) [int]" msgstr "``p`` (:class:`bool`) [int]" -#: ../../c-api/arg.rst:353 +#: ../../c-api/arg.rst:369 msgid "" "Tests the value passed in for truth (a boolean **p**\\ redicate) and " "converts the result to its equivalent C true/false integer value. Sets the " @@ -677,18 +697,18 @@ msgid "" "how Python tests values for truth." msgstr "" -#: ../../c-api/arg.rst:364 ../../c-api/arg.rst:659 +#: ../../c-api/arg.rst:380 ../../c-api/arg.rst:675 msgid "``(items)`` (:class:`tuple`) [*matching-items*]" msgstr "``(items)`` (:class:`tuple`) [*matching-items*]" -#: ../../c-api/arg.rst:362 +#: ../../c-api/arg.rst:378 msgid "" "The object must be a Python sequence whose length is the number of format " "units in *items*. The C arguments must correspond to the individual format " "units in *items*. Format units for sequences may be nested." msgstr "" -#: ../../c-api/arg.rst:366 +#: ../../c-api/arg.rst:382 msgid "" "It is possible to pass \"long\" integers (integers whose value exceeds the " "platform's :const:`LONG_MAX`) however no proper range checking is done --- " @@ -697,17 +717,17 @@ msgid "" "downcasts in C --- your mileage may vary)." msgstr "" -#: ../../c-api/arg.rst:372 +#: ../../c-api/arg.rst:388 msgid "" "A few other characters have a meaning in a format string. These may not " "occur inside nested parentheses. They are:" msgstr "" -#: ../../c-api/arg.rst:380 +#: ../../c-api/arg.rst:396 msgid "``|``" msgstr "``|``" -#: ../../c-api/arg.rst:376 +#: ../../c-api/arg.rst:392 msgid "" "Indicates that the remaining arguments in the Python argument list are " "optional. The C variables corresponding to optional arguments should be " @@ -716,11 +736,11 @@ msgid "" "corresponding C variable(s)." msgstr "" -#: ../../c-api/arg.rst:389 +#: ../../c-api/arg.rst:405 msgid "``$``" msgstr "``$``" -#: ../../c-api/arg.rst:383 +#: ../../c-api/arg.rst:399 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` only: Indicates that the remaining " "arguments in the Python argument list are keyword-only. Currently, all " @@ -728,35 +748,35 @@ msgid "" "be specified before ``$`` in the format string." msgstr "" -#: ../../c-api/arg.rst:394 +#: ../../c-api/arg.rst:410 msgid "``:``" msgstr "``:``" -#: ../../c-api/arg.rst:392 +#: ../../c-api/arg.rst:408 msgid "" "The list of format units ends here; the string after the colon is used as " "the function name in error messages (the \"associated value\" of the " "exception that :c:func:`PyArg_ParseTuple` raises)." msgstr "" -#: ../../c-api/arg.rst:399 +#: ../../c-api/arg.rst:415 msgid "``;``" msgstr "``;``" -#: ../../c-api/arg.rst:397 +#: ../../c-api/arg.rst:413 msgid "" "The list of format units ends here; the string after the semicolon is used " "as the error message *instead* of the default error message. ``:`` and ``;" "`` mutually exclude each other." msgstr "" -#: ../../c-api/arg.rst:401 +#: ../../c-api/arg.rst:417 msgid "" "Note that any Python object references which are provided to the caller are " "*borrowed* references; do not decrement their reference count!" msgstr "" -#: ../../c-api/arg.rst:404 +#: ../../c-api/arg.rst:420 msgid "" "Additional arguments passed to these functions must be addresses of " "variables whose type is determined by the format string; these are used to " @@ -766,7 +786,7 @@ msgid "" "unit in that case." msgstr "" -#: ../../c-api/arg.rst:410 +#: ../../c-api/arg.rst:426 msgid "" "For the conversion to succeed, the *arg* object must match the format and " "the format must be exhausted. On success, the ``PyArg_Parse*`` functions " @@ -776,24 +796,24 @@ msgid "" "the following format units are left untouched." msgstr "" -#: ../../c-api/arg.rst:419 +#: ../../c-api/arg.rst:435 msgid "API Functions" msgstr "API 函式" -#: ../../c-api/arg.rst:423 +#: ../../c-api/arg.rst:439 msgid "" "Parse the parameters of a function that takes only positional parameters " "into local variables. Returns true on success; on failure, it returns false " "and raises the appropriate exception." msgstr "" -#: ../../c-api/arg.rst:430 +#: ../../c-api/arg.rst:446 msgid "" "Identical to :c:func:`PyArg_ParseTuple`, except that it accepts a va_list " "rather than a variable number of arguments." msgstr "" -#: ../../c-api/arg.rst:436 +#: ../../c-api/arg.rst:452 msgid "" "Parse the parameters of a function that takes both positional and keyword " "parameters into local variables. The *keywords* argument is a ``NULL``-" @@ -802,26 +822,26 @@ msgid "" "success; on failure, it returns false and raises the appropriate exception." msgstr "" -#: ../../c-api/arg.rst:443 +#: ../../c-api/arg.rst:459 msgid "" "Added support for :ref:`positional-only parameters `." msgstr "" -#: ../../c-api/arg.rst:450 +#: ../../c-api/arg.rst:466 msgid "" "Identical to :c:func:`PyArg_ParseTupleAndKeywords`, except that it accepts a " "va_list rather than a variable number of arguments." msgstr "" -#: ../../c-api/arg.rst:456 +#: ../../c-api/arg.rst:472 msgid "" "Ensure that the keys in the keywords argument dictionary are strings. This " "is only needed if :c:func:`PyArg_ParseTupleAndKeywords` is not used, since " "the latter already does this check." msgstr "" -#: ../../c-api/arg.rst:466 +#: ../../c-api/arg.rst:482 msgid "" "Function used to deconstruct the argument lists of \"old-style\" functions " "--- these are functions which use the :const:`METH_OLDARGS` parameter " @@ -832,7 +852,7 @@ msgid "" "continue to be used for that purpose." msgstr "" -#: ../../c-api/arg.rst:477 +#: ../../c-api/arg.rst:493 msgid "" "A simpler form of parameter retrieval which does not use a format string to " "specify the types of the arguments. Functions which use this method to " @@ -850,23 +870,23 @@ msgid "" "if there was a failure." msgstr "" -#: ../../c-api/arg.rst:492 +#: ../../c-api/arg.rst:508 msgid "" "This is an example of the use of this function, taken from the sources for " "the :mod:`_weakref` helper module for weak references::" msgstr "" -#: ../../c-api/arg.rst:508 +#: ../../c-api/arg.rst:524 msgid "" "The call to :c:func:`PyArg_UnpackTuple` in this example is entirely " "equivalent to this call to :c:func:`PyArg_ParseTuple`::" msgstr "" -#: ../../c-api/arg.rst:516 +#: ../../c-api/arg.rst:532 msgid "Building values" msgstr "" -#: ../../c-api/arg.rst:520 +#: ../../c-api/arg.rst:536 msgid "" "Create a new value based on a format string similar to those accepted by the " "``PyArg_Parse*`` family of functions and a sequence of values. Returns the " @@ -874,7 +894,7 @@ msgid "" "``NULL`` is returned." msgstr "" -#: ../../c-api/arg.rst:525 +#: ../../c-api/arg.rst:541 msgid "" ":c:func:`Py_BuildValue` does not always build a tuple. It builds a tuple " "only if its format string contains two or more format units. If the format " @@ -883,7 +903,7 @@ msgid "" "it to return a tuple of size 0 or one, parenthesize the format string." msgstr "" -#: ../../c-api/arg.rst:531 +#: ../../c-api/arg.rst:547 msgid "" "When memory buffers are passed as parameters to supply data to build " "objects, as for the ``s`` and ``s#`` formats, the required data is copied. " @@ -894,7 +914,7 @@ msgid "" "`Py_BuildValue` returns." msgstr "" -#: ../../c-api/arg.rst:539 +#: ../../c-api/arg.rst:555 msgid "" "In the following description, the quoted form is the format unit; the entry " "in (round) parentheses is the Python object type that the format unit will " @@ -902,155 +922,155 @@ msgid "" "be passed." msgstr "" -#: ../../c-api/arg.rst:543 +#: ../../c-api/arg.rst:559 msgid "" "The characters space, tab, colon and comma are ignored in format strings " "(but not within format units such as ``s#``). This can be used to make long " "format strings a tad more readable." msgstr "" -#: ../../c-api/arg.rst:549 +#: ../../c-api/arg.rst:565 msgid "``s`` (:class:`str` or ``None``) [const char \\*]" msgstr "``s``\\ (:class:`str` 或 ``None``)[const char \\*]" -#: ../../c-api/arg.rst:548 +#: ../../c-api/arg.rst:564 msgid "" "Convert a null-terminated C string to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, ``None`` is used." msgstr "" -#: ../../c-api/arg.rst:554 +#: ../../c-api/arg.rst:570 msgid "" "``s#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" "``s#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:552 +#: ../../c-api/arg.rst:568 msgid "" "Convert a C string and its length to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:558 +#: ../../c-api/arg.rst:574 msgid "``y`` (:class:`bytes`) [const char \\*]" msgstr "``y`` (:class:`bytes`) [const char \\*]" -#: ../../c-api/arg.rst:557 +#: ../../c-api/arg.rst:573 msgid "" "This converts a C string to a Python :class:`bytes` object. If the C string " "pointer is ``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:562 +#: ../../c-api/arg.rst:578 msgid "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:561 +#: ../../c-api/arg.rst:577 msgid "" "This converts a C string and its lengths to a Python object. If the C " "string pointer is ``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:565 ../../c-api/arg.rst:581 +#: ../../c-api/arg.rst:581 ../../c-api/arg.rst:597 msgid "Same as ``s``." msgstr "和 ``s`` 相同。" -#: ../../c-api/arg.rst:568 +#: ../../c-api/arg.rst:584 msgid "" "``z#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" "``z#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:568 ../../c-api/arg.rst:584 +#: ../../c-api/arg.rst:584 ../../c-api/arg.rst:600 msgid "Same as ``s#``." msgstr "和 ``s#`` 相同。" -#: ../../c-api/arg.rst:573 +#: ../../c-api/arg.rst:589 msgid "``u`` (:class:`str`) [const wchar_t \\*]" msgstr "``u`` (:class:`str`) [const wchar_t \\*]" -#: ../../c-api/arg.rst:571 +#: ../../c-api/arg.rst:587 msgid "" "Convert a null-terminated :c:expr:`wchar_t` buffer of Unicode (UTF-16 or " "UCS-4) data to a Python Unicode object. If the Unicode buffer pointer is " "``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:578 +#: ../../c-api/arg.rst:594 msgid "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" msgstr "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:576 +#: ../../c-api/arg.rst:592 msgid "" "Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python " "Unicode object. If the Unicode buffer pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:581 +#: ../../c-api/arg.rst:597 msgid "``U`` (:class:`str` or ``None``) [const char \\*]" msgstr "``U``\\ (:class:`str` 或 ``None``)[const char \\*]" -#: ../../c-api/arg.rst:584 +#: ../../c-api/arg.rst:600 msgid "" "``U#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" "``U#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:587 +#: ../../c-api/arg.rst:603 msgid "Convert a plain C :c:expr:`int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:590 +#: ../../c-api/arg.rst:606 msgid "``b`` (:class:`int`) [char]" msgstr "``b`` (:class:`int`) [char]" -#: ../../c-api/arg.rst:590 +#: ../../c-api/arg.rst:606 msgid "Convert a plain C :c:expr:`char` to a Python integer object." msgstr "將一個 C 的 :c:expr:`char` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:593 +#: ../../c-api/arg.rst:609 msgid "Convert a plain C :c:expr:`short int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`short int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:596 +#: ../../c-api/arg.rst:612 msgid "Convert a C :c:expr:`long int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`long int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:599 +#: ../../c-api/arg.rst:615 msgid "Convert a C :c:expr:`unsigned char` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned char` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:602 +#: ../../c-api/arg.rst:618 msgid "Convert a C :c:expr:`unsigned short int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned short int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:605 +#: ../../c-api/arg.rst:621 msgid "Convert a C :c:expr:`unsigned int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:608 +#: ../../c-api/arg.rst:624 msgid "Convert a C :c:expr:`unsigned long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:611 +#: ../../c-api/arg.rst:627 msgid "Convert a C :c:expr:`long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:614 +#: ../../c-api/arg.rst:630 msgid "Convert a C :c:expr:`unsigned long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:617 +#: ../../c-api/arg.rst:633 msgid "Convert a C :c:type:`Py_ssize_t` to a Python integer." msgstr "將一個 C 的 :c:type:`Py_ssize_t` 轉換成 Python 整數。" -#: ../../c-api/arg.rst:621 +#: ../../c-api/arg.rst:637 msgid "``c`` (:class:`bytes` of length 1) [char]" msgstr "``c``\\ (長度為 1 的 :class:`bytes`)[char]" -#: ../../c-api/arg.rst:620 +#: ../../c-api/arg.rst:636 msgid "" "Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` " "object of length 1." @@ -1058,7 +1078,7 @@ msgstr "" "將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" "`bytes`。" -#: ../../c-api/arg.rst:624 +#: ../../c-api/arg.rst:640 msgid "" "Convert a C :c:expr:`int` representing a character to Python :class:`str` " "object of length 1." @@ -1066,23 +1086,23 @@ msgstr "" "將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" "`str`。" -#: ../../c-api/arg.rst:628 +#: ../../c-api/arg.rst:644 msgid "Convert a C :c:expr:`double` to a Python floating point number." msgstr "將一個 C 的 :c:expr:`double` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:631 +#: ../../c-api/arg.rst:647 msgid "Convert a C :c:expr:`float` to a Python floating point number." msgstr "將一個 C 的 :c:expr:`float` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:634 +#: ../../c-api/arg.rst:650 msgid "``D`` (:class:`complex`) [Py_complex \\*]" msgstr "``D`` (:class:`complex`) [Py_complex \\*]" -#: ../../c-api/arg.rst:634 +#: ../../c-api/arg.rst:650 msgid "Convert a C :c:type:`Py_complex` structure to a Python complex number." msgstr "將一個 C 的 :c:type:`Py_complex` 結構轉換成 Python 複數。" -#: ../../c-api/arg.rst:637 +#: ../../c-api/arg.rst:653 msgid "" "Pass a Python object untouched (except for its reference count, which is " "incremented by one). If the object passed in is a ``NULL`` pointer, it is " @@ -1092,26 +1112,26 @@ msgid "" "raised yet, :exc:`SystemError` is set." msgstr "" -#: ../../c-api/arg.rst:645 +#: ../../c-api/arg.rst:661 msgid "``S`` (object) [PyObject \\*]" msgstr "``S``\\ (物件)[PyObject \\*]" -#: ../../c-api/arg.rst:645 +#: ../../c-api/arg.rst:661 msgid "Same as ``O``." msgstr "和 ``O`` 相同。" -#: ../../c-api/arg.rst:650 +#: ../../c-api/arg.rst:666 msgid "``N`` (object) [PyObject \\*]" msgstr "``N``\\ (物件)[PyObject \\*]" -#: ../../c-api/arg.rst:648 +#: ../../c-api/arg.rst:664 msgid "" "Same as ``O``, except it doesn't increment the reference count on the " "object. Useful when the object is created by a call to an object constructor " "in the argument list." msgstr "" -#: ../../c-api/arg.rst:653 +#: ../../c-api/arg.rst:669 msgid "" "Convert *anything* to a Python object through a *converter* function. The " "function is called with *anything* (which should be compatible with :c:expr:" @@ -1119,40 +1139,40 @@ msgid "" "``NULL`` if an error occurred." msgstr "" -#: ../../c-api/arg.rst:659 +#: ../../c-api/arg.rst:675 msgid "" "Convert a sequence of C values to a Python tuple with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:662 +#: ../../c-api/arg.rst:678 msgid "``[items]`` (:class:`list`) [*matching-items*]" msgstr "``[items]`` (:class:`list`) [*matching-items*]" -#: ../../c-api/arg.rst:662 +#: ../../c-api/arg.rst:678 msgid "" "Convert a sequence of C values to a Python list with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:667 +#: ../../c-api/arg.rst:683 msgid "``{items}`` (:class:`dict`) [*matching-items*]" msgstr "``{items}`` (:class:`dict`) [*matching-items*]" -#: ../../c-api/arg.rst:665 +#: ../../c-api/arg.rst:681 msgid "" "Convert a sequence of C values to a Python dictionary. Each pair of " "consecutive C values adds one item to the dictionary, serving as key and " "value, respectively." msgstr "" -#: ../../c-api/arg.rst:669 +#: ../../c-api/arg.rst:685 msgid "" "If there is an error in the format string, the :exc:`SystemError` exception " "is set and ``NULL`` returned." msgstr "" -#: ../../c-api/arg.rst:674 +#: ../../c-api/arg.rst:690 msgid "" "Identical to :c:func:`Py_BuildValue`, except that it accepts a va_list " "rather than a variable number of arguments." diff --git a/howto/annotations.po b/howto/annotations.po index b02da9b8a8..bbaecf047d 100644 --- a/howto/annotations.po +++ b/howto/annotations.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-06-03 00:13+0000\n" +"POT-Creation-Date: 2022-12-25 00:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -91,18 +91,26 @@ msgid "" "three arguments, for example ``getattr(o, '__annotations__', None)``." msgstr "" -#: ../../howto/annotations.rst:62 +#: ../../howto/annotations.rst:60 +msgid "" +"Before Python 3.10, accessing ``__annotations__`` on a class that defines no " +"annotations but that has a parent class with annotations would return the " +"parent's ``__annotations__``. In Python 3.10 and newer, the child class's " +"annotations will be an empty dict instead." +msgstr "" + +#: ../../howto/annotations.rst:68 msgid "Accessing The Annotations Dict Of An Object In Python 3.9 And Older" msgstr "" -#: ../../howto/annotations.rst:64 +#: ../../howto/annotations.rst:70 msgid "" "In Python 3.9 and older, accessing the annotations dict of an object is much " "more complicated than in newer versions. The problem is a design flaw in " "these older versions of Python, specifically to do with class annotations." msgstr "" -#: ../../howto/annotations.rst:69 +#: ../../howto/annotations.rst:75 msgid "" "Best practice for accessing the annotations dict of other objects--" "functions, other callables, and modules--is the same as best practice for " @@ -111,7 +119,7 @@ msgid "" "``__annotations__`` attribute." msgstr "" -#: ../../howto/annotations.rst:76 +#: ../../howto/annotations.rst:82 msgid "" "Unfortunately, this isn't best practice for classes. The problem is that, " "since ``__annotations__`` is optional on classes, and because classes can " @@ -120,11 +128,11 @@ msgid "" "annotations dict of a *base class.* As an example::" msgstr "" -#: ../../howto/annotations.rst:92 +#: ../../howto/annotations.rst:98 msgid "This will print the annotations dict from ``Base``, not ``Derived``." msgstr "" -#: ../../howto/annotations.rst:95 +#: ../../howto/annotations.rst:101 msgid "" "Your code will have to have a separate code path if the object you're " "examining is a class (``isinstance(o, type)``). In that case, best practice " @@ -134,32 +142,32 @@ msgid "" "practice is to call the ``get`` method on the class dict." msgstr "" -#: ../../howto/annotations.rst:103 +#: ../../howto/annotations.rst:109 msgid "" "To put it all together, here is some sample code that safely accesses the " "``__annotations__`` attribute on an arbitrary object in Python 3.9 and " "before::" msgstr "" -#: ../../howto/annotations.rst:112 +#: ../../howto/annotations.rst:118 msgid "" "After running this code, ``ann`` should be either a dictionary or ``None``. " "You're encouraged to double-check the type of ``ann`` using :func:" "`isinstance` before further examination." msgstr "" -#: ../../howto/annotations.rst:117 +#: ../../howto/annotations.rst:123 msgid "" "Note that some exotic or malformed type objects may not have a ``__dict__`` " "attribute, so for extra safety you may also wish to use :func:`getattr` to " "access ``__dict__``." msgstr "" -#: ../../howto/annotations.rst:123 +#: ../../howto/annotations.rst:129 msgid "Manually Un-Stringizing Stringized Annotations" msgstr "" -#: ../../howto/annotations.rst:125 +#: ../../howto/annotations.rst:131 msgid "" "In situations where some annotations may be \"stringized\", and you wish to " "evaluate those strings to produce the Python values they represent, it " @@ -167,7 +175,7 @@ msgid "" "you." msgstr "" -#: ../../howto/annotations.rst:131 +#: ../../howto/annotations.rst:137 msgid "" "If you're using Python 3.9 or older, or if for some reason you can't use :" "func:`inspect.get_annotations`, you'll need to duplicate its logic. You're " @@ -175,26 +183,26 @@ msgid "" "in the current Python version and follow a similar approach." msgstr "" -#: ../../howto/annotations.rst:137 +#: ../../howto/annotations.rst:143 msgid "" "In a nutshell, if you wish to evaluate a stringized annotation on an " "arbitrary object ``o``:" msgstr "" -#: ../../howto/annotations.rst:140 +#: ../../howto/annotations.rst:146 msgid "" "If ``o`` is a module, use ``o.__dict__`` as the ``globals`` when calling :" "func:`eval`." msgstr "" -#: ../../howto/annotations.rst:142 +#: ../../howto/annotations.rst:148 msgid "" "If ``o`` is a class, use ``sys.modules[o.__module__].__dict__`` as the " "``globals``, and ``dict(vars(o))`` as the ``locals``, when calling :func:" "`eval`." msgstr "" -#: ../../howto/annotations.rst:145 +#: ../../howto/annotations.rst:151 msgid "" "If ``o`` is a wrapped callable using :func:`functools.update_wrapper`, :func:" "`functools.wraps`, or :func:`functools.partial`, iteratively unwrap it by " @@ -202,13 +210,13 @@ msgid "" "have found the root unwrapped function." msgstr "" -#: ../../howto/annotations.rst:149 +#: ../../howto/annotations.rst:155 msgid "" "If ``o`` is a callable (but not a class), use ``o.__globals__`` as the " "globals when calling :func:`eval`." msgstr "" -#: ../../howto/annotations.rst:152 +#: ../../howto/annotations.rst:158 msgid "" "However, not all string values used as annotations can be successfully " "turned into Python values by :func:`eval`. String values could theoretically " @@ -217,19 +225,19 @@ msgid "" "be evaluated. For example:" msgstr "" -#: ../../howto/annotations.rst:159 +#: ../../howto/annotations.rst:165 msgid "" ":pep:`604` union types using ``|``, before support for this was added to " "Python 3.10." msgstr "" -#: ../../howto/annotations.rst:161 +#: ../../howto/annotations.rst:167 msgid "" "Definitions that aren't needed at runtime, only imported when :const:`typing." "TYPE_CHECKING` is true." msgstr "" -#: ../../howto/annotations.rst:164 +#: ../../howto/annotations.rst:170 msgid "" "If :func:`eval` attempts to evaluate such values, it will fail and raise an " "exception. So, when designing a library API that works with annotations, " @@ -237,43 +245,43 @@ msgid "" "requested to by the caller." msgstr "" -#: ../../howto/annotations.rst:172 +#: ../../howto/annotations.rst:178 msgid "Best Practices For ``__annotations__`` In Any Python Version" msgstr "" -#: ../../howto/annotations.rst:174 +#: ../../howto/annotations.rst:180 msgid "" "You should avoid assigning to the ``__annotations__`` member of objects " "directly. Let Python manage setting ``__annotations__``." msgstr "" -#: ../../howto/annotations.rst:177 +#: ../../howto/annotations.rst:183 msgid "" "If you do assign directly to the ``__annotations__`` member of an object, " "you should always set it to a ``dict`` object." msgstr "" -#: ../../howto/annotations.rst:180 +#: ../../howto/annotations.rst:186 msgid "" "If you directly access the ``__annotations__`` member of an object, you " "should ensure that it's a dictionary before attempting to examine its " "contents." msgstr "" -#: ../../howto/annotations.rst:184 +#: ../../howto/annotations.rst:190 msgid "You should avoid modifying ``__annotations__`` dicts." msgstr "" -#: ../../howto/annotations.rst:186 +#: ../../howto/annotations.rst:192 msgid "" "You should avoid deleting the ``__annotations__`` attribute of an object." msgstr "" -#: ../../howto/annotations.rst:191 +#: ../../howto/annotations.rst:197 msgid "``__annotations__`` Quirks" msgstr "" -#: ../../howto/annotations.rst:193 +#: ../../howto/annotations.rst:199 msgid "" "In all versions of Python 3, function objects lazy-create an annotations " "dict if no annotations are defined on that object. You can delete the " @@ -285,13 +293,13 @@ msgid "" "guaranteed to always throw an ``AttributeError``." msgstr "" -#: ../../howto/annotations.rst:203 +#: ../../howto/annotations.rst:209 msgid "" "Everything in the above paragraph also applies to class and module objects " "in Python 3.10 and newer." msgstr "" -#: ../../howto/annotations.rst:206 +#: ../../howto/annotations.rst:212 msgid "" "In all versions of Python 3, you can set ``__annotations__`` on a function " "object to ``None``. However, subsequently accessing the annotations on that " @@ -302,7 +310,7 @@ msgid "" "set." msgstr "" -#: ../../howto/annotations.rst:214 +#: ../../howto/annotations.rst:220 msgid "" "If Python stringizes your annotations for you (using ``from __future__ " "import annotations``), and you specify a string as an annotation, the string " @@ -310,7 +318,7 @@ msgid "" "example::" msgstr "" -#: ../../howto/annotations.rst:225 +#: ../../howto/annotations.rst:231 msgid "" "This prints ``{'a': \"'str'\"}``. This shouldn't really be considered a " "\"quirk\"; it's mentioned here simply because it might be surprising." diff --git a/library/argparse.po b/library/argparse.po index e7aa0d6cdc..0db75ef049 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-11-23 00:17+0000\n" +"POT-Creation-Date: 2022-12-26 13:06+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -756,7 +756,7 @@ msgid "" msgstr "" #: ../../library/argparse.rst:758 -msgid "choices_ - A container of the allowable values for the argument." +msgid "choices_ - A sequence of the allowable values for the argument." msgstr "" #: ../../library/argparse.rst:760 @@ -1136,7 +1136,7 @@ msgstr "" #: ../../library/argparse.rst:1201 msgid "" "Some command-line arguments should be selected from a restricted set of " -"values. These can be handled by passing a container object as the *choices* " +"values. These can be handled by passing a sequence object as the *choices* " "keyword argument to :meth:`~ArgumentParser.add_argument`. When the command " "line is parsed, argument values will be checked, and an error message will " "be displayed if the argument was not one of the acceptable values::" @@ -1144,15 +1144,15 @@ msgstr "" #: ../../library/argparse.rst:1216 msgid "" -"Note that inclusion in the *choices* container is checked after any type_ " +"Note that inclusion in the *choices* sequence is checked after any type_ " "conversions have been performed, so the type of the objects in the *choices* " -"container should match the type_ specified::" +"sequence should match the type_ specified::" msgstr "" #: ../../library/argparse.rst:1228 msgid "" -"Any container can be passed as the *choices* value, so :class:`list` " -"objects, :class:`set` objects, and custom containers are all supported." +"Any sequence can be passed as the *choices* value, so :class:`list` " +"objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" #: ../../library/argparse.rst:1231 @@ -1211,8 +1211,8 @@ msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " "available specifiers include the program name, ``%(prog)s`` and most keyword " -"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, ``" -"%(type)s``, etc.::" +"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, " +"``%(type)s``, etc.::" msgstr "" #: ../../library/argparse.rst:1310 diff --git a/library/array.po b/library/array.po index e7eed6b5b1..180e47351f 100644 --- a/library/array.po +++ b/library/array.po @@ -215,7 +215,7 @@ msgid "" "``Py_UNICODE``. This change doesn't affect its behavior because " "``Py_UNICODE`` is alias of ``wchar_t`` since Python 3.3." msgstr "" -"目前 ``array(‘u’)`` 使用 ``wchar_t`` 取代已棄用的 ``Py_UNICODE`` 作為 C " +"目前 ``array('u')`` 使用 ``wchar_t`` 取代已棄用的 ``Py_UNICODE`` 作為 C " "type。這個異動並沒有影響到它的作用,因爲自從 Python 3.3 開始 ``Py_UNICODE`` " "即為 ``wchar_t`` 的別名。" @@ -476,7 +476,7 @@ msgid "" msgstr "" "當一個陣列物件被列印或轉換成字串時,它會被表示為 ``array(typecode, " "initializer)``\\ 。若為空陣列則參數 *initializer* 被省略,若 *typecode* 是 " -"``’u’`` 將被表示為字串,其他情況則被表示為由數字組成的 list。只要 :class:" +"``'u'`` 將被表示為字串,其他情況則被表示為由數字組成的 list。只要 :class:" "`~array.array` class(類別)透過 ``from array import array`` 的方式引入,便能" "確保該字串能透過 :func:`eval` 轉換回一個擁有相同型別及數值的陣列。範例:\n" "\n" diff --git a/library/compileall.po b/library/compileall.po index c9601f07d4..7c40681b5e 100644 --- a/library/compileall.po +++ b/library/compileall.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"POT-Creation-Date: 2022-12-25 00:16+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -281,7 +281,7 @@ msgstr "" msgid "" "The *stripdir*, *prependdir* and *limit_sl_dest* arguments correspond to the " "``-s``, ``-p`` and ``-e`` options described above. They may be specified as " -"``str``, ``bytes`` or :py:class:`os.PathLike`." +"``str`` or :py:class:`os.PathLike`." msgstr "" #: ../../library/compileall.rst:204 ../../library/compileall.rst:274 diff --git a/library/functions.po b/library/functions.po index 0242b0d010..362b021866 100644 --- a/library/functions.po +++ b/library/functions.po @@ -9,8 +9,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-31 08:13+0000\n" -"PO-Revision-Date: 2022-10-01 14:30+0800\n" +"POT-Creation-Date: 2022-12-25 00:16+0000\n" +"PO-Revision-Date: 2022-12-26 23:06+0800\n" "Last-Translator: Phil Lin \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -19,7 +19,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.1.1\n" +"X-Generator: Poedit 3.2.2\n" #: ../../library/functions.rst:5 ../../library/functions.rst:11 msgid "Built-in Functions" @@ -482,8 +482,8 @@ msgid "" "ways." msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" -#: ../../library/functions.rst:140 ../../library/functions.rst:831 -#: ../../library/functions.rst:1144 +#: ../../library/functions.rst:140 ../../library/functions.rst:834 +#: ../../library/functions.rst:1147 msgid "See also :func:`format` for more information." msgstr "可參考 :func:`format` 獲取更多資訊。" @@ -502,8 +502,8 @@ msgstr "" "(參見 :ref:`typesnumeric`),其他 class 不能繼承自它。它只有 ``False`` 和 " "``True`` 兩個實例(參見 :ref:`bltin-boolean-values`)。" -#: ../../library/functions.rst:154 ../../library/functions.rst:696 -#: ../../library/functions.rst:916 +#: ../../library/functions.rst:154 ../../library/functions.rst:699 +#: ../../library/functions.rst:919 msgid "*x* is now a positional-only parameter." msgstr "" @@ -890,8 +890,8 @@ msgstr "" msgid "The complex type is described in :ref:`typesnumeric`." msgstr "複數型別在 :ref:`typesnumeric` 中有相關描述。" -#: ../../library/functions.rst:392 ../../library/functions.rst:693 -#: ../../library/functions.rst:913 +#: ../../library/functions.rst:392 ../../library/functions.rst:696 +#: ../../library/functions.rst:916 msgid "Grouping digits with underscores as in code literals is allowed." msgstr "可以使用底線將程式碼文字中的數字進行分組。" @@ -1265,26 +1265,26 @@ msgid "" "sign may be ``'+'`` or ``'-'``; a ``'+'`` sign has no effect on the value " "produced. The argument may also be a string representing a NaN (not-a-" "number), or positive or negative infinity. More precisely, the input must " -"conform to the following grammar after leading and trailing whitespace " -"characters are removed:" +"conform to the ``floatvalue`` production rule in the following grammar, " +"after leading and trailing whitespace characters are removed:" msgstr "" "如果引數是字串,則它必須是包含十進位制數字的字串,字串前面可以有符號,之前也" "可以有空格。選擇性的符號有 ``'+'`` 和 ``'-'``;``'+'`` 對建立的值沒有影響。引" "數也可以是 NaN(非數字)或正負無窮大的字串。確切地說,除去首尾的空格後,輸入" -"必須遵循以下語法:" +"必須遵循以下語法中 ``floatvalue`` 的生成規則:" -#: ../../library/functions.rst:662 +#: ../../library/functions.rst:665 msgid "" -"Here ``floatnumber`` is the form of a Python floating-point literal, " -"described in :ref:`floating`. Case is not significant, so, for example, " -"\"inf\", \"Inf\", \"INFINITY\", and \"iNfINity\" are all acceptable " -"spellings for positive infinity." +"Here ``digit`` is a Unicode decimal digit (character in the Unicode general " +"category ``Nd``). Case is not significant, so, for example, \"inf\", " +"\"Inf\", \"INFINITY\", and \"iNfINity\" are all acceptable spellings for " +"positive infinity." msgstr "" -"``floatnumber`` 是 Python 浮點數的字串形式,詳見 :ref:`floating`。字母大小寫" -"都可以,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表示正無窮" -"大。" +"``digit`` 是一個 Unicode 十進位數字(Unicode 一般分類 ``Nd`` 中的字元)。字母" +"大小寫都可以,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表示正" +"無窮大。" -#: ../../library/functions.rst:667 +#: ../../library/functions.rst:670 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 " @@ -1294,7 +1294,7 @@ msgstr "" "否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的" "浮點數。如果引數在 Python 浮點精度範圍外,則會觸發 :exc:`OverflowError`。" -#: ../../library/functions.rst:672 +#: ../../library/functions.rst:675 msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." "__float__()``. If ``__float__()`` is not defined then it falls back to :" @@ -1303,26 +1303,26 @@ msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 指派給 ``x.__float__()``。如果未定" "義 ``__float__()`` 則使用 :meth:`__index__`。" -#: ../../library/functions.rst:676 +#: ../../library/functions.rst:679 msgid "If no argument is given, ``0.0`` is returned." msgstr "如果沒有引數,則回傳 ``0.0``。" -#: ../../library/functions.rst:678 +#: ../../library/functions.rst:681 msgid "Examples::" msgstr "" "例如:\n" "\n" "::" -#: ../../library/functions.rst:691 +#: ../../library/functions.rst:694 msgid "The float type is described in :ref:`typesnumeric`." msgstr ":ref:`typesnumeric` 描述了浮點數型別。" -#: ../../library/functions.rst:699 +#: ../../library/functions.rst:702 msgid "Falls back to :meth:`__index__` if :meth:`__float__` is not defined." msgstr "" -#: ../../library/functions.rst:709 +#: ../../library/functions.rst:712 msgid "" "Convert a *value* to a \"formatted\" representation, as controlled by " "*format_spec*. The interpretation of *format_spec* will depend on the type " @@ -1333,7 +1333,7 @@ msgstr "" "取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" "`formatspec`。" -#: ../../library/functions.rst:714 +#: ../../library/functions.rst:717 msgid "" "The default *format_spec* is an empty string which usually gives the same " "effect as calling :func:`str(value) `." @@ -1341,7 +1341,7 @@ msgstr "" "預設的 *format_spec* 是一個空字串,它通常和呼叫 :func:`str(value) ` 的效" "果相同。" -#: ../../library/functions.rst:717 +#: ../../library/functions.rst:720 msgid "" "A call to ``format(value, format_spec)`` is translated to ``type(value)." "__format__(value, format_spec)`` which bypasses the instance dictionary when " @@ -1355,7 +1355,7 @@ msgstr "" "字典。如果搜尋到 :mod:`object` 這個 method 但 *format_spec* 不為空,或是 " "*format_spec* 或回傳值不是字串,則會觸發 :exc:`TypeError`。" -#: ../../library/functions.rst:724 +#: ../../library/functions.rst:727 msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." @@ -1363,7 +1363,7 @@ msgstr "" "當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會觸發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:733 +#: ../../library/functions.rst:736 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " "*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" @@ -1373,7 +1373,7 @@ msgstr "" "素。\\ ``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" "`frozenset` 和 :ref:`types-set`。" -#: ../../library/functions.rst:737 +#: ../../library/functions.rst:740 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." @@ -1381,7 +1381,7 @@ msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" -#: ../../library/functions.rst:745 +#: ../../library/functions.rst:748 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 " @@ -1396,7 +1396,7 @@ msgstr "" "`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" "`setattr`)。" -#: ../../library/functions.rst:754 +#: ../../library/functions.rst:757 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " @@ -1404,7 +1404,7 @@ msgid "" "`getattr`." msgstr "" -#: ../../library/functions.rst:762 +#: ../../library/functions.rst:765 msgid "" "Return the dictionary implementing the current module namespace. For code " "within functions, this is set when the function is defined and remains the " @@ -1413,7 +1413,7 @@ msgstr "" "回傳代表當前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" "函式時設定且不論該函式是在何處呼叫都會保持相同。" -#: ../../library/functions.rst:769 +#: ../../library/functions.rst:772 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. " @@ -1424,7 +1424,7 @@ msgstr "" "則回傳 ``False``。(此功能是通過呼叫 ``getattr(object, name)`` 看是否有 :exc:" "`AttributeError` 來實現的。)" -#: ../../library/functions.rst:777 +#: ../../library/functions.rst:780 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 " @@ -1435,7 +1435,7 @@ msgstr "" "時用來快速比較 dictionary 的鍵。相同大小的數字數值有相同的雜湊值(即使它們型" "別不同,如 1 和 1.0)。" -#: ../../library/functions.rst:784 +#: ../../library/functions.rst:787 msgid "" "For objects with custom :meth:`__hash__` methods, note that :func:`hash` " "truncates the return value based on the bit width of the host machine. See :" @@ -1444,7 +1444,7 @@ msgstr "" "請注意,如果物件實現了自己的 :meth:`__hash__` method,:func:`hash` 根據執行機" "器的位元長度來擷取回傳值。另請參閱 :meth:`__hash__`。" -#: ../../library/functions.rst:791 +#: ../../library/functions.rst:794 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 " @@ -1458,7 +1458,7 @@ msgstr "" "鍵字或文件主題中搜索該字串,並在控制台上列印幫助資訊。如果引數是其他任意物" "件,則會生成該物件的幫助頁。" -#: ../../library/functions.rst:798 +#: ../../library/functions.rst:801 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 " @@ -1466,12 +1466,12 @@ msgid "" "parameters `." msgstr "" -#: ../../library/functions.rst:803 +#: ../../library/functions.rst:806 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." msgstr "該函式透過 :mod:`site` module 加入到內建命名空間。" -#: ../../library/functions.rst:805 +#: ../../library/functions.rst:808 msgid "" "Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " "for callables are now more comprehensive and consistent." @@ -1479,7 +1479,7 @@ msgstr "" "變更至 :mod:`pydoc` 和 :mod:`inspect` 使得可呼叫物件的簽名信息 (signature) 更" "加全面和一致。" -#: ../../library/functions.rst:812 +#: ../../library/functions.rst:815 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 :" @@ -1489,7 +1489,7 @@ msgstr "" "class:`int` 物件,則必須定義一個 :meth:`__index__` method 並且回傳一個整數。" "舉例來說:" -#: ../../library/functions.rst:821 +#: ../../library/functions.rst:824 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 " @@ -1498,20 +1498,20 @@ msgstr "" "如果要將整數轉換為大寫或小寫的十六進位制字串,並可選擇有無 \"0x\" 前綴,則可" "以使用如下方法:" -#: ../../library/functions.rst:833 +#: ../../library/functions.rst:836 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:838 +#: ../../library/functions.rst:841 msgid "" "To obtain a hexadecimal string representation for a float, use the :meth:" "`float.hex` method." msgstr "" "如果要獲取浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" -#: ../../library/functions.rst:844 +#: ../../library/functions.rst:847 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. " @@ -1521,7 +1521,7 @@ msgstr "" "回傳物件的 \"標識值\" 。該值是一個整數,在此物件的生命週期中保證是唯一且恆定" "的。兩個生命期不重疊的物件可能具有相同的 :func:`id` 值。" -#: ../../library/functions.rst:849 +#: ../../library/functions.rst:852 msgid "This is the address of the object in memory." msgstr "" @@ -1531,7 +1531,7 @@ msgid "" "``id``." msgstr "" -#: ../../library/functions.rst:857 +#: ../../library/functions.rst:860 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, " @@ -1544,7 +1544,7 @@ msgstr "" "\n" "::" -#: ../../library/functions.rst:867 +#: ../../library/functions.rst:870 msgid "" "If the :mod:`readline` module was loaded, then :func:`input` will use it to " "provide elaborate line editing and history features." @@ -1558,7 +1558,7 @@ msgid "" "``prompt``." msgstr "" -#: ../../library/functions.rst:872 +#: ../../library/functions.rst:875 msgid "" "Raises an :ref:`auditing event ` ``builtins.input`` with argument " "``prompt`` before reading input" @@ -1570,13 +1570,13 @@ msgid "" "argument ``result``." msgstr "" -#: ../../library/functions.rst:877 +#: ../../library/functions.rst:880 msgid "" "Raises an :ref:`auditing event ` ``builtins.input/result`` with " "the result after successfully reading input." msgstr "" -#: ../../library/functions.rst:884 +#: ../../library/functions.rst:887 msgid "" "Return an integer object constructed from a number or string *x*, or return " "``0`` if no arguments are given. If *x* defines :meth:`__int__`, ``int(x)`` " @@ -1589,7 +1589,7 @@ msgstr "" "了 :meth:`__index__` 則回傳 ``x.__index__()``。如果 *x* 定義了 :meth:" "`__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數則向零舍入。" -#: ../../library/functions.rst:891 +#: ../../library/functions.rst:894 msgid "" "If *x* is not a number or if *base* is given, then *x* must be a string, :" "class:`bytes`, or :class:`bytearray` instance representing an :ref:`integer " @@ -1614,11 +1614,11 @@ msgstr "" "2、8、10、16 進制中的一個,所以 ``int('010', 0)`` 是非法的,但 " "``int('010')`` 和 ``int('010', 8)`` 是有效的。" -#: ../../library/functions.rst:904 +#: ../../library/functions.rst:907 msgid "The integer type is described in :ref:`typesnumeric`." msgstr "整數型別定義請參閱 :ref:`typesnumeric`。" -#: ../../library/functions.rst:906 +#: ../../library/functions.rst:909 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 " @@ -1630,15 +1630,15 @@ msgstr "" "使用 :meth:`base.__int__ ` 而不是 :meth:`base.__index__ " "`。" -#: ../../library/functions.rst:919 +#: ../../library/functions.rst:922 msgid "Falls back to :meth:`__index__` if :meth:`__int__` is not defined." msgstr "" -#: ../../library/functions.rst:922 +#: ../../library/functions.rst:925 msgid "The delegation to :meth:`__trunc__` is deprecated." msgstr "" -#: ../../library/functions.rst:925 +#: ../../library/functions.rst:928 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 " @@ -1648,7 +1648,7 @@ msgid "" "documentation." msgstr "" -#: ../../library/functions.rst:935 +#: ../../library/functions.rst:938 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 " @@ -1688,7 +1688,7 @@ msgstr "" "*class* 是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會" "觸發 :exc:`TypeError`。" -#: ../../library/functions.rst:967 +#: ../../library/functions.rst:970 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " @@ -1711,18 +1711,18 @@ msgstr "" "帶引數地呼叫 *object*\\ ;如果回傳的結果是 *sentinel* 則觸發 :exc:" "`StopIteration`,否則回傳呼叫結果。" -#: ../../library/functions.rst:980 +#: ../../library/functions.rst:983 msgid "See also :ref:`typeiter`." msgstr "另請參閱 :ref:`typeiter`。" -#: ../../library/functions.rst:982 +#: ../../library/functions.rst:985 msgid "" "One useful application of the second form of :func:`iter` is to build a " "block-reader. For example, reading fixed-width blocks from a binary database " "file until the end of file is reached::" msgstr "" -#: ../../library/functions.rst:994 +#: ../../library/functions.rst:997 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 " @@ -1731,13 +1731,13 @@ msgstr "" "回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 " "range)或集合(如 dictionary、set 或 frozen set)。" -#: ../../library/functions.rst:1000 +#: ../../library/functions.rst:1003 msgid "" "``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." "maxsize`, such as :class:`range(2 ** 100) `." msgstr "" -#: ../../library/functions.rst:1009 +#: ../../library/functions.rst:1012 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." @@ -1745,7 +1745,7 @@ msgstr "" "除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` " "和 :ref:`typesseq`。" -#: ../../library/functions.rst:1015 +#: ../../library/functions.rst:1018 msgid "" "Update and return a dictionary representing the current local symbol table. " "Free variables are returned by :func:`locals` when it is called in function " @@ -1756,7 +1756,7 @@ msgstr "" "叫 :func:`locals` 時會回傳自由變數。請注意,在 module 階層中,\\ :func:" "`locals` 和 :func:`globals` 是相同的 dictionary。" -#: ../../library/functions.rst:1021 +#: ../../library/functions.rst:1024 msgid "" "The contents of this dictionary should not be modified; changes may not " "affect the values of local and free variables used by the interpreter." @@ -1764,7 +1764,7 @@ msgstr "" "此 dictionary 的內容不應該被更動;更改可能不會影響直譯器使用的本地變數或自由" "變數的值。" -#: ../../library/functions.rst:1026 +#: ../../library/functions.rst:1029 msgid "" "Return an iterator that applies *function* to every item of *iterable*, " "yielding the results. If additional *iterables* arguments are passed, " @@ -1779,13 +1779,13 @@ msgstr "" "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經是 tuple 的引數,請參" "閱 :func:`itertools.starmap`\\。" -#: ../../library/functions.rst:1038 +#: ../../library/functions.rst:1041 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." msgstr "回傳 iterable 中最大的元素,或者回傳兩個及以上引數中最大的。" -#: ../../library/functions.rst:1041 +#: ../../library/functions.rst:1044 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 " @@ -1794,7 +1794,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素" "會被回傳。如果提供了兩個或以上的位置引數,則回傳最大的位置引數。" -#: ../../library/functions.rst:1046 ../../library/functions.rst:1084 +#: ../../library/functions.rst:1049 ../../library/functions.rst:1087 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 " @@ -1806,7 +1806,7 @@ msgstr "" "式,如同 :meth:`list.sort` 使用方式。*default* 引數是當 iterable 為空時回傳的" "值。如果 iterable 為空,並且沒有提供 *default*,則會觸發 :exc:`ValueError`。" -#: ../../library/functions.rst:1052 +#: ../../library/functions.rst:1055 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -1817,15 +1817,15 @@ msgstr "" "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " "iterable, key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1057 ../../library/functions.rst:1095 +#: ../../library/functions.rst:1060 ../../library/functions.rst:1098 msgid "The *default* keyword-only argument." msgstr "*default* 僅限關鍵字引數。" -#: ../../library/functions.rst:1060 ../../library/functions.rst:1098 +#: ../../library/functions.rst:1063 ../../library/functions.rst:1101 msgid "The *key* can be ``None``." msgstr "" -#: ../../library/functions.rst:1068 +#: ../../library/functions.rst:1071 msgid "" "Return a \"memory view\" object created from the given argument. See :ref:" "`typememoryview` for more information." @@ -1833,13 +1833,13 @@ msgstr "" "回傳由給定的引數建立之 \"memory view\" 物件。有關詳細資訊,請參閱 :ref:" "`typememoryview`。" -#: ../../library/functions.rst:1076 +#: ../../library/functions.rst:1079 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." msgstr "回傳 iterable 中最小的元素,或者回傳兩個及以上引數中最小的。" -#: ../../library/functions.rst:1079 +#: ../../library/functions.rst:1082 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 " @@ -1848,7 +1848,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" "被回傳。如果提供了兩個或以上的位置引數,則回傳最小的位置引數。" -#: ../../library/functions.rst:1090 +#: ../../library/functions.rst:1093 msgid "" "If multiple items are minimal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -1859,7 +1859,7 @@ msgstr "" "``sorted(iterable, key=keyfunc)[0]`` 和 ``heapq.nsmallest(1, iterable, " "key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1105 +#: ../../library/functions.rst:1108 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 " @@ -1869,7 +1869,7 @@ msgstr "" "素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則觸發 :" "exc:`StopIteration`。" -#: ../../library/functions.rst:1112 +#: ../../library/functions.rst:1115 msgid "" "Return a new featureless object. :class:`object` is a base for all classes. " "It has methods that are common to all instances of Python classes. This " @@ -1878,7 +1878,7 @@ msgstr "" "回傳一個沒有特徵的新物件。:class:`object` 是所有 class 的基礎,它具有所有 " "Python class 實例的通用 method。這個函式不接受任何引數。" -#: ../../library/functions.rst:1118 +#: ../../library/functions.rst:1121 msgid "" ":class:`object` does *not* have a :attr:`~object.__dict__`, so you can't " "assign arbitrary attributes to an instance of the :class:`object` class." @@ -1886,7 +1886,7 @@ msgstr "" "由於 :class:`object` *沒有* :attr:`~object.__dict__`,因此無法將任意屬性賦" "給 :class:`object` class 的實例。" -#: ../../library/functions.rst:1124 +#: ../../library/functions.rst:1127 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` " @@ -1897,7 +1897,7 @@ msgstr "" "Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" "`__index__` method 回傳一個整數。舉例來說:" -#: ../../library/functions.rst:1134 +#: ../../library/functions.rst:1137 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." @@ -1905,7 +1905,7 @@ msgstr "" "如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方" "法。" -#: ../../library/functions.rst:1151 +#: ../../library/functions.rst:1154 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 " @@ -1914,7 +1914,7 @@ msgstr "" "開啟 *file* 並回傳對應的 :term:`file object`。如果該檔案不能開啟,則觸發 :" "exc:`OSError`。關於使用此函式的更多方法請參閱\\ :ref:`tut-files`。" -#: ../../library/functions.rst:1155 +#: ../../library/functions.rst:1158 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 " @@ -1927,7 +1927,7 @@ msgstr "" "果有提供檔案描述器,它會隨著回傳的 I/O 物件關閉而關閉,除非 *closefd* 被設為 " "``False``。)" -#: ../../library/functions.rst:1161 +#: ../../library/functions.rst:1164 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. " @@ -1948,71 +1948,71 @@ msgstr "" "getencoding()` 來獲取當前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制" "模式且不要指定 *encoding*。)可用的模式有:" -#: ../../library/functions.rst:1178 +#: ../../library/functions.rst:1181 msgid "Character" msgstr "字元" -#: ../../library/functions.rst:1178 +#: ../../library/functions.rst:1181 msgid "Meaning" msgstr "意義" -#: ../../library/functions.rst:1180 +#: ../../library/functions.rst:1183 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/functions.rst:1180 +#: ../../library/functions.rst:1183 msgid "open for reading (default)" msgstr "讀取(預設)" -#: ../../library/functions.rst:1181 +#: ../../library/functions.rst:1184 msgid "``'w'``" msgstr "``'w'``" -#: ../../library/functions.rst:1181 +#: ../../library/functions.rst:1184 msgid "open for writing, truncating the file first" msgstr "" -#: ../../library/functions.rst:1182 +#: ../../library/functions.rst:1185 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/functions.rst:1182 +#: ../../library/functions.rst:1185 msgid "open for exclusive creation, failing if the file already exists" msgstr "唯一性創建,如果文件已存在則會失敗" -#: ../../library/functions.rst:1183 +#: ../../library/functions.rst:1186 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/functions.rst:1183 +#: ../../library/functions.rst:1186 msgid "open for writing, appending to the end of file if it exists" msgstr "寫入,如果文件存在則在末尾追加寫入內容" -#: ../../library/functions.rst:1184 +#: ../../library/functions.rst:1187 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/functions.rst:1184 +#: ../../library/functions.rst:1187 msgid "binary mode" msgstr "二進制模式" -#: ../../library/functions.rst:1185 +#: ../../library/functions.rst:1188 msgid "``'t'``" msgstr "``'t'``" -#: ../../library/functions.rst:1185 +#: ../../library/functions.rst:1188 msgid "text mode (default)" msgstr "文字模式(預設)" -#: ../../library/functions.rst:1186 +#: ../../library/functions.rst:1189 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/functions.rst:1186 +#: ../../library/functions.rst:1189 msgid "open for updating (reading and writing)" msgstr "更新(讀取並寫入)" -#: ../../library/functions.rst:1189 +#: ../../library/functions.rst:1192 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 " @@ -2021,7 +2021,7 @@ msgstr "" "預設的模式是 ``'r'``\\ (開啟並讀取文字,同 ``'rt'``)。對於二進位制寫入," "``'w+b'`` 模式開啟並把檔案內容變成 0 bytes,``'r+b'`` 則不會捨棄原始內容。" -#: ../../library/functions.rst:1193 +#: ../../library/functions.rst:1196 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* " @@ -2032,14 +2032,14 @@ msgid "" "specified *encoding* if given." msgstr "" -#: ../../library/functions.rst:1203 +#: ../../library/functions.rst:1206 msgid "" "Python doesn't depend on the underlying operating system's notion of text " "files; all the processing is done by Python itself, and is therefore " "platform-independent." msgstr "" -#: ../../library/functions.rst:1207 +#: ../../library/functions.rst:1210 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 " @@ -2052,7 +2052,7 @@ msgid "" "given, the default buffering policy works as follows:" msgstr "" -#: ../../library/functions.rst:1217 +#: ../../library/functions.rst:1220 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 " @@ -2060,14 +2060,14 @@ msgid "" "the buffer will typically be 4096 or 8192 bytes long." msgstr "" -#: ../../library/functions.rst:1222 +#: ../../library/functions.rst:1225 msgid "" "\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " "returns ``True``) use line buffering. Other text files use the policy " "described above for binary files." msgstr "" -#: ../../library/functions.rst:1226 +#: ../../library/functions.rst:1229 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 " @@ -2076,7 +2076,7 @@ msgid "" "the list of supported encodings." msgstr "" -#: ../../library/functions.rst:1232 +#: ../../library/functions.rst:1235 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 " @@ -2085,25 +2085,25 @@ msgid "" "register_error` is also valid. The standard names include:" msgstr "" -#: ../../library/functions.rst:1240 +#: ../../library/functions.rst:1243 msgid "" "``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " "error. The default value of ``None`` has the same effect." msgstr "" -#: ../../library/functions.rst:1244 +#: ../../library/functions.rst:1247 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." msgstr "" -#: ../../library/functions.rst:1247 +#: ../../library/functions.rst:1250 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." msgstr "" -#: ../../library/functions.rst:1250 +#: ../../library/functions.rst:1253 msgid "" "``'surrogateescape'`` will represent any incorrect bytes as low surrogate " "code units ranging from U+DC80 to U+DCFF. These surrogate code units will " @@ -2112,33 +2112,33 @@ msgid "" "an unknown encoding." msgstr "" -#: ../../library/functions.rst:1257 +#: ../../library/functions.rst:1260 msgid "" "``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " "not supported by the encoding are replaced with the appropriate XML " "character reference ``&#nnn;``." msgstr "" -#: ../../library/functions.rst:1261 +#: ../../library/functions.rst:1264 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." msgstr "" -#: ../../library/functions.rst:1264 +#: ../../library/functions.rst:1267 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." msgstr "" -#: ../../library/functions.rst:1272 +#: ../../library/functions.rst:1275 msgid "" "*newline* determines how to parse newline characters from the stream. It can " "be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " "follows:" msgstr "" -#: ../../library/functions.rst:1276 +#: ../../library/functions.rst:1279 msgid "" "When reading input from the stream, if *newline* is ``None``, universal " "newlines mode is enabled. Lines in the input can end in ``'\\n'``, " @@ -2149,7 +2149,7 @@ msgid "" "given string, and the line ending is returned to the caller untranslated." msgstr "" -#: ../../library/functions.rst:1284 +#: ../../library/functions.rst:1287 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -2158,7 +2158,7 @@ msgid "" "characters written are translated to the given string." msgstr "" -#: ../../library/functions.rst:1290 +#: ../../library/functions.rst:1293 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 " @@ -2166,7 +2166,7 @@ msgid "" "otherwise, an error will be raised." msgstr "" -#: ../../library/functions.rst:1295 +#: ../../library/functions.rst:1298 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 " @@ -2175,11 +2175,11 @@ msgid "" "similar to passing ``None``)." msgstr "" -#: ../../library/functions.rst:1301 +#: ../../library/functions.rst:1304 msgid "The newly created file is :ref:`non-inheritable `." msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" -#: ../../library/functions.rst:1303 +#: ../../library/functions.rst:1306 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::" @@ -2189,7 +2189,7 @@ msgstr "" "\n" "::" -#: ../../library/functions.rst:1316 +#: ../../library/functions.rst:1319 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 " @@ -2204,7 +2204,7 @@ msgid "" "FileIO`, is returned." msgstr "" -#: ../../library/functions.rst:1337 +#: ../../library/functions.rst:1340 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " "(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" @@ -2220,25 +2220,25 @@ msgid "" "``mode``, ``flags``." msgstr "" -#: ../../library/functions.rst:1343 +#: ../../library/functions.rst:1346 msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." msgstr "" -#: ../../library/functions.rst:1348 +#: ../../library/functions.rst:1351 msgid "The *opener* parameter was added." msgstr "增加了 *opener* 參數。" -#: ../../library/functions.rst:1349 +#: ../../library/functions.rst:1352 msgid "The ``'x'`` mode was added." msgstr "增加了 ``'x'`` 模式。" -#: ../../library/functions.rst:1350 +#: ../../library/functions.rst:1353 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "過去觸發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" -#: ../../library/functions.rst:1351 +#: ../../library/functions.rst:1354 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." @@ -2246,11 +2246,11 @@ msgstr "" "如果檔案已存在但使用了唯一性建立模式 (\\ ``'x'``\\ ),現在會觸發 :exc:" "`FileExistsError`。" -#: ../../library/functions.rst:1356 +#: ../../library/functions.rst:1359 msgid "The file is now non-inheritable." msgstr "檔案在當前版本開始禁止繼承。" -#: ../../library/functions.rst:1360 +#: ../../library/functions.rst:1363 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 :" @@ -2259,15 +2259,15 @@ msgstr "" "如果系統呼叫被中斷,但訊號處理程序沒有觸發例外,此函式現在會重試系統呼叫,而" "不是觸發 :exc:`InterruptedError`\\ (原因詳見 :pep:`475`)。" -#: ../../library/functions.rst:1363 +#: ../../library/functions.rst:1366 msgid "The ``'namereplace'`` error handler was added." msgstr "增加了 ``'namereplace'`` 錯誤處理程式。" -#: ../../library/functions.rst:1367 +#: ../../library/functions.rst:1370 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "增加對實現了 :class:`os.PathLike` 物件的支援。" -#: ../../library/functions.rst:1368 +#: ../../library/functions.rst:1371 msgid "" "On Windows, opening a console buffer may return a subclass of :class:`io." "RawIOBase` other than :class:`io.FileIO`." @@ -2275,11 +2275,11 @@ msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" -#: ../../library/functions.rst:1371 +#: ../../library/functions.rst:1374 msgid "The ``'U'`` mode has been removed." msgstr "``'U'`` 模式被移除。" -#: ../../library/functions.rst:1376 +#: ../../library/functions.rst:1379 msgid "" "Given a string representing one Unicode character, return an integer " "representing the Unicode code point of that character. For example, " @@ -2290,7 +2290,7 @@ msgstr "" "``ord('a')`` 回傳整數 ``97``、\\ ``ord('€')``\\ (歐元符號)回傳 ``8364``。這" "是 :func:`chr` 的逆函式。" -#: ../../library/functions.rst:1384 +#: ../../library/functions.rst:1387 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) % " @@ -2301,7 +2301,7 @@ msgstr "" "*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" -#: ../../library/functions.rst:1389 +#: ../../library/functions.rst:1392 msgid "" "The arguments must have numeric types. With mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " @@ -2314,7 +2314,7 @@ msgid "" "close to ``3j``." msgstr "" -#: ../../library/functions.rst:1399 +#: ../../library/functions.rst:1402 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 " @@ -2323,29 +2323,29 @@ msgid "" "*base* modulo *mod*." msgstr "" -#: ../../library/functions.rst:1405 +#: ../../library/functions.rst:1408 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "" -#: ../../library/functions.rst:1412 +#: ../../library/functions.rst:1415 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." msgstr "" -#: ../../library/functions.rst:1417 +#: ../../library/functions.rst:1420 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "" -#: ../../library/functions.rst:1424 +#: ../../library/functions.rst:1427 msgid "" "Print *objects* to the text stream *file*, separated by *sep* and followed " "by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " "keyword arguments." msgstr "" -#: ../../library/functions.rst:1428 +#: ../../library/functions.rst:1431 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* " @@ -2354,7 +2354,7 @@ msgid "" "*end*." msgstr "" -#: ../../library/functions.rst:1434 +#: ../../library/functions.rst:1437 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 " @@ -2362,38 +2362,38 @@ msgid "" "binary mode file objects. For these, use ``file.write(...)`` instead." msgstr "" -#: ../../library/functions.rst:1439 +#: ../../library/functions.rst:1442 msgid "" "Whether the output is buffered is usually determined by *file*, but if the " "*flush* keyword argument is true, the stream is forcibly flushed." msgstr "" -#: ../../library/functions.rst:1442 +#: ../../library/functions.rst:1445 msgid "Added the *flush* keyword argument." msgstr "增加了 *flush* 關鍵字引數。" -#: ../../library/functions.rst:1448 +#: ../../library/functions.rst:1451 msgid "Return a property attribute." msgstr "回傳 property 屬性。" -#: ../../library/functions.rst:1450 +#: ../../library/functions.rst:1453 msgid "" "*fget* is a function for getting an attribute value. *fset* is a function " "for setting an attribute value. *fdel* is a function for deleting an " "attribute value. And *doc* creates a docstring for the attribute." msgstr "" -#: ../../library/functions.rst:1454 +#: ../../library/functions.rst:1457 msgid "A typical use is to define a managed attribute ``x``::" msgstr "" -#: ../../library/functions.rst:1471 +#: ../../library/functions.rst:1474 msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." msgstr "" -#: ../../library/functions.rst:1474 +#: ../../library/functions.rst:1477 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 " @@ -2401,14 +2401,14 @@ msgid "" "term:`decorator`::" msgstr "" -#: ../../library/functions.rst:1487 +#: ../../library/functions.rst:1490 msgid "" -"The ``@property`` decorator turns the :meth:`voltage` method into a \"getter" -"\" for a read-only attribute with the same name, and it sets the docstring " -"for *voltage* to \"Get the current voltage.\"" +"The ``@property`` decorator turns the :meth:`voltage` method into a " +"\"getter\" for a read-only attribute with the same name, and it sets the " +"docstring for *voltage* to \"Get the current voltage.\"" msgstr "" -#: ../../library/functions.rst:1491 +#: ../../library/functions.rst:1494 msgid "" "A property object has :attr:`~property.getter`, :attr:`~property.setter`, " "and :attr:`~property.deleter` methods usable as decorators that create a " @@ -2416,30 +2416,30 @@ msgid "" "decorated function. This is best explained with an example::" msgstr "" -#: ../../library/functions.rst:1513 +#: ../../library/functions.rst:1516 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:1517 +#: ../../library/functions.rst:1520 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." msgstr "" -#: ../../library/functions.rst:1520 +#: ../../library/functions.rst:1523 msgid "The docstrings of property objects are now writeable." msgstr "" -#: ../../library/functions.rst:1529 +#: ../../library/functions.rst:1532 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:1535 +#: ../../library/functions.rst:1538 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 " @@ -2452,7 +2452,7 @@ msgid "" "`RuntimeError`." msgstr "" -#: ../../library/functions.rst:1548 +#: ../../library/functions.rst:1551 msgid "" "Return a reverse :term:`iterator`. *seq* must be an object which has a :" "meth:`__reversed__` method or supports the sequence protocol (the :meth:" @@ -2460,14 +2460,14 @@ msgid "" "starting at ``0``)." msgstr "" -#: ../../library/functions.rst:1556 +#: ../../library/functions.rst:1559 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:1560 +#: ../../library/functions.rst:1563 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 " @@ -2478,13 +2478,13 @@ msgid "" "``None``. Otherwise, the return value has the same type as *number*." msgstr "" -#: ../../library/functions.rst:1569 +#: ../../library/functions.rst:1572 msgid "" "For a general Python object ``number``, ``round`` delegates to ``number." "__round__``." msgstr "" -#: ../../library/functions.rst:1574 +#: ../../library/functions.rst:1577 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 " @@ -2493,21 +2493,21 @@ msgid "" "information." msgstr "" -#: ../../library/functions.rst:1586 +#: ../../library/functions.rst:1589 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:1590 +#: ../../library/functions.rst:1593 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:1597 +#: ../../library/functions.rst:1600 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 " @@ -2516,7 +2516,7 @@ msgid "" "is equivalent to ``x.foobar = 123``." msgstr "" -#: ../../library/functions.rst:1603 +#: ../../library/functions.rst:1606 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:" @@ -2525,14 +2525,14 @@ msgid "" "notation, but is accessible through :func:`getattr` etc.." msgstr "" -#: ../../library/functions.rst:1611 +#: ../../library/functions.rst:1614 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:1620 +#: ../../library/functions.rst:1623 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " @@ -2545,35 +2545,35 @@ msgid "" "func:`itertools.islice` for an alternate version that returns an iterator." msgstr "" -#: ../../library/functions.rst:1633 +#: ../../library/functions.rst:1636 msgid "Return a new sorted list from the items in *iterable*." msgstr "" -#: ../../library/functions.rst:1635 +#: ../../library/functions.rst:1638 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" -#: ../../library/functions.rst:1637 +#: ../../library/functions.rst:1640 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:1641 +#: ../../library/functions.rst:1644 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:1644 +#: ../../library/functions.rst:1647 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." msgstr "" -#: ../../library/functions.rst:1647 +#: ../../library/functions.rst:1650 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 " @@ -2581,7 +2581,7 @@ msgid "" "example, sort by department, then by salary grade)." msgstr "" -#: ../../library/functions.rst:1652 +#: ../../library/functions.rst:1655 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -2593,22 +2593,22 @@ msgid "" "method." msgstr "" -#: ../../library/functions.rst:1661 +#: ../../library/functions.rst:1664 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functions.rst:1665 +#: ../../library/functions.rst:1668 msgid "Transform a method into a static method." msgstr "" -#: ../../library/functions.rst:1667 +#: ../../library/functions.rst:1670 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -#: ../../library/functions.rst:1674 +#: ../../library/functions.rst:1677 msgid "" "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -2616,21 +2616,21 @@ msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" -#: ../../library/functions.rst:1677 +#: ../../library/functions.rst:1680 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " "an instance (such as ``C().f()``). Moreover, they can be called as regular " "functions (such as ``f()``)." msgstr "" -#: ../../library/functions.rst:1681 +#: ../../library/functions.rst:1684 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:1685 +#: ../../library/functions.rst:1688 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 " @@ -2639,36 +2639,36 @@ msgid "" "cases, use this idiom::" msgstr "" -#: ../../library/functions.rst:1697 +#: ../../library/functions.rst:1700 msgid "For more information on static methods, see :ref:`types`." msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" -#: ../../library/functions.rst:1699 +#: ../../library/functions.rst:1702 msgid "" "Static methods now inherit the method attributes (``__module__``, " "``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``), have a " "new ``__wrapped__`` attribute, and are now callable as regular functions." msgstr "" -#: ../../library/functions.rst:1714 +#: ../../library/functions.rst:1717 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" -#: ../../library/functions.rst:1716 +#: ../../library/functions.rst:1719 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -#: ../../library/functions.rst:1722 +#: ../../library/functions.rst:1725 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:1726 +#: ../../library/functions.rst:1729 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 ``''." @@ -2677,31 +2677,31 @@ msgid "" "using :func:`itertools.chain`." msgstr "" -#: ../../library/functions.rst:1732 +#: ../../library/functions.rst:1735 msgid "The *start* parameter can be specified as a keyword argument." msgstr "*start* 參數可被指定為關鍵字引數。" -#: ../../library/functions.rst:1738 +#: ../../library/functions.rst:1741 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:1742 +#: ../../library/functions.rst:1745 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:1746 +#: ../../library/functions.rst:1749 msgid "" "For example, if :attr:`~class.__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:1750 +#: ../../library/functions.rst:1753 msgid "" "The :attr:`~class.__mro__` attribute of the *object_or_type* lists the " "method resolution search order used by both :func:`getattr` and :func:" @@ -2709,7 +2709,7 @@ msgid "" "hierarchy is updated." msgstr "" -#: ../../library/functions.rst:1755 +#: ../../library/functions.rst:1758 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. " @@ -2717,7 +2717,7 @@ msgid "" "(this is useful for classmethods)." msgstr "" -#: ../../library/functions.rst:1760 +#: ../../library/functions.rst:1763 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 " @@ -2725,7 +2725,7 @@ msgid "" "closely parallels the use of *super* in other programming languages." msgstr "" -#: ../../library/functions.rst:1765 +#: ../../library/functions.rst:1768 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 " @@ -2738,18 +2738,18 @@ msgid "" "classes that are unknown prior to runtime)." msgstr "" -#: ../../library/functions.rst:1775 +#: ../../library/functions.rst:1778 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" -#: ../../library/functions.rst:1782 +#: ../../library/functions.rst:1785 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:1786 +#: ../../library/functions.rst:1789 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -2759,7 +2759,7 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" -#: ../../library/functions.rst:1793 +#: ../../library/functions.rst:1796 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 " @@ -2769,33 +2769,33 @@ msgid "" "accessing the current instance for ordinary methods." msgstr "" -#: ../../library/functions.rst:1800 +#: ../../library/functions.rst:1803 msgid "" "For practical suggestions on how to design cooperative classes using :func:" "`super`, see `guide to using super() `_." msgstr "" -#: ../../library/functions.rst:1810 +#: ../../library/functions.rst:1813 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:1819 +#: ../../library/functions.rst:1822 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:1823 +#: ../../library/functions.rst:1826 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:1827 +#: ../../library/functions.rst:1830 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 " @@ -2808,11 +2808,11 @@ msgid "" "identical :class:`type` objects:" msgstr "" -#: ../../library/functions.rst:1842 +#: ../../library/functions.rst:1845 msgid "See also :ref:`bltin-type-objects`." msgstr "另請參閱 :ref:`bltin-type-objects`。" -#: ../../library/functions.rst:1844 +#: ../../library/functions.rst:1847 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -2820,23 +2820,23 @@ msgid "" "would." msgstr "" -#: ../../library/functions.rst:1849 +#: ../../library/functions.rst:1852 msgid "See also :ref:`class-customization`." msgstr "另請參閱 :ref:`class-customization`。" -#: ../../library/functions.rst:1851 +#: ../../library/functions.rst:1854 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:1858 +#: ../../library/functions.rst:1861 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " "or any other object with a :attr:`~object.__dict__` attribute." msgstr "" -#: ../../library/functions.rst:1861 +#: ../../library/functions.rst:1864 msgid "" "Objects such as modules and instances have an updateable :attr:`~object." "__dict__` attribute; however, other objects may have write restrictions on " @@ -2844,54 +2844,54 @@ msgid "" "`types.MappingProxyType` to prevent direct dictionary updates)." msgstr "" -#: ../../library/functions.rst:1866 +#: ../../library/functions.rst:1869 msgid "" "Without an argument, :func:`vars` acts like :func:`locals`. Note, the " "locals dictionary is only useful for reads since updates to the locals " "dictionary are ignored." msgstr "" -#: ../../library/functions.rst:1870 +#: ../../library/functions.rst:1873 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:1876 +#: ../../library/functions.rst:1879 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." msgstr "" -#: ../../library/functions.rst:1879 +#: ../../library/functions.rst:1882 msgid "Example::" msgstr "" "例如:\n" "\n" "::" -#: ../../library/functions.rst:1888 +#: ../../library/functions.rst:1891 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:1891 +#: ../../library/functions.rst:1894 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:1895 +#: ../../library/functions.rst:1898 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:1899 +#: ../../library/functions.rst:1902 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 " @@ -2899,51 +2899,51 @@ msgid "" "approaches to dealing with this issue:" msgstr "" -#: ../../library/functions.rst:1904 +#: ../../library/functions.rst:1907 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:1911 +#: ../../library/functions.rst:1914 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:1918 +#: ../../library/functions.rst:1921 msgid "" "Unlike the default behavior, it checks that the lengths of iterables are " "identical, raising a :exc:`ValueError` if they aren't:" msgstr "" -#: ../../library/functions.rst:1926 +#: ../../library/functions.rst:1929 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:1930 +#: ../../library/functions.rst:1933 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:1934 +#: ../../library/functions.rst:1937 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:1937 +#: ../../library/functions.rst:1940 msgid "Tips and tricks:" msgstr "" -#: ../../library/functions.rst:1939 +#: ../../library/functions.rst:1942 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 " @@ -2952,23 +2952,23 @@ msgid "" "iterator. This has the effect of dividing the input into n-length chunks." msgstr "" -#: ../../library/functions.rst:1945 +#: ../../library/functions.rst:1948 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -#: ../../library/functions.rst:1956 +#: ../../library/functions.rst:1959 msgid "Added the ``strict`` argument." msgstr "增加了 ``strict`` 引數。" -#: ../../library/functions.rst:1968 +#: ../../library/functions.rst:1971 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:1971 +#: ../../library/functions.rst:1974 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -2980,7 +2980,7 @@ msgid "" "discouraged in favor of :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:1980 +#: ../../library/functions.rst:1983 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -2990,7 +2990,7 @@ msgid "" "determine the package context of the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:1987 +#: ../../library/functions.rst:1990 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -2999,7 +2999,7 @@ msgid "" "details)." msgstr "" -#: ../../library/functions.rst:1993 +#: ../../library/functions.rst:1996 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 " @@ -3007,58 +3007,58 @@ msgid "" "given, the module named by *name* is returned." msgstr "" -#: ../../library/functions.rst:1998 +#: ../../library/functions.rst:2001 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" msgstr "" -#: ../../library/functions.rst:2003 +#: ../../library/functions.rst:2006 msgid "The statement ``import spam.ham`` results in this call::" msgstr "" -#: ../../library/functions.rst:2007 +#: ../../library/functions.rst:2010 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:2010 +#: ../../library/functions.rst:2013 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" msgstr "" -#: ../../library/functions.rst:2017 +#: ../../library/functions.rst:2020 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:2021 +#: ../../library/functions.rst:2024 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2024 +#: ../../library/functions.rst:2027 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." msgstr "" -#: ../../library/functions.rst:2028 +#: ../../library/functions.rst:2031 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:2033 +#: ../../library/functions.rst:2036 msgid "Footnotes" msgstr "註解" -#: ../../library/functions.rst:2034 +#: ../../library/functions.rst:2037 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 " diff --git a/library/functools.po b/library/functools.po index 8adce1b2e5..55ab0a8326 100644 --- a/library/functools.po +++ b/library/functools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-31 08:13+0000\n" +"POT-Creation-Date: 2022-12-25 00:16+0000\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -53,14 +53,20 @@ msgid "" "`lru_cache()` with a size limit." msgstr "" -#: ../../library/functools.rst:39 ../../library/functools.rst:267 +#: ../../library/functools.rst:39 ../../library/functools.rst:273 msgid "For example::" msgstr "" "舉例來說:\n" "\n" "::" -#: ../../library/functools.rst:57 +#: ../../library/functools.rst:52 ../../library/functools.rst:146 +msgid "" +"The cache is threadsafe so the wrapped function can be used in multiple " +"threads." +msgstr "" + +#: ../../library/functools.rst:60 msgid "" "Transform a method of a class into a property whose value is computed once " "and then cached as a normal attribute for the life of the instance. Similar " @@ -68,22 +74,22 @@ msgid "" "computed properties of instances that are otherwise effectively immutable." msgstr "" -#: ../../library/functools.rst:62 ../../library/functools.rst:127 -#: ../../library/functools.rst:359 +#: ../../library/functools.rst:65 ../../library/functools.rst:130 +#: ../../library/functools.rst:365 msgid "Example::" msgstr "" "範例:\n" "\n" "::" -#: ../../library/functools.rst:73 +#: ../../library/functools.rst:76 msgid "" "The mechanics of :func:`cached_property` are somewhat different from :func:" "`property`. A regular property blocks attribute writes unless a setter is " "defined. In contrast, a *cached_property* allows writes." msgstr "" -#: ../../library/functools.rst:77 +#: ../../library/functools.rst:80 msgid "" "The *cached_property* decorator only runs on lookups and only when an " "attribute of the same name doesn't exist. When it does run, the " @@ -92,20 +98,20 @@ msgid "" "and it works like a normal attribute." msgstr "" -#: ../../library/functools.rst:83 +#: ../../library/functools.rst:86 msgid "" "The cached value can be cleared by deleting the attribute. This allows the " "*cached_property* method to run again." msgstr "" -#: ../../library/functools.rst:86 +#: ../../library/functools.rst:89 msgid "" "Note, this decorator interferes with the operation of :pep:`412` key-sharing " "dictionaries. This means that instance dictionaries can take more space " "than usual." msgstr "" -#: ../../library/functools.rst:90 +#: ../../library/functools.rst:93 msgid "" "Also, this decorator requires that the ``__dict__`` attribute on each " "instance be a mutable mapping. This means it will not work with some types, " @@ -115,14 +121,14 @@ msgid "" "such classes don't provide a ``__dict__`` attribute at all)." msgstr "" -#: ../../library/functools.rst:97 +#: ../../library/functools.rst:100 msgid "" "If a mutable mapping is not available or if space-efficient key sharing is " "desired, an effect similar to :func:`cached_property` can be achieved by a " "stacking :func:`property` on top of :func:`cache`::" msgstr "" -#: ../../library/functools.rst:115 +#: ../../library/functools.rst:118 msgid "" "Transform an old-style comparison function to a :term:`key function`. Used " "with tools that accept key functions (such as :func:`sorted`, :func:`min`, :" @@ -132,7 +138,7 @@ msgid "" "comparison functions." msgstr "" -#: ../../library/functools.rst:122 +#: ../../library/functools.rst:125 msgid "" "A comparison function is any callable that accepts two arguments, compares " "them, and returns a negative number for less-than, zero for equality, or a " @@ -140,25 +146,25 @@ msgid "" "one argument and returns another value to be used as the sort key." msgstr "" -#: ../../library/functools.rst:131 +#: ../../library/functools.rst:134 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functools.rst:139 +#: ../../library/functools.rst:142 msgid "" "Decorator to wrap a function with a memoizing callable that saves up to the " "*maxsize* most recent calls. It can save time when an expensive or I/O " "bound function is periodically called with the same arguments." msgstr "" -#: ../../library/functools.rst:143 +#: ../../library/functools.rst:149 msgid "" "Since a dictionary is used to cache results, the positional and keyword " "arguments to the function must be hashable." msgstr "" -#: ../../library/functools.rst:146 +#: ../../library/functools.rst:152 msgid "" "Distinct argument patterns may be considered to be distinct calls with " "separate cache entries. For example, ``f(a=1, b=2)`` and ``f(b=2, a=1)`` " @@ -166,20 +172,20 @@ msgid "" "entries." msgstr "" -#: ../../library/functools.rst:151 +#: ../../library/functools.rst:157 msgid "" "If *user_function* is specified, it must be a callable. This allows the " "*lru_cache* decorator to be applied directly to a user function, leaving the " "*maxsize* at its default value of 128::" msgstr "" -#: ../../library/functools.rst:159 +#: ../../library/functools.rst:165 msgid "" "If *maxsize* is set to ``None``, the LRU feature is disabled and the cache " "can grow without bound." msgstr "" -#: ../../library/functools.rst:162 +#: ../../library/functools.rst:168 msgid "" "If *typed* is set to true, function arguments of different types will be " "cached separately. If *typed* is false, the implementation will usually " @@ -187,7 +193,7 @@ msgid "" "such as *str* and *int* may be cached separately even when *typed* is false.)" msgstr "" -#: ../../library/functools.rst:168 +#: ../../library/functools.rst:174 msgid "" "Note, type specificity applies only to the function's immediate arguments " "rather than their contents. The scalar arguments, ``Decimal(42)`` and " @@ -196,7 +202,7 @@ msgid "" "Fraction(42))`` are treated as equivalent." msgstr "" -#: ../../library/functools.rst:174 +#: ../../library/functools.rst:180 msgid "" "The wrapped function is instrumented with a :func:`cache_parameters` " "function that returns a new :class:`dict` showing the values for *maxsize* " @@ -204,7 +210,7 @@ msgid "" "has no effect." msgstr "" -#: ../../library/functools.rst:179 +#: ../../library/functools.rst:185 msgid "" "To help measure the effectiveness of the cache and tune the *maxsize* " "parameter, the wrapped function is instrumented with a :func:`cache_info` " @@ -212,32 +218,32 @@ msgid "" "*maxsize* and *currsize*." msgstr "" -#: ../../library/functools.rst:184 +#: ../../library/functools.rst:190 msgid "" "The decorator also provides a :func:`cache_clear` function for clearing or " "invalidating the cache." msgstr "" -#: ../../library/functools.rst:187 +#: ../../library/functools.rst:193 msgid "" "The original underlying function is accessible through the :attr:" "`__wrapped__` attribute. This is useful for introspection, for bypassing " "the cache, or for rewrapping the function with a different cache." msgstr "" -#: ../../library/functools.rst:191 +#: ../../library/functools.rst:197 msgid "" "The cache keeps references to the arguments and return values until they age " "out of the cache or until the cache is cleared." msgstr "" -#: ../../library/functools.rst:194 +#: ../../library/functools.rst:200 msgid "" "If a method is cached, the ``self`` instance argument is included in the " "cache. See :ref:`faq-cache-method-calls`" msgstr "" -#: ../../library/functools.rst:197 +#: ../../library/functools.rst:203 msgid "" "An `LRU (least recently used) cache `_ works best when the " @@ -247,7 +253,7 @@ msgid "" "long-running processes such as web servers." msgstr "" -#: ../../library/functools.rst:204 +#: ../../library/functools.rst:210 msgid "" "In general, the LRU cache should only be used when you want to reuse " "previously computed values. Accordingly, it doesn't make sense to cache " @@ -255,44 +261,44 @@ msgid "" "objects on each call, or impure functions such as time() or random()." msgstr "" -#: ../../library/functools.rst:209 +#: ../../library/functools.rst:215 msgid "Example of an LRU cache for static web content::" msgstr "" -#: ../../library/functools.rst:228 +#: ../../library/functools.rst:234 msgid "" "Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a `dynamic " "programming `_ technique::" msgstr "" -#: ../../library/functools.rst:248 +#: ../../library/functools.rst:254 msgid "Added the *typed* option." msgstr "新增 *typed* 選項。" -#: ../../library/functools.rst:251 +#: ../../library/functools.rst:257 msgid "Added the *user_function* option." msgstr "新增 *user_function* 選項。" -#: ../../library/functools.rst:254 +#: ../../library/functools.rst:260 msgid "Added the function :func:`cache_parameters`" msgstr "新增 :func:`cache_parameters` 函式。" -#: ../../library/functools.rst:259 +#: ../../library/functools.rst:265 msgid "" "Given a class defining one or more rich comparison ordering methods, this " "class decorator supplies the rest. This simplifies the effort involved in " "specifying all of the possible rich comparison operations:" msgstr "" -#: ../../library/functools.rst:263 +#: ../../library/functools.rst:269 msgid "" "The class must define one of :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, " "or :meth:`__ge__`. In addition, the class should supply an :meth:`__eq__` " "method." msgstr "" -#: ../../library/functools.rst:287 +#: ../../library/functools.rst:293 msgid "" "While this decorator makes it easy to create well behaved totally ordered " "types, it *does* come at the cost of slower execution and more complex stack " @@ -301,7 +307,7 @@ msgid "" "rich comparison methods instead is likely to provide an easy speed boost." msgstr "" -#: ../../library/functools.rst:296 +#: ../../library/functools.rst:302 msgid "" "This decorator makes no attempt to override methods that have been declared " "in the class *or its superclasses*. Meaning that if a superclass defines a " @@ -309,13 +315,13 @@ msgid "" "the original method is abstract." msgstr "" -#: ../../library/functools.rst:303 +#: ../../library/functools.rst:309 msgid "" "Returning NotImplemented from the underlying comparison function for " "unrecognised types is now supported." msgstr "" -#: ../../library/functools.rst:309 +#: ../../library/functools.rst:315 msgid "" "Return a new :ref:`partial object` which when called will " "behave like *func* called with the positional arguments *args* and keyword " @@ -324,29 +330,29 @@ msgid "" "extend and override *keywords*. Roughly equivalent to::" msgstr "" -#: ../../library/functools.rst:325 +#: ../../library/functools.rst:331 msgid "" -"The :func:`partial` is used for partial function application which \"freezes" -"\" some portion of a function's arguments and/or keywords resulting in a new " -"object with a simplified signature. For example, :func:`partial` can be " -"used to create a callable that behaves like the :func:`int` function where " -"the *base* argument defaults to two:" +"The :func:`partial` is used for partial function application which " +"\"freezes\" some portion of a function's arguments and/or keywords resulting " +"in a new object with a simplified signature. For example, :func:`partial` " +"can be used to create a callable that behaves like the :func:`int` function " +"where the *base* argument defaults to two:" msgstr "" -#: ../../library/functools.rst:340 +#: ../../library/functools.rst:346 msgid "" "Return a new :class:`partialmethod` descriptor which behaves like :class:" "`partial` except that it is designed to be used as a method definition " "rather than being directly callable." msgstr "" -#: ../../library/functools.rst:344 +#: ../../library/functools.rst:350 msgid "" "*func* must be a :term:`descriptor` or a callable (objects which are both, " "like normal functions, are handled as descriptors)." msgstr "" -#: ../../library/functools.rst:347 +#: ../../library/functools.rst:353 msgid "" "When *func* is a descriptor (such as a normal Python function, :func:" "`classmethod`, :func:`staticmethod`, :func:`abstractmethod` or another " @@ -355,7 +361,7 @@ msgid "" "objects>` returned as the result." msgstr "" -#: ../../library/functools.rst:353 +#: ../../library/functools.rst:359 msgid "" "When *func* is a non-descriptor callable, an appropriate bound method is " "created dynamically. This behaves like a normal Python function when used as " @@ -364,7 +370,7 @@ msgid "" "`partialmethod` constructor." msgstr "" -#: ../../library/functools.rst:384 +#: ../../library/functools.rst:390 msgid "" "Apply *function* of two arguments cumulatively to the items of *iterable*, " "from left to right, so as to reduce the iterable to a single value. For " @@ -377,30 +383,30 @@ msgid "" "the first item is returned." msgstr "" -#: ../../library/functools.rst:393 +#: ../../library/functools.rst:399 msgid "Roughly equivalent to::" msgstr "" -#: ../../library/functools.rst:405 +#: ../../library/functools.rst:411 msgid "" "See :func:`itertools.accumulate` for an iterator that yields all " "intermediate values." msgstr "" -#: ../../library/functools.rst:410 +#: ../../library/functools.rst:416 msgid "" "Transform a function into a :term:`single-dispatch ` :term:" "`generic function`." msgstr "" -#: ../../library/functools.rst:413 +#: ../../library/functools.rst:419 msgid "" "To define a generic function, decorate it with the ``@singledispatch`` " "decorator. When defining a function using ``@singledispatch``, note that the " "dispatch happens on the type of the first argument::" msgstr "" -#: ../../library/functools.rst:424 +#: ../../library/functools.rst:430 msgid "" "To add overloaded implementations to the function, use the :func:`register` " "attribute of the generic function, which can be used as a decorator. For " @@ -408,36 +414,36 @@ msgid "" "first argument automatically::" msgstr "" -#: ../../library/functools.rst:442 +#: ../../library/functools.rst:448 msgid ":data:`types.UnionType` and :data:`typing.Union` can also be used::" msgstr "" -#: ../../library/functools.rst:459 +#: ../../library/functools.rst:465 msgid "" "For code which doesn't use type annotations, the appropriate type argument " "can be passed explicitly to the decorator itself::" msgstr "" -#: ../../library/functools.rst:470 +#: ../../library/functools.rst:476 msgid "" "To enable registering :term:`lambdas` and pre-existing functions, " "the :func:`register` attribute can also be used in a functional form::" msgstr "" -#: ../../library/functools.rst:478 +#: ../../library/functools.rst:484 msgid "" "The :func:`register` attribute returns the undecorated function. This " "enables decorator stacking, :mod:`pickling`, and the creation of " "unit tests for each variant independently::" msgstr "" -#: ../../library/functools.rst:492 +#: ../../library/functools.rst:498 msgid "" "When called, the generic function dispatches on the type of the first " "argument::" msgstr "" -#: ../../library/functools.rst:512 +#: ../../library/functools.rst:518 msgid "" "Where there is no registered implementation for a specific type, its method " "resolution order is used to find a more generic implementation. The original " @@ -446,42 +452,42 @@ msgid "" "found." msgstr "" -#: ../../library/functools.rst:518 +#: ../../library/functools.rst:524 msgid "" "If an implementation is registered to an :term:`abstract base class`, " "virtual subclasses of the base class will be dispatched to that " "implementation::" msgstr "" -#: ../../library/functools.rst:533 +#: ../../library/functools.rst:539 msgid "" "To check which implementation the generic function will choose for a given " "type, use the ``dispatch()`` attribute::" msgstr "" -#: ../../library/functools.rst:541 +#: ../../library/functools.rst:547 msgid "" "To access all registered implementations, use the read-only ``registry`` " "attribute::" msgstr "" -#: ../../library/functools.rst:555 +#: ../../library/functools.rst:561 msgid "The :func:`register` attribute now supports using type annotations." msgstr "" -#: ../../library/functools.rst:558 +#: ../../library/functools.rst:564 msgid "" "The :func:`register` attribute now supports :data:`types.UnionType` and :" "data:`typing.Union` as type annotations." msgstr "" -#: ../../library/functools.rst:565 +#: ../../library/functools.rst:571 msgid "" "Transform a method into a :term:`single-dispatch ` :term:" "`generic function`." msgstr "" -#: ../../library/functools.rst:568 +#: ../../library/functools.rst:574 msgid "" "To define a generic method, decorate it with the ``@singledispatchmethod`` " "decorator. When defining a function using ``@singledispatchmethod``, note " @@ -489,7 +495,7 @@ msgid "" "argument::" msgstr "" -#: ../../library/functools.rst:586 +#: ../../library/functools.rst:592 msgid "" "``@singledispatchmethod`` supports nesting with other decorators such as :" "func:`@classmethod`. Note that to allow for ``dispatcher." @@ -498,14 +504,14 @@ msgid "" "rather than an instance of the class::" msgstr "" -#: ../../library/functools.rst:608 +#: ../../library/functools.rst:614 msgid "" "The same pattern can be used for other similar decorators: :func:" "`@staticmethod`, :func:`@abstractmethod`, " "and others." msgstr "" -#: ../../library/functools.rst:617 +#: ../../library/functools.rst:623 msgid "" "Update a *wrapper* function to look like the *wrapped* function. The " "optional arguments are tuples to specify which attributes of the original " @@ -519,7 +525,7 @@ msgid "" "``__dict__``, i.e. the instance dictionary)." msgstr "" -#: ../../library/functools.rst:627 +#: ../../library/functools.rst:633 msgid "" "To allow access to the original function for introspection and other " "purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), " @@ -527,7 +533,7 @@ msgid "" "that refers to the function being wrapped." msgstr "" -#: ../../library/functools.rst:632 +#: ../../library/functools.rst:638 msgid "" "The main intended use for this function is in :term:`decorator` functions " "which wrap the decorated function and return the wrapper. If the wrapper " @@ -536,7 +542,7 @@ msgid "" "is typically less than helpful." msgstr "" -#: ../../library/functools.rst:638 +#: ../../library/functools.rst:644 msgid "" ":func:`update_wrapper` may be used with callables other than functions. Any " "attributes named in *assigned* or *updated* that are missing from the object " @@ -545,26 +551,26 @@ msgid "" "wrapper function itself is missing any attributes named in *updated*." msgstr "" -#: ../../library/functools.rst:644 +#: ../../library/functools.rst:650 msgid "Automatic addition of the ``__wrapped__`` attribute." msgstr "" -#: ../../library/functools.rst:647 +#: ../../library/functools.rst:653 msgid "Copying of the ``__annotations__`` attribute by default." msgstr "" -#: ../../library/functools.rst:650 +#: ../../library/functools.rst:656 msgid "Missing attributes no longer trigger an :exc:`AttributeError`." msgstr "" -#: ../../library/functools.rst:653 +#: ../../library/functools.rst:659 msgid "" "The ``__wrapped__`` attribute now always refers to the wrapped function, " "even if that function defined a ``__wrapped__`` attribute. (see :issue:" "`17482`)" msgstr "" -#: ../../library/functools.rst:661 +#: ../../library/functools.rst:667 msgid "" "This is a convenience function for invoking :func:`update_wrapper` as a " "function decorator when defining a wrapper function. It is equivalent to " @@ -572,42 +578,42 @@ msgid "" "updated=updated)``. For example::" msgstr "" -#: ../../library/functools.rst:687 +#: ../../library/functools.rst:693 msgid "" "Without the use of this decorator factory, the name of the example function " "would have been ``'wrapper'``, and the docstring of the original :func:" "`example` would have been lost." msgstr "" -#: ../../library/functools.rst:695 +#: ../../library/functools.rst:701 msgid ":class:`partial` Objects" msgstr ":class:`partial` 物件" -#: ../../library/functools.rst:697 +#: ../../library/functools.rst:703 msgid "" ":class:`partial` objects are callable objects created by :func:`partial`. " "They have three read-only attributes:" msgstr "" -#: ../../library/functools.rst:703 +#: ../../library/functools.rst:709 msgid "" "A callable object or function. Calls to the :class:`partial` object will be " "forwarded to :attr:`func` with new arguments and keywords." msgstr "" -#: ../../library/functools.rst:709 +#: ../../library/functools.rst:715 msgid "" "The leftmost positional arguments that will be prepended to the positional " "arguments provided to a :class:`partial` object call." msgstr "" -#: ../../library/functools.rst:715 +#: ../../library/functools.rst:721 msgid "" "The keyword arguments that will be supplied when the :class:`partial` object " "is called." msgstr "" -#: ../../library/functools.rst:718 +#: ../../library/functools.rst:724 msgid "" ":class:`partial` objects are like :class:`function` objects in that they are " "callable, weak referencable, and can have attributes. There are some " diff --git a/library/sched.po b/library/sched.po index 2151297d28..2ee4573c28 100644 --- a/library/sched.po +++ b/library/sched.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"POT-Creation-Date: 2022-12-25 00:16+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -60,15 +60,15 @@ msgstr "" "\n" "::" -#: ../../library/sched.rst:61 +#: ../../library/sched.rst:67 msgid "Scheduler Objects" msgstr "" -#: ../../library/sched.rst:63 +#: ../../library/sched.rst:69 msgid ":class:`scheduler` instances have the following methods and attributes:" msgstr "" -#: ../../library/sched.rst:68 +#: ../../library/sched.rst:74 msgid "" "Schedule a new event. The *time* argument should be a numeric type " "compatible with the return value of the *timefunc* function passed to the " @@ -76,59 +76,59 @@ msgid "" "order of their *priority*. A lower number represents a higher priority." msgstr "" -#: ../../library/sched.rst:73 +#: ../../library/sched.rst:79 msgid "" "Executing the event means executing ``action(*argument, **kwargs)``. " "*argument* is a sequence holding the positional arguments for *action*. " "*kwargs* is a dictionary holding the keyword arguments for *action*." msgstr "" -#: ../../library/sched.rst:77 +#: ../../library/sched.rst:83 msgid "" "Return value is an event which may be used for later cancellation of the " "event (see :meth:`cancel`)." msgstr "" -#: ../../library/sched.rst:80 ../../library/sched.rst:93 +#: ../../library/sched.rst:86 ../../library/sched.rst:99 msgid "*argument* parameter is optional." msgstr "" -#: ../../library/sched.rst:83 ../../library/sched.rst:96 +#: ../../library/sched.rst:89 ../../library/sched.rst:102 msgid "*kwargs* parameter was added." msgstr "新增 *kwargs* 參數。" -#: ../../library/sched.rst:89 +#: ../../library/sched.rst:95 msgid "" "Schedule an event for *delay* more time units. Other than the relative time, " "the other arguments, the effect and the return value are the same as those " "for :meth:`enterabs`." msgstr "" -#: ../../library/sched.rst:101 +#: ../../library/sched.rst:107 msgid "" "Remove the event from the queue. If *event* is not an event currently in the " "queue, this method will raise a :exc:`ValueError`." msgstr "" -#: ../../library/sched.rst:107 +#: ../../library/sched.rst:113 msgid "Return ``True`` if the event queue is empty." msgstr "" -#: ../../library/sched.rst:112 +#: ../../library/sched.rst:118 msgid "" "Run all scheduled events. This method will wait (using the :func:" "`delayfunc` function passed to the constructor) for the next event, then " "execute it and so on until there are no more scheduled events." msgstr "" -#: ../../library/sched.rst:116 +#: ../../library/sched.rst:122 msgid "" "If *blocking* is false executes the scheduled events due to expire soonest " "(if any) and then return the deadline of the next scheduled call in the " "scheduler (if any)." msgstr "" -#: ../../library/sched.rst:120 +#: ../../library/sched.rst:126 msgid "" "Either *action* or *delayfunc* can raise an exception. In either case, the " "scheduler will maintain a consistent state and propagate the exception. If " @@ -136,7 +136,7 @@ msgid "" "future calls to :meth:`run`." msgstr "" -#: ../../library/sched.rst:125 +#: ../../library/sched.rst:131 msgid "" "If a sequence of events takes longer to run than the time available before " "the next event, the scheduler will simply fall behind. No events will be " @@ -144,11 +144,11 @@ msgid "" "longer pertinent." msgstr "" -#: ../../library/sched.rst:130 +#: ../../library/sched.rst:136 msgid "*blocking* parameter was added." msgstr "新增 *blocking* 參數。" -#: ../../library/sched.rst:135 +#: ../../library/sched.rst:141 msgid "" "Read-only attribute returning a list of upcoming events in the order they " "will be run. Each event is shown as a :term:`named tuple` with the " diff --git a/library/stdtypes.po b/library/stdtypes.po index 42c3110f84..e7400aed72 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-12-22 00:15+0000\n" +"POT-Creation-Date: 2022-12-25 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-" @@ -5863,7 +5863,7 @@ msgstr "" #: ../../library/stdtypes.rst:5479 msgid "" -"The :class:`int` type in CPython is an abitrary length number stored in " +"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 " "can convert a string to a binary integer or a binary integer to a string in " "linear time, *unless* the base is a power of 2. Even the best known " @@ -5924,8 +5924,8 @@ msgid "``str(integer)``." msgstr "``str(integer)``。" #: ../../library/stdtypes.rst:5543 -msgid "``repr(integer)``" -msgstr "``repr(integer)``" +msgid "``repr(integer)``." +msgstr "``repr(integer)``。" #: ../../library/stdtypes.rst:5544 msgid "" @@ -5990,7 +5990,7 @@ msgid "" "`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " "env var and the ``-X`` option are set, the ``-X`` option takes precedence. A " "value of *-1* indicates that both were unset, thus a value of :data:`sys." -"int_info.default_max_str_digits` was used during initilization." +"int_info.default_max_str_digits` was used during initialization." msgstr "" #: ../../library/stdtypes.rst:5573 diff --git a/library/subprocess.po b/library/subprocess.po index 96a2a48e9c..fdd3f5536b 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-11-09 00:19+0000\n" +"POT-Creation-Date: 2022-12-25 00:16+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1774,11 +1774,7 @@ msgid "" "`subprocess._USE_VFORK` attribute to a false value." msgstr "" -#: ../../library/subprocess.rst:1570 -msgid "subprocess._USE_VFORK = False # See CPython issue gh-NNNNNN." -msgstr "" - -#: ../../library/subprocess.rst:1572 +#: ../../library/subprocess.rst:1574 msgid "" "Setting this has no impact on use of ``posix_spawn()`` which could use " "``vfork()`` internally within its libc implementation. There is a similar :" @@ -1786,11 +1782,7 @@ msgid "" "that." msgstr "" -#: ../../library/subprocess.rst:1577 -msgid "subprocess._USE_POSIX_SPAWN = False # See CPython issue gh-NNNNNN." -msgstr "" - -#: ../../library/subprocess.rst:1579 +#: ../../library/subprocess.rst:1583 msgid "" "It is safe to set these to false on any Python version. They will have no " "effect on older versions when unsupported. Do not assume the attributes are " @@ -1798,17 +1790,17 @@ msgid "" "the corresponding function will be used, only that that it may be." msgstr "" -#: ../../library/subprocess.rst:1584 +#: ../../library/subprocess.rst:1588 msgid "" "Please file issues any time you have to use these private knobs with a way " "to reproduce the issue you were seeing. Link to that issue from a comment in " "your code." msgstr "" -#: ../../library/subprocess.rst:1588 +#: ../../library/subprocess.rst:1592 msgid "``_USE_POSIX_SPAWN``" msgstr "``_USE_POSIX_SPAWN``" -#: ../../library/subprocess.rst:1589 +#: ../../library/subprocess.rst:1593 msgid "``_USE_VFORK``" msgstr "``_USE_VFORK``" diff --git a/library/typing.po b/library/typing.po index 3012ab56ec..575a5b6f7f 100644 --- a/library/typing.po +++ b/library/typing.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-11-23 00:17+0000\n" +"POT-Creation-Date: 2022-12-25 00:16+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -337,7 +337,7 @@ msgid "" msgstr "" #: ../../library/typing.rst:222 ../../library/typing.rst:1164 -#: ../../library/typing.rst:2801 +#: ../../library/typing.rst:2805 msgid "For example::" msgstr "" "舉例來說:\n" @@ -1498,9 +1498,9 @@ msgstr "" msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This raises :exc:`TypeError` when applied to a non-protocol class. This " -"allows a simple-minded structural check, very similar to \"one trick ponies" -"\" in :mod:`collections.abc` such as :class:`~collections.abc.Iterable`. " -"For example::" +"allows a simple-minded structural check, very similar to \"one trick " +"ponies\" in :mod:`collections.abc` such as :class:`~collections.abc." +"Iterable`. For example::" msgstr "" #: ../../library/typing.rst:1587 @@ -2671,16 +2671,22 @@ msgstr "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。" #: ../../library/typing.rst:2770 msgid "" +"Calling ``get_type_hints()`` on a class no longer returns the annotations of " +"its base classes." +msgstr "" + +#: ../../library/typing.rst:2774 +msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:2778 +#: ../../library/typing.rst:2782 msgid "Provide basic introspection for generic types and special typing forms." msgstr "" -#: ../../library/typing.rst:2780 +#: ../../library/typing.rst:2784 msgid "" "For a typing object of the form ``X[Y, Z, ...]`` these functions return " "``X`` and ``(Y, Z, ...)``. If ``X`` is a generic alias for a builtin or :mod:" @@ -2691,11 +2697,11 @@ msgid "" "and ``()`` correspondingly. Examples::" msgstr "" -#: ../../library/typing.rst:2799 +#: ../../library/typing.rst:2803 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:2814 +#: ../../library/typing.rst:2818 msgid "" "A class used for internal typing representation of string forward " "references. For example, ``List[\"SomeClass\"]`` is implicitly transformed " @@ -2703,24 +2709,24 @@ msgid "" "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:2820 +#: ../../library/typing.rst:2824 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:2827 +#: ../../library/typing.rst:2831 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:2831 +#: ../../library/typing.rst:2835 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It is ``False`` at runtime. Usage::" msgstr "" -#: ../../library/typing.rst:2840 +#: ../../library/typing.rst:2844 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -2728,7 +2734,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:2847 +#: ../../library/typing.rst:2851 msgid "" "If ``from __future__ import annotations`` is used, annotations are not " "evaluated at function definition time. Instead, they are stored as strings " @@ -2736,11 +2742,11 @@ msgid "" "annotation (see :pep:`563`)." msgstr "" -#: ../../library/typing.rst:2856 +#: ../../library/typing.rst:2860 msgid "Deprecation Timeline of Major Features" msgstr "" -#: ../../library/typing.rst:2858 +#: ../../library/typing.rst:2862 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -2748,62 +2754,62 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:2863 +#: ../../library/typing.rst:2867 msgid "Feature" msgstr "" -#: ../../library/typing.rst:2863 +#: ../../library/typing.rst:2867 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:2863 +#: ../../library/typing.rst:2867 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:2863 +#: ../../library/typing.rst:2867 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:2865 +#: ../../library/typing.rst:2869 msgid "``typing.io`` and ``typing.re`` submodules" msgstr "" -#: ../../library/typing.rst:2865 +#: ../../library/typing.rst:2869 msgid "3.8" msgstr "3.8" -#: ../../library/typing.rst:2865 +#: ../../library/typing.rst:2869 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:2865 +#: ../../library/typing.rst:2869 msgid ":issue:`38291`" msgstr ":issue:`38291`" -#: ../../library/typing.rst:2868 +#: ../../library/typing.rst:2872 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:2868 +#: ../../library/typing.rst:2872 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:2868 ../../library/typing.rst:2871 +#: ../../library/typing.rst:2872 ../../library/typing.rst:2875 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:2868 +#: ../../library/typing.rst:2872 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:2871 +#: ../../library/typing.rst:2875 msgid "``typing.Text``" msgstr "``typing.Text``" -#: ../../library/typing.rst:2871 +#: ../../library/typing.rst:2875 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:2871 +#: ../../library/typing.rst:2875 msgid ":gh:`92332`" msgstr ":gh:`92332`" diff --git a/tutorial/appendix.po b/tutorial/appendix.po index 82b39fc64a..d63a4f5ff6 100644 --- a/tutorial/appendix.po +++ b/tutorial/appendix.po @@ -89,7 +89,7 @@ msgid "" msgstr "" "(假設直譯器在用戶的 :envvar:`PATH` 上)在腳本的開頭並給檔案一個可執行模式。 " "``#!`` 必須是檔案的前兩個字元。 在某些平台上,第一行必須以 Unix 樣式的換行 " -"(``’\\n’``) 結尾,而不是 Windows (``’\\r\\n’``) 換行。 請注意,井號 " +"(``'\\n'``) 結尾,而不是 Windows (``'\\r\\n'``) 換行。 請注意,井號 " "``'#'`` 用於在 Python 中開始註解。" #: ../../tutorial/appendix.rst:52 diff --git a/tutorial/classes.po b/tutorial/classes.po index 7061e9bcf6..0836649e0e 100644 --- a/tutorial/classes.po +++ b/tutorial/classes.po @@ -9,8 +9,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-12-13 00:16+0000\n" -"PO-Revision-Date: 2022-12-19 16:52+0800\n" +"POT-Creation-Date: 2022-12-25 00:16+0000\n" +"PO-Revision-Date: 2022-12-26 23:12+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -615,7 +615,7 @@ msgid "" "is a method object, and can be stored away and called at a later time. For " "example::" msgstr "" -"在 :class:`MyClass` 的例子中,這將回傳字串 ``’hello world’``。然而,並沒有必" +"在 :class:`MyClass` 的例子中,這將回傳字串 ``'hello world'``。然而,並沒有必" "要立即呼叫一個 method:\\ ``x.f`` 是一個 method 物件,並且可以被儲藏起來,之" "後再被呼叫。舉例來說:\n" "\n" @@ -1103,16 +1103,16 @@ msgstr "補充說明" #: ../../tutorial/classes.rst:739 msgid "" "Sometimes it is useful to have a data type similar to the Pascal \"record\" " -"or C \"struct\", bundling together a few named data items. An empty class " -"definition will do nicely::" +"or C \"struct\", bundling together a few named data items. The idiomatic " +"approach is to use :mod:`dataclasses` for this purpose::" msgstr "" "如果有一種資料型別,類似於 Pascal 的「record」或 C 的「struct」,可以將一些有" -"名稱的資料項目捆綁在一起,有時候這會很有用。其實一個空白的 class definition " -"就可以勝任:\n" +"名稱的資料項目捆綁在一起,有時候這會很有用。符合語言習慣的做法是使用 :mod:" +"`dataclasses`:\n" "\n" "::" -#: ../../tutorial/classes.rst:753 +#: ../../tutorial/classes.rst:759 msgid "" "A piece of Python code that expects a particular abstract data type can " "often be passed a class that emulates the methods of that data type " @@ -1126,7 +1126,7 @@ msgstr "" "物件來格式化某些資料,你也可以定義一個有 :meth:`read` 和 :meth:`!readline` " "method 的 class 作為替代方式,從字串緩衝區取得資料,並將其作為引數來傳遞。" -#: ../../tutorial/classes.rst:764 +#: ../../tutorial/classes.rst:770 msgid "" "Instance method objects have attributes, too: ``m.__self__`` is the instance " "object with the method :meth:`m`, and ``m.__func__`` is the function object " @@ -1135,11 +1135,11 @@ msgstr "" "實例的 method 物件也具有屬性:``m.__self__`` 就是帶有 method :meth:`m` 的實例" "物件,而 ``m.__func__`` 則是該 method 所對應的函式物件。" -#: ../../tutorial/classes.rst:772 +#: ../../tutorial/classes.rst:778 msgid "Iterators" msgstr "疊代器 (Iterator)" -#: ../../tutorial/classes.rst:774 +#: ../../tutorial/classes.rst:780 msgid "" "By now you have probably noticed that most container objects can be looped " "over using a :keyword:`for` statement::" @@ -1149,7 +1149,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/classes.rst:788 +#: ../../tutorial/classes.rst:794 msgid "" "This style of access is clear, concise, and convenient. The use of " "iterators pervades and unifies Python. Behind the scenes, the :keyword:" @@ -1171,7 +1171,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/classes.rst:813 +#: ../../tutorial/classes.rst:819 msgid "" "Having seen the mechanics behind the iterator protocol, it is easy to add " "iterator behavior to your classes. Define an :meth:`__iter__` method which " @@ -1185,11 +1185,11 @@ msgstr "" "\n" "::" -#: ../../tutorial/classes.rst:850 +#: ../../tutorial/classes.rst:856 msgid "Generators" msgstr "產生器 (Generator)" -#: ../../tutorial/classes.rst:852 +#: ../../tutorial/classes.rst:858 msgid "" ":term:`Generators ` are a simple and powerful tool for creating " "iterators. They are written like regular functions but use the :keyword:" @@ -1205,7 +1205,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/classes.rst:873 +#: ../../tutorial/classes.rst:879 msgid "" "Anything that can be done with generators can also be done with class-based " "iterators as described in the previous section. What makes generators so " @@ -1216,7 +1216,7 @@ msgstr "" "描述。而讓產生器的程式碼更為精簡的原因是,\\ :meth:`__iter__` 和 :meth:" "`~generator.__next__` method 會自動被建立。" -#: ../../tutorial/classes.rst:878 +#: ../../tutorial/classes.rst:884 msgid "" "Another key feature is that the local variables and execution state are " "automatically saved between calls. This made the function easier to write " @@ -1227,7 +1227,7 @@ msgstr "" "函式比使用 ``self.index`` 和 ``self.data`` 這種實例變數的方式更容易編寫且更為" "清晰。" -#: ../../tutorial/classes.rst:883 +#: ../../tutorial/classes.rst:889 msgid "" "In addition to automatic method creation and saving program state, when " "generators terminate, they automatically raise :exc:`StopIteration`. In " @@ -1238,11 +1238,11 @@ msgstr "" "`StopIteration`\\ 。這些特性結合在一起,使建立疊代器能與編寫常規函式一樣容" "易。" -#: ../../tutorial/classes.rst:892 +#: ../../tutorial/classes.rst:898 msgid "Generator Expressions" msgstr "產生器運算式" -#: ../../tutorial/classes.rst:894 +#: ../../tutorial/classes.rst:900 msgid "" "Some simple generators can be coded succinctly as expressions using a syntax " "similar to list comprehensions but with parentheses instead of square " @@ -1257,18 +1257,18 @@ msgstr "" "產生器定義相比,程式碼較精簡但功能較少,也比等效的 list comprehension 更為節" "省記憶體。" -#: ../../tutorial/classes.rst:901 +#: ../../tutorial/classes.rst:907 msgid "Examples::" msgstr "" "例如:\n" "\n" "::" -#: ../../tutorial/classes.rst:922 +#: ../../tutorial/classes.rst:928 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/classes.rst:923 +#: ../../tutorial/classes.rst:929 msgid "" "Except for one thing. Module objects have a secret read-only attribute " "called :attr:`~object.__dict__` which returns the dictionary used to " diff --git a/tutorial/whatnow.po b/tutorial/whatnow.po index f46cc853e0..74588983da 100644 --- a/tutorial/whatnow.po +++ b/tutorial/whatnow.po @@ -111,7 +111,7 @@ msgid "" msgstr "" "https://code.activestate.com/recipes/langs/python/:Python Cookbook 是一個相" "當大的程式碼集,包含程式碼範例、較大的模組以及有用的腳本。特別值得注意的貢獻" -"則被收集在一本名為 Python Cookbook (O’Reilly & Associates, ISBN " +"則被收集在一本名為 Python Cookbook (O'Reilly & Associates, ISBN " "0-596-00797-3.) 的書籍中。" #: ../../tutorial/whatnow.rst:48