diff --git a/.scripts/poetry.lock b/.scripts/poetry.lock index 60d477dd30..5f06f9c25c 100644 --- a/.scripts/poetry.lock +++ b/.scripts/poetry.lock @@ -173,13 +173,13 @@ files = [ [[package]] name = "hstspreload" -version = "2024.9.1" +version = "2024.10.1" description = "Chromium HSTS Preload list as a Python package" optional = false python-versions = ">=3.6" files = [ - {file = "hstspreload-2024.9.1-py3-none-any.whl", hash = "sha256:9c1b2d0313899d3ff9dac03ab39d53fed95c32eef9862e7eabee8dc07dfd589c"}, - {file = "hstspreload-2024.9.1.tar.gz", hash = "sha256:2ab4518495a132c4ae430c474afffd12938852c6eec68ce1368c8f7858dc3076"}, + {file = "hstspreload-2024.10.1-py3-none-any.whl", hash = "sha256:3ab481036cbdff095cb411dafe33ee7924492319cf6ddaf4e776a159537541b3"}, + {file = "hstspreload-2024.10.1.tar.gz", hash = "sha256:2859a6b52253743ddddad468d8c9570ba650170ca49ac416336826915ee409b8"}, ] [[package]] diff --git a/c-api/buffer.po b/c-api/buffer.po index fa0c60391b..d183ac606f 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -341,16 +341,17 @@ msgid "" "itemsize`, :c:member:`~Py_buffer.ndim`." msgstr "" -#: ../../c-api/buffer.rst:249 +#: ../../c-api/buffer.rst:248 msgid "readonly, format" msgstr "" -#: ../../c-api/buffer.rst:253 +#: ../../c-api/buffer.rst:252 msgid "" "Controls the :c:member:`~Py_buffer.readonly` field. If set, the exporter " "MUST provide a writable buffer or else report failure. Otherwise, the " "exporter MAY provide either a read-only or writable buffer, but the choice " -"MUST be consistent for all consumers." +"MUST be consistent for all consumers. For example, :c:expr:`PyBUF_SIMPLE | " +"PyBUF_WRITABLE` can be used to request a simple writable buffer." msgstr "" #: ../../c-api/buffer.rst:260 @@ -369,156 +370,157 @@ msgstr "" #: ../../c-api/buffer.rst:268 msgid "" -":c:macro:`PyBUF_FORMAT` can be \\|'d to any of the flags except :c:macro:" -"`PyBUF_SIMPLE`. The latter already implies format ``B`` (unsigned bytes)." +":c:macro:`PyBUF_FORMAT` must be \\|'d to any of the flags except :c:macro:" +"`PyBUF_SIMPLE`, because the latter already implies format ``B`` (unsigned " +"bytes). :c:macro:`!PyBUF_FORMAT` cannot be used on its own." msgstr "" -#: ../../c-api/buffer.rst:273 +#: ../../c-api/buffer.rst:274 msgid "shape, strides, suboffsets" msgstr "" -#: ../../c-api/buffer.rst:275 +#: ../../c-api/buffer.rst:276 msgid "" "The flags that control the logical structure of the memory are listed in " "decreasing order of complexity. Note that each flag contains all bits of the " "flags below it." msgstr "" -#: ../../c-api/buffer.rst:282 ../../c-api/buffer.rst:306 -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 +#: ../../c-api/buffer.rst:332 msgid "Request" msgstr "" -#: ../../c-api/buffer.rst:282 ../../c-api/buffer.rst:306 -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 +#: ../../c-api/buffer.rst:332 msgid "shape" msgstr "" -#: ../../c-api/buffer.rst:282 ../../c-api/buffer.rst:306 -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 +#: ../../c-api/buffer.rst:332 msgid "strides" msgstr "" -#: ../../c-api/buffer.rst:282 ../../c-api/buffer.rst:306 -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 +#: ../../c-api/buffer.rst:332 msgid "suboffsets" msgstr "" -#: ../../c-api/buffer.rst:284 ../../c-api/buffer.rst:286 -#: ../../c-api/buffer.rst:288 ../../c-api/buffer.rst:308 -#: ../../c-api/buffer.rst:310 ../../c-api/buffer.rst:312 -#: ../../c-api/buffer.rst:314 ../../c-api/buffer.rst:333 -#: ../../c-api/buffer.rst:335 ../../c-api/buffer.rst:337 -#: ../../c-api/buffer.rst:339 ../../c-api/buffer.rst:341 -#: ../../c-api/buffer.rst:343 ../../c-api/buffer.rst:345 -#: ../../c-api/buffer.rst:347 +#: ../../c-api/buffer.rst:285 ../../c-api/buffer.rst:287 +#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:309 +#: ../../c-api/buffer.rst:311 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:315 ../../c-api/buffer.rst:334 +#: ../../c-api/buffer.rst:336 ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:342 +#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:348 msgid "yes" msgstr "" -#: ../../c-api/buffer.rst:284 ../../c-api/buffer.rst:333 -#: ../../c-api/buffer.rst:335 +#: ../../c-api/buffer.rst:285 ../../c-api/buffer.rst:334 +#: ../../c-api/buffer.rst:336 msgid "if needed" msgstr "" -#: ../../c-api/buffer.rst:286 ../../c-api/buffer.rst:288 -#: ../../c-api/buffer.rst:290 ../../c-api/buffer.rst:308 -#: ../../c-api/buffer.rst:310 ../../c-api/buffer.rst:312 -#: ../../c-api/buffer.rst:314 ../../c-api/buffer.rst:337 -#: ../../c-api/buffer.rst:339 ../../c-api/buffer.rst:341 -#: ../../c-api/buffer.rst:343 ../../c-api/buffer.rst:345 -#: ../../c-api/buffer.rst:347 +#: ../../c-api/buffer.rst:287 ../../c-api/buffer.rst:289 +#: ../../c-api/buffer.rst:291 ../../c-api/buffer.rst:309 +#: ../../c-api/buffer.rst:311 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:315 ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:342 +#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:348 msgid "NULL" msgstr "NULL" -#: ../../c-api/buffer.rst:297 +#: ../../c-api/buffer.rst:298 msgid "contiguity requests" msgstr "" -#: ../../c-api/buffer.rst:299 +#: ../../c-api/buffer.rst:300 msgid "" "C or Fortran :term:`contiguity ` can be explicitly requested, " "with and without stride information. Without stride information, the buffer " "must be C-contiguous." msgstr "" -#: ../../c-api/buffer.rst:306 ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:307 ../../c-api/buffer.rst:332 msgid "contig" msgstr "" -#: ../../c-api/buffer.rst:308 ../../c-api/buffer.rst:314 -#: ../../c-api/buffer.rst:345 ../../c-api/buffer.rst:347 +#: ../../c-api/buffer.rst:309 ../../c-api/buffer.rst:315 +#: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:348 msgid "C" msgstr "C" -#: ../../c-api/buffer.rst:310 +#: ../../c-api/buffer.rst:311 msgid "F" msgstr "F" -#: ../../c-api/buffer.rst:312 +#: ../../c-api/buffer.rst:313 msgid "C or F" msgstr "C 或 F" -#: ../../c-api/buffer.rst:314 +#: ../../c-api/buffer.rst:315 msgid ":c:macro:`PyBUF_ND`" msgstr ":c:macro:`PyBUF_ND`" -#: ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:320 msgid "compound requests" msgstr "" -#: ../../c-api/buffer.rst:321 +#: ../../c-api/buffer.rst:322 msgid "" "All possible requests are fully defined by some combination of the flags in " "the previous section. For convenience, the buffer protocol provides " "frequently used combinations as single flags." msgstr "" -#: ../../c-api/buffer.rst:325 +#: ../../c-api/buffer.rst:326 msgid "" "In the following table *U* stands for undefined contiguity. The consumer " "would have to call :c:func:`PyBuffer_IsContiguous` to determine contiguity." msgstr "" -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:332 msgid "readonly" msgstr "" -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:332 msgid "format" msgstr "" -#: ../../c-api/buffer.rst:333 ../../c-api/buffer.rst:335 -#: ../../c-api/buffer.rst:337 ../../c-api/buffer.rst:339 -#: ../../c-api/buffer.rst:341 ../../c-api/buffer.rst:343 +#: ../../c-api/buffer.rst:334 ../../c-api/buffer.rst:336 +#: ../../c-api/buffer.rst:338 ../../c-api/buffer.rst:340 +#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:344 msgid "U" msgstr "U" -#: ../../c-api/buffer.rst:333 ../../c-api/buffer.rst:337 -#: ../../c-api/buffer.rst:341 ../../c-api/buffer.rst:345 +#: ../../c-api/buffer.rst:334 ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:346 msgid "0" msgstr "0" -#: ../../c-api/buffer.rst:335 ../../c-api/buffer.rst:339 -#: ../../c-api/buffer.rst:343 ../../c-api/buffer.rst:347 +#: ../../c-api/buffer.rst:336 ../../c-api/buffer.rst:340 +#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:348 msgid "1 or 0" msgstr "1 或 0" -#: ../../c-api/buffer.rst:352 +#: ../../c-api/buffer.rst:353 msgid "Complex arrays" msgstr "" -#: ../../c-api/buffer.rst:355 +#: ../../c-api/buffer.rst:356 msgid "NumPy-style: shape and strides" msgstr "" -#: ../../c-api/buffer.rst:357 +#: ../../c-api/buffer.rst:358 msgid "" "The logical structure of NumPy-style arrays is defined by :c:member:" "`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`, :c:member:`~Py_buffer." "shape` and :c:member:`~Py_buffer.strides`." msgstr "" -#: ../../c-api/buffer.rst:360 +#: ../../c-api/buffer.rst:361 msgid "" "If ``ndim == 0``, the memory location pointed to by :c:member:`~Py_buffer." "buf` is interpreted as a scalar of size :c:member:`~Py_buffer.itemsize`. In " @@ -526,14 +528,14 @@ msgid "" "strides` are ``NULL``." msgstr "" -#: ../../c-api/buffer.rst:364 +#: ../../c-api/buffer.rst:365 msgid "" "If :c:member:`~Py_buffer.strides` is ``NULL``, the array is interpreted as a " "standard n-dimensional C-array. Otherwise, the consumer must access an n-" "dimensional array as follows:" msgstr "" -#: ../../c-api/buffer.rst:368 +#: ../../c-api/buffer.rst:369 msgid "" "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * " "strides[n-1];\n" @@ -543,14 +545,14 @@ msgstr "" "strides[n-1];\n" "item = *((typeof(item) *)ptr);" -#: ../../c-api/buffer.rst:374 +#: ../../c-api/buffer.rst:375 msgid "" "As noted above, :c:member:`~Py_buffer.buf` can point to any location within " "the actual memory block. An exporter can check the validity of a buffer with " "this function:" msgstr "" -#: ../../c-api/buffer.rst:378 +#: ../../c-api/buffer.rst:379 msgid "" "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n" " \"\"\"Verify that the parameters represent a valid array within\n" @@ -579,11 +581,11 @@ msgid "" " return 0 <= offset+imin and offset+imax+itemsize <= memlen" msgstr "" -#: ../../c-api/buffer.rst:408 +#: ../../c-api/buffer.rst:409 msgid "PIL-style: shape, strides and suboffsets" msgstr "" -#: ../../c-api/buffer.rst:410 +#: ../../c-api/buffer.rst:411 msgid "" "In addition to the regular items, PIL-style arrays can contain pointers that " "must be followed in order to get to the next element in a dimension. For " @@ -594,14 +596,14 @@ msgid "" "x[2][3]`` arrays that can be located anywhere in memory." msgstr "" -#: ../../c-api/buffer.rst:419 +#: ../../c-api/buffer.rst:420 msgid "" "Here is a function that returns a pointer to the element in an N-D array " "pointed to by an N-dimensional index when there are both non-``NULL`` " "strides and suboffsets::" msgstr "" -#: ../../c-api/buffer.rst:423 +#: ../../c-api/buffer.rst:424 msgid "" "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" " Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" @@ -629,25 +631,25 @@ msgstr "" " return (void*)pointer;\n" "}" -#: ../../c-api/buffer.rst:438 +#: ../../c-api/buffer.rst:439 msgid "Buffer-related functions" msgstr "" -#: ../../c-api/buffer.rst:442 +#: ../../c-api/buffer.rst:443 msgid "" "Return ``1`` if *obj* supports the buffer interface otherwise ``0``. When " "``1`` is returned, it doesn't guarantee that :c:func:`PyObject_GetBuffer` " "will succeed. This function always succeeds." msgstr "" -#: ../../c-api/buffer.rst:449 +#: ../../c-api/buffer.rst:450 msgid "" "Send a request to *exporter* to fill in *view* as specified by *flags*. If " "the exporter cannot provide a buffer of the exact type, it MUST raise :exc:" "`BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/buffer.rst:454 +#: ../../c-api/buffer.rst:455 msgid "" "On success, fill in *view*, set ``view->obj`` to a new reference to " "*exporter* and return 0. In the case of chained buffer providers that " @@ -655,7 +657,7 @@ msgid "" "instead of *exporter* (See :ref:`Buffer Object Structures `)." msgstr "" -#: ../../c-api/buffer.rst:459 +#: ../../c-api/buffer.rst:460 msgid "" "Successful calls to :c:func:`PyObject_GetBuffer` must be paired with calls " "to :c:func:`PyBuffer_Release`, similar to :c:func:`malloc` and :c:func:" @@ -663,7 +665,7 @@ msgid "" "`PyBuffer_Release` must be called exactly once." msgstr "" -#: ../../c-api/buffer.rst:467 +#: ../../c-api/buffer.rst:468 msgid "" "Release the buffer *view* and release the :term:`strong reference` (i.e. " "decrement the reference count) to the view's supporting object, ``view-" @@ -671,19 +673,19 @@ msgid "" "used, otherwise reference leaks may occur." msgstr "" -#: ../../c-api/buffer.rst:472 +#: ../../c-api/buffer.rst:473 msgid "" "It is an error to call this function on a buffer that was not obtained via :" "c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../c-api/buffer.rst:478 +#: ../../c-api/buffer.rst:479 msgid "" "Return the implied :c:member:`~Py_buffer.itemsize` from :c:member:" "`~Py_buffer.format`. On error, raise an exception and return -1." msgstr "" -#: ../../c-api/buffer.rst:486 +#: ../../c-api/buffer.rst:487 msgid "" "Return ``1`` if the memory defined by the *view* is C-style (*order* is " "``'C'``) or Fortran-style (*order* is ``'F'``) :term:`contiguous` or either " @@ -691,69 +693,69 @@ msgid "" "succeeds." msgstr "" -#: ../../c-api/buffer.rst:493 +#: ../../c-api/buffer.rst:494 msgid "" "Get the memory area pointed to by the *indices* inside the given *view*. " "*indices* must point to an array of ``view->ndim`` indices." msgstr "" -#: ../../c-api/buffer.rst:499 +#: ../../c-api/buffer.rst:500 msgid "" "Copy contiguous *len* bytes from *buf* to *view*. *fort* can be ``'C'`` or " "``'F'`` (for C-style or Fortran-style ordering). ``0`` is returned on " "success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:506 +#: ../../c-api/buffer.rst:507 msgid "" "Copy *len* bytes from *src* to its contiguous representation in *buf*. " "*order* can be ``'C'`` or ``'F'`` or ``'A'`` (for C-style or Fortran-style " "ordering or either one). ``0`` is returned on success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:510 +#: ../../c-api/buffer.rst:511 msgid "This function fails if *len* != *src->len*." msgstr "" -#: ../../c-api/buffer.rst:515 +#: ../../c-api/buffer.rst:516 msgid "" "Copy data from *src* to *dest* buffer. Can convert between C-style and or " "Fortran-style buffers." msgstr "" -#: ../../c-api/buffer.rst:518 +#: ../../c-api/buffer.rst:519 msgid "``0`` is returned on success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:522 +#: ../../c-api/buffer.rst:523 msgid "" "Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style " "if *order* is ``'C'`` or Fortran-style if *order* is ``'F'``) array of the " "given shape with the given number of bytes per element." msgstr "" -#: ../../c-api/buffer.rst:529 +#: ../../c-api/buffer.rst:530 msgid "" "Handle buffer requests for an exporter that wants to expose *buf* of size " "*len* with writability set according to *readonly*. *buf* is interpreted as " "a sequence of unsigned bytes." msgstr "" -#: ../../c-api/buffer.rst:533 +#: ../../c-api/buffer.rst:534 msgid "" "The *flags* argument indicates the request type. This function always fills " "in *view* as specified by flags, unless *buf* has been designated as read-" "only and :c:macro:`PyBUF_WRITABLE` is set in *flags*." msgstr "" -#: ../../c-api/buffer.rst:537 +#: ../../c-api/buffer.rst:538 msgid "" "On success, set ``view->obj`` to a new reference to *exporter* and return 0. " "Otherwise, raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and " "return ``-1``;" msgstr "" -#: ../../c-api/buffer.rst:541 +#: ../../c-api/buffer.rst:542 msgid "" "If this function is used as part of a :ref:`getbufferproc `, " "*exporter* MUST be set to the exporting object and *flags* must be passed " @@ -780,14 +782,14 @@ msgstr "buffer object(緩衝物件)" msgid "PyBufferProcs (C type)" msgstr "PyBufferProcs(C 型別)" -#: ../../c-api/buffer.rst:294 +#: ../../c-api/buffer.rst:295 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../c-api/buffer.rst:294 +#: ../../c-api/buffer.rst:295 msgid "C-contiguous" msgstr "C-contiguous(C 連續的)" -#: ../../c-api/buffer.rst:294 +#: ../../c-api/buffer.rst:295 msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" diff --git a/c-api/exceptions.po b/c-api/exceptions.po index c0ba0fe6ca..faaa283f82 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -784,9 +784,9 @@ msgstr "" #: ../../c-api/exceptions.rst:736 msgid "" -"The :attr:`!__module__` attribute of the new class is set to the first part " -"(up to the last dot) of the *name* argument, and the class name is set to " -"the last part (after the last dot). The *base* argument can be used to " +"The :attr:`~type.__module__` attribute of the new class is set to the first " +"part (up to the last dot) of the *name* argument, and the class name is set " +"to the last part (after the last dot). The *base* argument can be used to " "specify alternate base classes; it can either be only one class or a tuple " "of classes. The *dict* argument can be used to specify a dictionary of class " "variables and methods." diff --git a/c-api/init.po b/c-api/init.po index 9ca9aecb98..f06d0dbb97 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1470,7 +1470,7 @@ msgstr "" #: ../../c-api/init.rst:1220 msgid "" "Destroy the current thread state and release the global interpreter lock. " -"Like :c:func:`PyThreadState_Delete`, the global interpreter lock need not be " +"Like :c:func:`PyThreadState_Delete`, the global interpreter lock must be " "held. The thread state must have been reset with a previous call to :c:func:" "`PyThreadState_Clear`." msgstr "" diff --git a/c-api/long.po b/c-api/long.po index 7c2be2dcee..8416a8fa8a 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-30 09:19+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -166,41 +166,52 @@ msgid "" "most-significant bit is not a sign bit. Flags other than endian are ignored." msgstr "" -#: ../../c-api/long.rst:149 ../../c-api/long.rst:175 +#: ../../c-api/long.rst:148 ../../c-api/long.rst:184 msgid "" "Return a C :c:expr:`long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:153 +#: ../../c-api/long.rst:152 msgid "" "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" "expr:`long`." msgstr "" -#: ../../c-api/long.rst:156 ../../c-api/long.rst:184 ../../c-api/long.rst:205 -#: ../../c-api/long.rst:225 ../../c-api/long.rst:248 +#: ../../c-api/long.rst:155 ../../c-api/long.rst:193 ../../c-api/long.rst:214 +#: ../../c-api/long.rst:234 ../../c-api/long.rst:257 msgid "Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:158 ../../c-api/long.rst:186 ../../c-api/long.rst:207 -#: ../../c-api/long.rst:229 ../../c-api/long.rst:313 ../../c-api/long.rst:333 +#: ../../c-api/long.rst:157 ../../c-api/long.rst:195 ../../c-api/long.rst:216 +#: ../../c-api/long.rst:238 ../../c-api/long.rst:322 ../../c-api/long.rst:342 msgid "Use :meth:`~object.__index__` if available." msgstr "" -#: ../../c-api/long.rst:161 ../../c-api/long.rst:189 ../../c-api/long.rst:210 -#: ../../c-api/long.rst:232 ../../c-api/long.rst:316 ../../c-api/long.rst:336 +#: ../../c-api/long.rst:160 ../../c-api/long.rst:198 ../../c-api/long.rst:219 +#: ../../c-api/long.rst:241 ../../c-api/long.rst:325 ../../c-api/long.rst:345 msgid "This function will no longer use :meth:`~object.__int__`." msgstr "" #: ../../c-api/long.rst:167 msgid "" +"A :term:`soft deprecated` alias. Exactly equivalent to the preferred " +"``PyLong_AsLong``. In particular, it can fail with :exc:`OverflowError` or " +"another exception." +msgstr "" + +#: ../../c-api/long.rst:171 +msgid "The function is soft deprecated." +msgstr "" + +#: ../../c-api/long.rst:176 +msgid "" "Similar to :c:func:`PyLong_AsLong`, but store the result in a C :c:expr:" "`int` instead of a C :c:expr:`long`." msgstr "" -#: ../../c-api/long.rst:179 +#: ../../c-api/long.rst:188 msgid "" "If the value of *obj* is greater than :c:macro:`LONG_MAX` or less than :c:" "macro:`LONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " @@ -208,20 +219,20 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:198 ../../c-api/long.rst:216 +#: ../../c-api/long.rst:207 ../../c-api/long.rst:225 msgid "" "Return a C :c:expr:`long long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:202 +#: ../../c-api/long.rst:211 msgid "" "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" "expr:`long long`." msgstr "" -#: ../../c-api/long.rst:220 +#: ../../c-api/long.rst:229 msgid "" "If the value of *obj* is greater than :c:macro:`LLONG_MAX` or less than :c:" "macro:`LLONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " @@ -229,133 +240,133 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:242 +#: ../../c-api/long.rst:251 msgid "" "Return a C :c:type:`Py_ssize_t` representation of *pylong*. *pylong* must " "be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:245 +#: ../../c-api/long.rst:254 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "type:`Py_ssize_t`." msgstr "" -#: ../../c-api/long.rst:257 +#: ../../c-api/long.rst:266 msgid "" "Return a C :c:expr:`unsigned long` representation of *pylong*. *pylong* " "must be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:260 +#: ../../c-api/long.rst:269 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`unsigned long`." msgstr "" -#: ../../c-api/long.rst:263 +#: ../../c-api/long.rst:272 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:273 +#: ../../c-api/long.rst:282 msgid "" "Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:276 +#: ../../c-api/long.rst:285 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "type:`size_t`." msgstr "" -#: ../../c-api/long.rst:279 +#: ../../c-api/long.rst:288 msgid "" "Returns ``(size_t)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:288 +#: ../../c-api/long.rst:297 msgid "" "Return a C :c:expr:`unsigned long long` representation of *pylong*. " "*pylong* must be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:291 +#: ../../c-api/long.rst:300 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for an :" "c:expr:`unsigned long long`." msgstr "" -#: ../../c-api/long.rst:294 +#: ../../c-api/long.rst:303 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:297 +#: ../../c-api/long.rst:306 msgid "" "A negative *pylong* now raises :exc:`OverflowError`, not :exc:`TypeError`." msgstr "" -#: ../../c-api/long.rst:303 +#: ../../c-api/long.rst:312 msgid "" "Return a C :c:expr:`unsigned long` representation of *obj*. If *obj* is not " "an instance of :c:type:`PyLongObject`, first call its :meth:`~object." "__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:307 +#: ../../c-api/long.rst:316 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long`, return " "the reduction of that value modulo ``ULONG_MAX + 1``." msgstr "" -#: ../../c-api/long.rst:310 +#: ../../c-api/long.rst:319 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:322 +#: ../../c-api/long.rst:331 msgid "" "Return a C :c:expr:`unsigned long long` representation of *obj*. If *obj* " "is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object." "__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:327 +#: ../../c-api/long.rst:336 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long long`, " "return the reduction of that value modulo ``ULLONG_MAX + 1``." msgstr "" -#: ../../c-api/long.rst:330 +#: ../../c-api/long.rst:339 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` " "to disambiguate." msgstr "" -#: ../../c-api/long.rst:342 +#: ../../c-api/long.rst:351 msgid "" "Return a C :c:expr:`double` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:345 +#: ../../c-api/long.rst:354 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`double`." msgstr "" -#: ../../c-api/long.rst:348 +#: ../../c-api/long.rst:357 msgid "" "Returns ``-1.0`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:353 +#: ../../c-api/long.rst:362 msgid "" "Convert a Python integer *pylong* to a C :c:expr:`void` pointer. If *pylong* " "cannot be converted, an :exc:`OverflowError` will be raised. This is only " @@ -363,33 +374,33 @@ msgid "" "c:func:`PyLong_FromVoidPtr`." msgstr "" -#: ../../c-api/long.rst:358 +#: ../../c-api/long.rst:367 msgid "" "Returns ``NULL`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:363 +#: ../../c-api/long.rst:372 msgid "" "Copy the Python integer value *pylong* to a native *buffer* of size " "*n_bytes*. The *flags* can be set to ``-1`` to behave similarly to a C cast, " "or to values documented below to control the behavior." msgstr "" -#: ../../c-api/long.rst:367 +#: ../../c-api/long.rst:376 msgid "" "Returns ``-1`` with an exception raised on error. This may happen if " "*pylong* cannot be interpreted as an integer, or if *pylong* was negative " "and the ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` flag was set." msgstr "" -#: ../../c-api/long.rst:371 +#: ../../c-api/long.rst:380 msgid "" "Otherwise, returns the number of bytes required to store the value. If this " "is equal to or less than *n_bytes*, the entire value was copied. All " "*n_bytes* of the buffer are written: large buffers are padded with zeroes." msgstr "" -#: ../../c-api/long.rst:376 +#: ../../c-api/long.rst:385 msgid "" "If the returned value is greater than than *n_bytes*, the value was " "truncated: as many of the lowest bits of the value as could fit are written, " @@ -397,25 +408,25 @@ msgid "" "style downcast." msgstr "" -#: ../../c-api/long.rst:383 +#: ../../c-api/long.rst:392 msgid "" "Overflow is not considered an error. If the returned value is larger than " "*n_bytes*, most significant bits were discarded." msgstr "" -#: ../../c-api/long.rst:386 +#: ../../c-api/long.rst:395 msgid "``0`` will never be returned." msgstr "``0`` 將永不被回傳。" -#: ../../c-api/long.rst:388 +#: ../../c-api/long.rst:397 msgid "Values are always copied as two's-complement." msgstr "" -#: ../../c-api/long.rst:390 +#: ../../c-api/long.rst:399 msgid "Usage example::" msgstr "使用範例: ::" -#: ../../c-api/long.rst:392 +#: ../../c-api/long.rst:401 msgid "" "int32_t value;\n" "Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);\n" @@ -432,26 +443,26 @@ msgid "" "}" msgstr "" -#: ../../c-api/long.rst:406 +#: ../../c-api/long.rst:415 msgid "" "Passing zero to *n_bytes* will return the size of a buffer that would be " "large enough to hold the value. This may be larger than technically " "necessary, but not unreasonably so. If *n_bytes=0*, *buffer* may be ``NULL``." msgstr "" -#: ../../c-api/long.rst:413 +#: ../../c-api/long.rst:422 msgid "" "Passing *n_bytes=0* to this function is not an accurate way to determine the " "bit length of the value." msgstr "" -#: ../../c-api/long.rst:416 +#: ../../c-api/long.rst:425 msgid "" "To get at the entire Python value of an unknown size, the function can be " "called twice: first to determine the buffer size, then to fill it::" msgstr "" -#: ../../c-api/long.rst:419 +#: ../../c-api/long.rst:428 msgid "" "// Ask how much space we need.\n" "Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);\n" @@ -482,69 +493,69 @@ msgid "" "free(bignum);" msgstr "" -#: ../../c-api/long.rst:447 +#: ../../c-api/long.rst:456 msgid "" "*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults " "that behave most like a C cast, or a combintation of the other flags in the " "table below. Note that ``-1`` cannot be combined with other flags." msgstr "" -#: ../../c-api/long.rst:452 +#: ../../c-api/long.rst:461 msgid "" "Currently, ``-1`` corresponds to ``Py_ASNATIVEBYTES_NATIVE_ENDIAN | " "Py_ASNATIVEBYTES_UNSIGNED_BUFFER``." msgstr "" -#: ../../c-api/long.rst:458 +#: ../../c-api/long.rst:467 msgid "Flag" msgstr "旗標" -#: ../../c-api/long.rst:458 +#: ../../c-api/long.rst:467 msgid "Value" msgstr "數值" -#: ../../c-api/long.rst:460 +#: ../../c-api/long.rst:469 msgid "``-1``" msgstr "``-1``" -#: ../../c-api/long.rst:461 +#: ../../c-api/long.rst:470 msgid "``0``" msgstr "``0``" -#: ../../c-api/long.rst:462 +#: ../../c-api/long.rst:471 msgid "``1``" msgstr "``1``" -#: ../../c-api/long.rst:463 +#: ../../c-api/long.rst:472 msgid "``3``" msgstr "``3``" -#: ../../c-api/long.rst:464 +#: ../../c-api/long.rst:473 msgid "``4``" msgstr "``4``" -#: ../../c-api/long.rst:465 +#: ../../c-api/long.rst:474 msgid "``8``" msgstr "``8``" -#: ../../c-api/long.rst:466 +#: ../../c-api/long.rst:475 msgid "``16``" msgstr "``16``" -#: ../../c-api/long.rst:469 +#: ../../c-api/long.rst:478 msgid "" "Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian " "flags. Passing ``2`` is reserved." msgstr "" -#: ../../c-api/long.rst:472 +#: ../../c-api/long.rst:481 msgid "" "By default, sufficient buffer will be requested to include a sign bit. For " "example, when converting 128 with *n_bytes=1*, the function will return 2 " "(or more) in order to store a zero sign bit." msgstr "" -#: ../../c-api/long.rst:476 +#: ../../c-api/long.rst:485 msgid "" "If ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` is specified, a zero sign bit will " "be omitted from size calculations. This allows, for example, 128 to fit in a " @@ -554,7 +565,7 @@ msgid "" "requested." msgstr "" -#: ../../c-api/long.rst:483 +#: ../../c-api/long.rst:492 msgid "" "Specifying ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` causes an exception to be " "set if *pylong* is negative. Without this flag, negative values will be " @@ -562,7 +573,7 @@ msgid "" "of whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified." msgstr "" -#: ../../c-api/long.rst:488 +#: ../../c-api/long.rst:497 msgid "" "If ``Py_ASNATIVEBYTES_ALLOW_INDEX`` is specified and a non-integer value is " "passed, its :meth:`~object.__index__` method will be called first. This may " @@ -572,7 +583,7 @@ msgid "" "`TypeError`." msgstr "" -#: ../../c-api/long.rst:497 +#: ../../c-api/long.rst:506 msgid "" "With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without " "*REJECT_NEGATIVE*), multiple Python integers can map to a single value " @@ -580,22 +591,22 @@ msgid "" "buffer and set all its bits. This matches typical C cast behavior." msgstr "" -#: ../../c-api/long.rst:508 +#: ../../c-api/long.rst:517 msgid "" "On success, return a read only :term:`named tuple`, that holds information " "about Python's internal representation of integers. See :data:`sys.int_info` " "for description of individual fields." msgstr "" -#: ../../c-api/long.rst:512 +#: ../../c-api/long.rst:521 msgid "On failure, return ``NULL`` with an exception set." msgstr "在失敗時,會回傳 ``NULL`` 並設定例外。" -#: ../../c-api/long.rst:519 +#: ../../c-api/long.rst:528 msgid "Return 1 if *op* is compact, 0 otherwise." msgstr "" -#: ../../c-api/long.rst:521 +#: ../../c-api/long.rst:530 msgid "" "This function makes it possible for performance-critical code to implement a " "“fast path” for small integers. For compact values use :c:func:" @@ -603,23 +614,23 @@ msgid "" "`PyLong_As* ` function or :c:func:`PyLong_AsNativeBytes`." msgstr "" -#: ../../c-api/long.rst:527 +#: ../../c-api/long.rst:536 msgid "The speedup is expected to be negligible for most users." msgstr "" -#: ../../c-api/long.rst:529 +#: ../../c-api/long.rst:538 msgid "" "Exactly what values are considered compact is an implementation detail and " "is subject to change." msgstr "" -#: ../../c-api/long.rst:534 +#: ../../c-api/long.rst:543 msgid "" "If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, " "return its value." msgstr "" -#: ../../c-api/long.rst:537 +#: ../../c-api/long.rst:546 msgid "Otherwise, the return value is undefined." msgstr "" @@ -635,23 +646,23 @@ msgstr "long integer(長整数)" msgid "integer" msgstr "integer(整数)" -#: ../../c-api/long.rst:145 +#: ../../c-api/long.rst:144 msgid "LONG_MAX (C macro)" msgstr "LONG_MAX(C 巨集)" -#: ../../c-api/long.rst:145 ../../c-api/long.rst:195 ../../c-api/long.rst:238 -#: ../../c-api/long.rst:253 ../../c-api/long.rst:269 ../../c-api/long.rst:285 +#: ../../c-api/long.rst:144 ../../c-api/long.rst:204 ../../c-api/long.rst:247 +#: ../../c-api/long.rst:262 ../../c-api/long.rst:278 ../../c-api/long.rst:294 msgid "OverflowError (built-in exception)" msgstr "OverflowError(内建例外)" -#: ../../c-api/long.rst:238 +#: ../../c-api/long.rst:247 msgid "PY_SSIZE_T_MAX (C macro)" msgstr "PY_SSIZE_T_MAX(C 巨集)" -#: ../../c-api/long.rst:253 +#: ../../c-api/long.rst:262 msgid "ULONG_MAX (C macro)" msgstr "ULONG_MAX(C 巨集)" -#: ../../c-api/long.rst:269 +#: ../../c-api/long.rst:278 msgid "SIZE_MAX (C macro)" msgstr "SIZE_MAX(C 巨集)" diff --git a/c-api/object.po b/c-api/object.po index 039b7a3b69..d557e3d5c6 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -477,17 +477,17 @@ msgstr "" #: ../../c-api/object.rst:370 msgid "" -"If *cls* has a :meth:`~class.__subclasscheck__` method, it will be called to " +"If *cls* has a :meth:`~type.__subclasscheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " "*derived* is a subclass of *cls* if it is a direct or indirect subclass, i." -"e. contained in ``cls.__mro__``." +"e. contained in :attr:`cls.__mro__ `." msgstr "" #: ../../c-api/object.rst:375 msgid "" "Normally only class objects, i.e. instances of :class:`type` or a derived " "class, are considered classes. However, objects can override this by having " -"a :attr:`~class.__bases__` attribute (which must be a tuple of base classes)." +"a :attr:`~type.__bases__` attribute (which must be a tuple of base classes)." msgstr "" #: ../../c-api/object.rst:382 @@ -498,7 +498,7 @@ msgstr "" #: ../../c-api/object.rst:389 msgid "" -"If *cls* has a :meth:`~class.__instancecheck__` method, it will be called to " +"If *cls* has a :meth:`~type.__instancecheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " "*inst* is an instance of *cls* if its class is a subclass of *cls*." msgstr "" @@ -506,13 +506,13 @@ msgstr "" #: ../../c-api/object.rst:393 msgid "" "An instance *inst* can override what is considered its class by having a :" -"attr:`~instance.__class__` attribute." +"attr:`~object.__class__` attribute." msgstr "" #: ../../c-api/object.rst:396 msgid "" "An object *cls* can override if it is considered a class, and what its base " -"classes are, by having a :attr:`~class.__bases__` attribute (which must be a " +"classes are, by having a :attr:`~type.__bases__` attribute (which must be a " "tuple of base classes)." msgstr "" diff --git a/c-api/type.po b/c-api/type.po index 0cba8494b9..9ca76377b5 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -65,32 +65,32 @@ msgstr "" #: ../../c-api/type.rst:55 msgid "" "Return the type object's internal namespace, which is otherwise only exposed " -"via a read-only proxy (``cls.__dict__``). This is a replacement for " -"accessing :c:member:`~PyTypeObject.tp_dict` directly. The returned " -"dictionary must be treated as read-only." +"via a read-only proxy (:attr:`cls.__dict__ `). This is a " +"replacement for accessing :c:member:`~PyTypeObject.tp_dict` directly. The " +"returned dictionary must be treated as read-only." msgstr "" -#: ../../c-api/type.rst:60 +#: ../../c-api/type.rst:61 msgid "" "This function is meant for specific embedding and language-binding cases, " "where direct access to the dict is necessary and indirect access (e.g. via " "the proxy or :c:func:`PyObject_GetAttr`) isn't adequate." msgstr "" -#: ../../c-api/type.rst:64 +#: ../../c-api/type.rst:65 msgid "" "Extension modules should continue to use ``tp_dict``, directly or " "indirectly, when setting up their own types." msgstr "" -#: ../../c-api/type.rst:72 +#: ../../c-api/type.rst:73 msgid "" "Invalidate the internal lookup cache for the type and all of its subtypes. " "This function must be called after any manual modification of the attributes " "or base classes of the type." msgstr "" -#: ../../c-api/type.rst:79 +#: ../../c-api/type.rst:80 msgid "" "Register *callback* as a type watcher. Return a non-negative integer ID " "which must be passed to future calls to :c:func:`PyType_Watch`. In case of " @@ -98,21 +98,21 @@ msgid "" "exception." msgstr "" -#: ../../c-api/type.rst:89 +#: ../../c-api/type.rst:90 msgid "" "Clear watcher identified by *watcher_id* (previously returned from :c:func:" "`PyType_AddWatcher`). Return ``0`` on success, ``-1`` on error (e.g. if " "*watcher_id* was never registered.)" msgstr "" -#: ../../c-api/type.rst:93 +#: ../../c-api/type.rst:94 msgid "" "An extension should never call ``PyType_ClearWatcher`` with a *watcher_id* " "that was not returned to it by a previous call to :c:func:" "`PyType_AddWatcher`." msgstr "" -#: ../../c-api/type.rst:102 +#: ../../c-api/type.rst:103 msgid "" "Mark *type* as watched. The callback granted *watcher_id* by :c:func:" "`PyType_AddWatcher` will be called whenever :c:func:`PyType_Modified` " @@ -122,61 +122,61 @@ msgid "" "detail and subject to change.)" msgstr "" -#: ../../c-api/type.rst:109 +#: ../../c-api/type.rst:110 msgid "" "An extension should never call ``PyType_Watch`` with a *watcher_id* that was " "not returned to it by a previous call to :c:func:`PyType_AddWatcher`." msgstr "" -#: ../../c-api/type.rst:117 +#: ../../c-api/type.rst:118 msgid "Type of a type-watcher callback function." msgstr "" -#: ../../c-api/type.rst:119 +#: ../../c-api/type.rst:120 msgid "" "The callback must not modify *type* or cause :c:func:`PyType_Modified` to be " "called on *type* or any type in its MRO; violating this rule could cause " "infinite recursion." msgstr "" -#: ../../c-api/type.rst:128 +#: ../../c-api/type.rst:129 msgid "" "Return non-zero if the type object *o* sets the feature *feature*. Type " "features are denoted by single bit flags." msgstr "" -#: ../../c-api/type.rst:134 +#: ../../c-api/type.rst:135 msgid "" "Return true if the type object includes support for the cycle detector; this " "tests the type flag :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" -#: ../../c-api/type.rst:140 +#: ../../c-api/type.rst:141 msgid "Return true if *a* is a subtype of *b*." msgstr "" -#: ../../c-api/type.rst:142 +#: ../../c-api/type.rst:143 msgid "" -"This function only checks for actual subtypes, which means that :meth:" -"`~class.__subclasscheck__` is not called on *b*. Call :c:func:" -"`PyObject_IsSubclass` to do the same check that :func:`issubclass` would do." +"This function only checks for actual subtypes, which means that :meth:`~type." +"__subclasscheck__` is not called on *b*. Call :c:func:`PyObject_IsSubclass` " +"to do the same check that :func:`issubclass` would do." msgstr "" -#: ../../c-api/type.rst:150 +#: ../../c-api/type.rst:151 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_alloc` slot of a type " "object. Use Python's default memory allocation mechanism to allocate a new " "instance and initialize all its contents to ``NULL``." msgstr "" -#: ../../c-api/type.rst:156 +#: ../../c-api/type.rst:157 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_new` slot of a type " "object. Create a new instance using the type's :c:member:`~PyTypeObject." "tp_alloc` slot." msgstr "" -#: ../../c-api/type.rst:161 +#: ../../c-api/type.rst:162 msgid "" "Finalize a type object. This should be called on all type objects to finish " "their initialization. This function is responsible for adding inherited " @@ -184,7 +184,7 @@ msgid "" "and sets an exception on error." msgstr "" -#: ../../c-api/type.rst:167 +#: ../../c-api/type.rst:168 msgid "" "If some of the base classes implements the GC protocol and the provided type " "does not include the :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags, then the GC " @@ -195,32 +195,32 @@ msgid "" "handle." msgstr "" -#: ../../c-api/type.rst:177 +#: ../../c-api/type.rst:178 msgid "" -"Return the type's name. Equivalent to getting the type's ``__name__`` " -"attribute." +"Return the type's name. Equivalent to getting the type's :attr:`~type." +"__name__` attribute." msgstr "" -#: ../../c-api/type.rst:183 +#: ../../c-api/type.rst:185 msgid "" -"Return the type's qualified name. Equivalent to getting the type's " -"``__qualname__`` attribute." +"Return the type's qualified name. Equivalent to getting the type's :attr:" +"`~type.__qualname__` attribute." msgstr "" -#: ../../c-api/type.rst:190 +#: ../../c-api/type.rst:192 msgid "" "Return the type's fully qualified name. Equivalent to ``f\"{type.__module__}." -"{type.__qualname__}\"``, or ``type.__qualname__`` if ``type.__module__`` is " -"not a string or is equal to ``\"builtins\"``." +"{type.__qualname__}\"``, or :attr:`type.__qualname__` if :attr:`type." +"__module__` is not a string or is equal to ``\"builtins\"``." msgstr "" -#: ../../c-api/type.rst:198 +#: ../../c-api/type.rst:200 msgid "" -"Return the type's module name. Equivalent to getting the ``type.__module__`` " -"attribute." +"Return the type's module name. Equivalent to getting the :attr:`type." +"__module__` attribute." msgstr "" -#: ../../c-api/type.rst:205 +#: ../../c-api/type.rst:207 msgid "" "Return the function pointer stored in the given slot. If the result is " "``NULL``, this indicates that either the slot is ``NULL``, or that the " @@ -228,30 +228,30 @@ msgid "" "result pointer into the appropriate function type." msgstr "" -#: ../../c-api/type.rst:211 +#: ../../c-api/type.rst:213 msgid "" "See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument." msgstr "" -#: ../../c-api/type.rst:215 +#: ../../c-api/type.rst:217 msgid "" ":c:func:`PyType_GetSlot` can now accept all types. Previously, it was " "limited to :ref:`heap types `." msgstr "" -#: ../../c-api/type.rst:221 +#: ../../c-api/type.rst:223 msgid "" "Return the module object associated with the given type when the type was " "created using :c:func:`PyType_FromModuleAndSpec`." msgstr "" -#: ../../c-api/type.rst:224 ../../c-api/type.rst:244 +#: ../../c-api/type.rst:226 ../../c-api/type.rst:246 msgid "" "If no module is associated with the given type, sets :py:class:`TypeError` " "and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:227 +#: ../../c-api/type.rst:229 msgid "" "This function is usually used to get the module in which a method is " "defined. Note that in such a method, ``PyType_GetModule(Py_TYPE(self))`` may " @@ -262,31 +262,31 @@ msgid "" "type:`!PyCMethod` cannot be used." msgstr "" -#: ../../c-api/type.rst:240 +#: ../../c-api/type.rst:242 msgid "" "Return the state of the module object associated with the given type. This " "is a shortcut for calling :c:func:`PyModule_GetState()` on the result of :c:" "func:`PyType_GetModule`." msgstr "" -#: ../../c-api/type.rst:247 +#: ../../c-api/type.rst:249 msgid "" "If the *type* has an associated module but its state is ``NULL``, returns " "``NULL`` without setting an exception." msgstr "" -#: ../../c-api/type.rst:254 +#: ../../c-api/type.rst:256 msgid "" "Find the first superclass whose module was created from the given :c:type:" "`PyModuleDef` *def*, and return that module." msgstr "" -#: ../../c-api/type.rst:257 +#: ../../c-api/type.rst:259 msgid "" "If no module is found, raises a :py:class:`TypeError` and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:259 +#: ../../c-api/type.rst:261 msgid "" "This function is intended to be used together with :c:func:" "`PyModule_GetState()` to get module state from slot methods (such as :c:" @@ -295,40 +295,40 @@ msgid "" "type:`PyCMethod` calling convention." msgstr "" -#: ../../c-api/type.rst:269 +#: ../../c-api/type.rst:271 msgid "Attempt to assign a version tag to the given type." msgstr "" -#: ../../c-api/type.rst:271 +#: ../../c-api/type.rst:273 msgid "" "Returns 1 if the type already had a valid version tag or a new one was " "assigned, or 0 if a new tag could not be assigned." msgstr "" -#: ../../c-api/type.rst:278 +#: ../../c-api/type.rst:280 msgid "Creating Heap-Allocated Types" msgstr "" -#: ../../c-api/type.rst:280 +#: ../../c-api/type.rst:282 msgid "" "The following functions and structs are used to create :ref:`heap types " "`." msgstr "" -#: ../../c-api/type.rst:285 +#: ../../c-api/type.rst:287 msgid "" "Create and return a :ref:`heap type ` from the *spec* (see :c:" "macro:`Py_TPFLAGS_HEAPTYPE`)." msgstr "" -#: ../../c-api/type.rst:288 +#: ../../c-api/type.rst:290 msgid "" "The metaclass *metaclass* is used to construct the resulting type object. " "When *metaclass* is ``NULL``, the metaclass is derived from *bases* (or " "*Py_tp_base[s]* slots if *bases* is ``NULL``, see below)." msgstr "" -#: ../../c-api/type.rst:292 +#: ../../c-api/type.rst:294 msgid "" "Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not " "supported, except if ``tp_new`` is ``NULL``. (For backwards compatibility, " @@ -337,7 +337,7 @@ msgid "" "deprecated and in Python 3.14+ such metaclasses will not be supported.)" msgstr "" -#: ../../c-api/type.rst:299 +#: ../../c-api/type.rst:301 msgid "" "The *bases* argument can be used to specify base classes; it can either be " "only one class or a tuple of classes. If *bases* is ``NULL``, the " @@ -346,7 +346,7 @@ msgid "" "derives from :class:`object`." msgstr "" -#: ../../c-api/type.rst:305 +#: ../../c-api/type.rst:307 msgid "" "The *module* argument can be used to record the module in which the new " "class is defined. It must be a module object or ``NULL``. If not ``NULL``, " @@ -355,11 +355,11 @@ msgid "" "subclasses; it must be specified for each class individually." msgstr "" -#: ../../c-api/type.rst:312 +#: ../../c-api/type.rst:314 msgid "This function calls :c:func:`PyType_Ready` on the new type." msgstr "" -#: ../../c-api/type.rst:314 +#: ../../c-api/type.rst:316 msgid "" "Note that this function does *not* fully match the behavior of calling :py:" "class:`type() ` or using the :keyword:`class` statement. With user-" @@ -368,41 +368,41 @@ msgid "" "Specifically:" msgstr "" -#: ../../c-api/type.rst:321 +#: ../../c-api/type.rst:323 msgid "" ":py:meth:`~object.__new__` is not called on the new class (and it must be " "set to ``type.__new__``)." msgstr "" -#: ../../c-api/type.rst:323 +#: ../../c-api/type.rst:325 msgid ":py:meth:`~object.__init__` is not called on the new class." msgstr "" -#: ../../c-api/type.rst:324 +#: ../../c-api/type.rst:326 msgid ":py:meth:`~object.__init_subclass__` is not called on any bases." msgstr "" -#: ../../c-api/type.rst:325 +#: ../../c-api/type.rst:327 msgid ":py:meth:`~object.__set_name__` is not called on new descriptors." msgstr "" -#: ../../c-api/type.rst:331 +#: ../../c-api/type.rst:333 msgid "Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, module, spec, bases)``。" -#: ../../c-api/type.rst:337 +#: ../../c-api/type.rst:339 msgid "" "The function now accepts a single class as the *bases* argument and ``NULL`` " "as the ``tp_doc`` slot." msgstr "" -#: ../../c-api/type.rst:342 ../../c-api/type.rst:359 +#: ../../c-api/type.rst:344 ../../c-api/type.rst:361 msgid "" "The function now finds and uses a metaclass corresponding to the provided " "base classes. Previously, only :class:`type` instances were returned." msgstr "" -#: ../../c-api/type.rst:345 ../../c-api/type.rst:362 ../../c-api/type.rst:378 +#: ../../c-api/type.rst:347 ../../c-api/type.rst:364 ../../c-api/type.rst:380 msgid "" "The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*. which " "may result in incomplete initialization. Creating classes whose metaclass " @@ -410,42 +410,42 @@ msgid "" "it will be no longer allowed." msgstr "" -#: ../../c-api/type.rst:353 +#: ../../c-api/type.rst:355 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, bases)``。" -#: ../../c-api/type.rst:370 +#: ../../c-api/type.rst:372 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``。" -#: ../../c-api/type.rst:374 +#: ../../c-api/type.rst:376 msgid "" "The function now finds and uses a metaclass corresponding to the base " "classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` " "instances were returned." msgstr "" -#: ../../c-api/type.rst:395 +#: ../../c-api/type.rst:397 msgid "Structure defining a type's behavior." msgstr "" -#: ../../c-api/type.rst:399 +#: ../../c-api/type.rst:401 msgid "Name of the type, used to set :c:member:`PyTypeObject.tp_name`." msgstr "" -#: ../../c-api/type.rst:403 +#: ../../c-api/type.rst:405 msgid "" "If positive, specifies the size of the instance in bytes. It is used to set :" "c:member:`PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/type.rst:406 +#: ../../c-api/type.rst:408 msgid "" "If zero, specifies that :c:member:`~PyTypeObject.tp_basicsize` should be " "inherited." msgstr "" -#: ../../c-api/type.rst:409 +#: ../../c-api/type.rst:411 msgid "" "If negative, the absolute value specifies how much space instances of the " "class need *in addition* to the superclass. Use :c:func:" @@ -453,17 +453,17 @@ msgid "" "this way." msgstr "" -#: ../../c-api/type.rst:416 +#: ../../c-api/type.rst:418 msgid "Previously, this field could not be negative." msgstr "" -#: ../../c-api/type.rst:420 +#: ../../c-api/type.rst:422 msgid "" "Size of one element of a variable-size type, in bytes. Used to set :c:member:" "`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation for caveats." msgstr "" -#: ../../c-api/type.rst:424 +#: ../../c-api/type.rst:426 msgid "" "If zero, :c:member:`~PyTypeObject.tp_itemsize` is inherited. Extending " "arbitrary variable-sized classes is dangerous, since some types use a fixed " @@ -472,58 +472,58 @@ msgid "" "only possible in the following situations:" msgstr "" -#: ../../c-api/type.rst:431 +#: ../../c-api/type.rst:433 msgid "" "The base is not variable-sized (its :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -#: ../../c-api/type.rst:433 +#: ../../c-api/type.rst:435 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is positive, suggesting that " "the memory layout of the base class is known." msgstr "" -#: ../../c-api/type.rst:435 +#: ../../c-api/type.rst:437 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is zero, suggesting that the " "subclass does not access the instance's memory directly." msgstr "" -#: ../../c-api/type.rst:438 +#: ../../c-api/type.rst:440 msgid "With the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag." msgstr "" -#: ../../c-api/type.rst:442 +#: ../../c-api/type.rst:444 msgid "Type flags, used to set :c:member:`PyTypeObject.tp_flags`." msgstr "" -#: ../../c-api/type.rst:444 +#: ../../c-api/type.rst:446 msgid "" "If the ``Py_TPFLAGS_HEAPTYPE`` flag is not set, :c:func:" "`PyType_FromSpecWithBases` sets it automatically." msgstr "" -#: ../../c-api/type.rst:449 +#: ../../c-api/type.rst:451 msgid "" "Array of :c:type:`PyType_Slot` structures. Terminated by the special slot " "value ``{0, NULL}``." msgstr "" -#: ../../c-api/type.rst:452 +#: ../../c-api/type.rst:454 msgid "Each slot ID should be specified at most once." msgstr "" -#: ../../c-api/type.rst:462 +#: ../../c-api/type.rst:464 msgid "" "Structure defining optional functionality of a type, containing a slot ID " "and a value pointer." msgstr "" -#: ../../c-api/type.rst:467 +#: ../../c-api/type.rst:469 msgid "A slot ID." msgstr "" -#: ../../c-api/type.rst:469 +#: ../../c-api/type.rst:471 msgid "" "Slot IDs are named like the field names of the structures :c:type:" "`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:" @@ -531,30 +531,30 @@ msgid "" "prefix. For example, use:" msgstr "" -#: ../../c-api/type.rst:475 +#: ../../c-api/type.rst:477 msgid "``Py_tp_dealloc`` to set :c:member:`PyTypeObject.tp_dealloc`" msgstr "" -#: ../../c-api/type.rst:476 +#: ../../c-api/type.rst:478 msgid "``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`" msgstr "" -#: ../../c-api/type.rst:477 +#: ../../c-api/type.rst:479 msgid "``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`" msgstr "" -#: ../../c-api/type.rst:479 +#: ../../c-api/type.rst:481 msgid "" "The following “offset” fields cannot be set using :c:type:`PyType_Slot`:" msgstr "" -#: ../../c-api/type.rst:481 +#: ../../c-api/type.rst:483 msgid "" ":c:member:`~PyTypeObject.tp_weaklistoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)" msgstr "" -#: ../../c-api/type.rst:483 +#: ../../c-api/type.rst:485 msgid "" ":c:member:`~PyTypeObject.tp_dictoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_DICT` instead if possible)" @@ -562,7 +562,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_dictoffset`\\ (如果可能,請改用 :c:macro:" "`Py_TPFLAGS_MANAGED_DICT`)" -#: ../../c-api/type.rst:485 +#: ../../c-api/type.rst:487 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall_offset` (use " "``\"__vectorcalloffset__\"`` in :ref:`PyMemberDef `)" @@ -570,7 +570,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_vectorcall_offset`\\ (請用 :ref:`PyMemberDef " "` 中的 ``\"__vectorcalloffset__\"``)" -#: ../../c-api/type.rst:489 +#: ../../c-api/type.rst:491 msgid "" "If it is not possible to switch to a ``MANAGED`` flag (for example, for " "vectorcall or to support Python older than 3.12), specify the offset in :c:" @@ -578,48 +578,48 @@ msgid "" "documentation ` for details." msgstr "" -#: ../../c-api/type.rst:495 +#: ../../c-api/type.rst:497 msgid "The following fields cannot be set at all when creating a heap type:" msgstr "" -#: ../../c-api/type.rst:497 +#: ../../c-api/type.rst:499 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall` (use :c:member:`~PyTypeObject." "tp_new` and/or :c:member:`~PyTypeObject.tp_init`)" msgstr "" -#: ../../c-api/type.rst:501 +#: ../../c-api/type.rst:503 msgid "" "Internal fields: :c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject." "tp_mro`, :c:member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject." "tp_subclasses`, and :c:member:`~PyTypeObject.tp_weaklist`." msgstr "" -#: ../../c-api/type.rst:508 +#: ../../c-api/type.rst:510 msgid "" "Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on " "some platforms. To avoid issues, use the *bases* argument of :c:func:" "`PyType_FromSpecWithBases` instead." msgstr "" -#: ../../c-api/type.rst:515 +#: ../../c-api/type.rst:517 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" -#: ../../c-api/type.rst:517 +#: ../../c-api/type.rst:519 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` are now available under the :ref:`limited API `." msgstr "" -#: ../../c-api/type.rst:524 +#: ../../c-api/type.rst:526 msgid "" "The desired value of the slot. In most cases, this is a pointer to a " "function." msgstr "" -#: ../../c-api/type.rst:527 +#: ../../c-api/type.rst:529 msgid "Slots other than ``Py_tp_doc`` may not be ``NULL``." msgstr "" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index a19d40c885..951587ed1f 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1410,15 +1410,15 @@ msgstr "" msgid "" "For :ref:`statically allocated type objects `, the *tp_name* " "field should contain a dot. Everything before the last dot is made " -"accessible as the :attr:`__module__` attribute, and everything after the " -"last dot is made accessible as the :attr:`~definition.__name__` attribute." +"accessible as the :attr:`~type.__module__` attribute, and everything after " +"the last dot is made accessible as the :attr:`~type.__name__` attribute." msgstr "" #: ../../c-api/typeobj.rst:574 msgid "" "If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is " -"made accessible as the :attr:`~definition.__name__` attribute, and the :attr:" -"`__module__` attribute is undefined (unless explicitly set in the " +"made accessible as the :attr:`~type.__name__` attribute, and the :attr:" +"`~type.__module__` attribute is undefined (unless explicitly set in the " "dictionary, as explained above). This means your type will be impossible to " "pickle. Additionally, it will not be listed in module documentations " "created with pydoc." @@ -2109,7 +2109,7 @@ msgstr "" #: ../../c-api/typeobj.rst:1134 msgid "" -"This bit indicates that instances of the class have a ``__dict__`` " +"This bit indicates that instances of the class have a `~object.__dict__` " "attribute, and that the space for the dictionary is managed by the VM." msgstr "" @@ -2310,8 +2310,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1337 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " -"this type object. This is exposed as the :attr:`__doc__` attribute on the " -"type and instances of the type." +"this type object. This is exposed as the :attr:`~type.__doc__` attribute on " +"the type and instances of the type." msgstr "" #: ../../c-api/typeobj.rst:1343 @@ -3231,7 +3231,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2038 msgid "" -"To get a list of subclasses, call the Python method :py:meth:`~class." +"To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__`." msgstr "" diff --git a/c-api/unicode.po b/c-api/unicode.po index 1245ea48db..8ebbcebe8f 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -317,7 +317,7 @@ msgstr "" #: ../../c-api/unicode.rst:320 msgid "" -"Join two surrogate characters and return a single :c:type:`Py_UCS4` value. " +"Join two surrogate code points and return a single :c:type:`Py_UCS4` value. " "*high* and *low* are respectively the leading and trailing surrogates in a " "surrogate pair. *high* must be in the range [0xD800; 0xDBFF] and *low* must " "be in the range [0xDC00; 0xDFFF]." @@ -346,7 +346,11 @@ msgid "" "created using this function are not resizable." msgstr "" -#: ../../c-api/unicode.rst:347 +#: ../../c-api/unicode.rst:341 +msgid "On error, set an exception and return ``NULL``." +msgstr "" + +#: ../../c-api/unicode.rst:349 msgid "" "Create a new Unicode object with the given *kind* (possible values are :c:" "macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" @@ -354,7 +358,7 @@ msgid "" "1, 2 or 4 bytes per character, as given by the kind." msgstr "" -#: ../../c-api/unicode.rst:352 +#: ../../c-api/unicode.rst:354 msgid "" "If necessary, the input *buffer* is copied and transformed into the " "canonical representation. For example, if the *buffer* is a UCS4 string (:c:" @@ -362,7 +366,7 @@ msgid "" "range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" -#: ../../c-api/unicode.rst:363 +#: ../../c-api/unicode.rst:365 msgid "" "Create a Unicode object from the char buffer *str*. The bytes will be " "interpreted as being UTF-8 encoded. The buffer is copied into the new " @@ -370,29 +374,29 @@ msgid "" "data is not allowed." msgstr "" -#: ../../c-api/unicode.rst:369 +#: ../../c-api/unicode.rst:371 msgid "This function raises :exc:`SystemError` when:" msgstr "" -#: ../../c-api/unicode.rst:371 +#: ../../c-api/unicode.rst:373 msgid "*size* < 0," msgstr "" -#: ../../c-api/unicode.rst:372 +#: ../../c-api/unicode.rst:374 msgid "*str* is ``NULL`` and *size* > 0" msgstr "" -#: ../../c-api/unicode.rst:374 +#: ../../c-api/unicode.rst:376 msgid "*str* == ``NULL`` with *size* > 0 is not allowed anymore." msgstr "" -#: ../../c-api/unicode.rst:380 +#: ../../c-api/unicode.rst:382 msgid "" "Create a Unicode object from a UTF-8 encoded null-terminated char buffer " "*str*." msgstr "" -#: ../../c-api/unicode.rst:386 +#: ../../c-api/unicode.rst:388 msgid "" "Take a C :c:func:`printf`\\ -style *format* string and a variable number of " "arguments, calculate the size of the resulting Python Unicode string and " @@ -401,23 +405,23 @@ msgid "" "*format* ASCII-encoded string." msgstr "" -#: ../../c-api/unicode.rst:392 +#: ../../c-api/unicode.rst:394 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../c-api/unicode.rst:395 +#: ../../c-api/unicode.rst:397 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../c-api/unicode.rst:397 +#: ../../c-api/unicode.rst:399 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../c-api/unicode.rst:400 +#: ../../c-api/unicode.rst:402 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is given in the next argument, which must be of type :c:expr:" @@ -425,7 +429,7 @@ msgid "" "optional precision." msgstr "" -#: ../../c-api/unicode.rst:405 +#: ../../c-api/unicode.rst:407 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. If " "specified as ``'*'`` (an asterisk), the actual precision is given in the " @@ -433,316 +437,316 @@ msgid "" "comes after the precision." msgstr "" -#: ../../c-api/unicode.rst:410 +#: ../../c-api/unicode.rst:412 msgid "Length modifier (optional)." msgstr "" -#: ../../c-api/unicode.rst:412 +#: ../../c-api/unicode.rst:414 msgid "Conversion type." msgstr "" -#: ../../c-api/unicode.rst:414 +#: ../../c-api/unicode.rst:416 msgid "The conversion flag characters are:" msgstr "" -#: ../../c-api/unicode.rst:419 +#: ../../c-api/unicode.rst:421 msgid "Flag" msgstr "旗標" -#: ../../c-api/unicode.rst:419 +#: ../../c-api/unicode.rst:421 msgid "Meaning" msgstr "含義" -#: ../../c-api/unicode.rst:421 +#: ../../c-api/unicode.rst:423 msgid "``0``" msgstr "``0``" -#: ../../c-api/unicode.rst:421 +#: ../../c-api/unicode.rst:423 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../c-api/unicode.rst:423 +#: ../../c-api/unicode.rst:425 msgid "``-``" msgstr "``-``" -#: ../../c-api/unicode.rst:423 +#: ../../c-api/unicode.rst:425 msgid "" "The converted value is left adjusted (overrides the ``0`` flag if both are " "given)." msgstr "" -#: ../../c-api/unicode.rst:427 +#: ../../c-api/unicode.rst:429 msgid "" "The length modifiers for following integer conversions (``d``, ``i``, ``o``, " "``u``, ``x``, or ``X``) specify the type of the argument (:c:expr:`int` by " "default):" msgstr "" -#: ../../c-api/unicode.rst:434 +#: ../../c-api/unicode.rst:436 msgid "Modifier" msgstr "" -#: ../../c-api/unicode.rst:434 +#: ../../c-api/unicode.rst:436 msgid "Types" msgstr "" -#: ../../c-api/unicode.rst:436 +#: ../../c-api/unicode.rst:438 msgid "``l``" msgstr "``l``" -#: ../../c-api/unicode.rst:436 +#: ../../c-api/unicode.rst:438 msgid ":c:expr:`long` or :c:expr:`unsigned long`" msgstr ":c:expr:`long` 或 :c:expr:`unsigned long`" -#: ../../c-api/unicode.rst:438 +#: ../../c-api/unicode.rst:440 msgid "``ll``" msgstr "``ll``" -#: ../../c-api/unicode.rst:438 +#: ../../c-api/unicode.rst:440 msgid ":c:expr:`long long` or :c:expr:`unsigned long long`" msgstr ":c:expr:`long long` 或 :c:expr:`unsigned long long`" -#: ../../c-api/unicode.rst:440 +#: ../../c-api/unicode.rst:442 msgid "``j``" msgstr "``j``" -#: ../../c-api/unicode.rst:440 +#: ../../c-api/unicode.rst:442 msgid ":c:type:`intmax_t` or :c:type:`uintmax_t`" msgstr ":c:type:`intmax_t` 或 :c:type:`uintmax_t`" -#: ../../c-api/unicode.rst:442 +#: ../../c-api/unicode.rst:444 msgid "``z``" msgstr "``z``" -#: ../../c-api/unicode.rst:442 +#: ../../c-api/unicode.rst:444 msgid ":c:type:`size_t` or :c:type:`ssize_t`" msgstr ":c:type:`size_t` 或 :c:type:`ssize_t`" -#: ../../c-api/unicode.rst:444 +#: ../../c-api/unicode.rst:446 msgid "``t``" msgstr "``t``" -#: ../../c-api/unicode.rst:444 +#: ../../c-api/unicode.rst:446 msgid ":c:type:`ptrdiff_t`" msgstr ":c:type:`ptrdiff_t`" -#: ../../c-api/unicode.rst:447 +#: ../../c-api/unicode.rst:449 msgid "" "The length modifier ``l`` for following conversions ``s`` or ``V`` specify " "that the type of the argument is :c:expr:`const wchar_t*`." msgstr "" -#: ../../c-api/unicode.rst:450 +#: ../../c-api/unicode.rst:452 msgid "The conversion specifiers are:" msgstr "" -#: ../../c-api/unicode.rst:456 +#: ../../c-api/unicode.rst:458 msgid "Conversion Specifier" msgstr "" -#: ../../c-api/unicode.rst:457 +#: ../../c-api/unicode.rst:459 msgid "Type" msgstr "" -#: ../../c-api/unicode.rst:458 +#: ../../c-api/unicode.rst:460 msgid "Comment" msgstr "" -#: ../../c-api/unicode.rst:460 +#: ../../c-api/unicode.rst:462 msgid "``%``" msgstr "``%``" -#: ../../c-api/unicode.rst:461 +#: ../../c-api/unicode.rst:463 msgid "*n/a*" msgstr "*n/a*" -#: ../../c-api/unicode.rst:462 +#: ../../c-api/unicode.rst:464 msgid "The literal ``%`` character." msgstr "" -#: ../../c-api/unicode.rst:464 +#: ../../c-api/unicode.rst:466 msgid "``d``, ``i``" msgstr "``d``, ``i``" -#: ../../c-api/unicode.rst:465 ../../c-api/unicode.rst:469 -#: ../../c-api/unicode.rst:473 ../../c-api/unicode.rst:477 -#: ../../c-api/unicode.rst:481 +#: ../../c-api/unicode.rst:467 ../../c-api/unicode.rst:471 +#: ../../c-api/unicode.rst:475 ../../c-api/unicode.rst:479 +#: ../../c-api/unicode.rst:483 msgid "Specified by the length modifier" msgstr "" -#: ../../c-api/unicode.rst:466 +#: ../../c-api/unicode.rst:468 msgid "The decimal representation of a signed C integer." msgstr "" -#: ../../c-api/unicode.rst:468 +#: ../../c-api/unicode.rst:470 msgid "``u``" msgstr "``u``" -#: ../../c-api/unicode.rst:470 +#: ../../c-api/unicode.rst:472 msgid "The decimal representation of an unsigned C integer." msgstr "" -#: ../../c-api/unicode.rst:472 +#: ../../c-api/unicode.rst:474 msgid "``o``" msgstr "``o``" -#: ../../c-api/unicode.rst:474 +#: ../../c-api/unicode.rst:476 msgid "The octal representation of an unsigned C integer." msgstr "" -#: ../../c-api/unicode.rst:476 +#: ../../c-api/unicode.rst:478 msgid "``x``" msgstr "``x``" -#: ../../c-api/unicode.rst:478 +#: ../../c-api/unicode.rst:480 msgid "The hexadecimal representation of an unsigned C integer (lowercase)." msgstr "" -#: ../../c-api/unicode.rst:480 +#: ../../c-api/unicode.rst:482 msgid "``X``" msgstr "``X``" -#: ../../c-api/unicode.rst:482 +#: ../../c-api/unicode.rst:484 msgid "The hexadecimal representation of an unsigned C integer (uppercase)." msgstr "" -#: ../../c-api/unicode.rst:484 +#: ../../c-api/unicode.rst:486 msgid "``c``" msgstr "``c``" -#: ../../c-api/unicode.rst:485 +#: ../../c-api/unicode.rst:487 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../c-api/unicode.rst:486 +#: ../../c-api/unicode.rst:488 msgid "A single character." msgstr "" -#: ../../c-api/unicode.rst:488 +#: ../../c-api/unicode.rst:490 msgid "``s``" msgstr "``s``" -#: ../../c-api/unicode.rst:489 +#: ../../c-api/unicode.rst:491 msgid ":c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:490 +#: ../../c-api/unicode.rst:492 msgid "A null-terminated C character array." msgstr "" -#: ../../c-api/unicode.rst:492 +#: ../../c-api/unicode.rst:494 msgid "``p``" msgstr "``p``" -#: ../../c-api/unicode.rst:493 +#: ../../c-api/unicode.rst:495 msgid ":c:expr:`const void*`" msgstr ":c:expr:`const void*`" -#: ../../c-api/unicode.rst:494 +#: ../../c-api/unicode.rst:496 msgid "" "The hex representation of a C pointer. Mostly equivalent to " "``printf(\"%p\")`` except that it is guaranteed to start with the literal " "``0x`` regardless of what the platform's ``printf`` yields." msgstr "" -#: ../../c-api/unicode.rst:499 +#: ../../c-api/unicode.rst:501 msgid "``A``" msgstr "``A``" -#: ../../c-api/unicode.rst:500 ../../c-api/unicode.rst:504 -#: ../../c-api/unicode.rst:514 ../../c-api/unicode.rst:518 -#: ../../c-api/unicode.rst:522 ../../c-api/unicode.rst:527 +#: ../../c-api/unicode.rst:502 ../../c-api/unicode.rst:506 +#: ../../c-api/unicode.rst:516 ../../c-api/unicode.rst:520 +#: ../../c-api/unicode.rst:524 ../../c-api/unicode.rst:529 msgid ":c:expr:`PyObject*`" msgstr ":c:expr:`PyObject*`" -#: ../../c-api/unicode.rst:501 +#: ../../c-api/unicode.rst:503 msgid "The result of calling :func:`ascii`." msgstr "" -#: ../../c-api/unicode.rst:503 +#: ../../c-api/unicode.rst:505 msgid "``U``" msgstr "``U``" -#: ../../c-api/unicode.rst:505 +#: ../../c-api/unicode.rst:507 msgid "A Unicode object." msgstr "一 Unicode 物件。" -#: ../../c-api/unicode.rst:507 +#: ../../c-api/unicode.rst:509 msgid "``V``" msgstr "``V``" -#: ../../c-api/unicode.rst:508 +#: ../../c-api/unicode.rst:510 msgid ":c:expr:`PyObject*`, :c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`PyObject*`、:c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:509 +#: ../../c-api/unicode.rst:511 msgid "" "A Unicode object (which may be ``NULL``) and a null-terminated C character " "array as a second parameter (which will be used, if the first parameter is " "``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:513 +#: ../../c-api/unicode.rst:515 msgid "``S``" msgstr "``S``" -#: ../../c-api/unicode.rst:515 +#: ../../c-api/unicode.rst:517 msgid "The result of calling :c:func:`PyObject_Str`." msgstr "" -#: ../../c-api/unicode.rst:517 +#: ../../c-api/unicode.rst:519 msgid "``R``" msgstr "``R``" -#: ../../c-api/unicode.rst:519 +#: ../../c-api/unicode.rst:521 msgid "The result of calling :c:func:`PyObject_Repr`." msgstr "" -#: ../../c-api/unicode.rst:521 +#: ../../c-api/unicode.rst:523 msgid "``T``" msgstr "``T``" -#: ../../c-api/unicode.rst:523 +#: ../../c-api/unicode.rst:525 msgid "" "Get the fully qualified name of an object type; call :c:func:" "`PyType_GetFullyQualifiedName`." msgstr "" -#: ../../c-api/unicode.rst:526 +#: ../../c-api/unicode.rst:528 msgid "``#T``" msgstr "``#T``" -#: ../../c-api/unicode.rst:528 +#: ../../c-api/unicode.rst:530 msgid "" "Similar to ``T`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" -#: ../../c-api/unicode.rst:531 +#: ../../c-api/unicode.rst:533 msgid "``N``" msgstr "``N``" -#: ../../c-api/unicode.rst:532 ../../c-api/unicode.rst:537 +#: ../../c-api/unicode.rst:534 ../../c-api/unicode.rst:539 msgid ":c:expr:`PyTypeObject*`" msgstr ":c:expr:`PyTypeObject*`" -#: ../../c-api/unicode.rst:533 +#: ../../c-api/unicode.rst:535 msgid "" "Get the fully qualified name of a type; call :c:func:" "`PyType_GetFullyQualifiedName`." msgstr "" -#: ../../c-api/unicode.rst:536 +#: ../../c-api/unicode.rst:538 msgid "``#N``" msgstr "``#N``" -#: ../../c-api/unicode.rst:538 +#: ../../c-api/unicode.rst:540 msgid "" "Similar to ``N`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" -#: ../../c-api/unicode.rst:542 +#: ../../c-api/unicode.rst:544 msgid "" "The width formatter unit is number of characters rather than bytes. The " "precision formatter unit is number of bytes or :c:type:`wchar_t` items (if " @@ -752,28 +756,28 @@ msgid "" "``PyObject*`` argument is not ``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:550 +#: ../../c-api/unicode.rst:552 msgid "" "Unlike to C :c:func:`printf` the ``0`` flag has effect even when a precision " "is given for integer conversions (``d``, ``i``, ``u``, ``o``, ``x``, or " "``X``)." msgstr "" -#: ../../c-api/unicode.rst:554 +#: ../../c-api/unicode.rst:556 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." msgstr "" -#: ../../c-api/unicode.rst:557 +#: ../../c-api/unicode.rst:559 msgid "Support for ``\"%li\"``, ``\"%lli\"`` and ``\"%zi\"`` added." msgstr "" -#: ../../c-api/unicode.rst:560 +#: ../../c-api/unicode.rst:562 msgid "" "Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, " "``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." msgstr "" -#: ../../c-api/unicode.rst:564 +#: ../../c-api/unicode.rst:566 msgid "" "Support for conversion specifiers ``o`` and ``X``. Support for length " "modifiers ``j`` and ``t``. Length modifiers are now applied to all integer " @@ -782,40 +786,40 @@ msgid "" "flag ``-``." msgstr "" -#: ../../c-api/unicode.rst:572 +#: ../../c-api/unicode.rst:574 msgid "" "An unrecognized format character now sets a :exc:`SystemError`. In previous " "versions it caused all the rest of the format string to be copied as-is to " "the result string, and any extra arguments discarded." msgstr "" -#: ../../c-api/unicode.rst:576 +#: ../../c-api/unicode.rst:578 msgid "Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added." msgstr "" -#: ../../c-api/unicode.rst:582 +#: ../../c-api/unicode.rst:584 msgid "" "Identical to :c:func:`PyUnicode_FromFormat` except that it takes exactly two " "arguments." msgstr "" -#: ../../c-api/unicode.rst:588 +#: ../../c-api/unicode.rst:590 msgid "" "Copy an instance of a Unicode subtype to a new true Unicode object if " "necessary. If *obj* is already a true Unicode object (not a subtype), return " "a new :term:`strong reference` to the object." msgstr "" -#: ../../c-api/unicode.rst:592 +#: ../../c-api/unicode.rst:594 msgid "" "Objects other than Unicode or its subtypes will cause a :exc:`TypeError`." msgstr "" -#: ../../c-api/unicode.rst:598 +#: ../../c-api/unicode.rst:600 msgid "Decode an encoded object *obj* to a Unicode object." msgstr "" -#: ../../c-api/unicode.rst:600 +#: ../../c-api/unicode.rst:602 msgid "" ":class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects " "` are decoded according to the given *encoding* and using " @@ -823,23 +827,27 @@ msgid "" "interface use the default values (see :ref:`builtincodecs` for details)." msgstr "" -#: ../../c-api/unicode.rst:606 +#: ../../c-api/unicode.rst:608 msgid "" "All other objects, including Unicode objects, cause a :exc:`TypeError` to be " "set." msgstr "" -#: ../../c-api/unicode.rst:609 +#: ../../c-api/unicode.rst:611 msgid "" "The API returns ``NULL`` if there was an error. The caller is responsible " "for decref'ing the returned objects." msgstr "" -#: ../../c-api/unicode.rst:615 +#: ../../c-api/unicode.rst:617 msgid "Return the length of the Unicode object, in code points." msgstr "" -#: ../../c-api/unicode.rst:626 +#: ../../c-api/unicode.rst:619 +msgid "On error, set an exception and return ``-1``." +msgstr "" + +#: ../../c-api/unicode.rst:630 msgid "" "Copy characters from one Unicode object into another. This function " "performs character conversion when necessary and falls back to :c:func:`!" @@ -847,39 +855,43 @@ msgid "" "otherwise returns the number of copied characters." msgstr "" -#: ../../c-api/unicode.rst:637 +#: ../../c-api/unicode.rst:641 msgid "" "Fill a string with a character: write *fill_char* into ``unicode[start:" "start+length]``." msgstr "" -#: ../../c-api/unicode.rst:640 +#: ../../c-api/unicode.rst:644 msgid "" "Fail if *fill_char* is bigger than the string maximum character, or if the " "string has more than 1 reference." msgstr "" -#: ../../c-api/unicode.rst:643 +#: ../../c-api/unicode.rst:647 msgid "" "Return the number of written character, or return ``-1`` and raise an " "exception on error." msgstr "" -#: ../../c-api/unicode.rst:652 +#: ../../c-api/unicode.rst:656 msgid "" "Write a character to a string. The string must have been created through :c:" "func:`PyUnicode_New`. Since Unicode strings are supposed to be immutable, " "the string must not be shared, or have been hashed yet." msgstr "" -#: ../../c-api/unicode.rst:656 +#: ../../c-api/unicode.rst:660 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " "not out of bounds, and that the object can be modified safely (i.e. that it " "its reference count is one)." msgstr "" -#: ../../c-api/unicode.rst:665 +#: ../../c-api/unicode.rst:664 +msgid "Return ``0`` on success, ``-1`` on error with an exception set." +msgstr "" + +#: ../../c-api/unicode.rst:671 msgid "" "Read a character from a string. This function checks that *unicode* is a " "Unicode object and the index is not out of bounds, in contrast to :c:func:" @@ -887,12 +899,17 @@ msgid "" msgstr "" #: ../../c-api/unicode.rst:675 +msgid "Return character on success, ``-1`` on error with an exception set." +msgstr "" + +#: ../../c-api/unicode.rst:683 msgid "" "Return a substring of *unicode*, from character index *start* (included) to " -"character index *end* (excluded). Negative indices are not supported." +"character index *end* (excluded). Negative indices are not supported. On " +"error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:684 +#: ../../c-api/unicode.rst:693 msgid "" "Copy the string *unicode* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " @@ -900,7 +917,7 @@ msgid "" "*unicode*). *buffer* is returned on success." msgstr "" -#: ../../c-api/unicode.rst:694 +#: ../../c-api/unicode.rst:703 msgid "" "Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" "func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" @@ -908,17 +925,17 @@ msgid "" "appended." msgstr "" -#: ../../c-api/unicode.rst:703 +#: ../../c-api/unicode.rst:712 msgid "Locale Encoding" msgstr "" -#: ../../c-api/unicode.rst:705 +#: ../../c-api/unicode.rst:714 msgid "" "The current locale encoding can be used to decode text from the operating " "system." msgstr "" -#: ../../c-api/unicode.rst:712 +#: ../../c-api/unicode.rst:721 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are " @@ -927,21 +944,21 @@ msgid "" "null character but cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:719 +#: ../../c-api/unicode.rst:728 msgid "" "Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" "term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:722 ../../c-api/unicode.rst:757 +#: ../../c-api/unicode.rst:731 ../../c-api/unicode.rst:766 msgid "This function ignores the :ref:`Python UTF-8 Mode `." msgstr "" -#: ../../c-api/unicode.rst:726 ../../c-api/unicode.rst:823 +#: ../../c-api/unicode.rst:735 ../../c-api/unicode.rst:832 msgid "The :c:func:`Py_DecodeLocale` function." msgstr ":c:func:`Py_DecodeLocale` 函式。" -#: ../../c-api/unicode.rst:730 +#: ../../c-api/unicode.rst:739 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -949,13 +966,13 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:739 +#: ../../c-api/unicode.rst:748 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." msgstr "" -#: ../../c-api/unicode.rst:747 +#: ../../c-api/unicode.rst:756 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " @@ -964,17 +981,17 @@ msgid "" "`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:754 +#: ../../c-api/unicode.rst:763 msgid "" "Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" "`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:761 ../../c-api/unicode.rst:854 +#: ../../c-api/unicode.rst:770 ../../c-api/unicode.rst:863 msgid "The :c:func:`Py_EncodeLocale` function." msgstr ":c:func:`Py_EncodeLocale` 函式。" -#: ../../c-api/unicode.rst:765 +#: ../../c-api/unicode.rst:774 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -982,24 +999,24 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:774 +#: ../../c-api/unicode.rst:783 msgid "File System Encoding" msgstr "" -#: ../../c-api/unicode.rst:776 +#: ../../c-api/unicode.rst:785 msgid "" "Functions encoding to and decoding from the :term:`filesystem encoding and " "error handler` (:pep:`383` and :pep:`529`)." msgstr "" -#: ../../c-api/unicode.rst:779 +#: ../../c-api/unicode.rst:788 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " "``\"O&\"`` converter should be used, passing :c:func:`PyUnicode_FSConverter` " "as the conversion function:" msgstr "" -#: ../../c-api/unicode.rst:785 +#: ../../c-api/unicode.rst:794 msgid "" "ParseTuple converter: encode :class:`str` objects -- obtained directly or " "through the :class:`os.PathLike` interface -- to :class:`bytes` using :c:" @@ -1008,18 +1025,18 @@ msgid "" "is no longer used." msgstr "" -#: ../../c-api/unicode.rst:793 ../../c-api/unicode.rst:810 +#: ../../c-api/unicode.rst:802 ../../c-api/unicode.rst:819 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../c-api/unicode.rst:796 +#: ../../c-api/unicode.rst:805 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " "converter should be used, passing :c:func:`PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" -#: ../../c-api/unicode.rst:802 +#: ../../c-api/unicode.rst:811 msgid "" "ParseTuple converter: decode :class:`bytes` objects -- obtained either " "directly or indirectly through the :class:`os.PathLike` interface -- to :" @@ -1028,57 +1045,57 @@ msgid "" "which must be released when it is no longer used." msgstr "" -#: ../../c-api/unicode.rst:816 +#: ../../c-api/unicode.rst:825 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:818 +#: ../../c-api/unicode.rst:827 msgid "" "If you need to decode a string from the current locale encoding, use :c:func:" "`PyUnicode_DecodeLocaleAndSize`." msgstr "" -#: ../../c-api/unicode.rst:825 ../../c-api/unicode.rst:838 -#: ../../c-api/unicode.rst:858 +#: ../../c-api/unicode.rst:834 ../../c-api/unicode.rst:847 +#: ../../c-api/unicode.rst:867 msgid "" "The :term:`filesystem error handler ` " "is now used." msgstr "" -#: ../../c-api/unicode.rst:832 +#: ../../c-api/unicode.rst:841 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" -#: ../../c-api/unicode.rst:835 +#: ../../c-api/unicode.rst:844 msgid "" "If the string length is known, use :c:func:" "`PyUnicode_DecodeFSDefaultAndSize`." msgstr "" -#: ../../c-api/unicode.rst:845 +#: ../../c-api/unicode.rst:854 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" -#: ../../c-api/unicode.rst:849 +#: ../../c-api/unicode.rst:858 msgid "" "If you need to encode a string to the current locale encoding, use :c:func:" "`PyUnicode_EncodeLocale`." msgstr "" -#: ../../c-api/unicode.rst:863 +#: ../../c-api/unicode.rst:872 msgid "wchar_t Support" msgstr "wchar_t 支援" -#: ../../c-api/unicode.rst:865 +#: ../../c-api/unicode.rst:874 msgid ":c:type:`wchar_t` support for platforms which support it:" msgstr "" -#: ../../c-api/unicode.rst:869 +#: ../../c-api/unicode.rst:878 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " @@ -1086,7 +1103,7 @@ msgid "" "failure." msgstr "" -#: ../../c-api/unicode.rst:877 +#: ../../c-api/unicode.rst:886 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " @@ -1094,13 +1111,13 @@ msgid "" "`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" -#: ../../c-api/unicode.rst:882 +#: ../../c-api/unicode.rst:891 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" -#: ../../c-api/unicode.rst:885 +#: ../../c-api/unicode.rst:894 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" "terminated. It is the responsibility of the caller to make sure that the :c:" @@ -1110,7 +1127,7 @@ msgid "" "most C functions." msgstr "" -#: ../../c-api/unicode.rst:895 +#: ../../c-api/unicode.rst:904 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " @@ -1121,37 +1138,37 @@ msgid "" "`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/unicode.rst:903 +#: ../../c-api/unicode.rst:912 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" -#: ../../c-api/unicode.rst:910 +#: ../../c-api/unicode.rst:919 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" -#: ../../c-api/unicode.rst:918 +#: ../../c-api/unicode.rst:927 msgid "Built-in Codecs" msgstr "" -#: ../../c-api/unicode.rst:920 +#: ../../c-api/unicode.rst:929 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" -#: ../../c-api/unicode.rst:923 +#: ../../c-api/unicode.rst:932 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" -#: ../../c-api/unicode.rst:927 +#: ../../c-api/unicode.rst:936 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " @@ -1159,28 +1176,28 @@ msgid "" "handler` internally." msgstr "" -#: ../../c-api/unicode.rst:932 +#: ../../c-api/unicode.rst:941 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -#: ../../c-api/unicode.rst:936 +#: ../../c-api/unicode.rst:945 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" -#: ../../c-api/unicode.rst:941 +#: ../../c-api/unicode.rst:950 msgid "Generic Codecs" msgstr "" -#: ../../c-api/unicode.rst:943 +#: ../../c-api/unicode.rst:952 msgid "These are the generic codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:949 +#: ../../c-api/unicode.rst:958 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " @@ -1189,7 +1206,7 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:959 +#: ../../c-api/unicode.rst:968 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1198,21 +1215,21 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:967 +#: ../../c-api/unicode.rst:976 msgid "UTF-8 Codecs" msgstr "UTF-8 編解碼器" -#: ../../c-api/unicode.rst:969 +#: ../../c-api/unicode.rst:978 msgid "These are the UTF-8 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:974 +#: ../../c-api/unicode.rst:983 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:981 +#: ../../c-api/unicode.rst:990 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " @@ -1220,14 +1237,20 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:989 +#: ../../c-api/unicode.rst:998 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:996 +#: ../../c-api/unicode.rst:1002 ../../c-api/unicode.rst:1017 +msgid "" +"The function fails if the string contains surrogate code points (``U+D800`` " +"- ``U+DFFF``)." +msgstr "" + +#: ../../c-api/unicode.rst:1008 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " @@ -1236,13 +1259,13 @@ msgid "" "regardless of whether there are any other null code points." msgstr "" -#: ../../c-api/unicode.rst:1002 +#: ../../c-api/unicode.rst:1014 msgid "" "On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " "return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:1005 +#: ../../c-api/unicode.rst:1020 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1251,47 +1274,47 @@ msgid "" "collected." msgstr "" -#: ../../c-api/unicode.rst:1012 ../../c-api/unicode.rst:1025 +#: ../../c-api/unicode.rst:1027 ../../c-api/unicode.rst:1040 msgid "The return type is now ``const char *`` rather of ``char *``." msgstr "" -#: ../../c-api/unicode.rst:1015 +#: ../../c-api/unicode.rst:1030 msgid "This function is a part of the :ref:`limited API `." msgstr "" -#: ../../c-api/unicode.rst:1021 +#: ../../c-api/unicode.rst:1036 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "" -#: ../../c-api/unicode.rst:1030 +#: ../../c-api/unicode.rst:1045 msgid "UTF-32 Codecs" msgstr "UTF-32 編解碼器" -#: ../../c-api/unicode.rst:1032 +#: ../../c-api/unicode.rst:1047 msgid "These are the UTF-32 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1038 +#: ../../c-api/unicode.rst:1053 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1042 ../../c-api/unicode.rst:1092 +#: ../../c-api/unicode.rst:1057 ../../c-api/unicode.rst:1107 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" -#: ../../c-api/unicode.rst:1045 ../../c-api/unicode.rst:1095 +#: ../../c-api/unicode.rst:1060 ../../c-api/unicode.rst:1110 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" -#: ../../c-api/unicode.rst:1049 +#: ../../c-api/unicode.rst:1064 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1299,21 +1322,21 @@ msgid "" "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -#: ../../c-api/unicode.rst:1054 +#: ../../c-api/unicode.rst:1069 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1057 ../../c-api/unicode.rst:1108 +#: ../../c-api/unicode.rst:1072 ../../c-api/unicode.rst:1123 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" -#: ../../c-api/unicode.rst:1059 ../../c-api/unicode.rst:1110 +#: ../../c-api/unicode.rst:1074 ../../c-api/unicode.rst:1125 msgid "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1065 +#: ../../c-api/unicode.rst:1080 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " @@ -1322,29 +1345,29 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1074 +#: ../../c-api/unicode.rst:1089 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1080 +#: ../../c-api/unicode.rst:1095 msgid "UTF-16 Codecs" msgstr "UTF-16 編解碼器" -#: ../../c-api/unicode.rst:1082 +#: ../../c-api/unicode.rst:1097 msgid "These are the UTF-16 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1088 +#: ../../c-api/unicode.rst:1103 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1099 +#: ../../c-api/unicode.rst:1114 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1353,13 +1376,13 @@ msgid "" "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -#: ../../c-api/unicode.rst:1105 +#: ../../c-api/unicode.rst:1120 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1116 +#: ../../c-api/unicode.rst:1131 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " @@ -1369,28 +1392,28 @@ msgid "" "*consumed*." msgstr "" -#: ../../c-api/unicode.rst:1125 +#: ../../c-api/unicode.rst:1140 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1131 +#: ../../c-api/unicode.rst:1146 msgid "UTF-7 Codecs" msgstr "UTF-7 編解碼器" -#: ../../c-api/unicode.rst:1133 +#: ../../c-api/unicode.rst:1148 msgid "These are the UTF-7 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1138 +#: ../../c-api/unicode.rst:1153 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1145 +#: ../../c-api/unicode.rst:1160 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " @@ -1398,101 +1421,101 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1152 +#: ../../c-api/unicode.rst:1167 msgid "Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1154 +#: ../../c-api/unicode.rst:1169 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1160 +#: ../../c-api/unicode.rst:1175 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1166 +#: ../../c-api/unicode.rst:1181 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1172 +#: ../../c-api/unicode.rst:1187 msgid "Raw-Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1174 +#: ../../c-api/unicode.rst:1189 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1180 +#: ../../c-api/unicode.rst:1195 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1186 +#: ../../c-api/unicode.rst:1201 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1192 +#: ../../c-api/unicode.rst:1207 msgid "Latin-1 Codecs" msgstr "Latin-1 編解碼器" -#: ../../c-api/unicode.rst:1194 +#: ../../c-api/unicode.rst:1209 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -#: ../../c-api/unicode.rst:1200 +#: ../../c-api/unicode.rst:1215 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1206 +#: ../../c-api/unicode.rst:1221 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1212 +#: ../../c-api/unicode.rst:1227 msgid "ASCII Codecs" msgstr "ASCII 編解碼器" -#: ../../c-api/unicode.rst:1214 +#: ../../c-api/unicode.rst:1229 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" -#: ../../c-api/unicode.rst:1220 +#: ../../c-api/unicode.rst:1235 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1226 +#: ../../c-api/unicode.rst:1241 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1232 +#: ../../c-api/unicode.rst:1247 msgid "Character Map Codecs" msgstr "" -#: ../../c-api/unicode.rst:1234 +#: ../../c-api/unicode.rst:1249 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " @@ -1502,18 +1525,18 @@ msgid "" "sequences work well." msgstr "" -#: ../../c-api/unicode.rst:1240 +#: ../../c-api/unicode.rst:1255 msgid "These are the mapping codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1245 +#: ../../c-api/unicode.rst:1260 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *str* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1249 +#: ../../c-api/unicode.rst:1264 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1523,14 +1546,14 @@ msgid "" "treated as undefined mappings and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1260 +#: ../../c-api/unicode.rst:1275 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1264 +#: ../../c-api/unicode.rst:1279 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " @@ -1538,41 +1561,41 @@ msgid "" "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1270 +#: ../../c-api/unicode.rst:1285 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -#: ../../c-api/unicode.rst:1274 +#: ../../c-api/unicode.rst:1289 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" -#: ../../c-api/unicode.rst:1278 +#: ../../c-api/unicode.rst:1293 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" -#: ../../c-api/unicode.rst:1281 +#: ../../c-api/unicode.rst:1296 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -#: ../../c-api/unicode.rst:1285 +#: ../../c-api/unicode.rst:1300 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" -#: ../../c-api/unicode.rst:1290 +#: ../../c-api/unicode.rst:1305 msgid "MBCS codecs for Windows" msgstr "" -#: ../../c-api/unicode.rst:1292 +#: ../../c-api/unicode.rst:1307 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " @@ -1580,13 +1603,13 @@ msgid "" "is defined by the user settings on the machine running the codec." msgstr "" -#: ../../c-api/unicode.rst:1299 +#: ../../c-api/unicode.rst:1314 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1306 +#: ../../c-api/unicode.rst:1321 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " @@ -1594,44 +1617,44 @@ msgid "" "will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1314 +#: ../../c-api/unicode.rst:1329 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1321 +#: ../../c-api/unicode.rst:1336 msgid "" "Encode the Unicode object using the specified code page and return a Python " "bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" "c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" -#: ../../c-api/unicode.rst:1329 +#: ../../c-api/unicode.rst:1344 msgid "Methods & Slots" msgstr "" -#: ../../c-api/unicode.rst:1335 +#: ../../c-api/unicode.rst:1350 msgid "Methods and Slot Functions" msgstr "" -#: ../../c-api/unicode.rst:1337 +#: ../../c-api/unicode.rst:1352 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" -#: ../../c-api/unicode.rst:1341 +#: ../../c-api/unicode.rst:1356 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." msgstr "" -#: ../../c-api/unicode.rst:1346 +#: ../../c-api/unicode.rst:1361 msgid "Concat two strings giving a new Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1351 +#: ../../c-api/unicode.rst:1366 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -1640,27 +1663,27 @@ msgid "" "list." msgstr "" -#: ../../c-api/unicode.rst:1359 +#: ../../c-api/unicode.rst:1374 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" -#: ../../c-api/unicode.rst:1366 +#: ../../c-api/unicode.rst:1381 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1373 +#: ../../c-api/unicode.rst:1388 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1381 +#: ../../c-api/unicode.rst:1396 msgid "" "Return the first position of *substr* in ``unicode[start:end]`` using the " "given *direction* (*direction* == ``1`` means to do a forward search, " @@ -1669,7 +1692,7 @@ msgid "" "``-2`` indicates that an error occurred and an exception has been set." msgstr "" -#: ../../c-api/unicode.rst:1391 +#: ../../c-api/unicode.rst:1406 msgid "" "Return the first position of the character *ch* in ``unicode[start:end]`` " "using the given *direction* (*direction* == ``1`` means to do a forward " @@ -1679,56 +1702,57 @@ msgid "" "set." msgstr "" -#: ../../c-api/unicode.rst:1399 +#: ../../c-api/unicode.rst:1414 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" -#: ../../c-api/unicode.rst:1406 +#: ../../c-api/unicode.rst:1421 msgid "" "Return the number of non-overlapping occurrences of *substr* in " "``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1413 +#: ../../c-api/unicode.rst:1428 msgid "" "Replace at most *maxcount* occurrences of *substr* in *unicode* with " "*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " "means replace all occurrences." msgstr "" -#: ../../c-api/unicode.rst:1420 +#: ../../c-api/unicode.rst:1435 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" -#: ../../c-api/unicode.rst:1423 +#: ../../c-api/unicode.rst:1438 msgid "" "This function returns ``-1`` upon failure, so one should call :c:func:" "`PyErr_Occurred` to check for errors." msgstr "" -#: ../../c-api/unicode.rst:1429 +#: ../../c-api/unicode.rst:1444 msgid "" "Compare a Unicode object with a char buffer which is interpreted as being " "UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " -"(``0``) otherwise. If the Unicode object contains surrogate characters or " -"the C string is not valid UTF-8, false (``0``) is returned." +"(``0``) otherwise. If the Unicode object contains surrogate code points " +"(``U+D800`` - ``U+DFFF``) or the C string is not valid UTF-8, false (``0``) " +"is returned." msgstr "" -#: ../../c-api/unicode.rst:1435 ../../c-api/unicode.rst:1456 +#: ../../c-api/unicode.rst:1451 ../../c-api/unicode.rst:1472 msgid "This function does not raise exceptions." msgstr "" -#: ../../c-api/unicode.rst:1442 +#: ../../c-api/unicode.rst:1458 msgid "" "Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " "length using :c:func:`!strlen`. If the Unicode object contains null " "characters, false (``0``) is returned." msgstr "" -#: ../../c-api/unicode.rst:1451 +#: ../../c-api/unicode.rst:1467 msgid "" "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " @@ -1736,47 +1760,47 @@ msgid "" "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" -#: ../../c-api/unicode.rst:1461 +#: ../../c-api/unicode.rst:1477 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" -#: ../../c-api/unicode.rst:1463 +#: ../../c-api/unicode.rst:1479 msgid "``NULL`` in case an exception was raised" msgstr "" -#: ../../c-api/unicode.rst:1464 +#: ../../c-api/unicode.rst:1480 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" -#: ../../c-api/unicode.rst:1465 +#: ../../c-api/unicode.rst:1481 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -#: ../../c-api/unicode.rst:1467 +#: ../../c-api/unicode.rst:1483 msgid "" "Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" "`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." msgstr "" -#: ../../c-api/unicode.rst:1473 +#: ../../c-api/unicode.rst:1489 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" -#: ../../c-api/unicode.rst:1479 +#: ../../c-api/unicode.rst:1495 msgid "" "Check whether *substr* is contained in *unicode* and return true or false " "accordingly." msgstr "" -#: ../../c-api/unicode.rst:1482 +#: ../../c-api/unicode.rst:1498 msgid "" "*substr* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" -#: ../../c-api/unicode.rst:1488 +#: ../../c-api/unicode.rst:1504 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " @@ -1787,7 +1811,7 @@ msgid "" "interns it." msgstr "" -#: ../../c-api/unicode.rst:1495 +#: ../../c-api/unicode.rst:1511 msgid "" "(Clarification: even though there is a lot of talk about references, think " "of this function as reference-neutral. You must own the object you pass in; " @@ -1795,39 +1819,39 @@ msgid "" "the result.)" msgstr "" -#: ../../c-api/unicode.rst:1500 +#: ../../c-api/unicode.rst:1516 msgid "" "This function never raises an exception. On error, it leaves its argument " "unchanged without interning it." msgstr "" -#: ../../c-api/unicode.rst:1503 +#: ../../c-api/unicode.rst:1519 msgid "" "Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" "expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " "as with any other error -- the argument is left unchanged." msgstr "" -#: ../../c-api/unicode.rst:1507 +#: ../../c-api/unicode.rst:1523 msgid "" "Note that interned strings are not “immortal”. You must keep a reference to " "the result to benefit from interning." msgstr "" -#: ../../c-api/unicode.rst:1513 +#: ../../c-api/unicode.rst:1529 msgid "" "A combination of :c:func:`PyUnicode_FromString` and :c:func:" "`PyUnicode_InternInPlace`, meant for statically allocated strings." msgstr "" -#: ../../c-api/unicode.rst:1516 +#: ../../c-api/unicode.rst:1532 msgid "" "Return a new (\"owned\") reference to either a new Unicode string object " "that has been interned, or an earlier interned string object with the same " "value." msgstr "" -#: ../../c-api/unicode.rst:1520 +#: ../../c-api/unicode.rst:1536 msgid "" "Python may keep a reference to the result, or make it :term:`immortal`, " "preventing it from being garbage-collected promptly. For interning an " @@ -1836,6 +1860,6 @@ msgid "" "`PyUnicode_InternInPlace` directly." msgstr "" -#: ../../c-api/unicode.rst:1528 +#: ../../c-api/unicode.rst:1544 msgid "Strings interned this way are made :term:`immortal`." msgstr "" diff --git a/deprecations/index.po b/deprecations/index.po index b4a60d6ccd..7634be6157 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -130,46 +130,38 @@ msgstr "" "Alan Williams 於 :gh:`72346` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:50 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:55 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:62 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:64 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -180,7 +172,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:72 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -197,7 +189,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:80 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -205,7 +197,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -215,27 +207,27 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:92 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:94 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -245,7 +237,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -253,7 +245,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:105 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -265,7 +257,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -273,7 +265,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:115 +#: ../../deprecations/pending-removal-in-3.14.rst:112 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -321,10 +313,18 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:20 +msgid "" +":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " +"taken into consideration by the import system (:gh:`97879`)." +msgstr "" +":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " +"系統考慮。 (:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:23 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:22 +#: ../../deprecations/pending-removal-in-3.15.rst:25 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -337,11 +337,11 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:30 +#: ../../deprecations/pending-removal-in-3.15.rst:33 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-3.15.rst:35 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -349,11 +349,11 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:36 +#: ../../deprecations/pending-removal-in-3.15.rst:39 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:38 +#: ../../deprecations/pending-removal-in-3.15.rst:41 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -362,11 +362,11 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:45 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:47 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -377,11 +377,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:53 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:52 +#: ../../deprecations/pending-removal-in-3.15.rst:55 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -392,7 +392,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:58 +#: ../../deprecations/pending-removal-in-3.15.rst:61 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -402,11 +402,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:63 +#: ../../deprecations/pending-removal-in-3.15.rst:66 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:65 +#: ../../deprecations/pending-removal-in-3.15.rst:68 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index 2b0e1acbc9..615e97ede1 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-17 00:03+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -126,46 +126,38 @@ msgstr "" "Alan Williams 於 :gh:`72346` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:50 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:55 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:62 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:64 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -176,7 +168,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:72 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -193,7 +185,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:80 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -201,7 +193,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -211,27 +203,27 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:92 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:94 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -241,7 +233,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -249,7 +241,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:105 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -261,7 +253,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -269,7 +261,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:115 +#: ../../deprecations/pending-removal-in-3.14.rst:112 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index b8663476ab..d160dbfc7a 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -54,10 +54,18 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:20 +msgid "" +":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " +"taken into consideration by the import system (:gh:`97879`)." +msgstr "" +":mod:`importlib`:引入系統將不再設定或考慮 ``__package__`` 和 ``__cached__`` " +"(:gh:`97879`)。" + +#: ../../deprecations/pending-removal-in-3.15.rst:23 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:22 +#: ../../deprecations/pending-removal-in-3.15.rst:25 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -70,11 +78,11 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:30 +#: ../../deprecations/pending-removal-in-3.15.rst:33 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-3.15.rst:35 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -82,11 +90,11 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:36 +#: ../../deprecations/pending-removal-in-3.15.rst:39 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:38 +#: ../../deprecations/pending-removal-in-3.15.rst:41 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -95,11 +103,11 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:45 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:47 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -110,11 +118,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:53 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:52 +#: ../../deprecations/pending-removal-in-3.15.rst:55 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -125,7 +133,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:58 +#: ../../deprecations/pending-removal-in-3.15.rst:61 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -135,11 +143,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:63 +#: ../../deprecations/pending-removal-in-3.15.rst:66 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:65 +#: ../../deprecations/pending-removal-in-3.15.rst:68 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" diff --git a/extending/newtypes.po b/extending/newtypes.po index d31c7ef8a7..7029e57821 100644 --- a/extending/newtypes.po +++ b/extending/newtypes.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:34+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -561,7 +561,7 @@ msgid "" "defined this way can have an associated doc string simply by providing the " "text in the table. An application can use the introspection API to retrieve " "the descriptor from the class object, and get the doc string using its :attr:" -"`!__doc__` attribute." +"`~type.__doc__` attribute." msgstr "" #: ../../extending/newtypes.rst:301 diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index 8b1a2a41b9..d344eb253f 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -289,8 +289,8 @@ msgid "" "If you want your type to be subclassable from Python, and your type has the " "same :c:member:`~PyTypeObject.tp_basicsize` as its base type, you may have " "problems with multiple inheritance. A Python subclass of your type will " -"have to list your type first in its :attr:`~class.__bases__`, or else it " -"will not be able to call your type's :meth:`~object.__new__` method without " +"have to list your type first in its :attr:`~type.__bases__`, or else it will " +"not be able to call your type's :meth:`~object.__new__` method without " "getting an error. You can avoid this problem by ensuring that your type has " "a larger value for :c:member:`~PyTypeObject.tp_basicsize` than its base type " "does. Most of the time, this will be true anyway, because either your base " diff --git a/faq/design.po b/faq/design.po index 543508819a..8474f7dc97 100644 --- a/faq/design.po +++ b/faq/design.po @@ -363,7 +363,7 @@ msgstr "" "(二) 當我看到一段程式碼寫著 len(x),我\\ *知道*\\ 他要找某個東西的長度。這" "告訴了我兩件事:結果是一個整數、參數是某種容器。相對地,當我看到 x.len(),我" "必須先知道 x 是某種容器,並實作了一個介面或是繼承了一個有標準 len() 的類別。" -"遇到一個沒有實作映射 (mapping) 的類別卻有 get() 或 keys() 方法,或是不是檔案" +"遇到一個沒有實作對映 (mapping) 的類別卻有 get() 或 keys() 方法,或是不是檔案" "但卻有 write() 方法時,我們偶爾會覺得困惑。" #: ../../faq/design.rst:189 @@ -526,7 +526,7 @@ msgid "" "For cases where you need to choose from a very large number of " "possibilities, you can create a dictionary mapping case values to functions " "to call. For example::" -msgstr "如果可能性很多,你可以用字典去映射要呼叫的函式。舉例來說: ::" +msgstr "如果可能性很多,你可以用字典去對映要呼叫的函式。舉例來說: ::" #: ../../faq/design.rst:272 msgid "" diff --git a/faq/extending.po b/faq/extending.po index ab0b8990b6..720d5e9fe3 100644 --- a/faq/extending.po +++ b/faq/extending.po @@ -186,7 +186,7 @@ msgstr "" "還有一個針對 Python 物件的高級 API,它由所謂的「抽象」介面提供——閱讀 " "``Include/abstract.h`` 了解更多詳細資訊。它允許使用 :c:func:" "`PySequence_Length`、:c:func:`PySequence_GetItem` 等呼叫以及許多其他有用的協" -"議(例如數字 (:c:func:`PyNumber_Index) ` 等)和 PyMapping API 中的映射。" +"議(例如數字 (:c:func:`PyNumber_Index) ` 等)和 PyMapping API 中的對映。" #: ../../faq/extending.rst:104 msgid "How do I use Py_BuildValue() to create a tuple of arbitrary length?" diff --git a/faq/library.po b/faq/library.po index fef7290929..3a9a9e0094 100644 --- a/faq/library.po +++ b/faq/library.po @@ -1239,7 +1239,7 @@ msgid "" "`DatabaseProgramming wiki page `_ for details." msgstr "" -"支援大多數關係資料庫。有關詳細資訊,請參閱`DatabaseProgramming 維基頁面 " +"支援大多數關係資料庫。有關詳細資訊,請參閱 `DatabaseProgramming 維基頁面 " "`_。" #: ../../faq/library.rst:779 @@ -1255,9 +1255,9 @@ msgid "" "mod:`shelve` library module uses pickle and (g)dbm to create persistent " "mappings containing arbitrary Python objects." msgstr "" -":mod:`pickle` 庫模組以一種非常通用的方式解決了這個問題(儘管你仍然不能存儲諸" -"如打開的檔案、socket 或窗口之類的東西),而 :mod:`shelve` 庫模組使用 pickle " -"和 (g) dbm 建立包含任意 Python 物件的持久映射。" +":mod:`pickle` 函式庫模組以一種非常通用的方式解決了這個問題(儘管你仍然不能存" +"儲諸如打開的檔案、socket 或窗口之類的東西),而 :mod:`shelve` 函式庫模組使用 " +"pickle 和 (g) dbm 建立包含任意 Python 物件的持久對映。" #: ../../faq/library.rst:788 msgid "Mathematics and Numerics" diff --git a/faq/programming.po b/faq/programming.po index 4a9bd315fb..3a4d4abfe8 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-04-25 14:17+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -351,14 +351,14 @@ msgstr "" msgid "" "Why do lambdas defined in a loop with different values all return the same " "result?" -msgstr "為什麼在具有不同值的循環中定義的 lambda 都回傳相同的結果?" +msgstr "為什麼在具有不同值的迴圈中定義的 lambda 都回傳相同的結果?" #: ../../faq/programming.rst:210 msgid "" "Assume you use a for loop to define a few different lambdas (or even plain " "functions), e.g.::" msgstr "" -"假設你使用 for 循環來定義幾個不同的 lambda(甚至是普通函式),例如: ::" +"假設你使用 for 迴圈來定義幾個不同的 lambda(甚至是普通函式),例如: ::" #: ../../faq/programming.rst:213 msgid "" @@ -404,7 +404,7 @@ msgid "" "changing the value of ``x`` and see how the results of the lambdas change::" msgstr "" "發生這種情況是因為 ``x`` 不是 lambda 的局部變數,而是在外部作用域中定義的,並" -"且在呼叫 lambda 時存取它——而不是在定義時存取它。在循環結束時,``x`` 的值為 " +"且在呼叫 lambda 時存取它——而不是在定義時存取它。在迴圈結束時,``x`` 的值為 " "``4``,因此所有函式現在都回傳 ``4**2``,即 ``16``。你還可以透過更改 ``x`` 的" "值來驗證這一點,並查看 lambda 運算式的結果如何變化: ::" @@ -447,7 +447,7 @@ msgid "" "Therefore each lambda will now return the correct result::" msgstr "" "在這裡,``n=x`` 建立了一個新變數 ``n`` 局部於 lambda 並在定義 lambda 時計算," -"因此它具有與 ``x`` 在循環中的那個點相同的值。這意味著 ``n`` 的值在第一個 " +"因此它具有與 ``x`` 在迴圈中的那個點相同的值。這意味著 ``n`` 的值在第一個 " "lambda 中為 ``0`` ,在第二個中為 ``1`` ,在第三個中為 ``2`` ,依此類推。因此" "每個 lambda 現在將回傳正確的結果: ::" @@ -1517,9 +1517,8 @@ msgid "Don't try this at home, kids!" msgstr "孩子們,不要在家裡嘗試這個!" #: ../../faq/programming.rst:777 -#, fuzzy msgid "What does the slash(/) in the parameter list of a function mean?" -msgstr "函式參數 list 中的斜槓(/)是什麼意思?" +msgstr "函式參數串列中的斜槓 (/) 是什麼意思?" #: ../../faq/programming.rst:779 #, fuzzy @@ -1532,7 +1531,7 @@ msgid "" "only parameters. Its documentation looks like this::" msgstr "" "函式引數list中的斜杠表示它前面的參數是位置參數。僅位置參數是沒有外部可用名稱" -"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置映射到參數。例如,:" +"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例如,:" "func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" #: ../../faq/programming.rst:786 @@ -1858,7 +1857,7 @@ msgid "" "names of the functions. This is also the primary technique used to emulate " "a case construct::" msgstr "" -"最好的方法是使用將字串映射到函式的字典。這種技術的主要優點是字串不需要與函式" +"最好的方法是使用將字串對映到函式的字典。這種技術的主要優點是字串不需要與函式" "名稱相匹配。這也是用於模擬案例構造的主要技術: ::" #: ../../faq/programming.rst:947 @@ -2663,7 +2662,7 @@ msgstr "" msgid "" "To just run the method or function without saving the return values, a " "plain :keyword:`for` loop will suffice::" -msgstr "要只運行方法或函式而不保存回傳值,一個普通的 for 循環就足夠了: ::" +msgstr "要只運行方法或函式而不保存回傳值,一個普通的 for 迴圈就足夠了: ::" #: ../../faq/programming.rst:1337 msgid "" @@ -2872,7 +2871,7 @@ msgid "" "value\". In Python, use the ``key`` argument for the :meth:`list.sort` " "method::" msgstr "" -"該技術歸功於 Perl 社區的 Randal Schwartz,它透過將每個元素映射到其「排序值」" +"該技術歸功於 Perl 社區的 Randal Schwartz,它透過將每個元素對映到其「排序值」" "的度量對list的元素進行排序。在 Python 中,對 :meth:`list.sort` 方法使用 " "``key`` 引數: ::" @@ -3224,25 +3223,44 @@ msgstr "" #: ../../faq/programming.rst:1616 #, fuzzy msgid "" -"Most :meth:`!__setattr__` implementations must modify :meth:`self.__dict__ " -"` to store local state for self without causing an infinite " -"recursion." +"Many :meth:`~object.__setattr__` implementations call :meth:`!object." +"__setattr__` to set an attribute on self without causing infinite recursion::" msgstr "" "大多數 :meth:`!__setattr__` 實作必須修改 :meth:`self.__dict__ ` 以存儲 self 的本地狀態,而不會導致無限遞迴。" -#: ../../faq/programming.rst:1622 +#: ../../faq/programming.rst:1619 +#, fuzzy +msgid "" +"class X:\n" +" def __setattr__(self, name, value):\n" +" # Custom logic here...\n" +" object.__setattr__(self, name, value)" +msgstr "" +"class X:\n" +" ...\n" +" def __setattr__(self, name, value):\n" +" self.__dict__[name] = value\n" +" ..." + +#: ../../faq/programming.rst:1624 +msgid "" +"Alternatively, it is possible to set attributes by inserting entries into :" +"attr:`self.__dict__ ` directly." +msgstr "" + +#: ../../faq/programming.rst:1629 #, fuzzy msgid "" "How do I call a method defined in a base class from a derived class that " "extends it?" msgstr "如何從擴充它的衍生類別呼叫基底類別中定義的方法?" -#: ../../faq/programming.rst:1624 +#: ../../faq/programming.rst:1631 msgid "Use the built-in :func:`super` function::" msgstr "使用內建的 :func:`super` 函式: ::" -#: ../../faq/programming.rst:1626 +#: ../../faq/programming.rst:1633 msgid "" "class Derived(Base):\n" " def meth(self):\n" @@ -3252,7 +3270,7 @@ msgstr "" " def meth(self):\n" " super().meth() # calls Base.meth" -#: ../../faq/programming.rst:1630 +#: ../../faq/programming.rst:1637 #, fuzzy msgid "" "In the example, :func:`super` will automatically determine the instance from " @@ -3263,12 +3281,12 @@ msgstr "" "在示例中,:func:`super` 將自動確定呼叫它的實例(``self`` 值),使用 " "``type(self ).__mro__``,並回傳 MRO 中``Derived`` 之後的下一行:``Base``。" -#: ../../faq/programming.rst:1637 +#: ../../faq/programming.rst:1644 #, fuzzy msgid "How can I organize my code to make it easier to change the base class?" msgstr "我如何組織我的程式碼以便更容易地更改基底類別?" -#: ../../faq/programming.rst:1639 +#: ../../faq/programming.rst:1646 #, fuzzy msgid "" "You could assign the base class to an alias and derive from the alias. Then " @@ -3280,7 +3298,7 @@ msgstr "" "說一句,如果你想動態決定(例如,取決於資源的可用性)使用哪個基底類別,這個技" "巧也很方便。例子: ::" -#: ../../faq/programming.rst:1644 +#: ../../faq/programming.rst:1651 msgid "" "class Base:\n" " ...\n" @@ -3298,19 +3316,19 @@ msgstr "" "class Derived(BaseAlias):\n" " ..." -#: ../../faq/programming.rst:1654 +#: ../../faq/programming.rst:1661 #, fuzzy msgid "How do I create static class data and static class methods?" msgstr "如何建立靜態類別資料和靜態類別方法?" -#: ../../faq/programming.rst:1656 +#: ../../faq/programming.rst:1663 #, fuzzy msgid "" "Both static data and static methods (in the sense of C++ or Java) are " "supported in Python." msgstr "Python 支援靜態資料和靜態方法(在 C++ 或 Java 的意義上)。" -#: ../../faq/programming.rst:1659 +#: ../../faq/programming.rst:1666 #, fuzzy msgid "" "For static data, simply define a class attribute. To assign a new value to " @@ -3319,7 +3337,7 @@ msgstr "" "對於靜態資料,只需定義一個類別屬性即可。要為屬性分配新值,你必須在分配中顯式" "使用類別名: ::" -#: ../../faq/programming.rst:1662 +#: ../../faq/programming.rst:1669 msgid "" "class C:\n" " count = 0 # number of times C.__init__ called\n" @@ -3331,7 +3349,7 @@ msgid "" " return C.count # or return self.count" msgstr "" -#: ../../faq/programming.rst:1671 +#: ../../faq/programming.rst:1678 #, fuzzy msgid "" "``c.count`` also refers to ``C.count`` for any ``c`` such that " @@ -3342,7 +3360,7 @@ msgstr "" "除非被 ``c`` 本身或某些人覆蓋從 ``c.__class__`` 回到 ``C`` 的基底類別搜索路徑" "上的類別。" -#: ../../faq/programming.rst:1675 +#: ../../faq/programming.rst:1682 #, fuzzy msgid "" "Caution: within a method of C, an assignment like ``self.count = 42`` " @@ -3354,15 +3372,15 @@ msgstr "" "一個名為 \"count\" 的新的不相關實例。類別靜態資料名稱的重新綁定必須始終指定類" "別是否在方法內: ::" -#: ../../faq/programming.rst:1680 +#: ../../faq/programming.rst:1687 msgid "C.count = 314" msgstr "C.count = 314" -#: ../../faq/programming.rst:1682 +#: ../../faq/programming.rst:1689 msgid "Static methods are possible::" msgstr "靜態方法是可能的: ::" -#: ../../faq/programming.rst:1684 +#: ../../faq/programming.rst:1691 msgid "" "class C:\n" " @staticmethod\n" @@ -3376,7 +3394,7 @@ msgstr "" " # 沒有 'self' 參數!\n" " ..." -#: ../../faq/programming.rst:1690 +#: ../../faq/programming.rst:1697 #, fuzzy msgid "" "However, a far more straightforward way to get the effect of a static method " @@ -3384,7 +3402,7 @@ msgid "" msgstr "" "然而,獲得靜態方法效果的一種更直接的方法是透過一個簡單的模組級函式: ::" -#: ../../faq/programming.rst:1693 +#: ../../faq/programming.rst:1700 msgid "" "def getcount():\n" " return C.count" @@ -3392,7 +3410,7 @@ msgstr "" "def getcount():\n" " return C.count" -#: ../../faq/programming.rst:1696 +#: ../../faq/programming.rst:1703 #, fuzzy msgid "" "If your code is structured so as to define one class (or tightly related " @@ -3401,12 +3419,12 @@ msgstr "" "如果你的程式碼結構化以便為每個模組定義一個類別(或緊密相關的類別層次結構)," "則這提供了所需的封裝。" -#: ../../faq/programming.rst:1701 +#: ../../faq/programming.rst:1708 #, fuzzy msgid "How can I overload constructors (or methods) in Python?" msgstr "如何在 Python 中重載構造函式(或方法)?" -#: ../../faq/programming.rst:1703 +#: ../../faq/programming.rst:1710 #, fuzzy msgid "" "This answer actually applies to all methods, but the question usually comes " @@ -3414,11 +3432,11 @@ msgid "" msgstr "" "這個答案實際上適用於所有方法,但這個問題通常首先出現在構造函式的上下文中。" -#: ../../faq/programming.rst:1706 +#: ../../faq/programming.rst:1713 msgid "In C++ you'd write" msgstr "在 C++ 中你會寫成" -#: ../../faq/programming.rst:1708 +#: ../../faq/programming.rst:1715 msgid "" "class C {\n" " C() { cout << \"No arguments\\n\"; }\n" @@ -3430,7 +3448,7 @@ msgstr "" " C(int i) { cout << \"Argument is \" << i << \"\\n\"; }\n" "}" -#: ../../faq/programming.rst:1715 +#: ../../faq/programming.rst:1722 #, fuzzy msgid "" "In Python you have to write a single constructor that catches all cases " @@ -3438,7 +3456,7 @@ msgid "" msgstr "" "在 Python 中,你必須編寫一個構造函式來捕獲所有使用預設引數的情況。例如: ::" -#: ../../faq/programming.rst:1718 +#: ../../faq/programming.rst:1725 msgid "" "class C:\n" " def __init__(self, i=None):\n" @@ -3454,17 +3472,17 @@ msgstr "" " else:\n" " print(\"Argument is\", i)" -#: ../../faq/programming.rst:1725 +#: ../../faq/programming.rst:1732 #, fuzzy msgid "This is not entirely equivalent, but close enough in practice." msgstr "這並不完全等價,但在實踐中足夠接近。" -#: ../../faq/programming.rst:1727 +#: ../../faq/programming.rst:1734 #, fuzzy msgid "You could also try a variable-length argument list, e.g. ::" msgstr "你也可以嘗試可變長度引數 list,例如: ::" -#: ../../faq/programming.rst:1729 +#: ../../faq/programming.rst:1736 msgid "" "def __init__(self, *args):\n" " ..." @@ -3472,17 +3490,17 @@ msgstr "" "def __init__(self, *args):\n" " ..." -#: ../../faq/programming.rst:1732 +#: ../../faq/programming.rst:1739 #, fuzzy msgid "The same approach works for all method definitions." msgstr "相同的方法適用於所有方法定義。" -#: ../../faq/programming.rst:1736 +#: ../../faq/programming.rst:1743 #, fuzzy msgid "I try to use __spam and I get an error about _SomeClassName__spam." msgstr "我嘗試使用 __spam,但收到有關 _SomeClassName__spam 的錯誤。" -#: ../../faq/programming.rst:1738 +#: ../../faq/programming.rst:1745 #, fuzzy msgid "" "Variable names with double leading underscores are \"mangled\" to provide a " @@ -3497,13 +3515,13 @@ msgstr "" "上替換為 ``_classname__spam``,其中 ``classname`` 是當前類別名,所有前導底線" "被去除。" -#: ../../faq/programming.rst:1744 +#: ../../faq/programming.rst:1751 msgid "" "The identifier can be used unchanged within the class, but to access it " "outside the class, the mangled name must be used:" msgstr "" -#: ../../faq/programming.rst:1747 +#: ../../faq/programming.rst:1754 msgid "" "class A:\n" " def __one(self):\n" @@ -3529,7 +3547,7 @@ msgstr "" "\n" "four = 4 * A()._A__one()" -#: ../../faq/programming.rst:1761 +#: ../../faq/programming.rst:1768 #, fuzzy msgid "" "In particular, this does not guarantee privacy since an outside user can " @@ -3539,23 +3557,23 @@ msgstr "" "這並不能保證隱私:外部使用者仍然可以故意存取 \"_classname__spam\" 屬性,並且" "私有值在物件的 __dict__ 中可見。許多 Python 程式員根本懶得使用私有變數名。" -#: ../../faq/programming.rst:1767 +#: ../../faq/programming.rst:1774 msgid "" "The :ref:`private name mangling specifications ` for " "details and special cases." msgstr "" -#: ../../faq/programming.rst:1771 +#: ../../faq/programming.rst:1778 #, fuzzy msgid "My class defines __del__ but it is not called when I delete the object." msgstr "我的類別定義了 __del__ 但是當我刪除物件時它沒有被呼叫。" -#: ../../faq/programming.rst:1773 +#: ../../faq/programming.rst:1780 #, fuzzy msgid "There are several possible reasons for this." msgstr "這有幾個可能的原因。" -#: ../../faq/programming.rst:1775 +#: ../../faq/programming.rst:1782 #, fuzzy msgid "" "The :keyword:`del` statement does not necessarily call :meth:`~object." @@ -3565,7 +3583,7 @@ msgstr "" ":keyword:`del` 陳述式不一定呼叫 :meth:`~object.__del__` -- 它只是減少物件的引" "用計數,如果達到零,則呼叫 :meth:`!__del__`。" -#: ../../faq/programming.rst:1779 +#: ../../faq/programming.rst:1786 #, fuzzy msgid "" "If your data structures contain circular links (e.g. a tree where each child " @@ -3587,7 +3605,7 @@ msgstr "" "行順序是任意的。你可以運行 :func:`gc.collect` 來強制收集,但*存在*永遠不會收" "集物件的病態情況。" -#: ../../faq/programming.rst:1790 +#: ../../faq/programming.rst:1797 #, fuzzy msgid "" "Despite the cycle collector, it's still a good idea to define an explicit " @@ -3602,7 +3620,7 @@ msgstr "" "性。不要直接呼叫 :meth:`!__del__` -- :meth:`!__del__` 應該呼叫 ``close()`` 並" "且 ``close()`` 應該確保它可以多次呼叫同一個物件。" -#: ../../faq/programming.rst:1797 +#: ../../faq/programming.rst:1804 #, fuzzy msgid "" "Another way to avoid cyclical references is to use the :mod:`weakref` " @@ -3614,21 +3632,20 @@ msgstr "" "的情況下指向物件。例如,樹資料結構應該對其父參照和同級參照使用弱參照(如果需" "要的話!)。" -#: ../../faq/programming.rst:1810 -#, fuzzy +#: ../../faq/programming.rst:1817 msgid "" "Finally, if your :meth:`!__del__` method raises an exception, a warning " "message is printed to :data:`sys.stderr`." msgstr "" -"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告消息印出到 :data:" +"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告訊息印出到 :data:" "`sys.stderr`。" -#: ../../faq/programming.rst:1815 +#: ../../faq/programming.rst:1822 #, fuzzy msgid "How do I get a list of all instances of a given class?" msgstr "如何獲取給定類別的所有實例的 list?" -#: ../../faq/programming.rst:1817 +#: ../../faq/programming.rst:1824 #, fuzzy msgid "" "Python does not keep track of all instances of a class (or of a built-in " @@ -3638,12 +3655,11 @@ msgstr "" "Python 不會跟踪類別(或內建型別)的所有實例。你可以對類別的構造函式進行編程," "以透過保留對每個實例的弱參照list來跟踪所有實例。" -#: ../../faq/programming.rst:1823 -#, fuzzy +#: ../../faq/programming.rst:1830 msgid "Why does the result of ``id()`` appear to be not unique?" msgstr "為什麼 ``id()`` 的結果看起來不唯一?" -#: ../../faq/programming.rst:1825 +#: ../../faq/programming.rst:1832 #, fuzzy msgid "" "The :func:`id` builtin returns an integer that is guaranteed to be unique " @@ -3656,7 +3672,7 @@ msgstr "" "CPython 中,這是物件的記憶體地址,所以經常發生在從記憶體中刪除一個物件後,下" "一個新建立的物件被分配在記憶體中的相同位置。這個例子說明了這一點:" -#: ../../faq/programming.rst:1836 +#: ../../faq/programming.rst:1843 #, fuzzy msgid "" "The two ids belong to different integer objects that are created before, and " @@ -3667,18 +3683,18 @@ msgstr "" "這兩個 id 屬於之前建立的不同整數物件,並在執行 ``id()`` 呼叫後立即刪除。要確" "保你要檢查其 id 的物件仍然存在,請建立對該物件的另一個參照:" -#: ../../faq/programming.rst:1849 +#: ../../faq/programming.rst:1856 msgid "When can I rely on identity tests with the *is* operator?" msgstr "我什麼時候可以依靠 *is* 運算子進行識別性測試?" -#: ../../faq/programming.rst:1851 +#: ../../faq/programming.rst:1858 msgid "" "The ``is`` operator tests for object identity. The test ``a is b`` is " "equivalent to ``id(a) == id(b)``." msgstr "" "``is`` 運算子測試物件識別性。測試 ``a is b`` 等同於 ``id(a) == id(b)`` 。" -#: ../../faq/programming.rst:1854 +#: ../../faq/programming.rst:1861 msgid "" "The most important property of an identity test is that an object is always " "identical to itself, ``a is a`` always returns ``True``. Identity tests are " @@ -3689,7 +3705,7 @@ msgstr "" "識別性測試通常比相等性測試更快。與相等性測試不同,識別性測試保證回傳布林值 " "``True`` 或 ``False`` 。" -#: ../../faq/programming.rst:1859 +#: ../../faq/programming.rst:1866 msgid "" "However, identity tests can *only* be substituted for equality tests when " "object identity is assured. Generally, there are three circumstances where " @@ -3698,7 +3714,7 @@ msgstr "" "然而,*只有*\\ 當物件識別性得到保證時,識別性測試才能代替相等性測試。一般來" "說,保證識別性的情況有以下三種:" -#: ../../faq/programming.rst:1863 +#: ../../faq/programming.rst:1870 msgid "" "1) Assignments create new names but do not change object identity. After " "the assignment ``new = old``, it is guaranteed that ``new is old``." @@ -3706,7 +3722,7 @@ msgstr "" "1) 賦值建立新名稱但不改變物件識別性。賦值 ``new = old`` 後,保證 ``new is " "old``。" -#: ../../faq/programming.rst:1866 +#: ../../faq/programming.rst:1873 msgid "" "2) Putting an object in a container that stores object references does not " "change object identity. After the list assignment ``s[0] = x``, it is " @@ -3715,7 +3731,7 @@ msgstr "" "2) 將物件放入存儲物件參照的容器中不會改變物件識別性。在 list 賦值 ``s[0] = " "x`` 之後,保證 ``s[0] 是 x``。" -#: ../../faq/programming.rst:1870 +#: ../../faq/programming.rst:1877 #, fuzzy msgid "" "3) If an object is a singleton, it means that only one instance of that " @@ -3725,7 +3741,7 @@ msgstr "" "3)如果一個物件是單例,則意味著該物件只能存在一個實例。在賦值 ``a = None`` " "和 ``b = None`` 之後,可以保證 ``a is b`` 因為 ``None`` 是單例。" -#: ../../faq/programming.rst:1874 +#: ../../faq/programming.rst:1881 msgid "" "In most other circumstances, identity tests are inadvisable and equality " "tests are preferred. In particular, identity tests should not be used to " @@ -3735,7 +3751,7 @@ msgstr "" "在大多數其他情況下,識別性測試是不可取的,相等性測試是首選。特別是,識別性測" "試不應用於檢查常數,例如不能保證是單例的 :class:`int` 和 :class:`str`: ::" -#: ../../faq/programming.rst:1879 +#: ../../faq/programming.rst:1886 msgid "" ">>> a = 1000\n" ">>> b = 500\n" @@ -3761,12 +3777,11 @@ msgstr "" ">>> a is c\n" "False" -#: ../../faq/programming.rst:1891 -#, fuzzy +#: ../../faq/programming.rst:1898 msgid "Likewise, new instances of mutable containers are never identical::" -msgstr "同樣,可變容器的新實例永遠不會相同: ::" +msgstr "同樣地,可變容器的新實例永遠不會相同: ::" -#: ../../faq/programming.rst:1893 +#: ../../faq/programming.rst:1900 msgid "" ">>> a = []\n" ">>> b = []\n" @@ -3778,13 +3793,13 @@ msgstr "" ">>> a is b\n" "False" -#: ../../faq/programming.rst:1898 +#: ../../faq/programming.rst:1905 msgid "" "In the standard library code, you will see several common patterns for " "correctly using identity tests:" msgstr "在標準函式庫程式碼中,你將看到幾種正確使用識別性測試的常見模式:" -#: ../../faq/programming.rst:1901 +#: ../../faq/programming.rst:1908 msgid "" "1) As recommended by :pep:`8`, an identity test is the preferred way to " "check for ``None``. This reads like plain English in code and avoids " @@ -3794,7 +3809,7 @@ msgstr "" "1) 正如 :pep:`8` 所推薦的,識別性測試是檢查 ``None`` 的首選方法。這在程式碼中" "讀起來像簡單的英語,並避免與其他可能具有評估為 false 的布林值的物件混淆。" -#: ../../faq/programming.rst:1905 +#: ../../faq/programming.rst:1912 #, fuzzy msgid "" "2) Detecting optional arguments can be tricky when ``None`` is a valid input " @@ -3806,7 +3821,7 @@ msgstr "" "建立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似" "於 :meth:`dict.pop` 的方法: ::" -#: ../../faq/programming.rst:1910 +#: ../../faq/programming.rst:1917 msgid "" "_sentinel = object()\n" "\n" @@ -3830,7 +3845,7 @@ msgstr "" " raise KeyError(key)\n" " return default" -#: ../../faq/programming.rst:1921 +#: ../../faq/programming.rst:1928 msgid "" "3) Container implementations sometimes need to augment equality tests with " "identity tests. This prevents the code from being confused by objects such " @@ -3839,14 +3854,14 @@ msgstr "" "3) 容器實作有時需要透過識別性測試來增強相等性測試。這可以防止程式碼被諸如 " "float('NaN') 之類的不等於自身的物件所混淆。" -#: ../../faq/programming.rst:1925 +#: ../../faq/programming.rst:1932 msgid "" "For example, here is the implementation of :meth:`!collections.abc.Sequence." "__contains__`::" msgstr "" "例如,以下是 :meth:`!collections.abc.Sequence.__contains__` 的實作: ::" -#: ../../faq/programming.rst:1928 +#: ../../faq/programming.rst:1935 msgid "" "def __contains__(self, value):\n" " for v in self:\n" @@ -3860,12 +3875,12 @@ msgstr "" " return True\n" " return False" -#: ../../faq/programming.rst:1936 +#: ../../faq/programming.rst:1943 msgid "" "How can a subclass control what data is stored in an immutable instance?" msgstr "子類別如何控制不可變實例中存儲的資料?" -#: ../../faq/programming.rst:1938 +#: ../../faq/programming.rst:1945 #, fuzzy msgid "" "When subclassing an immutable type, override the :meth:`~object.__new__` " @@ -3877,14 +3892,14 @@ msgstr "" "`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法更改不可變" "實例中的資料。" -#: ../../faq/programming.rst:1943 +#: ../../faq/programming.rst:1950 #, fuzzy msgid "" "All of these immutable classes have a different signature than their parent " "class:" msgstr "所有這些不可變類別都具有與其父類別不同的簽名:" -#: ../../faq/programming.rst:1946 +#: ../../faq/programming.rst:1953 msgid "" "from datetime import date\n" "\n" @@ -3908,11 +3923,11 @@ msgid "" " return super().__new__(cls, s)" msgstr "" -#: ../../faq/programming.rst:1969 +#: ../../faq/programming.rst:1976 msgid "The classes can be used like this:" msgstr "這些類別可以像這樣使用:" -#: ../../faq/programming.rst:1971 +#: ../../faq/programming.rst:1978 msgid "" ">>> FirstOfMonthDate(2012, 2, 14)\n" "FirstOfMonthDate(2012, 2, 1)\n" @@ -3932,11 +3947,11 @@ msgstr "" ">>> TitleStr('Blog: Why Python Rocks')\n" "'blog-why-python-rocks'" -#: ../../faq/programming.rst:1986 +#: ../../faq/programming.rst:1993 msgid "How do I cache method calls?" msgstr "如何快取方法呼叫?" -#: ../../faq/programming.rst:1988 +#: ../../faq/programming.rst:1995 #, fuzzy msgid "" "The two principal tools for caching methods are :func:`functools." @@ -3946,7 +3961,7 @@ msgstr "" "快取方法的兩個主要工具是 func:`functools.cached_property` 和 :func:" "`functools.lru_cache`。前者在實例級別存儲結果,後者在類別級別存儲結果。" -#: ../../faq/programming.rst:1993 +#: ../../faq/programming.rst:2000 #, fuzzy msgid "" "The *cached_property* approach only works with methods that do not take any " @@ -3956,7 +3971,7 @@ msgstr "" "*cached_property* 方法僅適用於不帶任何引數的方法。它不會建立對實例的參照。只" "要實例還活著,快取的方法結果就會被保留。" -#: ../../faq/programming.rst:1997 +#: ../../faq/programming.rst:2004 #, fuzzy msgid "" "The advantage is that when an instance is no longer used, the cached method " @@ -3967,7 +3982,7 @@ msgstr "" "好處是當一個實例不再使用時,快取的方法結果會立即釋放。缺點是如果實例累積,累" "積的方法結果也會累積。他們可以不受限制地成長。" -#: ../../faq/programming.rst:2002 +#: ../../faq/programming.rst:2009 msgid "" "The *lru_cache* approach works with methods that have :term:`hashable` " "arguments. It creates a reference to the instance unless special efforts " @@ -3976,7 +3991,7 @@ msgstr "" "*lru_cache* 方法適用於具有\\ :term:`可雜湊 `\\ 引數的方法。除非特別" "努力傳遞弱參照,否則它會建立對實例的參照。" -#: ../../faq/programming.rst:2006 +#: ../../faq/programming.rst:2013 #, fuzzy msgid "" "The advantage of the least recently used algorithm is that the cache is " @@ -3986,11 +4001,11 @@ msgstr "" "最近最少使用演算法的優點是快取受指定的 *maxsize* 限制。缺點是實例會一直保持活" "動狀態,直到它們從快取中老化或快取被清除。" -#: ../../faq/programming.rst:2011 +#: ../../faq/programming.rst:2018 msgid "This example shows the various techniques::" msgstr "這個例子展示了各種技術: ::" -#: ../../faq/programming.rst:2013 +#: ../../faq/programming.rst:2020 msgid "" "class Weather:\n" " \"Lookup weather information on a government website\"\n" @@ -4015,7 +4030,7 @@ msgid "" " # Depends on the station_id, date, and units." msgstr "" -#: ../../faq/programming.rst:2035 +#: ../../faq/programming.rst:2042 #, fuzzy msgid "" "The above example assumes that the *station_id* never changes. If the " @@ -4025,7 +4040,7 @@ msgstr "" "上面的例子假設 *station_id* 永遠不會改變。如果相關的實例屬性是可變的,則 " "*cached_property* 方法無法工作,因為它無法檢測到屬性的更改。" -#: ../../faq/programming.rst:2040 +#: ../../faq/programming.rst:2047 #, fuzzy msgid "" "To make the *lru_cache* approach work when the *station_id* is mutable, the " @@ -4036,7 +4051,7 @@ msgstr "" "`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測相關屬性更" "新: ::" -#: ../../faq/programming.rst:2044 +#: ../../faq/programming.rst:2051 msgid "" "class Weather:\n" " \"Example with a mutable station identifier\"\n" @@ -4059,15 +4074,15 @@ msgid "" " # Depends on the station_id, date, and units." msgstr "" -#: ../../faq/programming.rst:2066 +#: ../../faq/programming.rst:2073 msgid "Modules" msgstr "模組" -#: ../../faq/programming.rst:2069 +#: ../../faq/programming.rst:2076 msgid "How do I create a .pyc file?" msgstr "如何建立 .pyc 檔案?" -#: ../../faq/programming.rst:2071 +#: ../../faq/programming.rst:2078 #, fuzzy msgid "" "When a module is imported for the first time (or when the source file has " @@ -4084,7 +4099,7 @@ msgstr "" "間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參閱 :" "pep:`3147`。)" -#: ../../faq/programming.rst:2079 +#: ../../faq/programming.rst:2086 #, fuzzy msgid "" "One reason that a ``.pyc`` file may not be created is a permissions problem " @@ -4097,7 +4112,7 @@ msgstr "" "__pycache__ 子目錄。例如,如果你以一個使用者的身份開發但以另一個使用者的身份" "運行,例如你正在使用 Web 服務器進行測試,就會發生這種情況。" -#: ../../faq/programming.rst:2084 +#: ../../faq/programming.rst:2091 #, fuzzy msgid "" "Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set, " @@ -4106,11 +4121,11 @@ msgid "" "``__pycache__`` subdirectory and write the compiled module to that " "subdirectory." msgstr "" -"除非:envvar:`PYTHONDONTWRITEBYTECODE` 環境變數被設定,如果你正在引入一個模組" -"並且 Python 有能力(權限,空閒空間等)建立一個 .pyc 檔案是自動的建立一個" +"除非 :envvar:`PYTHONDONTWRITEBYTECODE` 環境變數有被設定,如果你正在引入一個模" +"組並且 Python 有能力(權限、空閒空間等)建立一個 .pyc 檔案是自動的建立一個" "``__pycache__ `` 子目錄並將編譯後的模組寫入該子目錄。" -#: ../../faq/programming.rst:2089 +#: ../../faq/programming.rst:2096 #, fuzzy msgid "" "Running Python on a top level script is not considered an import and no ``." @@ -4125,26 +4140,25 @@ msgstr "" "入 ``python foo.py`` 作為一個 shell 命令),將為 xyz 建立一個 .pyc 因為引入" "了 xyz,但是不會為 foo 建立 .pyc 檔案,因為 ` `foo.py`` 沒有被引入。" -#: ../../faq/programming.rst:2096 -#, fuzzy +#: ../../faq/programming.rst:2103 msgid "" "If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." "pyc`` file for a module that is not imported -- you can, using the :mod:" "`py_compile` and :mod:`compileall` modules." msgstr "" -"如果你需要為 ``foo`` 建立一個 ``.pyc`` 檔案——也就是說,為一個未引入的模組建立" -"一個 ``.pyc`` 檔案——你可以使用 :mod :`py_compile` 和 :mod:`compileall` 模組。" +"如果你需要為 ``foo`` 建立一個 ``.pyc`` 檔案 —— 也就是說,要為一個未引入的模組" +"建立一個 ``.pyc`` 檔案 —— 你可以使用 :mod:`py_compile` 和 :mod:`compileall` " +"模組。" -#: ../../faq/programming.rst:2100 -#, fuzzy +#: ../../faq/programming.rst:2107 msgid "" "The :mod:`py_compile` module can manually compile any module. One way is to " "use the ``compile()`` function in that module interactively::" msgstr "" -":mod:`py_compile` 模組可以手動編譯任何模組。一種方法是在該模組中以交互方式使" -"用 ``compile()`` 函式: ::" +":mod:`py_compile` 模組允許手動編譯任何模組。其中一種方法是在該模組中以交互方" +"式使用 ``compile()`` 函式: ::" -#: ../../faq/programming.rst:2103 +#: ../../faq/programming.rst:2110 msgid "" ">>> import py_compile\n" ">>> py_compile.compile('foo.py') " @@ -4152,17 +4166,16 @@ msgstr "" ">>> import py_compile\n" ">>> py_compile.compile('foo.py') " -#: ../../faq/programming.rst:2106 -#, fuzzy +#: ../../faq/programming.rst:2113 msgid "" "This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same " "location as ``foo.py`` (or you can override that with the optional parameter " "``cfile``)." msgstr "" -"這會將 .pyc 寫入與 foo.py 相同位置的 __pycache__ 子目錄(或者你可以使用可選參" -"數 cfile 覆蓋它)。" +"這會將 ``.pyc`` 寫入與 ``foo.py`` 相同位置的 ``__pycache__`` 子目錄(或者你可" +"以使用可選參數 ``cfile`` 覆蓋它)。" -#: ../../faq/programming.rst:2110 +#: ../../faq/programming.rst:2117 #, fuzzy msgid "" "You can also automatically compile all files in a directory or directories " @@ -4173,15 +4186,15 @@ msgstr "" "你還可以使用 :mod:`compileall` 模組自動編譯目錄中的所有檔案。你可以在 shell " "提示符下運行 ``compileall.py`` 並提供包含要編譯的 Python 檔案的目錄路徑: ::" -#: ../../faq/programming.rst:2115 +#: ../../faq/programming.rst:2122 msgid "python -m compileall ." msgstr "python -m compileall ." -#: ../../faq/programming.rst:2119 +#: ../../faq/programming.rst:2126 msgid "How do I find the current module name?" msgstr "如何找到當前模組名稱?" -#: ../../faq/programming.rst:2121 +#: ../../faq/programming.rst:2128 #, fuzzy msgid "" "A module can find out its own module name by looking at the predefined " @@ -4194,7 +4207,7 @@ msgstr "" "值為``'__main__'``,則該程式作為腳本運行。許多通常透過引入使用的模組還提供命" "令行界面或自檢,只有在檢查 ``__name__`` 後才執行此程式碼: ::" -#: ../../faq/programming.rst:2127 +#: ../../faq/programming.rst:2134 msgid "" "def main():\n" " print('Running test...')\n" @@ -4204,20 +4217,20 @@ msgid "" " main()" msgstr "" -#: ../../faq/programming.rst:2136 +#: ../../faq/programming.rst:2143 #, fuzzy msgid "How can I have modules that mutually import each other?" msgstr "我怎樣才能擁有相互引入的模組?" -#: ../../faq/programming.rst:2138 +#: ../../faq/programming.rst:2145 msgid "Suppose you have the following modules:" msgstr "假設你有以下模組:" -#: ../../faq/programming.rst:2140 +#: ../../faq/programming.rst:2147 msgid ":file:`foo.py`::" msgstr ":file:`foo.py`: ::" -#: ../../faq/programming.rst:2142 +#: ../../faq/programming.rst:2149 msgid "" "from bar import bar_var\n" "foo_var = 1" @@ -4225,11 +4238,11 @@ msgstr "" "from bar import bar_var\n" "foo_var = 1" -#: ../../faq/programming.rst:2145 +#: ../../faq/programming.rst:2152 msgid ":file:`bar.py`::" msgstr ":file:`bar.py`: ::" -#: ../../faq/programming.rst:2147 +#: ../../faq/programming.rst:2154 msgid "" "from foo import foo_var\n" "bar_var = 2" @@ -4237,56 +4250,50 @@ msgstr "" "from foo import foo_var\n" "bar_var = 2" -#: ../../faq/programming.rst:2150 -#, fuzzy +#: ../../faq/programming.rst:2157 msgid "The problem is that the interpreter will perform the following steps:" msgstr "問題是直譯器將執行以下步驟:" -#: ../../faq/programming.rst:2152 -#, fuzzy +#: ../../faq/programming.rst:2159 msgid "main imports ``foo``" msgstr "主要引入 ``foo``" -#: ../../faq/programming.rst:2153 -#, fuzzy +#: ../../faq/programming.rst:2160 msgid "Empty globals for ``foo`` are created" msgstr "建立了 ``foo`` 的空全域變數" -#: ../../faq/programming.rst:2154 +#: ../../faq/programming.rst:2161 msgid "``foo`` is compiled and starts executing" msgstr "``foo`` 被編譯並開始執行" -#: ../../faq/programming.rst:2155 +#: ../../faq/programming.rst:2162 msgid "``foo`` imports ``bar``" msgstr "``foo`` 引入 ``bar``" -#: ../../faq/programming.rst:2156 -#, fuzzy +#: ../../faq/programming.rst:2163 msgid "Empty globals for ``bar`` are created" msgstr "建立了 ``bar`` 的空全域變數" -#: ../../faq/programming.rst:2157 +#: ../../faq/programming.rst:2164 msgid "``bar`` is compiled and starts executing" msgstr "``bar`` 已被編譯並開始執行" -#: ../../faq/programming.rst:2158 -#, fuzzy +#: ../../faq/programming.rst:2165 msgid "" "``bar`` imports ``foo`` (which is a no-op since there already is a module " "named ``foo``)" msgstr "" -"``bar`` 引入 ``foo``(這是一個空操作,因為已經有一個名為 ``foo`` 的模組)" +"``bar`` 引入 ``foo``\\ (這是一個空操作,因為已經有一個名為 ``foo`` 的模組)" -#: ../../faq/programming.rst:2159 -#, fuzzy +#: ../../faq/programming.rst:2166 msgid "" "The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set " "``bar.foo_var = foo.foo_var``" msgstr "" -"引入機制嘗試從 ``foo`` 全域變數中讀取 ``foo_var`` ,以設定 ``bar.foo_var = " -"foo.foo_var`` " +"引入機制嘗試從 ``foo`` 全域變數中讀取 ``foo_var``,以設定 ``bar.foo_var = " +"foo.foo_var``" -#: ../../faq/programming.rst:2161 +#: ../../faq/programming.rst:2168 #, fuzzy msgid "" "The last step fails, because Python isn't done with interpreting ``foo`` yet " @@ -4295,7 +4302,7 @@ msgstr "" "最後一步失敗了,因為 Python 還沒有完成對 ``foo`` 的直譯,而 ``foo`` 的全域符" "號字典仍然是空的。" -#: ../../faq/programming.rst:2164 +#: ../../faq/programming.rst:2171 #, fuzzy msgid "" "The same thing happens when you use ``import foo``, and then try to access " @@ -4304,11 +4311,11 @@ msgstr "" "當你使用 ``import foo``,然後嘗試在全域程式碼中存取 ``foo.foo_var`` 時,也會" "發生同樣的事情。" -#: ../../faq/programming.rst:2167 +#: ../../faq/programming.rst:2174 msgid "There are (at least) three possible workarounds for this problem." msgstr "此問題有(至少)三種可能的解決方法。" -#: ../../faq/programming.rst:2169 +#: ../../faq/programming.rst:2176 #, fuzzy msgid "" "Guido van Rossum recommends avoiding all uses of ``from import ..." @@ -4321,50 +4328,51 @@ msgstr "" "函式中。全域變數和類別變數的初始化應該只使用常數或內建函式。這意味著來自引入" "模組的所有內容都被參照為 ``.``。" -#: ../../faq/programming.rst:2174 +#: ../../faq/programming.rst:2181 msgid "" "Jim Roskind suggests performing steps in the following order in each module:" msgstr "Jim Roskind 建議在每個模組中按以下順序執行各個步驟:" -#: ../../faq/programming.rst:2176 +#: ../../faq/programming.rst:2183 #, fuzzy msgid "" "exports (globals, functions, and classes that don't need imported base " "classes)" -msgstr "導出(不需要引入基底類別的全域變數、函式和類別)" +msgstr "匯出(不需要引入基底類別的全域變數、函式和類別)" -#: ../../faq/programming.rst:2178 +#: ../../faq/programming.rst:2185 msgid "``import`` statements" msgstr "``import`` 陳述式" -#: ../../faq/programming.rst:2179 +#: ../../faq/programming.rst:2186 msgid "" "active code (including globals that are initialized from imported values)." msgstr "活躍程式碼(包括從引入值初始化的全域變數)。" -#: ../../faq/programming.rst:2181 -#, fuzzy +#: ../../faq/programming.rst:2188 msgid "" "Van Rossum doesn't like this approach much because the imports appear in a " "strange place, but it does work." msgstr "" "Van Rossum 不太喜歡這種方法,因為引入出現在一個奇怪的地方,但它確實有效。" -#: ../../faq/programming.rst:2184 +#: ../../faq/programming.rst:2191 msgid "" "Matthias Urlichs recommends restructuring your code so that the recursive " "import is not necessary in the first place." -msgstr "Matthias Urlichs 建議重構你的程式碼,以便打從一開始就不需要遞迴引入。" +msgstr "" +"Matthias Urlichs 建議重組 (restructuring) 你的程式碼,以便打從一開始就不需要" +"遞迴引入。" -#: ../../faq/programming.rst:2187 +#: ../../faq/programming.rst:2194 msgid "These solutions are not mutually exclusive." msgstr "這些方案並不衝突。" -#: ../../faq/programming.rst:2191 +#: ../../faq/programming.rst:2198 msgid "__import__('x.y.z') returns ; how do I get z?" msgstr "__import__('x.y.z') 回傳 ,那我怎麼得到 z?" -#: ../../faq/programming.rst:2193 +#: ../../faq/programming.rst:2200 #, fuzzy msgid "" "Consider using the convenience function :func:`~importlib.import_module` " @@ -4373,17 +4381,17 @@ msgstr "" "考慮使用來自 :mod:`importlib` 的便利函式 :func:`~importlib.import_module` 代" "替: ::" -#: ../../faq/programming.rst:2196 +#: ../../faq/programming.rst:2203 msgid "z = importlib.import_module('x.y.z')" msgstr "z = importlib.import_module('x.y.z')" -#: ../../faq/programming.rst:2200 +#: ../../faq/programming.rst:2207 msgid "" "When I edit an imported module and reimport it, the changes don't show up. " "Why does this happen?" msgstr "當我編輯需要引入的模組並重新引入它時,更動沒有反應出來。為什麼會這樣?" -#: ../../faq/programming.rst:2202 +#: ../../faq/programming.rst:2209 #, fuzzy msgid "" "For reasons of efficiency as well as consistency, Python only reads the " @@ -4396,7 +4404,7 @@ msgstr "" "一個由許多模組組成的程式中,每個模組都引入相同的基本模組,基本模組將被解析和" "重新解析很多次。要強制重新讀取已更改的模組,請執行以下操作: ::" -#: ../../faq/programming.rst:2208 +#: ../../faq/programming.rst:2215 msgid "" "import importlib\n" "import modname\n" @@ -4406,18 +4414,17 @@ msgstr "" "import modname\n" "importlib.reload(modname)" -#: ../../faq/programming.rst:2212 -#, fuzzy +#: ../../faq/programming.rst:2219 msgid "" "Warning: this technique is not 100% fool-proof. In particular, modules " "containing statements like ::" -msgstr "警告:此技術並非 100% 萬無一失。尤其是,包含像這樣的陳述式的模組: ::" +msgstr "警告:此技術並非 100% 萬無一失。尤其是包含像這樣陳述式的模組: ::" -#: ../../faq/programming.rst:2215 +#: ../../faq/programming.rst:2222 msgid "from modname import some_objects" msgstr "from modname import some_objects" -#: ../../faq/programming.rst:2217 +#: ../../faq/programming.rst:2224 #, fuzzy msgid "" "will continue to work with the old version of the imported objects. If the " @@ -4428,7 +4435,7 @@ msgstr "" "將繼續使用舊版本的引入物件。如果模組包含類別定義,現有的類別實例將*不會*更新" "為使用新的類別定義。這可能會導致以下自相矛盾的行為: ::" -#: ../../faq/programming.rst:2222 +#: ../../faq/programming.rst:2229 msgid "" ">>> import importlib\n" ">>> import cls\n" @@ -4439,13 +4446,13 @@ msgid "" "False" msgstr "" -#: ../../faq/programming.rst:2230 +#: ../../faq/programming.rst:2237 msgid "" "The nature of the problem is made clear if you print out the \"identity\" of " "the class objects::" msgstr "如果印出類別物件的「識別性」,問題的本質就很清楚了: ::" -#: ../../faq/programming.rst:2233 +#: ../../faq/programming.rst:2240 msgid "" ">>> hex(id(c.__class__))\n" "'0x7352a0'\n" diff --git a/glossary.po b/glossary.po index 0f5ee13d86..a882706b5e 100644 --- a/glossary.po +++ b/glossary.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -148,6 +148,8 @@ msgid "" "complex(real=3, imag=5)\n" "complex(**{'real': 3, 'imag': 5})" msgstr "" +"complex(real=3, imag=5)\n" +"complex(**{'real': 3, 'imag': 5})" #: ../../glossary.rst:67 msgid "" @@ -165,6 +167,8 @@ msgid "" "complex(3, 5)\n" "complex(*(3, 5))" msgstr "" +"complex(3, 5)\n" +"complex(*(3, 5))" #: ../../glossary.rst:76 msgid "" @@ -483,7 +487,7 @@ msgstr "" #: ../../glossary.rst:210 msgid "callable(argument1, argument2, argumentN)" -msgstr "" +msgstr "callable(argument1, argument2, argumentN)" #: ../../glossary.rst:212 msgid "" @@ -741,7 +745,7 @@ msgid "" "can be any object with :meth:`~object.__hash__` and :meth:`~object.__eq__` " "methods. Called a hash in Perl." msgstr "" -"一個關聯陣列 (associative array),其中任意的鍵會被映射到值。鍵可以是任何帶" +"一個關聯陣列 (associative array),其中任意的鍵會被對映到值。鍵可以是任何帶" "有 :meth:`~object.__hash__` 和 :meth:`~object.__eq__` method 的物件。在 Perl " "中被稱為雜湊 (hash)。" @@ -758,7 +762,7 @@ msgid "" msgstr "" "一種緊密的方法,用來處理一個可疊代物件中的全部或部分元素,並將處理結果以一個" "字典回傳。``results = {n: n ** 2 for n in range(10)}`` 會產生一個字典,它包含" -"了鍵 ``n`` 映射到值 ``n ** 2``。請參閱\\ :ref:`comprehensions`。" +"了鍵 ``n`` 對映到值 ``n ** 2``。請參閱\\ :ref:`comprehensions`。" #: ../../glossary.rst:333 msgid "dictionary view" @@ -785,14 +789,14 @@ msgstr "docstring(說明字串)" msgid "" "A string literal which appears as the first expression in a class, function " "or module. While ignored when the suite is executed, it is recognized by " -"the compiler and put into the :attr:`!__doc__` attribute of the enclosing " -"class, function or module. Since it is available via introspection, it is " -"the canonical place for documentation of the object." +"the compiler and put into the :attr:`~definition.__doc__` attribute of the " +"enclosing class, function or module. Since it is available via " +"introspection, it is the canonical place for documentation of the object." msgstr "" "一個在 class、函式或模組中,作為第一個運算式出現的字串文本。雖然它在套件執行" -"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組的 :attr:`!" -"__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏覽,因此它是物" -"件的說明文件存放的標準位置。" +"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組的 :attr:" +"`~definition.__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏" +"覽,因此它是物件的說明文件存放的標準位置。" #: ../../glossary.rst:349 msgid "duck-typing" @@ -1012,7 +1016,7 @@ msgstr "" #: ../../glossary.rst:440 msgid "free threading" -msgstr "" +msgstr "free threading(自由執行緒)" #: ../../glossary.rst:442 msgid "" @@ -1021,6 +1025,9 @@ msgid "" "term:`global interpreter lock` which allows only one thread to execute " "Python bytecode at a time. See :pep:`703`." msgstr "" +"為一種執行緒模型,多個執行緒可以在同一直譯器中同時運行 Python 位元組碼。這與" +"\\ :term:`全域直譯器鎖 `\\ 形成對比,後者一次只允許" +"一個執行緒執行 Python 位元組碼。請參閱 :pep:`703`。" #: ../../glossary.rst:446 msgid "function" @@ -1186,6 +1193,8 @@ msgid "" ">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" "285" msgstr "" +">>> sum(i*i for i in range(10)) # 平方之和 0, 1, 4, ... 81\n" +"285" #: ../../glossary.rst:521 msgid "generic function" @@ -1279,6 +1288,11 @@ msgid "" "performance for multi-threaded applications and makes it easier to use multi-" "core CPUs efficiently. For more details, see :pep:`703`." msgstr "" +"從 Python 3.13 開始可以使用 :option:`--disable-gil` 建置設定來停用 GIL。使用" +"此選項建立 Python 後,必須使用 :option:`-X gil 0 <-X>` 來執行程式碼,或者設" +"定 :envvar:`PYTHON_GIL=0 ` 環境變數後再執行程式碼。此功能可以提高" +"多執行緒應用程式的效能,並使多核心 CPU 的高效使用變得更加容易。有關更多詳細資" +"訊,請參閱 :pep:`703`。" #: ../../glossary.rst:563 msgid "hash-based pyc" @@ -1348,13 +1362,13 @@ msgstr "" #: ../../glossary.rst:591 msgid "immortal" -msgstr "" +msgstr "immportal(不滅)" #: ../../glossary.rst:593 msgid "" "*Immortal objects* are a CPython implementation detail introduced in :pep:" "`683`." -msgstr "" +msgstr "*不滅物件 (Immortal objects)* 是 :pep:`683` 引入的 CPython 實作細節。" #: ../../glossary.rst:596 msgid "" @@ -1362,6 +1376,9 @@ msgid "" "therefore it is never deallocated while the interpreter is running. For " "example, :const:`True` and :const:`None` are immortal in CPython." msgstr "" +"如果一個物件是不滅的,它的\\ :term:`參照計數 `\\ 永遠不會被" +"修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` 和 :const:" +"`None` 在 CPython 中是不滅的。" #: ../../glossary.rst:599 msgid "immutable" @@ -1562,14 +1579,14 @@ msgid "More information can be found in :ref:`typeiter`." msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" #: ../../glossary.rst:693 -#, fuzzy msgid "" "CPython does not consistently apply the requirement that an iterator define :" "meth:`~iterator.__iter__`. And also please note that the free-threading " "CPython does not guarantee the thread-safety of iterator operations." msgstr "" "CPython 並不是始終如一地都會檢查「疊代器有定義 :meth:`~iterator." -"__iter__`\\ 」這個規定。" +"__iter__`\\ 」這個規定。另請注意,free-threading(自由執行緒)CPython 不保證" +"疊代器操作的執行緒安全。" #: ../../glossary.rst:698 msgid "key function" @@ -2469,7 +2486,6 @@ msgid "reference count" msgstr "reference count(參照計數)" #: ../../glossary.rst:1090 -#, fuzzy msgid "" "The number of references to an object. When the reference count of an " "object drops to zero, it is deallocated. Some objects are :term:`immortal` " @@ -2480,10 +2496,10 @@ msgid "" "reference count for a particular object." msgstr "" "對於一個物件的參照次數。當一個物件的參照計數下降到零時,它會被解除配置 " -"(deallocated)。有些物件是「不滅的 (immortal)」並擁有不會被改變的參照計數,也" -"因此永遠不會被解除配置。參照計數通常在 Python 程式碼中看不到,但它卻是 :term:" -"`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :func:`~sys.getrefcount` 函" -"式來回傳一個特定物件的參照計數。" +"(deallocated)。有些物件是「\\ :term:`不滅的 ` (immortal)」並擁有不" +"會被改變的參照計數,也因此永遠不會被解除配置。參照計數通常在 Python 程式碼中" +"看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :" +"func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" #: ../../glossary.rst:1098 msgid "regular package" @@ -2503,13 +2519,15 @@ msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" #: ../../glossary.rst:1104 msgid "REPL" -msgstr "" +msgstr "REPL" #: ../../glossary.rst:1106 msgid "" "An acronym for the \"read–eval–print loop\", another name for the :term:" "`interactive` interpreter shell." msgstr "" +"「read-eval-print 迴圈 (read–eval–print loop)」的縮寫,是\\ :term:`互動式 " +"`\\ 直譯器 shell 的另一個名稱。" #: ../../glossary.rst:1108 msgid "__slots__" @@ -2613,7 +2631,7 @@ msgstr "" #: ../../glossary.rst:1151 msgid "soft deprecated" -msgstr "" +msgstr "soft deprecated(軟性棄用)" #: ../../glossary.rst:1153 msgid "" @@ -2622,6 +2640,8 @@ msgid "" "code. The API remains documented and tested, but will not be developed " "further (no enhancement)." msgstr "" +"軟性棄用代表 API 不應再用來編寫新程式碼,但在現有程式碼中繼續使用它仍然是安全" +"的。API 仍會以文件記錄並會被測試,但不會進一步開發(不會繼續改進)。" #: ../../glossary.rst:1158 msgid "" @@ -2629,16 +2649,20 @@ msgid "" "is that the soft deprecation does not imply scheduling the removal of the " "deprecated API." msgstr "" +"「軟性」棄用和(常規的)「硬性」棄用之間的主要區別在於,軟性棄用並不代表已經" +"確定要什麼時候刪除已棄用的 API。" #: ../../glossary.rst:1162 msgid "Another difference is that a soft deprecation does not issue a warning." -msgstr "" +msgstr "另一個區別是軟性棄用不會發出警告。" #: ../../glossary.rst:1164 msgid "" "See `PEP 387: Soft Deprecation `_." msgstr "" +"請參閱 `PEP 387:軟性棄用 `_。" #: ../../glossary.rst:1166 msgid "special method" @@ -2793,12 +2817,12 @@ msgstr "type(型別)" #: ../../glossary.rst:1232 msgid "" "The type of a Python object determines what kind of object it is; every " -"object has a type. An object's type is accessible as its :attr:`~instance." +"object has a type. An object's type is accessible as its :attr:`~object." "__class__` attribute or can be retrieved with ``type(obj)``." msgstr "" "一個 Python 物件的型別決定了它是什麼類型的物件;每個物件都有一個型別。一個物" -"件的型別可以用它的 :attr:`~instance.__class__` 屬性來存取,或以 " -"``type(obj)`` 來檢索。" +"件的型別可以用它的 :attr:`~object.__class__` 屬性來存取,或以 ``type(obj)`` " +"來檢索。" #: ../../glossary.rst:1236 msgid "type alias" diff --git a/howto/annotations.po b/howto/annotations.po index c4450542af..67acc522c3 100644 --- a/howto/annotations.po +++ b/howto/annotations.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2023-11-08 23:11+0800\n" "Last-Translator: rockleon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -192,15 +192,15 @@ 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 " "relies on an implementation detail of Python 3.9 and before: if a class has " -"annotations defined, they are stored in the class's ``__dict__`` " +"annotations defined, they are stored in the class's :attr:`~type.__dict__` " "dictionary. Since the class may or may not have annotations defined, best " -"practice is to call the ``get`` method on the class dict." +"practice is to call the :meth:`~dict.get` method on the class dict." msgstr "" "如果你正在檢查的物件是一個類別 (``isinstance(o, type)``),你的程式碼將必須有" "一個單獨的程式碼路徑。在這種情況下,最佳實踐依賴 Python 3.9 及之前版本的實作" -"細節 (implementation detail):如果一個類別定義了註釋,它們將儲存在該類別的 " -"``__dict__`` 字典中。由於類別可能定義了註釋,也可能沒有定義,因此最佳實踐是在" -"類別字典上呼叫 ``get`` 方法。" +"細節 (implementation detail):如果一個類別定義了註釋,它們將儲存在該類別的 :" +"attr:`~type.__dict__` 字典中。由於類別可能定義了註釋,也可能沒有定義,因此最" +"佳實踐是在類別字典上呼叫 :meth:`~dict.get` 方法。" #: ../../howto/annotations.rst:109 msgid "" @@ -234,13 +234,13 @@ msgstr "" #: ../../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__``." +"Note that some exotic or malformed type objects may not have a :attr:`~type." +"__dict__` attribute, so for extra safety you may also wish to use :func:" +"`getattr` to access :attr:`!__dict__`." msgstr "" -"請注意,某些外來 (exotic) 或格式錯誤 (malform) 的型別物件可能沒有 " -"``__dict__`` 屬性,因此為了額外的安全,你可能還希望使用 :func:`getattr` 來存" -"取 ``__dict__`` 。" +"請注意,某些外來 (exotic) 或格式錯誤 (malform) 的型別物件可能沒有 :attr:" +"`~type.__dict__` 屬性,因此為了額外的安全,你可能還希望使用 :func:`getattr` " +"來存取 :attr:`!__dict__`。" #: ../../howto/annotations.rst:129 msgid "Manually Un-Stringizing Stringized Annotations" diff --git a/howto/descriptor.po b/howto/descriptor.po index 80a905a7cd..876ca82e89 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -810,8 +810,8 @@ msgstr "" msgid "" "The expression ``obj.x`` looks up the attribute ``x`` in the chain of " "namespaces for ``obj``. If the search finds a descriptor outside of the " -"instance ``__dict__``, its :meth:`__get__` method is invoked according to " -"the precedence rules listed below." +"instance :attr:`~object.__dict__`, its :meth:`~object.__get__` method is " +"invoked according to the precedence rules listed below." msgstr "" #: ../../howto/descriptor.rst:568 diff --git a/howto/enum.po b/howto/enum.po index 8e243e281d..668b2723f2 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1137,9 +1137,9 @@ msgstr "" #: ../../howto/enum.rst:610 msgid "" "The new pickle protocol 4 also, in some circumstances, relies on :attr:" -"`~definition.__qualname__` being set to the location where pickle will be " -"able to find the class. For example, if the class was made available in " -"class SomeData in the global scope::" +"`~type.__qualname__` being set to the location where pickle will be able to " +"find the class. For example, if the class was made available in class " +"SomeData in the global scope::" msgstr "" #: ../../howto/enum.rst:615 @@ -1644,12 +1644,11 @@ msgid "" msgstr "" #: ../../howto/enum.rst:890 -#, fuzzy msgid "" "class IntEnum(int, ReprEnum): # or Enum instead of ReprEnum\n" " pass" msgstr "" -"class IntEnum(int, Enum):\n" +"class IntEnum(int, ReprEnum): # 或用 Enum 取代 ReprEnum\n" " pass" #: ../../howto/enum.rst:893 @@ -1792,9 +1791,8 @@ msgid "Supported ``_sunder_`` names" msgstr "" #: ../../howto/enum.rst:983 -#, fuzzy msgid ":attr:`~Enum._name_` -- name of the member" -msgstr "``_name_`` -- 成員的名稱" +msgstr ":attr:`~Enum._name_` -- 成員的名稱" #: ../../howto/enum.rst:984 msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" @@ -1942,6 +1940,11 @@ msgid "" ">>> MyEnum.example.value # and hex(11) is...\n" "17" msgstr "" +">>> class MyEnum(IntEnum): # help(int) -> int(x, base=10) -> integer\n" +"... example = '11', 16 # 所以 x='11' 且 base=16\n" +"...\n" +">>> MyEnum.example.value # 且 hex(11) 為...\n" +"17" #: ../../howto/enum.rst:1071 msgid "Boolean value of ``Enum`` classes and members" @@ -2222,7 +2225,7 @@ msgstr "" #: ../../howto/enum.rst:1216 msgid "Enum Classes" -msgstr "" +msgstr "Enum 類別" #: ../../howto/enum.rst:1218 msgid "" @@ -2237,7 +2240,7 @@ msgstr "" #: ../../howto/enum.rst:1227 msgid "Flag Classes" -msgstr "" +msgstr "Flag 類別" #: ../../howto/enum.rst:1229 msgid "" @@ -2263,7 +2266,7 @@ msgstr "" #: ../../howto/enum.rst:1243 msgid "Flag Members" -msgstr "" +msgstr "Flag 成員" #: ../../howto/enum.rst:1245 msgid "" @@ -2673,7 +2676,7 @@ msgstr "" #: ../../howto/enum.rst:1482 msgid "MultiValueEnum" -msgstr "" +msgstr "MultiValueEnum" #: ../../howto/enum.rst:1484 msgid "Supports having more than one value per member::" @@ -2763,7 +2766,7 @@ msgstr "" #: ../../howto/enum.rst:1557 msgid "Subclassing EnumType" -msgstr "" +msgstr "子類別化 EnumType" #: ../../howto/enum.rst:1559 msgid "" diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po new file mode 100644 index 0000000000..5578166a5d --- /dev/null +++ b/howto/free-threading-python.po @@ -0,0 +1,257 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../howto/free-threading-python.rst:5 +msgid "Python experimental support for free threading" +msgstr "" + +#: ../../howto/free-threading-python.rst:7 +msgid "" +"Starting with the 3.13 release, CPython has experimental support for a build " +"of Python called :term:`free threading` where the :term:`global interpreter " +"lock` (GIL) is disabled. Free-threaded execution allows for full " +"utilization of the available processing power by running threads in parallel " +"on available CPU cores. While not all software will benefit from this " +"automatically, programs designed with threading in mind will run faster on " +"multi-core hardware." +msgstr "" + +#: ../../howto/free-threading-python.rst:14 +msgid "" +"**The free-threaded mode is experimental** and work is ongoing to improve " +"it: expect some bugs and a substantial single-threaded performance hit." +msgstr "" + +#: ../../howto/free-threading-python.rst:17 +msgid "" +"This document describes the implications of free threading for Python code. " +"See :ref:`freethreading-extensions-howto` for information on how to write C " +"extensions that support the free-threaded build." +msgstr "" + +#: ../../howto/free-threading-python.rst:23 +msgid "" +":pep:`703` – Making the Global Interpreter Lock Optional in CPython for an " +"overall description of free-threaded Python." +msgstr "" + +#: ../../howto/free-threading-python.rst:28 +msgid "Installation" +msgstr "" + +#: ../../howto/free-threading-python.rst:30 +msgid "" +"Starting with Python 3.13, the official macOS and Windows installers " +"optionally support installing free-threaded Python binaries. The installers " +"are available at https://www.python.org/downloads/." +msgstr "" + +#: ../../howto/free-threading-python.rst:34 +msgid "" +"For information on other platforms, see the `Installing a Free-Threaded " +"Python `_, a " +"community-maintained installation guide for installing free-threaded Python." +msgstr "" + +#: ../../howto/free-threading-python.rst:38 +msgid "" +"When building CPython from source, the :option:`--disable-gil` configure " +"option should be used to build a free-threaded Python interpreter." +msgstr "" + +#: ../../howto/free-threading-python.rst:43 +msgid "Identifying free-threaded Python" +msgstr "" + +#: ../../howto/free-threading-python.rst:45 +msgid "" +"To check if the current interpreter supports free-threading, :option:`python " +"-VV <-V>` and :attr:`sys.version` contain \"experimental free-threading " +"build\". The new :func:`sys._is_gil_enabled` function can be used to check " +"whether the GIL is actually disabled in the running process." +msgstr "" + +#: ../../howto/free-threading-python.rst:50 +msgid "" +"The ``sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` configuration variable " +"can be used to determine whether the build supports free threading. If the " +"variable is set to ``1``, then the build supports free threading. This is " +"the recommended mechanism for decisions related to the build configuration." +msgstr "" + +#: ../../howto/free-threading-python.rst:57 +msgid "The global interpreter lock in free-threaded Python" +msgstr "" + +#: ../../howto/free-threading-python.rst:59 +msgid "" +"Free-threaded builds of CPython support optionally running with the GIL " +"enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or " +"the command-line option :option:`-X gil`." +msgstr "" + +#: ../../howto/free-threading-python.rst:63 +msgid "" +"The GIL may also automatically be enabled when importing a C-API extension " +"module that is not explicitly marked as supporting free threading. A " +"warning will be printed in this case." +msgstr "" + +#: ../../howto/free-threading-python.rst:67 +msgid "" +"In addition to individual package documentation, the following websites " +"track the status of popular packages support for free threading:" +msgstr "" + +#: ../../howto/free-threading-python.rst:70 +msgid "https://py-free-threading.github.io/tracking/" +msgstr "" + +#: ../../howto/free-threading-python.rst:71 +msgid "https://hugovk.github.io/free-threaded-wheels/" +msgstr "" + +#: ../../howto/free-threading-python.rst:75 +msgid "Thread safety" +msgstr "" + +#: ../../howto/free-threading-python.rst:77 +msgid "" +"The free-threaded build of CPython aims to provide similar thread-safety " +"behavior at the Python level to the default GIL-enabled build. Built-in " +"types like :class:`dict`, :class:`list`, and :class:`set` use internal locks " +"to protect against concurrent modifications in ways that behave similarly to " +"the GIL. However, Python has not historically guaranteed specific behavior " +"for concurrent modifications to these built-in types, so this should be " +"treated as a description of the current implementation, not a guarantee of " +"current or future behavior." +msgstr "" + +#: ../../howto/free-threading-python.rst:88 +msgid "" +"It's recommended to use the :class:`threading.Lock` or other synchronization " +"primitives instead of relying on the internal locks of built-in types, when " +"possible." +msgstr "" + +#: ../../howto/free-threading-python.rst:94 +msgid "Known limitations" +msgstr "" + +#: ../../howto/free-threading-python.rst:96 +msgid "" +"This section describes known limitations of the free-threaded CPython build." +msgstr "" + +#: ../../howto/free-threading-python.rst:99 +msgid "Immortalization" +msgstr "" + +#: ../../howto/free-threading-python.rst:101 +msgid "" +"The free-threaded build of the 3.13 release makes some objects :term:" +"`immortal`. Immortal objects are not deallocated and have reference counts " +"that are never modified. This is done to avoid reference count contention " +"that would prevent efficient multi-threaded scaling." +msgstr "" + +#: ../../howto/free-threading-python.rst:106 +msgid "" +"An object will be made immortal when a new thread is started for the first " +"time after the main thread is running. The following objects are " +"immortalized:" +msgstr "" + +#: ../../howto/free-threading-python.rst:109 +msgid "" +":ref:`function ` objects declared at the module level" +msgstr "" + +#: ../../howto/free-threading-python.rst:110 +msgid ":ref:`method ` descriptors" +msgstr "" + +#: ../../howto/free-threading-python.rst:111 +msgid ":ref:`code ` objects" +msgstr "" + +#: ../../howto/free-threading-python.rst:112 +msgid ":term:`module` objects and their dictionaries" +msgstr "" + +#: ../../howto/free-threading-python.rst:113 +msgid ":ref:`classes ` (type objects)" +msgstr "" + +#: ../../howto/free-threading-python.rst:115 +msgid "" +"Because immortal objects are never deallocated, applications that create " +"many objects of these types may see increased memory usage. This is " +"expected to be addressed in the 3.14 release." +msgstr "" + +#: ../../howto/free-threading-python.rst:119 +msgid "" +"Additionally, numeric and string literals in the code as well as strings " +"returned by :func:`sys.intern` are also immortalized. This behavior is " +"expected to remain in the 3.14 free-threaded build." +msgstr "" + +#: ../../howto/free-threading-python.rst:125 +msgid "Frame objects" +msgstr "" + +#: ../../howto/free-threading-python.rst:127 +msgid "" +"It is not safe to access :ref:`frame ` objects from other " +"threads and doing so may cause your program to crash . This means that :" +"func:`sys._current_frames` is generally not safe to use in a free-threaded " +"build. Functions like :func:`inspect.currentframe` and :func:`sys." +"_getframe` are generally safe as long as the resulting frame object is not " +"passed to another thread." +msgstr "" + +#: ../../howto/free-threading-python.rst:135 +msgid "Iterators" +msgstr "" + +#: ../../howto/free-threading-python.rst:137 +msgid "" +"Sharing the same iterator object between multiple threads is generally not " +"safe and threads may see duplicate or missing elements when iterating or " +"crash the interpreter." +msgstr "" + +#: ../../howto/free-threading-python.rst:143 +msgid "Single-threaded performance" +msgstr "" + +#: ../../howto/free-threading-python.rst:145 +msgid "" +"The free-threaded build has additional overhead when executing Python code " +"compared to the default GIL-enabled build. In 3.13, this overhead is about " +"40% on the `pyperformance `_ suite. " +"Programs that spend most of their time in C extensions or I/O will see less " +"of an impact. The largest impact is because the specializing adaptive " +"interpreter (:pep:`659`) is disabled in the free-threaded build. We expect " +"to re-enable it in a thread-safe way in the 3.14 release. This overhead is " +"expected to be reduced in upcoming Python release. We are aiming for an " +"overhead of 10% or less on the pyperformance suite compared to the default " +"GIL-enabled build." +msgstr "" diff --git a/howto/index.po b/howto/index.po index da80089a8f..d2b94700c4 100644 --- a/howto/index.po +++ b/howto/index.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" "PO-Revision-Date: 2021-07-05 12:45+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,116 +25,116 @@ msgid "Python HOWTOs" msgstr "Python 如何達成任務" #: ../../howto/index.rst:5 -#, fuzzy msgid "" "Python HOWTOs are documents that cover a specific topic in-depth. Modeled on " "the Linux Documentation Project's HOWTO collection, this collection is an " "effort to foster documentation that's more detailed than the Python Library " "Reference." msgstr "" -"「Python 如何達成任務 (HOWTOs)」是一系列的說明文件,其內容會盡量完整地涵蓋某" -"些單一、特定的主題。以 Linux 說明文件專案的 HOWTO 系列為模範,本系列的目標是" -"提供比 Python 函式庫參考手冊更實用的說明文件。" +"「Python 如何達成任務 (HOWTOs)」是一系列的說明文件,其內容會深度地涵蓋某些特" +"定的主題。以 Linux 說明文件專案的 HOWTO 系列為模範,本系列的目標是提供比 " +"Python 函式庫參考手冊更實用的說明文件。" -#: ../../howto/index.rst:37 +#: ../../howto/index.rst:38 msgid "General:" msgstr "" -#: ../../howto/index.rst:39 +#: ../../howto/index.rst:40 msgid ":ref:`annotations-howto`" msgstr ":ref:`annotations-howto`" -#: ../../howto/index.rst:40 +#: ../../howto/index.rst:41 msgid ":ref:`argparse-tutorial`" msgstr ":ref:`argparse-tutorial`" -#: ../../howto/index.rst:41 +#: ../../howto/index.rst:42 msgid ":ref:`descriptorhowto`" msgstr ":ref:`descriptorhowto`" -#: ../../howto/index.rst:42 +#: ../../howto/index.rst:43 msgid ":ref:`enum-howto`" msgstr ":ref:`enum-howto`" -#: ../../howto/index.rst:43 +#: ../../howto/index.rst:44 msgid ":ref:`functional-howto`" msgstr ":ref:`functional-howto`" -#: ../../howto/index.rst:44 +#: ../../howto/index.rst:45 msgid ":ref:`ipaddress-howto`" msgstr ":ref:`ipaddress-howto`" -#: ../../howto/index.rst:45 +#: ../../howto/index.rst:46 msgid ":ref:`logging-howto`" msgstr ":ref:`logging-howto`" -#: ../../howto/index.rst:46 +#: ../../howto/index.rst:47 msgid ":ref:`logging-cookbook`" msgstr ":ref:`logging-cookbook`" -#: ../../howto/index.rst:47 +#: ../../howto/index.rst:48 msgid ":ref:`regex-howto`" msgstr ":ref:`regex-howto`" -#: ../../howto/index.rst:48 +#: ../../howto/index.rst:49 msgid ":ref:`sortinghowto`" msgstr ":ref:`sortinghowto`" -#: ../../howto/index.rst:49 +#: ../../howto/index.rst:50 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../howto/index.rst:50 +#: ../../howto/index.rst:51 msgid ":ref:`urllib-howto`" msgstr ":ref:`urllib-howto`" -#: ../../howto/index.rst:52 +#: ../../howto/index.rst:53 msgid "Advanced development:" msgstr "" -#: ../../howto/index.rst:54 +#: ../../howto/index.rst:55 msgid ":ref:`curses-howto`" msgstr ":ref:`curses-howto`" -#: ../../howto/index.rst:55 +#: ../../howto/index.rst:56 +msgid ":ref:`freethreading-python-howto`" +msgstr ":ref:`freethreading-python-howto`" + +#: ../../howto/index.rst:57 msgid ":ref:`freethreading-extensions-howto`" msgstr ":ref:`freethreading-extensions-howto`" -#: ../../howto/index.rst:56 +#: ../../howto/index.rst:58 msgid ":ref:`isolating-extensions-howto`" msgstr ":ref:`isolating-extensions-howto`" -#: ../../howto/index.rst:57 +#: ../../howto/index.rst:59 msgid ":ref:`python_2.3_mro`" msgstr ":ref:`python_2.3_mro`" -#: ../../howto/index.rst:58 +#: ../../howto/index.rst:60 msgid ":ref:`socket-howto`" msgstr ":ref:`socket-howto`" -#: ../../howto/index.rst:59 +#: ../../howto/index.rst:61 msgid ":ref:`timerfd-howto`" msgstr ":ref:`timerfd-howto`" -#: ../../howto/index.rst:60 +#: ../../howto/index.rst:62 msgid ":ref:`cporting-howto`" msgstr ":ref:`cporting-howto`" -#: ../../howto/index.rst:62 +#: ../../howto/index.rst:64 msgid "Debugging and profiling:" msgstr "" -#: ../../howto/index.rst:64 +#: ../../howto/index.rst:66 msgid ":ref:`gdb`" msgstr ":ref:`gdb`" -#: ../../howto/index.rst:65 +#: ../../howto/index.rst:67 msgid ":ref:`instrumentation`" msgstr ":ref:`instrumentation`" -#: ../../howto/index.rst:66 +#: ../../howto/index.rst:68 msgid ":ref:`perf_profiling`" msgstr ":ref:`perf_profiling`" - -#~ msgid "Currently, the HOWTOs are:" -#~ msgstr "目前有以下這些任務指南:" diff --git a/howto/mro.po b/howto/mro.po index 816adb559d..ac73681c25 100644 --- a/howto/mro.po +++ b/howto/mro.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -527,7 +527,7 @@ msgstr "" msgid "" "A lazy programmer can obtain the MRO directly from Python 2.2, since in this " "case it coincides with the Python 2.3 linearization. It is enough to invoke " -"the .mro() method of class A:" +"the :meth:`~type.mro` method of class A:" msgstr "" #: ../../howto/mro.rst:345 diff --git a/library/abc.po b/library/abc.po index e6231cfde5..5d5dde6b3b 100644 --- a/library/abc.po +++ b/library/abc.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2022-11-16 03:29+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -187,12 +187,12 @@ msgid "" "Check whether *subclass* is considered a subclass of this ABC. This means " "that you can customize the behavior of :func:`issubclass` further without " "the need to call :meth:`register` on every class you want to consider a " -"subclass of the ABC. (This class method is called from the :meth:`~class." +"subclass of the ABC. (This class method is called from the :meth:`~type." "__subclasscheck__` method of the ABC.)" msgstr "" "檢查 *subclass* 是否該被認為是該 ABC 的子類別,也就是說你可以直接自訂 :func:" "`issubclass` 的行為,而不用對於那些你希望定義為該 ABC 的子類別的類別都個別呼" -"叫 :meth:`register` 方法。(這個類別方法是在 ABC 的 :meth:`~class." +"叫 :meth:`register` 方法。(這個類別方法是在 ABC 的 :meth:`~type." "__subclasscheck__` 方法中呼叫。)" #: ../../library/abc.rst:104 @@ -286,11 +286,11 @@ msgid "" "The :meth:`__subclasshook__` class method defined here says that any class " "that has an :meth:`~iterator.__iter__` method in its :attr:`~object." "__dict__` (or in that of one of its base classes, accessed via the :attr:" -"`~class.__mro__` list) is considered a ``MyIterable`` too." +"`~type.__mro__` list) is considered a ``MyIterable`` too." msgstr "" "這裡定義的 :meth:`__subclasshook__` 類別方法說明任何在其 :attr:`~object." -"__dict__` (或在其透過 :attr:`~class.__mro__` 列表訪問的基底類別) 中具有 :" -"meth:`~iterator.__iter__` 方法的類別也都會被視為 ``MyIterable``。" +"__dict__` (或在其透過 :attr:`~type.__mro__` 列表訪問的基底類別) 中具有 :meth:" +"`~iterator.__iter__` 方法的類別也都會被視為 ``MyIterable``。" #: ../../library/abc.rst:154 msgid "" diff --git a/library/argparse.po b/library/argparse.po index 8c2959c432..958fbaa23f 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-24 23:08+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-" @@ -514,7 +514,7 @@ msgstr "" msgid "*exit_on_error* parameter was added." msgstr "新增 *exit_on_error* 參數。" -#: ../../library/argparse.rst:244 ../../library/argparse.rst:782 +#: ../../library/argparse.rst:244 ../../library/argparse.rst:783 msgid "The following sections describe how each of these are used." msgstr "" @@ -524,14 +524,15 @@ msgstr "" #: ../../library/argparse.rst:252 msgid "" -"By default, :class:`ArgumentParser` objects use ``sys.argv[0]`` to determine " -"how to display the name of the program in help messages. This default is " -"almost always desirable because it will make the help messages match how the " -"program was invoked on the command line. For example, consider a file named " +"By default, :class:`ArgumentParser` objects use the base name (see :func:`os." +"path.basename`) of ``sys.argv[0]`` to determine how to display the name of " +"the program in help messages. This default is almost always desirable " +"because it will make the help messages match the name that was used to " +"invoke the program on the command line. For example, consider a file named " "``myprogram.py`` with the following code::" msgstr "" -#: ../../library/argparse.rst:258 ../../library/argparse.rst:678 +#: ../../library/argparse.rst:259 ../../library/argparse.rst:679 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -543,13 +544,13 @@ msgstr "" "parser.add_argument('--foo', help='foo help')\n" "args = parser.parse_args()" -#: ../../library/argparse.rst:263 +#: ../../library/argparse.rst:264 msgid "" "The help for this program will display ``myprogram.py`` as the program name " "(regardless of where the program was invoked from):" msgstr "" -#: ../../library/argparse.rst:266 +#: ../../library/argparse.rst:267 msgid "" "$ python myprogram.py --help\n" "usage: myprogram.py [-h] [--foo FOO]\n" @@ -579,13 +580,13 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO foo help" -#: ../../library/argparse.rst:282 +#: ../../library/argparse.rst:283 msgid "" "To change this default behavior, another value can be supplied using the " "``prog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:285 +#: ../../library/argparse.rst:286 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.print_help()\n" @@ -601,14 +602,14 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:292 +#: ../../library/argparse.rst:293 msgid "" "Note that the program name, whether determined from ``sys.argv[0]`` or from " "the ``prog=`` argument, is available to help messages using the ``%(prog)s`` " "format specifier." msgstr "" -#: ../../library/argparse.rst:298 +#: ../../library/argparse.rst:299 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.add_argument('--foo', help='foo of the %(prog)s program')\n" @@ -628,17 +629,17 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO foo of the myprogram program" -#: ../../library/argparse.rst:309 +#: ../../library/argparse.rst:310 msgid "usage" msgstr "" -#: ../../library/argparse.rst:311 +#: ../../library/argparse.rst:312 msgid "" "By default, :class:`ArgumentParser` calculates the usage message from the " "arguments it contains::" msgstr "" -#: ../../library/argparse.rst:314 +#: ../../library/argparse.rst:315 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" @@ -666,12 +667,12 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo [FOO] foo help" -#: ../../library/argparse.rst:327 +#: ../../library/argparse.rst:328 msgid "" "The default message can be overridden with the ``usage=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:329 +#: ../../library/argparse.rst:330 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s " "[options]')\n" @@ -701,17 +702,17 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo [FOO] foo help" -#: ../../library/argparse.rst:342 +#: ../../library/argparse.rst:343 msgid "" "The ``%(prog)s`` format specifier is available to fill in the program name " "in your usage messages." msgstr "" -#: ../../library/argparse.rst:349 +#: ../../library/argparse.rst:350 msgid "description" msgstr "描述" -#: ../../library/argparse.rst:351 +#: ../../library/argparse.rst:352 msgid "" "Most calls to the :class:`ArgumentParser` constructor will use the " "``description=`` keyword argument. This argument gives a brief description " @@ -720,7 +721,7 @@ msgid "" "messages for the various arguments::" msgstr "" -#: ../../library/argparse.rst:357 +#: ../../library/argparse.rst:358 msgid "" ">>> parser = argparse.ArgumentParser(description='A foo that bars')\n" ">>> parser.print_help()\n" @@ -740,24 +741,24 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:366 +#: ../../library/argparse.rst:367 msgid "" "By default, the description will be line-wrapped so that it fits within the " "given space. To change this behavior, see the formatter_class_ argument." msgstr "" -#: ../../library/argparse.rst:371 +#: ../../library/argparse.rst:372 msgid "epilog" msgstr "" -#: ../../library/argparse.rst:373 +#: ../../library/argparse.rst:374 msgid "" "Some programs like to display additional description of the program after " "the description of the arguments. Such text can be specified using the " "``epilog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:377 +#: ../../library/argparse.rst:378 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... description='A foo that bars',\n" @@ -785,18 +786,18 @@ msgstr "" "\n" "And that's how you'd foo a bar" -#: ../../library/argparse.rst:390 +#: ../../library/argparse.rst:391 msgid "" "As with the description_ argument, the ``epilog=`` text is by default line-" "wrapped, but this behavior can be adjusted with the formatter_class_ " "argument to :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:396 +#: ../../library/argparse.rst:397 msgid "parents" msgstr "" -#: ../../library/argparse.rst:398 +#: ../../library/argparse.rst:399 msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " @@ -807,7 +808,7 @@ msgid "" "object being constructed::" msgstr "" -#: ../../library/argparse.rst:405 +#: ../../library/argparse.rst:406 msgid "" ">>> parent_parser = argparse.ArgumentParser(add_help=False)\n" ">>> parent_parser.add_argument('--parent', type=int)\n" @@ -835,32 +836,32 @@ msgstr "" ">>> bar_parser.parse_args(['--bar', 'YYY'])\n" "Namespace(bar='YYY', parent=None)" -#: ../../library/argparse.rst:418 +#: ../../library/argparse.rst:419 msgid "" "Note that most parent parsers will specify ``add_help=False``. Otherwise, " "the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the " "parent and one in the child) and raise an error." msgstr "" -#: ../../library/argparse.rst:423 +#: ../../library/argparse.rst:424 msgid "" "You must fully initialize the parsers before passing them via ``parents=``. " "If you change the parent parsers after the child parser, those changes will " "not be reflected in the child." msgstr "" -#: ../../library/argparse.rst:431 +#: ../../library/argparse.rst:432 msgid "formatter_class" msgstr "formatter_class" -#: ../../library/argparse.rst:433 +#: ../../library/argparse.rst:434 msgid "" ":class:`ArgumentParser` objects allow the help formatting to be customized " "by specifying an alternate formatting class. Currently, there are four such " "classes:" msgstr "" -#: ../../library/argparse.rst:442 +#: ../../library/argparse.rst:443 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " "more control over how textual descriptions are displayed. By default, :class:" @@ -868,7 +869,7 @@ msgid "" "command-line help messages::" msgstr "" -#: ../../library/argparse.rst:447 +#: ../../library/argparse.rst:448 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -892,14 +893,14 @@ msgid "" "will be wrapped across a couple lines" msgstr "" -#: ../../library/argparse.rst:467 +#: ../../library/argparse.rst:468 msgid "" "Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` " "indicates that description_ and epilog_ are already correctly formatted and " "should not be line-wrapped::" msgstr "" -#: ../../library/argparse.rst:471 +#: ../../library/argparse.rst:472 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -924,7 +925,7 @@ msgid "" " -h, --help show this help message and exit" msgstr "" -#: ../../library/argparse.rst:493 +#: ../../library/argparse.rst:494 msgid "" ":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help " "text, including argument descriptions. However, multiple new lines are " @@ -932,13 +933,13 @@ msgid "" "between the newlines." msgstr "" -#: ../../library/argparse.rst:498 +#: ../../library/argparse.rst:499 msgid "" ":class:`ArgumentDefaultsHelpFormatter` automatically adds information about " "default values to each of the argument help messages::" msgstr "" -#: ../../library/argparse.rst:501 +#: ../../library/argparse.rst:502 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -970,14 +971,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO FOO! (default: 42)" -#: ../../library/argparse.rst:516 +#: ../../library/argparse.rst:517 msgid "" ":class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for " "each argument as the display name for its values (rather than using the " "dest_ as the regular formatter does)::" msgstr "" -#: ../../library/argparse.rst:520 +#: ../../library/argparse.rst:521 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -1009,11 +1010,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo int" -#: ../../library/argparse.rst:537 +#: ../../library/argparse.rst:538 msgid "prefix_chars" msgstr "prefix_chars" -#: ../../library/argparse.rst:539 +#: ../../library/argparse.rst:540 msgid "" "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " "Parsers that need to support different or additional prefix characters, e.g. " @@ -1021,7 +1022,7 @@ msgid "" "``prefix_chars=`` argument to the ArgumentParser constructor::" msgstr "" -#: ../../library/argparse.rst:545 +#: ../../library/argparse.rst:546 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')\n" ">>> parser.add_argument('+f')\n" @@ -1035,18 +1036,18 @@ msgstr "" ">>> parser.parse_args('+f X ++bar Y'.split())\n" "Namespace(bar='Y', f='X')" -#: ../../library/argparse.rst:551 +#: ../../library/argparse.rst:552 msgid "" "The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of " "characters that does not include ``-`` will cause ``-f/--foo`` options to be " "disallowed." msgstr "" -#: ../../library/argparse.rst:557 +#: ../../library/argparse.rst:558 msgid "fromfile_prefix_chars" msgstr "fromfile_prefix_chars" -#: ../../library/argparse.rst:559 +#: ../../library/argparse.rst:560 msgid "" "Sometimes, when dealing with a particularly long argument list, it may make " "sense to keep the list of arguments in a file rather than typing it out at " @@ -1056,7 +1057,7 @@ msgid "" "by the arguments they contain. For example::" msgstr "" -#: ../../library/argparse.rst:566 +#: ../../library/argparse.rst:567 msgid "" ">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" "... fp.write('-f\\nbar')\n" @@ -1074,7 +1075,7 @@ msgstr "" ">>> parser.parse_args(['-f', 'foo', '@args.txt'])\n" "Namespace(f='bar')" -#: ../../library/argparse.rst:574 +#: ../../library/argparse.rst:575 msgid "" "Arguments read from a file must by default be one per line (but see also :" "meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " @@ -1084,19 +1085,19 @@ msgid "" "f', 'bar']``." msgstr "" -#: ../../library/argparse.rst:580 +#: ../../library/argparse.rst:581 msgid "" ":class:`ArgumentParser` uses :term:`filesystem encoding and error handler` " "to read the file containing arguments." msgstr "" -#: ../../library/argparse.rst:583 +#: ../../library/argparse.rst:584 msgid "" "The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that " "arguments will never be treated as file references." msgstr "" -#: ../../library/argparse.rst:586 +#: ../../library/argparse.rst:587 msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " "from default (e.g. :func:`locale.getpreferredencoding(False) >> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" ">>> parser.add_argument('--foo')\n" @@ -1139,22 +1140,22 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace()" -#: ../../library/argparse.rst:616 +#: ../../library/argparse.rst:617 msgid "allow_abbrev" msgstr "allow_abbrev" -#: ../../library/argparse.rst:618 +#: ../../library/argparse.rst:619 msgid "" "Normally, when you pass an argument list to the :meth:`~ArgumentParser." "parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " "abbreviations ` of long options." msgstr "" -#: ../../library/argparse.rst:622 +#: ../../library/argparse.rst:623 msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:624 +#: ../../library/argparse.rst:625 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" ">>> parser.add_argument('--foobar', action='store_true')\n" @@ -1170,11 +1171,11 @@ msgstr "" "usage: PROG [-h] [--foobar] [--foonley]\n" "PROG: error: unrecognized arguments: --foon" -#: ../../library/argparse.rst:635 +#: ../../library/argparse.rst:636 msgid "conflict_handler" msgstr "conflict_handler" -#: ../../library/argparse.rst:637 +#: ../../library/argparse.rst:638 msgid "" ":class:`ArgumentParser` objects do not allow two actions with the same " "option string. By default, :class:`ArgumentParser` objects raise an " @@ -1182,7 +1183,7 @@ msgid "" "that is already in use::" msgstr "" -#: ../../library/argparse.rst:642 +#: ../../library/argparse.rst:643 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo', help='old foo help')\n" @@ -1198,7 +1199,7 @@ msgstr "" " ..\n" "ArgumentError: argument --foo: conflicting option string(s): --foo" -#: ../../library/argparse.rst:649 +#: ../../library/argparse.rst:650 msgid "" "Sometimes (e.g. when using parents_) it may be useful to simply override any " "older arguments with the same option string. To get this behavior, the " @@ -1206,7 +1207,7 @@ msgid "" "of :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:654 +#: ../../library/argparse.rst:655 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', " "conflict_handler='resolve')\n" @@ -1232,7 +1233,7 @@ msgstr "" " -f FOO old foo help\n" " --foo FOO new foo help" -#: ../../library/argparse.rst:665 +#: ../../library/argparse.rst:666 msgid "" "Note that :class:`ArgumentParser` objects only remove an action if all of " "its option strings are overridden. So, in the example above, the old ``-f/--" @@ -1240,24 +1241,24 @@ msgid "" "option string was overridden." msgstr "" -#: ../../library/argparse.rst:672 +#: ../../library/argparse.rst:673 msgid "add_help" msgstr "add_help" -#: ../../library/argparse.rst:674 +#: ../../library/argparse.rst:675 msgid "" "By default, ArgumentParser objects add an option which simply displays the " "parser's help message. For example, consider a file named ``myprogram.py`` " "containing the following code::" msgstr "" -#: ../../library/argparse.rst:683 +#: ../../library/argparse.rst:684 msgid "" "If ``-h`` or ``--help`` is supplied at the command line, the ArgumentParser " "help will be printed:" msgstr "" -#: ../../library/argparse.rst:686 +#: ../../library/argparse.rst:687 msgid "" "$ python myprogram.py --help\n" "usage: myprogram.py [-h] [--foo FOO]\n" @@ -1273,14 +1274,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO foo help" -#: ../../library/argparse.rst:695 +#: ../../library/argparse.rst:696 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " "This can be achieved by passing ``False`` as the ``add_help=`` argument to :" "class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:699 +#: ../../library/argparse.rst:700 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> parser.add_argument('--foo', help='foo help')\n" @@ -1298,7 +1299,7 @@ msgstr "" "options:\n" " --foo FOO foo help" -#: ../../library/argparse.rst:707 +#: ../../library/argparse.rst:708 msgid "" "The help option is typically ``-h/--help``. The exception to this is if the " "``prefix_chars=`` is specified and does not include ``-``, in which case ``-" @@ -1306,7 +1307,7 @@ msgid "" "in ``prefix_chars`` is used to prefix the help options::" msgstr "" -#: ../../library/argparse.rst:713 +#: ../../library/argparse.rst:714 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')\n" ">>> parser.print_help()\n" @@ -1322,24 +1323,24 @@ msgstr "" "options:\n" " +h, ++help show this help message and exit" -#: ../../library/argparse.rst:722 +#: ../../library/argparse.rst:723 msgid "exit_on_error" msgstr "exit_on_error" -#: ../../library/argparse.rst:724 +#: ../../library/argparse.rst:725 msgid "" "Normally, when you pass an invalid argument list to the :meth:" "`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " "exit with error info." msgstr "" -#: ../../library/argparse.rst:727 +#: ../../library/argparse.rst:728 msgid "" "If the user would like to catch errors manually, the feature can be enabled " "by setting ``exit_on_error`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:730 +#: ../../library/argparse.rst:731 msgid "" ">>> parser = argparse.ArgumentParser(exit_on_error=False)\n" ">>> parser.add_argument('--integers', type=int)\n" @@ -1365,81 +1366,81 @@ msgstr "" "...\n" "Catching an argumentError" -#: ../../library/argparse.rst:744 +#: ../../library/argparse.rst:745 msgid "The add_argument() method" msgstr "" -#: ../../library/argparse.rst:750 +#: ../../library/argparse.rst:751 msgid "" "Define how a single command-line argument should be parsed. Each parameter " "has its own more detailed description below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:753 +#: ../../library/argparse.rst:754 msgid "" "`name or flags`_ - Either a name or a list of option strings, e.g. ``foo`` " "or ``-f, --foo``." msgstr "" -#: ../../library/argparse.rst:756 +#: ../../library/argparse.rst:757 msgid "" "action_ - The basic type of action to be taken when this argument is " "encountered at the command line." msgstr "" -#: ../../library/argparse.rst:759 +#: ../../library/argparse.rst:760 msgid "nargs_ - The number of command-line arguments that should be consumed." msgstr "" -#: ../../library/argparse.rst:761 +#: ../../library/argparse.rst:762 msgid "" "const_ - A constant value required by some action_ and nargs_ selections." msgstr "" -#: ../../library/argparse.rst:763 +#: ../../library/argparse.rst:764 msgid "" "default_ - The value produced if the argument is absent from the command " "line and if it is absent from the namespace object." msgstr "" -#: ../../library/argparse.rst:766 +#: ../../library/argparse.rst:767 msgid "" "type_ - The type to which the command-line argument should be converted." msgstr "" -#: ../../library/argparse.rst:768 +#: ../../library/argparse.rst:769 msgid "choices_ - A sequence of the allowable values for the argument." msgstr "" -#: ../../library/argparse.rst:770 +#: ../../library/argparse.rst:771 msgid "" "required_ - Whether or not the command-line option may be omitted (optionals " "only)." msgstr "" -#: ../../library/argparse.rst:773 +#: ../../library/argparse.rst:774 msgid "help_ - A brief description of what the argument does." msgstr "" -#: ../../library/argparse.rst:775 +#: ../../library/argparse.rst:776 msgid "metavar_ - A name for the argument in usage messages." msgstr "" -#: ../../library/argparse.rst:777 +#: ../../library/argparse.rst:778 msgid "" "dest_ - The name of the attribute to be added to the object returned by :" "meth:`parse_args`." msgstr "" -#: ../../library/argparse.rst:780 +#: ../../library/argparse.rst:781 msgid "deprecated_ - Whether or not use of the argument is deprecated." msgstr "" -#: ../../library/argparse.rst:788 +#: ../../library/argparse.rst:789 msgid "name or flags" msgstr "" -#: ../../library/argparse.rst:790 +#: ../../library/argparse.rst:791 msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " @@ -1448,30 +1449,30 @@ msgid "" "or a simple argument name." msgstr "" -#: ../../library/argparse.rst:796 +#: ../../library/argparse.rst:797 msgid "For example, an optional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:798 +#: ../../library/argparse.rst:799 msgid ">>> parser.add_argument('-f', '--foo')" msgstr ">>> parser.add_argument('-f', '--foo')" -#: ../../library/argparse.rst:800 +#: ../../library/argparse.rst:801 msgid "while a positional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:802 +#: ../../library/argparse.rst:803 msgid ">>> parser.add_argument('bar')" msgstr ">>> parser.add_argument('bar')" -#: ../../library/argparse.rst:804 +#: ../../library/argparse.rst:805 msgid "" "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " "be identified by the ``-`` prefix, and the remaining arguments will be " "assumed to be positional::" msgstr "" -#: ../../library/argparse.rst:808 +#: ../../library/argparse.rst:809 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo')\n" @@ -1495,11 +1496,11 @@ msgstr "" "usage: PROG [-h] [-f FOO] bar\n" "PROG: error: the following arguments are required: bar" -#: ../../library/argparse.rst:823 +#: ../../library/argparse.rst:824 msgid "action" msgstr "" -#: ../../library/argparse.rst:825 +#: ../../library/argparse.rst:826 msgid "" ":class:`ArgumentParser` objects associate command-line arguments with " "actions. These actions can do just about anything with the command-line " @@ -1509,13 +1510,13 @@ msgid "" "be handled. The supplied actions are:" msgstr "" -#: ../../library/argparse.rst:831 +#: ../../library/argparse.rst:832 msgid "" "``'store'`` - This just stores the argument's value. This is the default " "action. For example::" msgstr "" -#: ../../library/argparse.rst:834 +#: ../../library/argparse.rst:835 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -1527,7 +1528,7 @@ msgstr "" ">>> parser.parse_args('--foo 1'.split())\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:839 +#: ../../library/argparse.rst:840 msgid "" "``'store_const'`` - This stores the value specified by the const_ keyword " "argument; note that the const_ keyword argument defaults to ``None``. The " @@ -1535,7 +1536,7 @@ msgid "" "specify some sort of flag. For example::" msgstr "" -#: ../../library/argparse.rst:844 +#: ../../library/argparse.rst:845 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_const', const=42)\n" @@ -1547,7 +1548,7 @@ msgstr "" ">>> parser.parse_args(['--foo'])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:849 +#: ../../library/argparse.rst:850 msgid "" "``'store_true'`` and ``'store_false'`` - These are special cases of " "``'store_const'`` used for storing the values ``True`` and ``False`` " @@ -1555,7 +1556,7 @@ msgid "" "``True`` respectively. For example::" msgstr "" -#: ../../library/argparse.rst:854 +#: ../../library/argparse.rst:855 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -1571,7 +1572,7 @@ msgstr "" ">>> parser.parse_args('--foo --bar'.split())\n" "Namespace(foo=True, bar=False, baz=True)" -#: ../../library/argparse.rst:861 +#: ../../library/argparse.rst:862 msgid "" "``'append'`` - This stores a list, and appends each argument value to the " "list. It is useful to allow an option to be specified multiple times. If the " @@ -1580,7 +1581,7 @@ msgid "" "after those default values. Example usage::" msgstr "" -#: ../../library/argparse.rst:867 +#: ../../library/argparse.rst:868 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='append')\n" @@ -1592,7 +1593,7 @@ msgstr "" ">>> parser.parse_args('--foo 1 --foo 2'.split())\n" "Namespace(foo=['1', '2'])" -#: ../../library/argparse.rst:872 +#: ../../library/argparse.rst:873 msgid "" "``'append_const'`` - This stores a list, and appends the value specified by " "the const_ keyword argument to the list; note that the const_ keyword " @@ -1601,7 +1602,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:878 +#: ../../library/argparse.rst:879 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--str', dest='types', action='append_const', " @@ -1619,13 +1620,13 @@ msgstr "" ">>> parser.parse_args('--str --int'.split())\n" "Namespace(types=[, ])" -#: ../../library/argparse.rst:884 +#: ../../library/argparse.rst:885 msgid "" "``'count'`` - This counts the number of times a keyword argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" -#: ../../library/argparse.rst:887 +#: ../../library/argparse.rst:888 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='count', default=0)\n" @@ -1633,11 +1634,11 @@ msgid "" "Namespace(verbose=3)" msgstr "" -#: ../../library/argparse.rst:892 +#: ../../library/argparse.rst:893 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -#: ../../library/argparse.rst:894 +#: ../../library/argparse.rst:895 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " @@ -1645,14 +1646,14 @@ msgid "" "output is created." msgstr "" -#: ../../library/argparse.rst:899 +#: ../../library/argparse.rst:900 msgid "" "``'version'`` - This expects a ``version=`` keyword argument in the :meth:" "`~ArgumentParser.add_argument` call, and prints version information and " "exits when invoked::" msgstr "" -#: ../../library/argparse.rst:903 +#: ../../library/argparse.rst:904 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1668,13 +1669,13 @@ msgstr "" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" -#: ../../library/argparse.rst:909 +#: ../../library/argparse.rst:910 msgid "" "``'extend'`` - This stores a list, and extends each argument value to the " "list. Example usage::" msgstr "" -#: ../../library/argparse.rst:913 +#: ../../library/argparse.rst:914 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " @@ -1690,7 +1691,7 @@ msgstr "" "\"f4\"])\n" "Namespace(foo=['f1', 'f2', 'f3', 'f4'])" -#: ../../library/argparse.rst:920 +#: ../../library/argparse.rst:921 msgid "" "You may also specify an arbitrary action by passing an Action subclass or " "other object that implements the same interface. The " @@ -1698,7 +1699,7 @@ msgid "" "boolean actions such as ``--foo`` and ``--no-foo``::" msgstr "" -#: ../../library/argparse.rst:925 +#: ../../library/argparse.rst:926 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -1712,18 +1713,18 @@ msgstr "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" -#: ../../library/argparse.rst:933 +#: ../../library/argparse.rst:934 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the ``__call__`` method and optionally the ``__init__`` and " "``format_usage`` methods." msgstr "" -#: ../../library/argparse.rst:937 +#: ../../library/argparse.rst:938 msgid "An example of a custom action::" msgstr "" -#: ../../library/argparse.rst:939 +#: ../../library/argparse.rst:940 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1744,15 +1745,15 @@ msgid "" "Namespace(bar='1', foo='2')" msgstr "" -#: ../../library/argparse.rst:957 +#: ../../library/argparse.rst:958 msgid "For more details, see :class:`Action`." msgstr "" -#: ../../library/argparse.rst:963 +#: ../../library/argparse.rst:964 msgid "nargs" msgstr "" -#: ../../library/argparse.rst:965 +#: ../../library/argparse.rst:966 msgid "" "ArgumentParser objects usually associate a single command-line argument with " "a single action to be taken. The ``nargs`` keyword argument associates a " @@ -1760,13 +1761,13 @@ msgid "" "ref:`specifying-ambiguous-arguments`. The supported values are:" msgstr "" -#: ../../library/argparse.rst:970 +#: ../../library/argparse.rst:971 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: ../../library/argparse.rst:973 +#: ../../library/argparse.rst:974 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1780,13 +1781,13 @@ msgstr "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" -#: ../../library/argparse.rst:979 +#: ../../library/argparse.rst:980 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" -#: ../../library/argparse.rst:984 +#: ../../library/argparse.rst:985 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -1796,7 +1797,7 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: ../../library/argparse.rst:991 +#: ../../library/argparse.rst:992 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1818,13 +1819,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:1001 +#: ../../library/argparse.rst:1002 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: ../../library/argparse.rst:1004 +#: ../../library/argparse.rst:1005 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?', type=argparse.FileType('r'),\n" @@ -1850,7 +1851,7 @@ msgstr "" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>,\n" " outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1018 +#: ../../library/argparse.rst:1019 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -1858,7 +1859,7 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: ../../library/argparse.rst:1023 +#: ../../library/argparse.rst:1024 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1874,14 +1875,14 @@ msgstr "" ">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" -#: ../../library/argparse.rst:1032 +#: ../../library/argparse.rst:1033 msgid "" "``'+'``. Just like ``'*'``, all command-line args present are gathered into " "a list. Additionally, an error message will be generated if there wasn't at " "least one command-line argument present. For example::" msgstr "" -#: ../../library/argparse.rst:1036 +#: ../../library/argparse.rst:1037 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1899,7 +1900,7 @@ msgstr "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:1044 +#: ../../library/argparse.rst:1045 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -1907,11 +1908,11 @@ msgid "" "be produced." msgstr "" -#: ../../library/argparse.rst:1052 +#: ../../library/argparse.rst:1053 msgid "const" msgstr "" -#: ../../library/argparse.rst:1054 +#: ../../library/argparse.rst:1055 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -1919,7 +1920,7 @@ msgid "" "common uses of it are:" msgstr "" -#: ../../library/argparse.rst:1058 +#: ../../library/argparse.rst:1059 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='store_const'`` or ``action='append_const'``. These actions add " @@ -1929,7 +1930,7 @@ msgid "" "receive a default value of ``None``." msgstr "" -#: ../../library/argparse.rst:1066 +#: ../../library/argparse.rst:1067 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " @@ -1939,17 +1940,17 @@ msgid "" "to be ``None`` instead. See the nargs_ description for examples." msgstr "" -#: ../../library/argparse.rst:1073 +#: ../../library/argparse.rst:1074 msgid "" "``const=None`` by default, including when ``action='append_const'`` or " "``action='store_const'``." msgstr "" -#: ../../library/argparse.rst:1080 +#: ../../library/argparse.rst:1081 msgid "default" msgstr "" -#: ../../library/argparse.rst:1082 +#: ../../library/argparse.rst:1083 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." @@ -1959,7 +1960,7 @@ msgid "" "command line::" msgstr "" -#: ../../library/argparse.rst:1089 +#: ../../library/argparse.rst:1090 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1975,13 +1976,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:1096 +#: ../../library/argparse.rst:1097 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not over write it::" msgstr "" -#: ../../library/argparse.rst:1099 +#: ../../library/argparse.rst:1100 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1993,7 +1994,7 @@ msgstr "" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" -#: ../../library/argparse.rst:1104 +#: ../../library/argparse.rst:1105 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " @@ -2001,7 +2002,7 @@ msgid "" "`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" -#: ../../library/argparse.rst:1109 +#: ../../library/argparse.rst:1110 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -2015,13 +2016,13 @@ msgstr "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" -#: ../../library/argparse.rst:1115 +#: ../../library/argparse.rst:1116 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" -#: ../../library/argparse.rst:1118 +#: ../../library/argparse.rst:1119 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -2039,11 +2040,18 @@ msgstr "" #: ../../library/argparse.rst:1126 msgid "" +"For required_ arguments, the ``default`` value is ignored. For example, this " +"applies to positional arguments with nargs_ values other than ``?`` or " +"``*``, or optional arguments marked as ``required=True``." +msgstr "" + +#: ../../library/argparse.rst:1130 +msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: ../../library/argparse.rst:1129 +#: ../../library/argparse.rst:1133 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -2059,11 +2067,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:1140 +#: ../../library/argparse.rst:1144 msgid "type" msgstr "" -#: ../../library/argparse.rst:1142 +#: ../../library/argparse.rst:1146 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -2072,13 +2080,13 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: ../../library/argparse.rst:1148 +#: ../../library/argparse.rst:1152 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -#: ../../library/argparse.rst:1151 +#: ../../library/argparse.rst:1155 msgid "" "The argument to ``type`` can be any callable that accepts a single string. " "If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" @@ -2086,11 +2094,11 @@ msgid "" "is displayed. No other exception types are handled." msgstr "" -#: ../../library/argparse.rst:1156 +#: ../../library/argparse.rst:1160 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: ../../library/argparse.rst:1158 +#: ../../library/argparse.rst:1162 msgid "" "import argparse\n" "import pathlib\n" @@ -2118,11 +2126,11 @@ msgstr "" "encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" -#: ../../library/argparse.rst:1172 +#: ../../library/argparse.rst:1176 msgid "User defined functions can be used as well:" msgstr "" -#: ../../library/argparse.rst:1174 +#: ../../library/argparse.rst:1178 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -2140,14 +2148,14 @@ msgstr "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" -#: ../../library/argparse.rst:1184 +#: ../../library/argparse.rst:1188 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" -#: ../../library/argparse.rst:1188 +#: ../../library/argparse.rst:1192 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -2155,7 +2163,7 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: ../../library/argparse.rst:1193 +#: ../../library/argparse.rst:1197 msgid "" "For example, JSON or YAML conversions have complex error cases that require " "better reporting than can be given by the ``type`` keyword. A :exc:`~json." @@ -2163,7 +2171,7 @@ msgid "" "exception would not be handled at all." msgstr "" -#: ../../library/argparse.rst:1198 +#: ../../library/argparse.rst:1202 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses *FileType* and then a subsequent " @@ -2172,17 +2180,17 @@ msgid "" "run and then use the :keyword:`with`-statement to manage the files." msgstr "" -#: ../../library/argparse.rst:1204 +#: ../../library/argparse.rst:1208 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: ../../library/argparse.rst:1211 +#: ../../library/argparse.rst:1215 msgid "choices" msgstr "" -#: ../../library/argparse.rst:1213 +#: ../../library/argparse.rst:1217 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a sequence object as the *choices* " @@ -2191,7 +2199,7 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: ../../library/argparse.rst:1219 +#: ../../library/argparse.rst:1223 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -2211,14 +2219,14 @@ msgstr "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" -#: ../../library/argparse.rst:1228 +#: ../../library/argparse.rst:1232 msgid "" "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* " "sequence should match the type_ specified::" msgstr "" -#: ../../library/argparse.rst:1232 +#: ../../library/argparse.rst:1236 msgid "" ">>> parser = argparse.ArgumentParser(prog='doors.py')\n" ">>> parser.add_argument('door', type=int, choices=range(1, 4))\n" @@ -2236,19 +2244,19 @@ msgstr "" "usage: doors.py [-h] {1,2,3}\n" "doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)" -#: ../../library/argparse.rst:1240 +#: ../../library/argparse.rst:1244 msgid "" "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:1243 +#: ../../library/argparse.rst:1247 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: ../../library/argparse.rst:1246 +#: ../../library/argparse.rst:1250 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -2256,11 +2264,11 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1255 +#: ../../library/argparse.rst:1259 msgid "required" msgstr "" -#: ../../library/argparse.rst:1257 +#: ../../library/argparse.rst:1261 msgid "" "In general, the :mod:`argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " @@ -2268,7 +2276,7 @@ msgid "" "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1262 +#: ../../library/argparse.rst:1266 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -2286,24 +2294,24 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1270 +#: ../../library/argparse.rst:1274 msgid "" "As the example shows, if an option is marked as ``required``, :meth:" "`~ArgumentParser.parse_args` will report an error if that option is not " "present at the command line." msgstr "" -#: ../../library/argparse.rst:1276 +#: ../../library/argparse.rst:1280 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: ../../library/argparse.rst:1283 +#: ../../library/argparse.rst:1287 msgid "help" msgstr "幫助" -#: ../../library/argparse.rst:1285 +#: ../../library/argparse.rst:1289 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " @@ -2311,7 +2319,7 @@ msgid "" "each argument::" msgstr "" -#: ../../library/argparse.rst:1290 +#: ../../library/argparse.rst:1294 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', action='store_true',\n" @@ -2343,7 +2351,7 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo foo the bars before frobbling" -#: ../../library/argparse.rst:1305 +#: ../../library/argparse.rst:1309 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " @@ -2352,7 +2360,7 @@ msgid "" "``%(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1310 +#: ../../library/argparse.rst:1314 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -2378,19 +2386,19 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1322 +#: ../../library/argparse.rst:1326 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: ../../library/argparse.rst:1325 +#: ../../library/argparse.rst:1329 msgid "" ":mod:`argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1328 +#: ../../library/argparse.rst:1332 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -2408,11 +2416,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1340 +#: ../../library/argparse.rst:1344 msgid "metavar" msgstr "" -#: ../../library/argparse.rst:1342 +#: ../../library/argparse.rst:1346 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, ArgumentParser objects use the " @@ -2424,7 +2432,7 @@ msgid "" "argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1351 +#: ../../library/argparse.rst:1355 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2456,11 +2464,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1366 +#: ../../library/argparse.rst:1370 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1368 +#: ../../library/argparse.rst:1372 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2492,21 +2500,21 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1383 +#: ../../library/argparse.rst:1387 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: ../../library/argparse.rst:1387 +#: ../../library/argparse.rst:1391 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: ../../library/argparse.rst:1391 +#: ../../library/argparse.rst:1395 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2530,11 +2538,11 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1406 +#: ../../library/argparse.rst:1410 msgid "dest" msgstr "" -#: ../../library/argparse.rst:1408 +#: ../../library/argparse.rst:1412 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " @@ -2544,7 +2552,7 @@ msgid "" "add_argument`::" msgstr "" -#: ../../library/argparse.rst:1415 +#: ../../library/argparse.rst:1419 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2556,7 +2564,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1420 +#: ../../library/argparse.rst:1424 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2568,7 +2576,7 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1429 +#: ../../library/argparse.rst:1433 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2586,11 +2594,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1437 +#: ../../library/argparse.rst:1441 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1439 +#: ../../library/argparse.rst:1443 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2602,11 +2610,11 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1448 +#: ../../library/argparse.rst:1452 msgid "deprecated" msgstr "" -#: ../../library/argparse.rst:1450 +#: ../../library/argparse.rst:1454 msgid "" "During a project's lifetime, some arguments may need to be removed from the " "command line. Before removing them, you should inform your users that the " @@ -2617,7 +2625,7 @@ msgid "" "will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" -#: ../../library/argparse.rst:1460 +#: ../../library/argparse.rst:1464 #, fuzzy msgid "" ">>> import argparse\n" @@ -2636,11 +2644,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:1473 +#: ../../library/argparse.rst:1477 msgid "Action classes" msgstr "" -#: ../../library/argparse.rst:1475 +#: ../../library/argparse.rst:1479 msgid "" "Action classes implement the Action API, a callable which returns a callable " "which processes arguments from the command-line. Any object which follows " @@ -2648,7 +2656,7 @@ msgid "" "add_argument`." msgstr "" -#: ../../library/argparse.rst:1484 +#: ../../library/argparse.rst:1488 msgid "" "Action objects are used by an ArgumentParser to represent the information " "needed to parse a single argument from one or more strings from the command " @@ -2657,7 +2665,7 @@ msgid "" "the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1490 +#: ../../library/argparse.rst:1494 msgid "" "Instances of Action (or return value of any callable to the ``action`` " "parameter) should have attributes \"dest\", \"option_strings\", \"default\", " @@ -2665,91 +2673,91 @@ msgid "" "these attributes are defined is to call ``Action.__init__``." msgstr "" -#: ../../library/argparse.rst:1495 +#: ../../library/argparse.rst:1499 msgid "" "Action instances should be callable, so subclasses must override the " "``__call__`` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1498 +#: ../../library/argparse.rst:1502 msgid "``parser`` - The ArgumentParser object which contains this action." msgstr "" -#: ../../library/argparse.rst:1500 +#: ../../library/argparse.rst:1504 msgid "" "``namespace`` - The :class:`Namespace` object that will be returned by :meth:" "`~ArgumentParser.parse_args`. Most actions add an attribute to this object " "using :func:`setattr`." msgstr "" -#: ../../library/argparse.rst:1504 +#: ../../library/argparse.rst:1508 msgid "" "``values`` - The associated command-line arguments, with any type " "conversions applied. Type conversions are specified with the type_ keyword " "argument to :meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1508 +#: ../../library/argparse.rst:1512 msgid "" "``option_string`` - The option string that was used to invoke this action. " "The ``option_string`` argument is optional, and will be absent if the action " "is associated with a positional argument." msgstr "" -#: ../../library/argparse.rst:1512 +#: ../../library/argparse.rst:1516 msgid "" "The ``__call__`` method may perform arbitrary actions, but will typically " "set attributes on the ``namespace`` based on ``dest`` and ``values``." msgstr "" -#: ../../library/argparse.rst:1515 +#: ../../library/argparse.rst:1519 msgid "" "Action subclasses can define a ``format_usage`` method that takes no " "argument and return a string which will be used when printing the usage of " "the program. If such method is not provided, a sensible default will be used." msgstr "" -#: ../../library/argparse.rst:1520 +#: ../../library/argparse.rst:1524 msgid "The parse_args() method" msgstr "" -#: ../../library/argparse.rst:1524 +#: ../../library/argparse.rst:1528 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1527 +#: ../../library/argparse.rst:1531 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:" "`add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1531 +#: ../../library/argparse.rst:1535 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "" -#: ../../library/argparse.rst:1534 +#: ../../library/argparse.rst:1538 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1539 +#: ../../library/argparse.rst:1543 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1541 +#: ../../library/argparse.rst:1545 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: ../../library/argparse.rst:1545 +#: ../../library/argparse.rst:1549 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2767,14 +2775,14 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1553 +#: ../../library/argparse.rst:1557 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: ../../library/argparse.rst:1557 +#: ../../library/argparse.rst:1561 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2782,13 +2790,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1560 +#: ../../library/argparse.rst:1564 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1563 +#: ../../library/argparse.rst:1567 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2796,13 +2804,13 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1566 +#: ../../library/argparse.rst:1570 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: ../../library/argparse.rst:1569 +#: ../../library/argparse.rst:1573 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='store_true')\n" @@ -2818,11 +2826,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1578 +#: ../../library/argparse.rst:1582 msgid "Invalid arguments" msgstr "" -#: ../../library/argparse.rst:1580 +#: ../../library/argparse.rst:1584 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -2830,7 +2838,7 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1585 +#: ../../library/argparse.rst:1589 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -2852,11 +2860,11 @@ msgid "" "PROG: error: extra arguments found: badger" msgstr "" -#: ../../library/argparse.rst:1606 +#: ../../library/argparse.rst:1610 msgid "Arguments containing ``-``" msgstr "" -#: ../../library/argparse.rst:1608 +#: ../../library/argparse.rst:1612 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -2868,7 +2876,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1616 +#: ../../library/argparse.rst:1620 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2901,7 +2909,7 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -#: ../../library/argparse.rst:1646 +#: ../../library/argparse.rst:1650 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -2909,7 +2917,7 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1651 +#: ../../library/argparse.rst:1655 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -2917,24 +2925,24 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1654 +#: ../../library/argparse.rst:1658 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" -#: ../../library/argparse.rst:1660 +#: ../../library/argparse.rst:1664 msgid "Argument abbreviations (prefix matching)" msgstr "" -#: ../../library/argparse.rst:1662 +#: ../../library/argparse.rst:1666 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: ../../library/argparse.rst:1666 +#: ../../library/argparse.rst:1670 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2958,17 +2966,17 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1677 +#: ../../library/argparse.rst:1681 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: ../../library/argparse.rst:1683 +#: ../../library/argparse.rst:1687 msgid "Beyond ``sys.argv``" msgstr "" -#: ../../library/argparse.rst:1685 +#: ../../library/argparse.rst:1689 msgid "" "Sometimes it may be useful to have an ArgumentParser parse arguments other " "than those of :data:`sys.argv`. This can be accomplished by passing a list " @@ -2976,7 +2984,7 @@ msgid "" "testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1690 +#: ../../library/argparse.rst:1694 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -3002,24 +3010,24 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1705 +#: ../../library/argparse.rst:1709 msgid "The Namespace object" msgstr "" -#: ../../library/argparse.rst:1709 +#: ../../library/argparse.rst:1713 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1712 +#: ../../library/argparse.rst:1716 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: ../../library/argparse.rst:1716 +#: ../../library/argparse.rst:1720 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3033,14 +3041,14 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1722 +#: ../../library/argparse.rst:1726 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:1726 +#: ../../library/argparse.rst:1730 msgid "" ">>> class C:\n" "... pass\n" @@ -3062,15 +3070,15 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1738 +#: ../../library/argparse.rst:1742 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1741 +#: ../../library/argparse.rst:1745 msgid "Sub-commands" msgstr "" -#: ../../library/argparse.rst:1748 +#: ../../library/argparse.rst:1752 msgid "" "Many programs split up their functionality into a number of sub-commands, " "for example, the ``svn`` program can invoke sub-commands like ``svn " @@ -3086,69 +3094,69 @@ msgid "" "can be modified as usual." msgstr "" -#: ../../library/argparse.rst:1760 +#: ../../library/argparse.rst:1764 msgid "Description of parameters:" msgstr "" -#: ../../library/argparse.rst:1762 +#: ../../library/argparse.rst:1766 msgid "" "title - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: ../../library/argparse.rst:1766 +#: ../../library/argparse.rst:1770 msgid "" "description - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1769 +#: ../../library/argparse.rst:1773 msgid "" "prog - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1773 +#: ../../library/argparse.rst:1777 msgid "" "parser_class - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. ArgumentParser)" msgstr "" -#: ../../library/argparse.rst:1776 +#: ../../library/argparse.rst:1780 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1779 +#: ../../library/argparse.rst:1783 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1782 +#: ../../library/argparse.rst:1786 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1785 +#: ../../library/argparse.rst:1789 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1787 +#: ../../library/argparse.rst:1791 msgid "" "metavar_ - string presenting available sub-commands in help; by default it " "is ``None`` and presents sub-commands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1790 +#: ../../library/argparse.rst:1794 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1792 +#: ../../library/argparse.rst:1796 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -3170,7 +3178,7 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -#: ../../library/argparse.rst:1811 +#: ../../library/argparse.rst:1815 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -3180,7 +3188,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1818 +#: ../../library/argparse.rst:1822 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -3189,7 +3197,7 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1826 +#: ../../library/argparse.rst:1830 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -3247,14 +3255,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1854 +#: ../../library/argparse.rst:1858 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: ../../library/argparse.rst:1858 +#: ../../library/argparse.rst:1862 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -3290,7 +3298,7 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1875 +#: ../../library/argparse.rst:1879 msgid "" "Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " "*aliases* argument, which allows multiple strings to refer to the same " @@ -3298,7 +3306,7 @@ msgid "" "``checkout``::" msgstr "" -#: ../../library/argparse.rst:1880 +#: ../../library/argparse.rst:1884 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -3314,13 +3322,13 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1887 +#: ../../library/argparse.rst:1891 msgid "" ":meth:`~_SubParsersAction.add_parser` supports also an additional " "*deprecated* argument, which allows to deprecate the subparser." msgstr "" -#: ../../library/argparse.rst:1901 +#: ../../library/argparse.rst:1905 msgid "" "One particularly effective way of handling sub-commands is to combine the " "use of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` " @@ -3328,7 +3336,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1906 +#: ../../library/argparse.rst:1910 msgid "" ">>> # sub-command functions\n" ">>> def foo(args):\n" @@ -3363,7 +3371,7 @@ msgid "" "((XYZYX))" msgstr "" -#: ../../library/argparse.rst:1938 +#: ../../library/argparse.rst:1942 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -3373,7 +3381,7 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1945 +#: ../../library/argparse.rst:1949 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -3393,15 +3401,15 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1954 +#: ../../library/argparse.rst:1958 msgid "New *required* keyword argument." msgstr "" -#: ../../library/argparse.rst:1959 +#: ../../library/argparse.rst:1963 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1963 +#: ../../library/argparse.rst:1967 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" @@ -3410,7 +3418,7 @@ msgid "" "the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1969 +#: ../../library/argparse.rst:1973 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -3428,14 +3436,14 @@ msgstr "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" -#: ../../library/argparse.rst:1975 +#: ../../library/argparse.rst:1979 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -#: ../../library/argparse.rst:1979 +#: ../../library/argparse.rst:1983 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -3447,15 +3455,15 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1984 +#: ../../library/argparse.rst:1988 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: ../../library/argparse.rst:1989 +#: ../../library/argparse.rst:1993 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1993 +#: ../../library/argparse.rst:1997 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " @@ -3464,7 +3472,7 @@ msgid "" "method::" msgstr "" -#: ../../library/argparse.rst:1999 +#: ../../library/argparse.rst:2003 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3488,7 +3496,7 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:2010 +#: ../../library/argparse.rst:2014 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" @@ -3499,7 +3507,7 @@ msgid "" "this display::" msgstr "" -#: ../../library/argparse.rst:2018 +#: ../../library/argparse.rst:2022 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3537,13 +3545,13 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:2036 +#: ../../library/argparse.rst:2040 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: ../../library/argparse.rst:2039 +#: ../../library/argparse.rst:2043 msgid "" "Calling :meth:`add_argument_group` on an argument group is deprecated. This " "feature was never supported and does not always work correctly. The function " @@ -3551,18 +3559,18 @@ msgid "" "future." msgstr "" -#: ../../library/argparse.rst:2047 +#: ../../library/argparse.rst:2051 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:2051 +#: ../../library/argparse.rst:2055 msgid "" "Create a mutually exclusive group. :mod:`argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: ../../library/argparse.rst:2055 +#: ../../library/argparse.rst:2059 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3588,14 +3596,14 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:2067 +#: ../../library/argparse.rst:2071 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: ../../library/argparse.rst:2071 +#: ../../library/argparse.rst:2075 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3613,7 +3621,7 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:2079 +#: ../../library/argparse.rst:2083 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." @@ -3621,7 +3629,7 @@ msgid "" "argument group that has a title and description. For example::" msgstr "" -#: ../../library/argparse.rst:2085 +#: ../../library/argparse.rst:2089 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3657,7 +3665,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:2102 +#: ../../library/argparse.rst:2106 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group is deprecated. These features were never " @@ -3665,11 +3673,11 @@ msgid "" "by accident through inheritance and will be removed in the future." msgstr "" -#: ../../library/argparse.rst:2110 +#: ../../library/argparse.rst:2114 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:2114 +#: ../../library/argparse.rst:2118 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -3678,7 +3686,7 @@ msgid "" "command line to be added::" msgstr "" -#: ../../library/argparse.rst:2120 +#: ../../library/argparse.rst:2124 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3692,12 +3700,12 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:2126 +#: ../../library/argparse.rst:2130 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" -#: ../../library/argparse.rst:2128 +#: ../../library/argparse.rst:2132 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3711,20 +3719,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:2134 +#: ../../library/argparse.rst:2138 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: ../../library/argparse.rst:2140 +#: ../../library/argparse.rst:2144 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: ../../library/argparse.rst:2144 +#: ../../library/argparse.rst:2148 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -3736,54 +3744,54 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:2151 +#: ../../library/argparse.rst:2155 msgid "Printing help" msgstr "" -#: ../../library/argparse.rst:2153 +#: ../../library/argparse.rst:2157 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: ../../library/argparse.rst:2159 +#: ../../library/argparse.rst:2163 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: ../../library/argparse.rst:2165 +#: ../../library/argparse.rst:2169 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: ../../library/argparse.rst:2169 +#: ../../library/argparse.rst:2173 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:2174 +#: ../../library/argparse.rst:2178 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:2179 +#: ../../library/argparse.rst:2183 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:2184 +#: ../../library/argparse.rst:2188 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:2188 +#: ../../library/argparse.rst:2192 msgid "" "Sometimes a script may only parse a few of the command-line arguments, " "passing the remaining arguments on to another script or program. In these " @@ -3794,7 +3802,7 @@ msgid "" "remaining argument strings." msgstr "" -#: ../../library/argparse.rst:2197 +#: ../../library/argparse.rst:2201 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -3808,7 +3816,7 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2204 +#: ../../library/argparse.rst:2208 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`~ArgumentParser.parse_known_args`. The parser may consume an option even if " @@ -3816,11 +3824,11 @@ msgid "" "remaining arguments list." msgstr "" -#: ../../library/argparse.rst:2211 +#: ../../library/argparse.rst:2215 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2215 +#: ../../library/argparse.rst:2219 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -3828,20 +3836,20 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2220 +#: ../../library/argparse.rst:2224 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: ../../library/argparse.rst:2224 +#: ../../library/argparse.rst:2228 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: ../../library/argparse.rst:2227 +#: ../../library/argparse.rst:2231 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -3851,18 +3859,18 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2233 +#: ../../library/argparse.rst:2237 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2237 +#: ../../library/argparse.rst:2241 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* to :data:`sys.stderr` before that. The user " "can override this method to handle these steps differently::" msgstr "" -#: ../../library/argparse.rst:2241 +#: ../../library/argparse.rst:2245 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3876,17 +3884,17 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2249 +#: ../../library/argparse.rst:2253 msgid "" "This method prints a usage message, including the *message*, to :data:`sys." "stderr` and terminates the program with a status code of 2." msgstr "" -#: ../../library/argparse.rst:2254 +#: ../../library/argparse.rst:2258 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2259 +#: ../../library/argparse.rst:2263 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -3894,7 +3902,7 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2264 +#: ../../library/argparse.rst:2268 msgid "" "These parsers do not support all the argparse features, and will raise " "exceptions if unsupported features are used. In particular, subparsers, and " @@ -3902,7 +3910,7 @@ msgid "" "not supported." msgstr "" -#: ../../library/argparse.rst:2269 +#: ../../library/argparse.rst:2273 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -3910,7 +3918,7 @@ msgid "" "collects all the positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2275 +#: ../../library/argparse.rst:2279 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3930,7 +3938,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2284 +#: ../../library/argparse.rst:2288 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -3938,11 +3946,11 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2294 +#: ../../library/argparse.rst:2298 msgid "Upgrading optparse code" msgstr "" -#: ../../library/argparse.rst:2296 +#: ../../library/argparse.rst:2300 msgid "" "Originally, the :mod:`argparse` module had attempted to maintain " "compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult " @@ -3953,47 +3961,47 @@ msgid "" "compatibility." msgstr "" -#: ../../library/argparse.rst:2303 +#: ../../library/argparse.rst:2307 msgid "" "The :mod:`argparse` module improves on the standard library :mod:`optparse` " "module in a number of ways including:" msgstr "" -#: ../../library/argparse.rst:2306 +#: ../../library/argparse.rst:2310 msgid "Handling positional arguments." msgstr "" -#: ../../library/argparse.rst:2307 +#: ../../library/argparse.rst:2311 msgid "Supporting sub-commands." msgstr "" -#: ../../library/argparse.rst:2308 +#: ../../library/argparse.rst:2312 msgid "Allowing alternative option prefixes like ``+`` and ``/``." msgstr "" -#: ../../library/argparse.rst:2309 +#: ../../library/argparse.rst:2313 msgid "Handling zero-or-more and one-or-more style arguments." msgstr "" -#: ../../library/argparse.rst:2310 +#: ../../library/argparse.rst:2314 msgid "Producing more informative usage messages." msgstr "" -#: ../../library/argparse.rst:2311 +#: ../../library/argparse.rst:2315 msgid "Providing a much simpler interface for custom ``type`` and ``action``." msgstr "" -#: ../../library/argparse.rst:2313 +#: ../../library/argparse.rst:2317 msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:" msgstr "" -#: ../../library/argparse.rst:2315 +#: ../../library/argparse.rst:2319 msgid "" "Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:" "`ArgumentParser.add_argument` calls." msgstr "" -#: ../../library/argparse.rst:2318 +#: ../../library/argparse.rst:2322 msgid "" "Replace ``(options, args) = parser.parse_args()`` with ``args = parser." "parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls " @@ -4001,78 +4009,78 @@ msgid "" "``options``, now in the :mod:`argparse` context is called ``args``." msgstr "" -#: ../../library/argparse.rst:2323 +#: ../../library/argparse.rst:2327 msgid "" "Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :" "meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:" "`~ArgumentParser.parse_args`." msgstr "" -#: ../../library/argparse.rst:2327 +#: ../../library/argparse.rst:2331 msgid "" "Replace callback actions and the ``callback_*`` keyword arguments with " "``type`` or ``action`` arguments." msgstr "" -#: ../../library/argparse.rst:2330 +#: ../../library/argparse.rst:2334 msgid "" "Replace string names for ``type`` keyword arguments with the corresponding " "type objects (e.g. int, float, complex, etc)." msgstr "" -#: ../../library/argparse.rst:2333 +#: ../../library/argparse.rst:2337 msgid "" "Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse." "OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`." msgstr "" -#: ../../library/argparse.rst:2337 +#: ../../library/argparse.rst:2341 msgid "" "Replace strings with implicit arguments such as ``%default`` or ``%prog`` " "with the standard Python syntax to use dictionaries to format strings, that " "is, ``%(default)s`` and ``%(prog)s``." msgstr "" -#: ../../library/argparse.rst:2341 +#: ../../library/argparse.rst:2345 msgid "" "Replace the OptionParser constructor ``version`` argument with a call to " "``parser.add_argument('--version', action='version', version='')``." msgstr "" -#: ../../library/argparse.rst:2345 +#: ../../library/argparse.rst:2349 msgid "Exceptions" msgstr "" -#: ../../library/argparse.rst:2349 +#: ../../library/argparse.rst:2353 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: ../../library/argparse.rst:2351 +#: ../../library/argparse.rst:2355 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: ../../library/argparse.rst:2356 +#: ../../library/argparse.rst:2360 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: ../../library/argparse.rst:982 +#: ../../library/argparse.rst:983 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/argparse.rst:982 ../../library/argparse.rst:1016 -#: ../../library/argparse.rst:1030 +#: ../../library/argparse.rst:983 ../../library/argparse.rst:1017 +#: ../../library/argparse.rst:1031 msgid "in argparse module" msgstr "於 argparse 模組中" -#: ../../library/argparse.rst:1016 +#: ../../library/argparse.rst:1017 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/argparse.rst:1030 +#: ../../library/argparse.rst:1031 msgid "+ (plus)" msgstr "+ (加號)" diff --git a/library/ast.po b/library/ast.po index a667e2bdc0..bf6a46b3ed 100644 --- a/library/ast.po +++ b/library/ast.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 15:56+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+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-" @@ -451,15 +451,15 @@ msgstr "" "parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" #: ../../library/ast.rst:176 -msgid "*body* is a :class:`list` of the module's :ref:`ast-statements`." -msgstr "*body* 是模組的\\ :ref:`ast-statements` 的一個 :class:`list`。" +msgid "``body`` is a :class:`list` of the module's :ref:`ast-statements`." +msgstr "``body`` 是模組的\\ :ref:`ast-statements` 的一個 :class:`list`。" #: ../../library/ast.rst:178 msgid "" -"*type_ignores* is a :class:`list` of the module's type ignore comments; see :" -"func:`ast.parse` for more details." +"``type_ignores`` is a :class:`list` of the module's type ignore comments; " +"see :func:`ast.parse` for more details." msgstr "" -"*type_ignores* 是模組的忽略型別註解的 :class:`list`;有關更多詳細資訊,請參" +"``type_ignores`` 是模組的忽略型別註解的 :class:`list`;有關更多詳細資訊,請參" "閱 :func:`ast.parse`。" #: ../../library/ast.rst:181 @@ -490,10 +490,10 @@ msgstr "" #: ../../library/ast.rst:197 msgid "" -"*body* is a single node, one of the :ref:`expression types `." msgstr "" -"*body* 是單個節點,是\\ :ref:`運算式型別 `\\ 的其中之一。" +"``body`` 是單個節點,是\\ :ref:`運算式型別 `\\ 的其中之一。" #: ../../library/ast.rst:200 ../../library/ast.rst:270 msgid "" @@ -514,9 +514,9 @@ msgstr "" "似。當 *mode* 是 ``\"single\"`` 時節點型別由 :func:`ast.parse` 生成。" #: ../../library/ast.rst:212 -msgid "*body* is a :class:`list` of :ref:`statement nodes `." +msgid "``body`` is a :class:`list` of :ref:`statement nodes `." msgstr "" -"*body* 是\\ :ref:`陳述式節點 (statement nodes) ` 的 :class:" +"``body`` 是\\ :ref:`陳述式節點 (statement nodes) ` 的 :class:" "`list`。" #: ../../library/ast.rst:214 @@ -570,13 +570,13 @@ msgstr "" #: ../../library/ast.rst:241 msgid "" -"*argtypes* is a :class:`list` of :ref:`expression nodes `." +"``argtypes`` is a :class:`list` of :ref:`expression nodes `." msgstr "" -"*argtypes* 是\\ :ref:`運算式節點 `\\ 的 :class:`list`。" +"``argtypes`` 是\\ :ref:`運算式節點 `\\ 的 :class:`list`。" #: ../../library/ast.rst:243 -msgid "*returns* is a single :ref:`expression node `." -msgstr "*returns* 是單個\\ :ref:`運算式節點 `。" +msgid "``returns`` is a single :ref:`expression node `." +msgstr "``returns`` 是單個\\ :ref:`運算式節點 `。" #: ../../library/ast.rst:245 msgid "" @@ -3133,16 +3133,16 @@ msgstr ":ref:`型別參數 `\\ 可以存在於類別、函式和型 #: ../../library/ast.rst:1769 msgid "" -"A :class:`typing.TypeVar`. *name* is the name of the type variable. *bound* " -"is the bound or constraints, if any. If *bound* is a :class:`Tuple`, it " -"represents constraints; otherwise it represents the bound. *default_value* " -"is the default value; if the :class:`!TypeVar` has no default, this " -"attribute will be set to ``None``." +"A :class:`typing.TypeVar`. ``name`` is the name of the type variable. " +"``bound`` is the bound or constraints, if any. If ``bound`` is a :class:" +"`Tuple`, it represents constraints; otherwise it represents the bound. " +"``default_value`` is the default value; if the :class:`!TypeVar` has no " +"default, this attribute will be set to ``None``." msgstr "" -"一個 :class:`typing.TypeVar`。*name* 是型別變數的名稱。*bound* 是(如果有存在" -"的)界限 (bound) 或約束 (constraint)。如果 *bound* 是一個 :class:`Tuple`,它" -"代表約束;否則它代表界限。*default_value* 為預設值;如果 :class:`!TypeVar` 沒" -"有預設值,那此屬性會被設為 ``None``。" +"一個 :class:`typing.TypeVar`。``name`` 是型別變數的名稱。``bound`` 是(如果有" +"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一個 :class:" +"`Tuple`,它代表約束;否則它代表界限。``default_value`` 為預設值;如果 :class:" +"`!TypeVar` 沒有預設值,那此屬性會被設為 ``None``。" #: ../../library/ast.rst:1775 msgid "" @@ -3185,12 +3185,12 @@ msgstr "新增 *default_value* 參數。" #: ../../library/ast.rst:1799 msgid "" -"A :class:`typing.ParamSpec`. *name* is the name of the parameter " -"specification. *default_value* is the default value; if the :class:`!" +"A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " +"specification. ``default_value`` is the default value; if the :class:`!" "ParamSpec` has no default, this attribute will be set to ``None``." msgstr "" -"一個 :class:`typing.ParamSpec`。*name* 是參數規範的名稱。*default_value* 是預" -"設值;如果 :class:`!ParamSpec` 沒有預設值,則該屬性將設定為 ``None``。" +"一個 :class:`typing.ParamSpec`。``name`` 是參數規範的名稱。``default_value`` " +"是預設值;如果 :class:`!ParamSpec` 沒有預設值,則該屬性將設定為 ``None``。" #: ../../library/ast.rst:1803 msgid "" @@ -3242,13 +3242,13 @@ msgstr "" #: ../../library/ast.rst:1834 msgid "" -"A :class:`typing.TypeVarTuple`. *name* is the name of the type variable " -"tuple. *default_value* is the default value; if the :class:`!TypeVarTuple` " +"A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " +"tuple. ``default_value`` is the default value; if the :class:`!TypeVarTuple` " "has no default, this attribute will be set to ``None``." msgstr "" -"一個 :class:`typing.TypeVarTuple`。*name* 是型別變數元組的名稱。" -"*default_value* 為預設值;如果 :class:`!TypeVarTuple` 沒有預設值,那此屬性會" -"被設為 ``None``。" +"一個 :class:`typing.TypeVarTuple`。``name`` 是型別變數元組的名稱。" +"``default_value`` 為預設值;如果 :class:`!TypeVarTuple` 沒有預設值,那此屬性" +"會被設為 ``None``。" #: ../../library/ast.rst:1838 msgid "" diff --git a/library/asyncio-task.po b/library/asyncio-task.po index ab4532b2ef..b4dd13ea2f 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -435,11 +435,11 @@ msgid "" " task.add_done_callback(background_tasks.discard)" msgstr "" -#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1141 +#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1188 msgid "Added the *name* parameter." msgstr "新增 *name* 參數。" -#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1148 +#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1195 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" @@ -502,9 +502,9 @@ msgstr "" msgid "Close the given coroutine if the task group is not active." msgstr "" -#: ../../library/asyncio-task.rst:345 ../../library/asyncio-task.rst:503 -#: ../../library/asyncio-task.rst:676 ../../library/asyncio-task.rst:734 -#: ../../library/asyncio-task.rst:760 ../../library/asyncio-task.rst:800 +#: ../../library/asyncio-task.rst:345 ../../library/asyncio-task.rst:550 +#: ../../library/asyncio-task.rst:723 ../../library/asyncio-task.rst:781 +#: ../../library/asyncio-task.rst:807 ../../library/asyncio-task.rst:847 msgid "Example::" msgstr "範例: ::" @@ -600,37 +600,92 @@ msgid "" msgstr "" #: ../../library/asyncio-task.rst:418 +msgid "Terminating a Task Group" +msgstr "" + +#: ../../library/asyncio-task.rst:420 +msgid "" +"While terminating a task group is not natively supported by the standard " +"library, termination can be achieved by adding an exception-raising task to " +"the task group and ignoring the raised exception:" +msgstr "" + +#: ../../library/asyncio-task.rst:424 +msgid "" +"import asyncio\n" +"from asyncio import TaskGroup\n" +"\n" +"class TerminateTaskGroup(Exception):\n" +" \"\"\"Exception raised to terminate a task group.\"\"\"\n" +"\n" +"async def force_terminate_task_group():\n" +" \"\"\"Used to force termination of a task group.\"\"\"\n" +" raise TerminateTaskGroup()\n" +"\n" +"async def job(task_id, sleep_time):\n" +" print(f'Task {task_id}: start')\n" +" await asyncio.sleep(sleep_time)\n" +" print(f'Task {task_id}: done')\n" +"\n" +"async def main():\n" +" try:\n" +" async with TaskGroup() as group:\n" +" # spawn some tasks\n" +" group.create_task(job(1, 0.5))\n" +" group.create_task(job(2, 1.5))\n" +" # sleep for 1 second\n" +" await asyncio.sleep(1)\n" +" # add an exception-raising task to force the group to terminate\n" +" group.create_task(force_terminate_task_group())\n" +" except* TerminateTaskGroup:\n" +" pass\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: ../../library/asyncio-task.rst:456 +msgid "Expected output:" +msgstr "預期的輸出: ::" + +#: ../../library/asyncio-task.rst:458 +msgid "" +"Task 1: start\n" +"Task 2: start\n" +"Task 1: done" +msgstr "" + +#: ../../library/asyncio-task.rst:465 msgid "Sleeping" msgstr "" -#: ../../library/asyncio-task.rst:422 +#: ../../library/asyncio-task.rst:469 msgid "Block for *delay* seconds." msgstr "" -#: ../../library/asyncio-task.rst:424 +#: ../../library/asyncio-task.rst:471 msgid "" "If *result* is provided, it is returned to the caller when the coroutine " "completes." msgstr "" -#: ../../library/asyncio-task.rst:427 +#: ../../library/asyncio-task.rst:474 msgid "" "``sleep()`` always suspends the current task, allowing other tasks to run." msgstr "" -#: ../../library/asyncio-task.rst:430 +#: ../../library/asyncio-task.rst:477 msgid "" "Setting the delay to 0 provides an optimized path to allow other tasks to " "run. This can be used by long-running functions to avoid blocking the event " "loop for the full duration of the function call." msgstr "" -#: ../../library/asyncio-task.rst:436 +#: ../../library/asyncio-task.rst:483 msgid "" "Example of coroutine displaying the current date every second for 5 seconds::" msgstr "" -#: ../../library/asyncio-task.rst:439 +#: ../../library/asyncio-task.rst:486 msgid "" "import asyncio\n" "import datetime\n" @@ -660,40 +715,40 @@ msgstr "" "\n" "asyncio.run(display_date())" -#: ../../library/asyncio-task.rst:454 ../../library/asyncio-task.rst:552 -#: ../../library/asyncio-task.rst:651 ../../library/asyncio-task.rst:825 -#: ../../library/asyncio-task.rst:879 ../../library/asyncio-task.rst:936 +#: ../../library/asyncio-task.rst:501 ../../library/asyncio-task.rst:599 +#: ../../library/asyncio-task.rst:698 ../../library/asyncio-task.rst:872 +#: ../../library/asyncio-task.rst:926 ../../library/asyncio-task.rst:983 msgid "Removed the *loop* parameter." msgstr "移除 *loop* 參數。" -#: ../../library/asyncio-task.rst:457 +#: ../../library/asyncio-task.rst:504 msgid "Raises :exc:`ValueError` if *delay* is :data:`~math.nan`." msgstr "" -#: ../../library/asyncio-task.rst:462 +#: ../../library/asyncio-task.rst:509 msgid "Running Tasks Concurrently" msgstr "" -#: ../../library/asyncio-task.rst:466 +#: ../../library/asyncio-task.rst:513 msgid "" "Run :ref:`awaitable objects ` in the *aws* sequence " "*concurrently*." msgstr "" -#: ../../library/asyncio-task.rst:469 +#: ../../library/asyncio-task.rst:516 msgid "" "If any awaitable in *aws* is a coroutine, it is automatically scheduled as a " "Task." msgstr "" -#: ../../library/asyncio-task.rst:472 +#: ../../library/asyncio-task.rst:519 msgid "" "If all awaitables are completed successfully, the result is an aggregate " "list of returned values. The order of result values corresponds to the " "order of awaitables in *aws*." msgstr "" -#: ../../library/asyncio-task.rst:476 +#: ../../library/asyncio-task.rst:523 msgid "" "If *return_exceptions* is ``False`` (default), the first raised exception is " "immediately propagated to the task that awaits on ``gather()``. Other " @@ -701,19 +756,19 @@ msgid "" "run." msgstr "" -#: ../../library/asyncio-task.rst:481 +#: ../../library/asyncio-task.rst:528 msgid "" "If *return_exceptions* is ``True``, exceptions are treated the same as " "successful results, and aggregated in the result list." msgstr "" -#: ../../library/asyncio-task.rst:484 +#: ../../library/asyncio-task.rst:531 msgid "" "If ``gather()`` is *cancelled*, all submitted awaitables (that have not " "completed yet) are also *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:487 +#: ../../library/asyncio-task.rst:534 msgid "" "If any Task or Future from the *aws* sequence is *cancelled*, it is treated " "as if it raised :exc:`CancelledError` -- the ``gather()`` call is **not** " @@ -721,7 +776,7 @@ msgid "" "submitted Task/Future to cause other Tasks/Futures to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:494 +#: ../../library/asyncio-task.rst:541 msgid "" "A new alternative to create and run tasks concurrently and wait for their " "completion is :class:`asyncio.TaskGroup`. *TaskGroup* provides stronger " @@ -731,7 +786,7 @@ msgid "" "tasks)." msgstr "" -#: ../../library/asyncio-task.rst:505 +#: ../../library/asyncio-task.rst:552 msgid "" "import asyncio\n" "\n" @@ -770,7 +825,7 @@ msgid "" "# [2, 6, 24]" msgstr "" -#: ../../library/asyncio-task.rst:541 +#: ../../library/asyncio-task.rst:588 msgid "" "If *return_exceptions* is false, cancelling gather() after it has been " "marked done won't cancel any submitted awaitables. For instance, gather can " @@ -779,28 +834,28 @@ msgid "" "the awaitables) from gather won't cancel any other awaitables." msgstr "" -#: ../../library/asyncio-task.rst:548 +#: ../../library/asyncio-task.rst:595 msgid "" "If the *gather* itself is cancelled, the cancellation is propagated " "regardless of *return_exceptions*." msgstr "" -#: ../../library/asyncio-task.rst:555 +#: ../../library/asyncio-task.rst:602 msgid "" "Deprecation warning is emitted if no positional arguments are provided or " "not all positional arguments are Future-like objects and there is no running " "event loop." msgstr "" -#: ../../library/asyncio-task.rst:564 +#: ../../library/asyncio-task.rst:611 msgid "Eager Task Factory" msgstr "" -#: ../../library/asyncio-task.rst:568 +#: ../../library/asyncio-task.rst:615 msgid "A task factory for eager task execution." msgstr "" -#: ../../library/asyncio-task.rst:570 +#: ../../library/asyncio-task.rst:617 msgid "" "When using this factory (via :meth:`loop.set_task_factory(asyncio." "eager_task_factory) `), coroutines begin execution " @@ -810,13 +865,13 @@ msgid "" "synchronously." msgstr "" -#: ../../library/asyncio-task.rst:576 +#: ../../library/asyncio-task.rst:623 msgid "" "A common example where this is beneficial is coroutines which employ caching " "or memoization to avoid actual I/O when possible." msgstr "" -#: ../../library/asyncio-task.rst:581 +#: ../../library/asyncio-task.rst:628 msgid "" "Immediate execution of the coroutine is a semantic change. If the coroutine " "returns or raises, the task is never scheduled to the event loop. If the " @@ -825,46 +880,46 @@ msgid "" "the application's task execution order is likely to change." msgstr "" -#: ../../library/asyncio-task.rst:592 +#: ../../library/asyncio-task.rst:639 msgid "" "Create an eager task factory, similar to :func:`eager_task_factory`, using " "the provided *custom_task_constructor* when creating a new task instead of " "the default :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:596 +#: ../../library/asyncio-task.rst:643 msgid "" "*custom_task_constructor* must be a *callable* with the signature matching " "the signature of :class:`Task.__init__ `. The callable must return a :" "class:`asyncio.Task`-compatible object." msgstr "" -#: ../../library/asyncio-task.rst:600 +#: ../../library/asyncio-task.rst:647 msgid "" "This function returns a *callable* intended to be used as a task factory of " "an event loop via :meth:`loop.set_task_factory(factory) `)." msgstr "" -#: ../../library/asyncio-task.rst:607 +#: ../../library/asyncio-task.rst:654 msgid "Shielding From Cancellation" msgstr "" -#: ../../library/asyncio-task.rst:611 +#: ../../library/asyncio-task.rst:658 msgid "" "Protect an :ref:`awaitable object ` from being :meth:" "`cancelled `." msgstr "" -#: ../../library/asyncio-task.rst:614 ../../library/asyncio-task.rst:780 +#: ../../library/asyncio-task.rst:661 ../../library/asyncio-task.rst:827 msgid "If *aw* is a coroutine it is automatically scheduled as a Task." msgstr "" -#: ../../library/asyncio-task.rst:616 +#: ../../library/asyncio-task.rst:663 msgid "The statement::" msgstr "" -#: ../../library/asyncio-task.rst:618 +#: ../../library/asyncio-task.rst:665 msgid "" "task = asyncio.create_task(something())\n" "res = await shield(task)" @@ -872,15 +927,15 @@ msgstr "" "task = asyncio.create_task(something())\n" "res = await shield(task)" -#: ../../library/asyncio-task.rst:621 +#: ../../library/asyncio-task.rst:668 msgid "is equivalent to::" msgstr "" -#: ../../library/asyncio-task.rst:623 +#: ../../library/asyncio-task.rst:670 msgid "res = await something()" msgstr "res = await something()" -#: ../../library/asyncio-task.rst:625 +#: ../../library/asyncio-task.rst:672 msgid "" "*except* that if the coroutine containing it is cancelled, the Task running " "in ``something()`` is not cancelled. From the point of view of " @@ -889,20 +944,20 @@ msgid "" "`CancelledError`." msgstr "" -#: ../../library/asyncio-task.rst:631 +#: ../../library/asyncio-task.rst:678 msgid "" "If ``something()`` is cancelled by other means (i.e. from within itself) " "that would also cancel ``shield()``." msgstr "" -#: ../../library/asyncio-task.rst:634 +#: ../../library/asyncio-task.rst:681 msgid "" "If it is desired to completely ignore cancellation (not recommended) the " "``shield()`` function should be combined with a try/except clause, as " "follows::" msgstr "" -#: ../../library/asyncio-task.rst:638 +#: ../../library/asyncio-task.rst:685 msgid "" "task = asyncio.create_task(something())\n" "try:\n" @@ -916,7 +971,7 @@ msgstr "" "except CancelledError:\n" " res = None" -#: ../../library/asyncio-task.rst:646 +#: ../../library/asyncio-task.rst:693 msgid "" "Save a reference to tasks passed to this function, to avoid a task " "disappearing mid-execution. The event loop only keeps weak references to " @@ -924,36 +979,36 @@ msgid "" "any time, even before it's done." msgstr "" -#: ../../library/asyncio-task.rst:654 +#: ../../library/asyncio-task.rst:701 msgid "" "Deprecation warning is emitted if *aw* is not Future-like object and there " "is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:660 +#: ../../library/asyncio-task.rst:707 msgid "Timeouts" msgstr "" -#: ../../library/asyncio-task.rst:664 +#: ../../library/asyncio-task.rst:711 msgid "" "Return an :ref:`asynchronous context manager ` that " "can be used to limit the amount of time spent waiting on something." msgstr "" -#: ../../library/asyncio-task.rst:668 +#: ../../library/asyncio-task.rst:715 msgid "" "*delay* can either be ``None``, or a float/int number of seconds to wait. If " "*delay* is ``None``, no time limit will be applied; this can be useful if " "the delay is unknown when the context manager is created." msgstr "" -#: ../../library/asyncio-task.rst:673 +#: ../../library/asyncio-task.rst:720 msgid "" "In either case, the context manager can be rescheduled after creation using :" "meth:`Timeout.reschedule`." msgstr "" -#: ../../library/asyncio-task.rst:678 +#: ../../library/asyncio-task.rst:725 msgid "" "async def main():\n" " async with asyncio.timeout(10):\n" @@ -963,7 +1018,7 @@ msgstr "" " async with asyncio.timeout(10):\n" " await long_running_task()" -#: ../../library/asyncio-task.rst:682 +#: ../../library/asyncio-task.rst:729 msgid "" "If ``long_running_task`` takes more than 10 seconds to complete, the context " "manager will cancel the current task and handle the resulting :exc:`asyncio." @@ -971,18 +1026,18 @@ msgid "" "can be caught and handled." msgstr "" -#: ../../library/asyncio-task.rst:689 +#: ../../library/asyncio-task.rst:736 msgid "" "The :func:`asyncio.timeout` context manager is what transforms the :exc:" "`asyncio.CancelledError` into a :exc:`TimeoutError`, which means the :exc:" "`TimeoutError` can only be caught *outside* of the context manager." msgstr "" -#: ../../library/asyncio-task.rst:694 +#: ../../library/asyncio-task.rst:741 msgid "Example of catching :exc:`TimeoutError`::" msgstr "" -#: ../../library/asyncio-task.rst:696 +#: ../../library/asyncio-task.rst:743 msgid "" "async def main():\n" " try:\n" @@ -994,48 +1049,48 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:705 +#: ../../library/asyncio-task.rst:752 msgid "" "The context manager produced by :func:`asyncio.timeout` can be rescheduled " "to a different deadline and inspected." msgstr "" -#: ../../library/asyncio-task.rst:710 +#: ../../library/asyncio-task.rst:757 msgid "" "An :ref:`asynchronous context manager ` for " "cancelling overdue coroutines." msgstr "" -#: ../../library/asyncio-task.rst:713 +#: ../../library/asyncio-task.rst:760 msgid "" "``when`` should be an absolute time at which the context should time out, as " "measured by the event loop's clock:" msgstr "" -#: ../../library/asyncio-task.rst:716 +#: ../../library/asyncio-task.rst:763 msgid "If ``when`` is ``None``, the timeout will never trigger." msgstr "" -#: ../../library/asyncio-task.rst:717 +#: ../../library/asyncio-task.rst:764 msgid "" "If ``when < loop.time()``, the timeout will trigger on the next iteration of " "the event loop." msgstr "" -#: ../../library/asyncio-task.rst:722 +#: ../../library/asyncio-task.rst:769 msgid "" "Return the current deadline, or ``None`` if the current deadline is not set." msgstr "" -#: ../../library/asyncio-task.rst:727 +#: ../../library/asyncio-task.rst:774 msgid "Reschedule the timeout." msgstr "" -#: ../../library/asyncio-task.rst:731 +#: ../../library/asyncio-task.rst:778 msgid "Return whether the context manager has exceeded its deadline (expired)." msgstr "" -#: ../../library/asyncio-task.rst:736 +#: ../../library/asyncio-task.rst:783 msgid "" "async def main():\n" " try:\n" @@ -1053,17 +1108,17 @@ msgid "" " print(\"Looks like we haven't finished on time.\")" msgstr "" -#: ../../library/asyncio-task.rst:751 +#: ../../library/asyncio-task.rst:798 msgid "Timeout context managers can be safely nested." msgstr "" -#: ../../library/asyncio-task.rst:757 +#: ../../library/asyncio-task.rst:804 msgid "" "Similar to :func:`asyncio.timeout`, except *when* is the absolute time to " "stop waiting, or ``None``." msgstr "" -#: ../../library/asyncio-task.rst:762 +#: ../../library/asyncio-task.rst:809 msgid "" "async def main():\n" " loop = get_running_loop()\n" @@ -1077,41 +1132,41 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:777 +#: ../../library/asyncio-task.rst:824 msgid "" "Wait for the *aw* :ref:`awaitable ` to complete with a " "timeout." msgstr "" -#: ../../library/asyncio-task.rst:782 +#: ../../library/asyncio-task.rst:829 msgid "" "*timeout* can either be ``None`` or a float or int number of seconds to wait " "for. If *timeout* is ``None``, block until the future completes." msgstr "" -#: ../../library/asyncio-task.rst:786 +#: ../../library/asyncio-task.rst:833 msgid "" "If a timeout occurs, it cancels the task and raises :exc:`TimeoutError`." msgstr "" -#: ../../library/asyncio-task.rst:789 +#: ../../library/asyncio-task.rst:836 msgid "" "To avoid the task :meth:`cancellation `, wrap it in :func:" "`shield`." msgstr "" -#: ../../library/asyncio-task.rst:792 +#: ../../library/asyncio-task.rst:839 msgid "" "The function will wait until the future is actually cancelled, so the total " "wait time may exceed the *timeout*. If an exception happens during " "cancellation, it is propagated." msgstr "" -#: ../../library/asyncio-task.rst:796 +#: ../../library/asyncio-task.rst:843 msgid "If the wait is cancelled, the future *aw* is also cancelled." msgstr "" -#: ../../library/asyncio-task.rst:802 +#: ../../library/asyncio-task.rst:849 msgid "" "async def eternity():\n" " # Sleep for one hour\n" @@ -1132,107 +1187,107 @@ msgid "" "# timeout!" msgstr "" -#: ../../library/asyncio-task.rst:820 +#: ../../library/asyncio-task.rst:867 msgid "" "When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be " "cancelled. Previously, it raised :exc:`TimeoutError` immediately." msgstr "" -#: ../../library/asyncio-task.rst:828 +#: ../../library/asyncio-task.rst:875 msgid "Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`." msgstr "引發 :exc:`TimeoutError` 而不是 :exc:`asyncio.TimeoutError`。" -#: ../../library/asyncio-task.rst:833 +#: ../../library/asyncio-task.rst:880 msgid "Waiting Primitives" msgstr "" -#: ../../library/asyncio-task.rst:837 +#: ../../library/asyncio-task.rst:884 msgid "" "Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the " "*aws* iterable concurrently and block until the condition specified by " "*return_when*." msgstr "" -#: ../../library/asyncio-task.rst:841 +#: ../../library/asyncio-task.rst:888 msgid "The *aws* iterable must not be empty." msgstr "" -#: ../../library/asyncio-task.rst:843 +#: ../../library/asyncio-task.rst:890 msgid "Returns two sets of Tasks/Futures: ``(done, pending)``." msgstr "" -#: ../../library/asyncio-task.rst:845 +#: ../../library/asyncio-task.rst:892 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-task.rst:847 +#: ../../library/asyncio-task.rst:894 msgid "done, pending = await asyncio.wait(aws)" msgstr "done, pending = await asyncio.wait(aws)" -#: ../../library/asyncio-task.rst:849 +#: ../../library/asyncio-task.rst:896 msgid "" "*timeout* (a float or int), if specified, can be used to control the maximum " "number of seconds to wait before returning." msgstr "" -#: ../../library/asyncio-task.rst:852 +#: ../../library/asyncio-task.rst:899 msgid "" "Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks " "that aren't done when the timeout occurs are simply returned in the second " "set." msgstr "" -#: ../../library/asyncio-task.rst:856 +#: ../../library/asyncio-task.rst:903 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: ../../library/asyncio-task.rst:862 +#: ../../library/asyncio-task.rst:909 msgid "Constant" msgstr "常數" -#: ../../library/asyncio-task.rst:863 +#: ../../library/asyncio-task.rst:910 msgid "Description" msgstr "描述" -#: ../../library/asyncio-task.rst:866 +#: ../../library/asyncio-task.rst:913 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: ../../library/asyncio-task.rst:869 +#: ../../library/asyncio-task.rst:916 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" "`ALL_COMPLETED`." msgstr "" -#: ../../library/asyncio-task.rst:874 +#: ../../library/asyncio-task.rst:921 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: ../../library/asyncio-task.rst:876 +#: ../../library/asyncio-task.rst:923 msgid "" "Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the futures " "when a timeout occurs." msgstr "" -#: ../../library/asyncio-task.rst:882 +#: ../../library/asyncio-task.rst:929 msgid "Passing coroutine objects to ``wait()`` directly is forbidden." msgstr "" -#: ../../library/asyncio-task.rst:885 ../../library/asyncio-task.rst:943 +#: ../../library/asyncio-task.rst:932 ../../library/asyncio-task.rst:990 msgid "Added support for generators yielding tasks." msgstr "" -#: ../../library/asyncio-task.rst:891 +#: ../../library/asyncio-task.rst:938 msgid "" "Run :ref:`awaitable objects ` in the *aws* iterable " "concurrently. The returned object can be iterated to obtain the results of " "the awaitables as they finish." msgstr "" -#: ../../library/asyncio-task.rst:895 +#: ../../library/asyncio-task.rst:942 msgid "" "The object returned by ``as_completed()`` can be iterated as an :term:" "`asynchronous iterator` or a plain :term:`iterator`. When asynchronous " @@ -1241,7 +1296,7 @@ msgid "" "tasks with their results. Example::" msgstr "" -#: ../../library/asyncio-task.rst:901 +#: ../../library/asyncio-task.rst:948 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1258,20 +1313,20 @@ msgid "" " print(\"IPv4 connection established.\")" msgstr "" -#: ../../library/asyncio-task.rst:915 +#: ../../library/asyncio-task.rst:962 msgid "" "During asynchronous iteration, implicitly-created tasks will be yielded for " "supplied awaitables that aren't tasks or futures." msgstr "" -#: ../../library/asyncio-task.rst:918 +#: ../../library/asyncio-task.rst:965 msgid "" "When used as a plain iterator, each iteration yields a new coroutine that " "returns the result or raises the exception of the next completed awaitable. " "This pattern is compatible with Python versions older than 3.13::" msgstr "" -#: ../../library/asyncio-task.rst:922 +#: ../../library/asyncio-task.rst:969 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1284,34 +1339,34 @@ msgid "" " reader, writer = await next_connect" msgstr "" -#: ../../library/asyncio-task.rst:932 +#: ../../library/asyncio-task.rst:979 msgid "" "A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables " "are done. This is raised by the ``async for`` loop during asynchronous " "iteration or by the coroutines yielded during plain iteration." msgstr "" -#: ../../library/asyncio-task.rst:939 +#: ../../library/asyncio-task.rst:986 msgid "" "Deprecation warning is emitted if not all awaitable objects in the *aws* " "iterable are Future-like objects and there is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:946 +#: ../../library/asyncio-task.rst:993 msgid "" "The result can now be used as either an :term:`asynchronous iterator` or as " "a plain :term:`iterator` (previously it was only a plain iterator)." msgstr "" -#: ../../library/asyncio-task.rst:952 +#: ../../library/asyncio-task.rst:999 msgid "Running in Threads" msgstr "" -#: ../../library/asyncio-task.rst:956 +#: ../../library/asyncio-task.rst:1003 msgid "Asynchronously run function *func* in a separate thread." msgstr "" -#: ../../library/asyncio-task.rst:958 +#: ../../library/asyncio-task.rst:1005 msgid "" "Any \\*args and \\*\\*kwargs supplied for this function are directly passed " "to *func*. Also, the current :class:`contextvars.Context` is propagated, " @@ -1319,19 +1374,19 @@ msgid "" "separate thread." msgstr "" -#: ../../library/asyncio-task.rst:963 +#: ../../library/asyncio-task.rst:1010 msgid "" "Return a coroutine that can be awaited to get the eventual result of *func*." msgstr "" -#: ../../library/asyncio-task.rst:965 +#: ../../library/asyncio-task.rst:1012 msgid "" "This coroutine function is primarily intended to be used for executing IO-" "bound functions/methods that would otherwise block the event loop if they " "were run in the main thread. For example::" msgstr "" -#: ../../library/asyncio-task.rst:969 +#: ../../library/asyncio-task.rst:1016 msgid "" "def blocking_io():\n" " print(f\"start blocking_io at {time.strftime('%X')}\")\n" @@ -1360,7 +1415,7 @@ msgid "" "# finished main at 19:50:54" msgstr "" -#: ../../library/asyncio-task.rst:995 +#: ../../library/asyncio-task.rst:1042 msgid "" "Directly calling ``blocking_io()`` in any coroutine would block the event " "loop for its duration, resulting in an additional 1 second of run time. " @@ -1368,7 +1423,7 @@ msgid "" "thread without blocking the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1002 +#: ../../library/asyncio-task.rst:1049 msgid "" "Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used " "to make IO-bound functions non-blocking. However, for extension modules that " @@ -1376,27 +1431,27 @@ msgid "" "``asyncio.to_thread()`` can also be used for CPU-bound functions." msgstr "" -#: ../../library/asyncio-task.rst:1011 +#: ../../library/asyncio-task.rst:1058 msgid "Scheduling From Other Threads" msgstr "" -#: ../../library/asyncio-task.rst:1015 +#: ../../library/asyncio-task.rst:1062 msgid "Submit a coroutine to the given event loop. Thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1017 +#: ../../library/asyncio-task.rst:1064 msgid "" "Return a :class:`concurrent.futures.Future` to wait for the result from " "another OS thread." msgstr "" -#: ../../library/asyncio-task.rst:1020 +#: ../../library/asyncio-task.rst:1067 msgid "" "This function is meant to be called from a different OS thread than the one " "where the event loop is running. Example::" msgstr "" -#: ../../library/asyncio-task.rst:1023 +#: ../../library/asyncio-task.rst:1070 msgid "" "# Create a coroutine\n" "coro = asyncio.sleep(1, result=3)\n" @@ -1408,13 +1463,13 @@ msgid "" "assert future.result(timeout) == 3" msgstr "" -#: ../../library/asyncio-task.rst:1032 +#: ../../library/asyncio-task.rst:1079 msgid "" "If an exception is raised in the coroutine, the returned Future will be " "notified. It can also be used to cancel the task in the event loop::" msgstr "" -#: ../../library/asyncio-task.rst:1036 +#: ../../library/asyncio-task.rst:1083 msgid "" "try:\n" " result = future.result(timeout)\n" @@ -1427,59 +1482,59 @@ msgid "" " print(f'The coroutine returned: {result!r}')" msgstr "" -#: ../../library/asyncio-task.rst:1046 +#: ../../library/asyncio-task.rst:1093 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "" -#: ../../library/asyncio-task.rst:1049 +#: ../../library/asyncio-task.rst:1096 msgid "" "Unlike other asyncio functions this function requires the *loop* argument to " "be passed explicitly." msgstr "" -#: ../../library/asyncio-task.rst:1056 +#: ../../library/asyncio-task.rst:1103 msgid "Introspection" msgstr "" -#: ../../library/asyncio-task.rst:1061 +#: ../../library/asyncio-task.rst:1108 msgid "" "Return the currently running :class:`Task` instance, or ``None`` if no task " "is running." msgstr "" -#: ../../library/asyncio-task.rst:1064 +#: ../../library/asyncio-task.rst:1111 msgid "" "If *loop* is ``None`` :func:`get_running_loop` is used to get the current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1072 +#: ../../library/asyncio-task.rst:1119 msgid "Return a set of not yet finished :class:`Task` objects run by the loop." msgstr "" -#: ../../library/asyncio-task.rst:1075 +#: ../../library/asyncio-task.rst:1122 msgid "" "If *loop* is ``None``, :func:`get_running_loop` is used for getting current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1083 +#: ../../library/asyncio-task.rst:1130 msgid "Return ``True`` if *obj* is a coroutine object." msgstr "" -#: ../../library/asyncio-task.rst:1089 +#: ../../library/asyncio-task.rst:1136 msgid "Task Object" msgstr "" -#: ../../library/asyncio-task.rst:1093 +#: ../../library/asyncio-task.rst:1140 msgid "" "A :class:`Future-like ` object that runs a Python :ref:`coroutine " "`. Not thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1096 +#: ../../library/asyncio-task.rst:1143 msgid "" "Tasks are used to run coroutines in event loops. If a coroutine awaits on a " "Future, the Task suspends the execution of the coroutine and waits for the " @@ -1487,21 +1542,21 @@ msgid "" "wrapped coroutine resumes." msgstr "" -#: ../../library/asyncio-task.rst:1102 +#: ../../library/asyncio-task.rst:1149 msgid "" "Event loops use cooperative scheduling: an event loop runs one Task at a " "time. While a Task awaits for the completion of a Future, the event loop " "runs other Tasks, callbacks, or performs IO operations." msgstr "" -#: ../../library/asyncio-task.rst:1107 +#: ../../library/asyncio-task.rst:1154 msgid "" "Use the high-level :func:`asyncio.create_task` function to create Tasks, or " "the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. " "Manual instantiation of Tasks is discouraged." msgstr "" -#: ../../library/asyncio-task.rst:1112 +#: ../../library/asyncio-task.rst:1159 msgid "" "To cancel a running Task use the :meth:`cancel` method. Calling it will " "cause the Task to throw a :exc:`CancelledError` exception into the wrapped " @@ -1509,20 +1564,20 @@ msgid "" "cancellation, the Future object will be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1117 +#: ../../library/asyncio-task.rst:1164 msgid "" ":meth:`cancelled` can be used to check if the Task was cancelled. The method " "returns ``True`` if the wrapped coroutine did not suppress the :exc:" "`CancelledError` exception and was actually cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1122 +#: ../../library/asyncio-task.rst:1169 msgid "" ":class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :" "meth:`Future.set_result` and :meth:`Future.set_exception`." msgstr "" -#: ../../library/asyncio-task.rst:1126 +#: ../../library/asyncio-task.rst:1173 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *coro* to run in. If no *context* is " @@ -1530,7 +1585,7 @@ msgid "" "in the copied context." msgstr "" -#: ../../library/asyncio-task.rst:1131 +#: ../../library/asyncio-task.rst:1178 msgid "" "An optional keyword-only *eager_start* argument allows eagerly starting the " "execution of the :class:`asyncio.Task` at task creation time. If set to " @@ -1540,96 +1595,96 @@ msgid "" "eagerly and will skip scheduling to the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1138 +#: ../../library/asyncio-task.rst:1185 msgid "Added support for the :mod:`contextvars` module." msgstr "" -#: ../../library/asyncio-task.rst:1144 +#: ../../library/asyncio-task.rst:1191 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" -#: ../../library/asyncio-task.rst:1151 +#: ../../library/asyncio-task.rst:1198 msgid "Added the *eager_start* parameter." msgstr "新增 *eager_start* 參數。" -#: ../../library/asyncio-task.rst:1156 +#: ../../library/asyncio-task.rst:1203 msgid "Return ``True`` if the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1158 +#: ../../library/asyncio-task.rst:1205 msgid "" "A Task is *done* when the wrapped coroutine either returned a value, raised " "an exception, or the Task was cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1163 +#: ../../library/asyncio-task.rst:1210 msgid "Return the result of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1165 +#: ../../library/asyncio-task.rst:1212 msgid "" "If the Task is *done*, the result of the wrapped coroutine is returned (or " "if the coroutine raised an exception, that exception is re-raised.)" msgstr "" -#: ../../library/asyncio-task.rst:1169 ../../library/asyncio-task.rst:1183 +#: ../../library/asyncio-task.rst:1216 ../../library/asyncio-task.rst:1230 msgid "" "If the Task has been *cancelled*, this method raises a :exc:`CancelledError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1172 +#: ../../library/asyncio-task.rst:1219 msgid "" "If the Task's result isn't yet available, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" -#: ../../library/asyncio-task.rst:1177 +#: ../../library/asyncio-task.rst:1224 msgid "Return the exception of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1179 +#: ../../library/asyncio-task.rst:1226 msgid "" "If the wrapped coroutine raised an exception that exception is returned. If " "the wrapped coroutine returned normally this method returns ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1186 +#: ../../library/asyncio-task.rst:1233 msgid "" "If the Task isn't *done* yet, this method raises an :exc:`InvalidStateError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1191 +#: ../../library/asyncio-task.rst:1238 msgid "Add a callback to be run when the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1193 ../../library/asyncio-task.rst:1202 +#: ../../library/asyncio-task.rst:1240 ../../library/asyncio-task.rst:1249 msgid "This method should only be used in low-level callback-based code." msgstr "" -#: ../../library/asyncio-task.rst:1195 +#: ../../library/asyncio-task.rst:1242 msgid "" "See the documentation of :meth:`Future.add_done_callback` for more details." msgstr "" -#: ../../library/asyncio-task.rst:1200 +#: ../../library/asyncio-task.rst:1247 msgid "Remove *callback* from the callbacks list." msgstr "" -#: ../../library/asyncio-task.rst:1204 +#: ../../library/asyncio-task.rst:1251 msgid "" "See the documentation of :meth:`Future.remove_done_callback` for more " "details." msgstr "" -#: ../../library/asyncio-task.rst:1209 +#: ../../library/asyncio-task.rst:1256 msgid "Return the list of stack frames for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1211 +#: ../../library/asyncio-task.rst:1258 msgid "" "If the wrapped coroutine is not done, this returns the stack where it is " "suspended. If the coroutine has completed successfully or was cancelled, " @@ -1637,15 +1692,15 @@ msgid "" "this returns the list of traceback frames." msgstr "" -#: ../../library/asyncio-task.rst:1217 +#: ../../library/asyncio-task.rst:1264 msgid "The frames are always ordered from oldest to newest." msgstr "" -#: ../../library/asyncio-task.rst:1219 +#: ../../library/asyncio-task.rst:1266 msgid "Only one stack frame is returned for a suspended coroutine." msgstr "" -#: ../../library/asyncio-task.rst:1221 +#: ../../library/asyncio-task.rst:1268 msgid "" "The optional *limit* argument sets the maximum number of frames to return; " "by default all available frames are returned. The ordering of the returned " @@ -1654,81 +1709,81 @@ msgid "" "are returned. (This matches the behavior of the traceback module.)" msgstr "" -#: ../../library/asyncio-task.rst:1230 +#: ../../library/asyncio-task.rst:1277 msgid "Print the stack or traceback for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1232 +#: ../../library/asyncio-task.rst:1279 msgid "" "This produces output similar to that of the traceback module for the frames " "retrieved by :meth:`get_stack`." msgstr "" -#: ../../library/asyncio-task.rst:1235 +#: ../../library/asyncio-task.rst:1282 msgid "The *limit* argument is passed to :meth:`get_stack` directly." msgstr "" -#: ../../library/asyncio-task.rst:1237 +#: ../../library/asyncio-task.rst:1284 msgid "" "The *file* argument is an I/O stream to which the output is written; by " "default output is written to :data:`sys.stdout`." msgstr "" -#: ../../library/asyncio-task.rst:1242 +#: ../../library/asyncio-task.rst:1289 msgid "Return the coroutine object wrapped by the :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:1246 +#: ../../library/asyncio-task.rst:1293 msgid "" "This will return ``None`` for Tasks which have already completed eagerly. " "See the :ref:`Eager Task Factory `." msgstr "" -#: ../../library/asyncio-task.rst:1253 +#: ../../library/asyncio-task.rst:1300 msgid "Newly added eager task execution means result may be ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1257 +#: ../../library/asyncio-task.rst:1304 msgid "" "Return the :class:`contextvars.Context` object associated with the task." msgstr "" -#: ../../library/asyncio-task.rst:1264 +#: ../../library/asyncio-task.rst:1311 msgid "Return the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1266 +#: ../../library/asyncio-task.rst:1313 msgid "" "If no name has been explicitly assigned to the Task, the default asyncio " "Task implementation generates a default name during instantiation." msgstr "" -#: ../../library/asyncio-task.rst:1274 +#: ../../library/asyncio-task.rst:1321 msgid "Set the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1276 +#: ../../library/asyncio-task.rst:1323 msgid "" "The *value* argument can be any object, which is then converted to a string." msgstr "" -#: ../../library/asyncio-task.rst:1279 +#: ../../library/asyncio-task.rst:1326 msgid "" "In the default Task implementation, the name will be visible in the :func:" "`repr` output of a task object." msgstr "" -#: ../../library/asyncio-task.rst:1286 +#: ../../library/asyncio-task.rst:1333 msgid "Request the Task to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1288 +#: ../../library/asyncio-task.rst:1335 msgid "" "This arranges for a :exc:`CancelledError` exception to be thrown into the " "wrapped coroutine on the next cycle of the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1291 +#: ../../library/asyncio-task.rst:1338 msgid "" "The coroutine then has a chance to clean up or even deny the request by " "suppressing the exception with a :keyword:`try` ... ... ``except " @@ -1740,21 +1795,21 @@ msgid "" "addition to catching the exception." msgstr "" -#: ../../library/asyncio-task.rst:1301 +#: ../../library/asyncio-task.rst:1348 msgid "Added the *msg* parameter." msgstr "新增 *msg* 參數。" -#: ../../library/asyncio-task.rst:1304 +#: ../../library/asyncio-task.rst:1351 msgid "The ``msg`` parameter is propagated from cancelled task to its awaiter." msgstr "" -#: ../../library/asyncio-task.rst:1309 +#: ../../library/asyncio-task.rst:1356 msgid "" "The following example illustrates how coroutines can intercept the " "cancellation request::" msgstr "" -#: ../../library/asyncio-task.rst:1312 +#: ../../library/asyncio-task.rst:1359 msgid "" "async def cancel_me():\n" " print('cancel_me(): before sleep')\n" @@ -1791,32 +1846,32 @@ msgid "" "# main(): cancel_me is cancelled now" msgstr "" -#: ../../library/asyncio-task.rst:1348 +#: ../../library/asyncio-task.rst:1395 msgid "Return ``True`` if the Task is *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:1350 +#: ../../library/asyncio-task.rst:1397 msgid "" "The Task is *cancelled* when the cancellation was requested with :meth:" "`cancel` and the wrapped coroutine propagated the :exc:`CancelledError` " "exception thrown into it." msgstr "" -#: ../../library/asyncio-task.rst:1356 +#: ../../library/asyncio-task.rst:1403 msgid "Decrement the count of cancellation requests to this Task." msgstr "" -#: ../../library/asyncio-task.rst:1358 +#: ../../library/asyncio-task.rst:1405 msgid "Returns the remaining number of cancellation requests." msgstr "" -#: ../../library/asyncio-task.rst:1360 +#: ../../library/asyncio-task.rst:1407 msgid "" "Note that once execution of a cancelled task completed, further calls to :" "meth:`uncancel` are ineffective." msgstr "" -#: ../../library/asyncio-task.rst:1365 +#: ../../library/asyncio-task.rst:1412 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. In particular, if a Task gets successfully uncancelled, this " @@ -1825,7 +1880,7 @@ msgid "" "respective structured block. For example::" msgstr "" -#: ../../library/asyncio-task.rst:1372 +#: ../../library/asyncio-task.rst:1419 msgid "" "async def make_request_with_timeout():\n" " try:\n" @@ -1839,7 +1894,7 @@ msgid "" " await unrelated_code()" msgstr "" -#: ../../library/asyncio-task.rst:1383 +#: ../../library/asyncio-task.rst:1430 msgid "" "While the block with ``make_request()`` and ``make_another_request()`` might " "get cancelled due to the timeout, ``unrelated_code()`` should continue " @@ -1848,14 +1903,14 @@ msgid "" "similar fashion." msgstr "" -#: ../../library/asyncio-task.rst:1389 +#: ../../library/asyncio-task.rst:1436 msgid "" "If end-user code is, for some reason, suppressing cancellation by catching :" "exc:`CancelledError`, it needs to call this method to remove the " "cancellation state." msgstr "" -#: ../../library/asyncio-task.rst:1393 +#: ../../library/asyncio-task.rst:1440 msgid "" "When this method decrements the cancellation count to zero, the method " "checks if a previous :meth:`cancel` call had arranged for :exc:" @@ -1864,17 +1919,17 @@ msgid "" "``_must_cancel`` flag)." msgstr "" -#: ../../library/asyncio-task.rst:1399 +#: ../../library/asyncio-task.rst:1446 msgid "Changed to rescind pending cancellation requests upon reaching zero." msgstr "" -#: ../../library/asyncio-task.rst:1404 +#: ../../library/asyncio-task.rst:1451 msgid "" "Return the number of pending cancellation requests to this Task, i.e., the " "number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls." msgstr "" -#: ../../library/asyncio-task.rst:1408 +#: ../../library/asyncio-task.rst:1455 msgid "" "Note that if this number is greater than zero but the Task is still " "executing, :meth:`cancelled` will still return ``False``. This is because " @@ -1883,7 +1938,7 @@ msgid "" "to zero." msgstr "" -#: ../../library/asyncio-task.rst:1414 +#: ../../library/asyncio-task.rst:1461 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. See :meth:`uncancel` for more details." diff --git a/library/calendar.po b/library/calendar.po index 4365ce363d..564f71a8d6 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-26 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -532,22 +532,24 @@ msgid "The :mod:`calendar` module exports the following data attributes:" msgstr ":mod:`calendar` 模組匯出以下資料屬性:" #: ../../library/calendar.rst:396 -msgid "An array that represents the days of the week in the current locale." -msgstr "以目前語系來表示的一週每一天名稱的陣列。" +msgid "" +"A sequence that represents the days of the week in the current locale, where " +"Monday is day number 0." +msgstr "以目前語系來表示的一週每一天名稱的序列,其中週一是第 0 天。" -#: ../../library/calendar.rst:401 +#: ../../library/calendar.rst:406 msgid "" -"An array that represents the abbreviated days of the week in the current " -"locale." -msgstr "以目前語系來表示的一週每一天縮寫名稱的陣列。" +"A sequence that represents the abbreviated days of the week in the current " +"locale, where Mon is day number 0." +msgstr "以目前語系來表示的一週每一天縮寫名稱的序列,其中 Mon 是第 0 天。" -#: ../../library/calendar.rst:412 +#: ../../library/calendar.rst:421 msgid "" "Aliases for the days of the week, where ``MONDAY`` is ``0`` and ``SUNDAY`` " "is ``6``." msgstr "一週每一天的別名,其中 ``MONDAY`` 是 ``0`` 而 ``SUNDAY`` 是 ``6``。" -#: ../../library/calendar.rst:420 +#: ../../library/calendar.rst:429 msgid "" "Enumeration defining days of the week as integer constants. The members of " "this enumeration are exported to the module scope as :data:`MONDAY` through :" @@ -556,32 +558,32 @@ msgstr "" "將一週中的幾天定義為整數常數的列舉。此列舉的成員將作為 :data:`MONDAY` 到 :" "data:`SUNDAY` 匯出到模組作用域。" -#: ../../library/calendar.rst:429 +#: ../../library/calendar.rst:438 msgid "" -"An array that represents the months of the year in the current locale. This " -"follows normal convention of January being month number 1, so it has a " +"A sequence that represents the months of the year in the current locale. " +"This follows normal convention of January being month number 1, so it has a " "length of 13 and ``month_name[0]`` is the empty string." msgstr "" -"以目前語系來表示的一年每個月份名稱的陣列。它按照一般慣例以數字 1 代表一月,因" +"以目前語系來表示的一年每個月份名稱的序列。它按照一般慣例以數字 1 代表一月,因" "此它的長度為 13,而 ``month_name[0]`` 是空字串。" -#: ../../library/calendar.rst:436 +#: ../../library/calendar.rst:449 msgid "" -"An array that represents the abbreviated months of the year in the current " +"A sequence that represents the abbreviated months of the year in the current " "locale. This follows normal convention of January being month number 1, so " "it has a length of 13 and ``month_abbr[0]`` is the empty string." msgstr "" -"以目前語系來表示的一年每個月份縮寫名稱的陣列。它按照一般慣例以數字 1 代表一" +"以目前語系來表示的一年每個月份縮寫名稱的序列。它按照一般慣例以數字 1 代表一" "月,因此它的長度為 13,而 ``month_abbr[0]`` 是空字串。" -#: ../../library/calendar.rst:454 +#: ../../library/calendar.rst:470 msgid "" "Aliases for the months of the year, where ``JANUARY`` is ``1`` and " "``DECEMBER`` is ``12``." msgstr "" "一年內每個月的別名,其中 ``JANUARY`` 是 ``ㄅ`` 而 ``DECEMBER`` 是 ``12``。" -#: ../../library/calendar.rst:462 +#: ../../library/calendar.rst:478 msgid "" "Enumeration defining months of the year as integer constants. The members of " "this enumeration are exported to the module scope as :data:`JANUARY` " @@ -590,62 +592,61 @@ msgstr "" "將一年中的月份定義為整數常數的列舉。此列舉的成員將作為 :data:`JANUARY` 到 :" "data:`DECEMBER` 匯出到模組作用域。" -#: ../../library/calendar.rst:469 +#: ../../library/calendar.rst:485 msgid "The :mod:`calendar` module defines the following exceptions:" msgstr ":mod:`calendar` 模組定義了以下例外:" -#: ../../library/calendar.rst:473 +#: ../../library/calendar.rst:489 msgid "" "A subclass of :exc:`ValueError`, raised when the given month number is " "outside of the range 1-12 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的月份數字超出 1-12 範圍(含)時引發。" -#: ../../library/calendar.rst:478 +#: ../../library/calendar.rst:494 msgid "The invalid month number." msgstr "無效的月份號。" -#: ../../library/calendar.rst:483 +#: ../../library/calendar.rst:499 msgid "" "A subclass of :exc:`ValueError`, raised when the given weekday number is " "outside of the range 0-6 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的週幾的數字超出 0-6(含)範圍時引發。" -#: ../../library/calendar.rst:488 +#: ../../library/calendar.rst:504 msgid "The invalid weekday number." msgstr "無效的週幾編號。" -#: ../../library/calendar.rst:493 +#: ../../library/calendar.rst:509 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/calendar.rst:494 +#: ../../library/calendar.rst:510 msgid "" "Object-oriented interface to dates and times with similar functionality to " "the :mod:`time` module." msgstr "日期與時間的物件導向介面,和 :mod:`time` 模組有相似的功能。" -#: ../../library/calendar.rst:497 +#: ../../library/calendar.rst:513 msgid "Module :mod:`time`" msgstr ":mod:`time` 模組" -#: ../../library/calendar.rst:498 +#: ../../library/calendar.rst:514 msgid "Low-level time related functions." msgstr "底層的時間相關函式。" -#: ../../library/calendar.rst:504 +#: ../../library/calendar.rst:520 msgid "Command-Line Usage" msgstr "命令列用法" -#: ../../library/calendar.rst:508 +#: ../../library/calendar.rst:524 msgid "" "The :mod:`calendar` module can be executed as a script from the command line " "to interactively print a calendar." msgstr ":mod:`calendar` 模組可以作為腳本從命令列執行,並以互動方式列印日曆。" -#: ../../library/calendar.rst:511 -#, fuzzy +#: ../../library/calendar.rst:527 msgid "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" @@ -653,13 +654,13 @@ msgid "" msgstr "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" -" [year] [month]" +" [-f FIRST_WEEKDAY] [year] [month]" -#: ../../library/calendar.rst:518 +#: ../../library/calendar.rst:534 msgid "For example, to print a calendar for the year 2000:" msgstr "例如,要列印 2000 年的日曆:" -#: ../../library/calendar.rst:520 +#: ../../library/calendar.rst:536 msgid "" "$ python -m calendar 2000\n" " 2000\n" @@ -737,42 +738,40 @@ msgstr "" "23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31\n" "30 31" -#: ../../library/calendar.rst:561 +#: ../../library/calendar.rst:577 msgid "The following options are accepted:" msgstr "接受以下選項:" -#: ../../library/calendar.rst:568 +#: ../../library/calendar.rst:584 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/calendar.rst:573 +#: ../../library/calendar.rst:589 msgid "The locale to use for month and weekday names. Defaults to English." msgstr "用於月份和週幾名稱的語系。預設為英語。" -#: ../../library/calendar.rst:579 +#: ../../library/calendar.rst:595 msgid "" "The encoding to use for output. :option:`--encoding` is required if :option:" "`--locale` is set." msgstr "" "用於輸出的編碼。如有設定 :option:`--locale` 則必須給定 :option:`--encoding`。" -#: ../../library/calendar.rst:585 +#: ../../library/calendar.rst:601 msgid "Print the calendar to the terminal as text, or as an HTML document." msgstr "將日曆以文字或 HTML 文件的形式印出到終端機。" -#: ../../library/calendar.rst:591 -#, fuzzy +#: ../../library/calendar.rst:607 msgid "" "The weekday to start each week. Must be a number between 0 (Monday) and 6 " "(Sunday). Defaults to 0." -msgstr "印出日曆的年份。必須是 1 到 9999 之間的數字。預設為當前年份。" +msgstr "一週起始的日子。必須是 0(週一)到 6(週日)之間的數字。預設為 0。" -#: ../../library/calendar.rst:599 -#, fuzzy +#: ../../library/calendar.rst:615 msgid "The year to print the calendar for. Defaults to the current year." -msgstr "印出日曆的年份。必須是 1 到 9999 之間的數字。預設為當前年份。" +msgstr "印出日曆的年份。預設為當前年份。" -#: ../../library/calendar.rst:605 +#: ../../library/calendar.rst:621 msgid "" "The month of the specified :option:`year` to print the calendar for. Must be " "a number between 1 and 12, and may only be used in text mode. Defaults to " @@ -781,11 +780,11 @@ msgstr "" "要列印日曆的指定 :option:`year` 的月份。必須是 1 到 12 之間的數字,並且只能在" "文字模式下使用。預設列印全年日曆。" -#: ../../library/calendar.rst:611 +#: ../../library/calendar.rst:627 msgid "*Text-mode options:*" msgstr "*文字模式選項:*" -#: ../../library/calendar.rst:615 +#: ../../library/calendar.rst:631 msgid "" "The width of the date column in terminal columns. The date is printed " "centred in the column. Any value lower than 2 is ignored. Defaults to 2." @@ -793,7 +792,7 @@ msgstr "" "終端機行中日期行的寬度。日期印出在行的中央。任何小於 2 的值都會被忽略。預設" "為 2。" -#: ../../library/calendar.rst:623 +#: ../../library/calendar.rst:639 msgid "" "The number of lines for each week in terminal rows. The date is printed top-" "aligned. Any value lower than 1 is ignored. Defaults to 1." @@ -801,21 +800,21 @@ msgstr "" "終端機列中每週的列數。日期印出時頂部會對齊。任何小於 1 的值都會被忽略。預設" "為 1。" -#: ../../library/calendar.rst:631 +#: ../../library/calendar.rst:647 msgid "" "The space between months in columns. Any value lower than 2 is ignored. " "Defaults to 6." msgstr "行中月份之間的間距。任何小於 2 的值都會被忽略。預設為 6。" -#: ../../library/calendar.rst:638 +#: ../../library/calendar.rst:654 msgid "The number of months printed per row. Defaults to 3." msgstr "每列印出的月份數量。預設為 3。" -#: ../../library/calendar.rst:642 +#: ../../library/calendar.rst:658 msgid "*HTML-mode options:*" msgstr "*HTML 模式選項:*" -#: ../../library/calendar.rst:646 +#: ../../library/calendar.rst:662 msgid "" "The path of a CSS stylesheet to use for the calendar. This must either be " "relative to the generated HTML, or an absolute HTTP or ``file:///`` URL." diff --git a/library/cmdline.po b/library/cmdline.po index 4f84c320d2..51d4a6fe87 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2023-10-14 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -170,61 +170,65 @@ msgid ":ref:`sqlite3 `" msgstr ":ref:`sqlite3 `" #: ../../library/cmdline.rst:43 +msgid ":ref:`symtable `" +msgstr ":ref:`symtable `" + +#: ../../library/cmdline.rst:44 msgid ":ref:`sysconfig `" msgstr ":ref:`sysconfig `" -#: ../../library/cmdline.rst:44 +#: ../../library/cmdline.rst:45 msgid ":mod:`tabnanny`" msgstr ":mod:`tabnanny`" -#: ../../library/cmdline.rst:45 +#: ../../library/cmdline.rst:46 msgid ":ref:`tarfile `" msgstr ":ref:`tarfile `" -#: ../../library/cmdline.rst:46 +#: ../../library/cmdline.rst:47 msgid ":mod:`!this`" msgstr ":mod:`!this`" -#: ../../library/cmdline.rst:47 +#: ../../library/cmdline.rst:48 msgid ":ref:`timeit `" msgstr ":ref:`timeit `" -#: ../../library/cmdline.rst:48 +#: ../../library/cmdline.rst:49 msgid ":ref:`tokenize `" msgstr ":ref:`tokenize `" -#: ../../library/cmdline.rst:49 +#: ../../library/cmdline.rst:50 msgid ":ref:`trace `" msgstr ":ref:`trace `" -#: ../../library/cmdline.rst:50 +#: ../../library/cmdline.rst:51 msgid ":mod:`turtledemo`" msgstr ":mod:`turtledemo`" -#: ../../library/cmdline.rst:51 +#: ../../library/cmdline.rst:52 msgid ":ref:`unittest `" msgstr ":ref:`unittest `" -#: ../../library/cmdline.rst:52 +#: ../../library/cmdline.rst:53 msgid ":ref:`uuid `" msgstr ":ref:`uuid `" -#: ../../library/cmdline.rst:53 +#: ../../library/cmdline.rst:54 msgid ":mod:`venv`" msgstr ":mod:`venv`" -#: ../../library/cmdline.rst:54 +#: ../../library/cmdline.rst:55 msgid ":mod:`webbrowser`" msgstr ":mod:`webbrowser`" -#: ../../library/cmdline.rst:55 +#: ../../library/cmdline.rst:56 msgid ":ref:`zipapp `" msgstr ":ref:`zipapp `" -#: ../../library/cmdline.rst:56 +#: ../../library/cmdline.rst:57 msgid ":ref:`zipfile `" msgstr ":ref:`zipfile `" -#: ../../library/cmdline.rst:58 +#: ../../library/cmdline.rst:59 msgid "See also the :ref:`Python command-line interface `." msgstr "另請見 :ref:`Python 命令列介面 `。" diff --git a/library/collections.po b/library/collections.po index 28d2d79ade..b2cd7486d9 100644 --- a/library/collections.po +++ b/library/collections.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2024-01-22 21:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1207,7 +1207,7 @@ msgstr "" "此屬性為 :meth:`__missing__` 方法所使用。如果有引數被傳入建構函式,則此屬性會" "被初始化成第一個引數,如未提供引數則被初始化為 ``None``。" -#: ../../library/collections.rst:765 ../../library/collections.rst:1188 +#: ../../library/collections.rst:765 ../../library/collections.rst:1191 msgid "" "Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`." msgstr "新增合併 (``|``) 和更新 (``|=``) 運算子,請見 :pep:`584`。" @@ -1357,10 +1357,11 @@ msgstr "" #: ../../library/collections.rst:877 msgid "" -"If *module* is defined, the ``__module__`` attribute of the named tuple is " -"set to that value." +"If *module* is defined, the :attr:`~type.__module__` attribute of the named " +"tuple is set to that value." msgstr "" -"如果 *module* 值有被定義,named tuple 的 ``__module__`` 屬性就被設定為該值。" +"如果 *module* 值有被定義,named tuple 的 :attr:`~type.__module__` 屬性就被設" +"定為該值。" #: ../../library/collections.rst:880 msgid "" @@ -1876,21 +1877,26 @@ msgstr "" "除了普通的對映方法,ordered dictionary 還支援了透過 :func:`reversed` 來做倒序" "疊代。" -#: ../../library/collections.rst:1172 +#: ../../library/collections.rst:1174 msgid "" "Equality tests between :class:`OrderedDict` objects are order-sensitive and " -"are implemented as ``list(od1.items())==list(od2.items())``. Equality tests " -"between :class:`OrderedDict` objects and other :class:`~collections.abc." -"Mapping` objects are order-insensitive like regular dictionaries. This " -"allows :class:`OrderedDict` objects to be substituted anywhere a regular " -"dictionary is used." +"are roughly equivalent to ``list(od1.items())==list(od2.items())``." msgstr "" -":class:`OrderedDict` 物件之間的相等性運算是會檢查順序是否相同的,是透過 " -"``list(od1.items())==list(od2.items())`` 來實現。:class:`OrderedDict` 物件和" -"其他 :class:`~collections.abc.Mapping` 物件間的相等性運算則像普通字典一樣不考" -"慮順序性,這使得 :class:`OrderedDict` 可於任何字典可使用的時機中被替換掉。" +":class:`OrderedDict` 物件之間的相等性運算是會檢查順序是否相同的,大致等價於 " +"``list(od1.items())==list(od2.items())``。" -#: ../../library/collections.rst:1179 +#: ../../library/collections.rst:1177 +msgid "" +"Equality tests between :class:`OrderedDict` objects and other :class:" +"`~collections.abc.Mapping` objects are order-insensitive like regular " +"dictionaries. This allows :class:`OrderedDict` objects to be substituted " +"anywhere a regular dictionary is used." +msgstr "" +":class:`OrderedDict` 物件和其他 :class:`~collections.abc.Mapping` 物件間的相" +"等性運算則像普通字典一樣不考慮順序性,這使得 :class:`OrderedDict` 可於任何字" +"典可使用的時機中被替換掉。" + +#: ../../library/collections.rst:1182 msgid "" "The items, keys, and values :term:`views ` of :class:" "`OrderedDict` now support reverse iteration using :func:`reversed`." @@ -1898,7 +1904,7 @@ msgstr "" ":class:`OrderedDict` 的項 (item)、鍵與值之\\ :term:`視圖 `\\ 現在可透過 :func:`reversed` 來倒序疊代。" -#: ../../library/collections.rst:1183 +#: ../../library/collections.rst:1186 msgid "" "With the acceptance of :pep:`468`, order is retained for keyword arguments " "passed to the :class:`OrderedDict` constructor and its :meth:`update` method." @@ -1906,11 +1912,11 @@ msgstr "" "隨著 :pep:`468` 被核可,被傳入給 :class:`OrderedDict` 建構函式與其 :meth:" "`update` 方法的關鍵字引數之順序被保留了下來。" -#: ../../library/collections.rst:1193 +#: ../../library/collections.rst:1196 msgid ":class:`OrderedDict` Examples and Recipes" msgstr ":class:`OrderedDict` 範例與用法" -#: ../../library/collections.rst:1195 +#: ../../library/collections.rst:1198 msgid "" "It is straightforward to create an ordered dictionary variant that remembers " "the order the keys were *last* inserted. If a new entry overwrites an " @@ -1920,7 +1926,7 @@ msgstr "" "建立一個能夠記住鍵\\ *最後*\\ 插入順序的 ordered dictionary 變體很簡單。如果" "新條目覆蓋了現有條目,則原本插入位置會被更改並移動至末端: ::" -#: ../../library/collections.rst:1200 +#: ../../library/collections.rst:1203 msgid "" "class LastUpdatedOrderedDict(OrderedDict):\n" " 'Store items in the order the keys were last added'\n" @@ -1930,7 +1936,7 @@ msgid "" " self.move_to_end(key)" msgstr "" -#: ../../library/collections.rst:1207 +#: ../../library/collections.rst:1210 msgid "" "An :class:`OrderedDict` would also be useful for implementing variants of :" "func:`functools.lru_cache`:" @@ -1938,7 +1944,7 @@ msgstr "" ":class:`OrderedDict` 在實現一個 :func:`functools.lru_cache` 的變形版本時也非" "常有用:" -#: ../../library/collections.rst:1210 +#: ../../library/collections.rst:1213 msgid "" "from collections import OrderedDict\n" "from time import time\n" @@ -1965,7 +1971,7 @@ msgid "" " return result" msgstr "" -#: ../../library/collections.rst:1237 +#: ../../library/collections.rst:1240 msgid "" "class MultiHitLRUCache:\n" " \"\"\" LRU cache that defers caching a result until\n" @@ -2003,11 +2009,11 @@ msgid "" " return result" msgstr "" -#: ../../library/collections.rst:1306 +#: ../../library/collections.rst:1309 msgid ":class:`UserDict` objects" msgstr ":class:`UserDict` 物件" -#: ../../library/collections.rst:1308 +#: ../../library/collections.rst:1311 msgid "" "The class, :class:`UserDict` acts as a wrapper around dictionary objects. " "The need for this class has been partially supplanted by the ability to " @@ -2018,7 +2024,7 @@ msgstr "" "`dict` 建立子類別,這個類別的需求已部分被滿足,不過這個類別使用起來更方便,因" "為被包裝的字典可以作為其屬性來存取。" -#: ../../library/collections.rst:1316 +#: ../../library/collections.rst:1319 msgid "" "Class that simulates a dictionary. The instance's contents are kept in a " "regular dictionary, which is accessible via the :attr:`data` attribute of :" @@ -2030,23 +2036,23 @@ msgstr "" "`data` 屬性來做存取。如果有提供 *initialdata*,:attr:`data` 屬性會被初始化為" "其值;要注意指到 *initialdata* 的參照不會被保留,使其可被用於其他目的。" -#: ../../library/collections.rst:1322 +#: ../../library/collections.rst:1325 msgid "" "In addition to supporting the methods and operations of mappings, :class:" "`UserDict` instances provide the following attribute:" msgstr "" "除了支援作為對映所需的方法與操作,:class:`UserDict` 實例提供了以下屬性:" -#: ../../library/collections.rst:1327 +#: ../../library/collections.rst:1330 msgid "" "A real dictionary used to store the contents of the :class:`UserDict` class." msgstr "一個真實的字典,用於儲存 :class:`UserDict` 類別的資料內容。" -#: ../../library/collections.rst:1333 +#: ../../library/collections.rst:1336 msgid ":class:`UserList` objects" msgstr ":class:`UserList` 物件" -#: ../../library/collections.rst:1335 +#: ../../library/collections.rst:1338 msgid "" "This class acts as a wrapper around list objects. It is a useful base class " "for your own list-like classes which can inherit from them and override " @@ -2057,7 +2063,7 @@ msgstr "" "入新方法來定義你所需的一個類似於 list 的類別。如此一來,我們可以為 list 加入" "新的特性。" -#: ../../library/collections.rst:1340 +#: ../../library/collections.rst:1343 msgid "" "The need for this class has been partially supplanted by the ability to " "subclass directly from :class:`list`; however, this class can be easier to " @@ -2066,7 +2072,7 @@ msgstr "" "因為已經可以直接自 :class:`list` 建立子類別,這個類別的需求已部分被滿足,不過" "這個類別使用起來更方便,因為被包裝的 list 可以作為其屬性來存取。" -#: ../../library/collections.rst:1346 +#: ../../library/collections.rst:1349 msgid "" "Class that simulates a list. The instance's contents are kept in a regular " "list, which is accessible via the :attr:`data` attribute of :class:" @@ -2079,20 +2085,20 @@ msgstr "" "list ``[]``。*list* 可以是任何 iterable,例如一個真實的 Python list 或是一" "個 :class:`UserList` 物件。" -#: ../../library/collections.rst:1352 +#: ../../library/collections.rst:1355 msgid "" "In addition to supporting the methods and operations of mutable sequences, :" "class:`UserList` instances provide the following attribute:" msgstr "除了支援可變序列的方法與操作,:class:`UserList` 實例提供了以下屬性:" -#: ../../library/collections.rst:1357 +#: ../../library/collections.rst:1360 msgid "" "A real :class:`list` object used to store the contents of the :class:" "`UserList` class." msgstr "" "一個真實的 :class:`list` 物件,用於儲存 :class:`UserList` 類別的資料內容。" -#: ../../library/collections.rst:1360 +#: ../../library/collections.rst:1363 msgid "" "**Subclassing requirements:** Subclasses of :class:`UserList` are expected " "to offer a constructor which can be called with either no arguments or one " @@ -2106,7 +2112,7 @@ msgstr "" "例,為了達成上述目的,它假設建構函式可傳入單一參數來呼叫,該參數即是做為數據" "來源的一個序列物件。" -#: ../../library/collections.rst:1367 +#: ../../library/collections.rst:1370 msgid "" "If a derived class does not wish to comply with this requirement, all of the " "special methods supported by this class will need to be overridden; please " @@ -2116,11 +2122,11 @@ msgstr "" "如果希望一個自此獲得的子類別不遵從上述要求,那所有該類別支援的特殊方法則必須" "被覆寫;請參考原始碼來理解在這情況下哪些方法是必須提供的。" -#: ../../library/collections.rst:1373 +#: ../../library/collections.rst:1376 msgid ":class:`UserString` objects" msgstr ":class:`UserString` 物件" -#: ../../library/collections.rst:1375 +#: ../../library/collections.rst:1378 msgid "" "The class, :class:`UserString` acts as a wrapper around string objects. The " "need for this class has been partially supplanted by the ability to subclass " @@ -2131,7 +2137,7 @@ msgstr "" "建立子類別,這個類別的需求已經部分被滿足,不過這個類別使用起來更方便,因為被" "包裝的字串可以作為其屬性來存取。" -#: ../../library/collections.rst:1383 +#: ../../library/collections.rst:1386 msgid "" "Class that simulates a string object. The instance's content is kept in a " "regular string object, which is accessible via the :attr:`data` attribute " @@ -2143,21 +2149,21 @@ msgstr "" "的 :attr:`data` 屬性來做存取。實例內容被初始化為 *seq* 的複製,*seq* 引數可以" "是任何可被內建函式 :func:`str` 轉換成字串的物件。" -#: ../../library/collections.rst:1390 +#: ../../library/collections.rst:1393 msgid "" "In addition to supporting the methods and operations of strings, :class:" "`UserString` instances provide the following attribute:" msgstr "" "除了支援字串的方法和操作以外,:class:`UserString` 實例也提供了以下屬性:" -#: ../../library/collections.rst:1395 +#: ../../library/collections.rst:1398 msgid "" "A real :class:`str` object used to store the contents of the :class:" "`UserString` class." msgstr "" "一個真實的 :class:`str` 物件,用來儲存 :class:`UserString` 類別的資料內容。" -#: ../../library/collections.rst:1398 +#: ../../library/collections.rst:1401 msgid "" "New methods ``__getnewargs__``, ``__rmod__``, ``casefold``, ``format_map``, " "``isprintable``, and ``maketrans``." diff --git a/library/contextvars.po b/library/contextvars.po index b90483b630..8f8fe6b9cd 100644 --- a/library/contextvars.po +++ b/library/contextvars.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -329,7 +329,7 @@ msgid "" " # without passing it explicitly to this function.\n" "\n" " client_addr = client_addr_var.get()\n" -" return f'Good bye, client @ {client_addr}\\n'.encode()\n" +" return f'Good bye, client @ {client_addr}\\r\\n'.encode()\n" "\n" "async def handle_request(reader, writer):\n" " addr = writer.transport.get_extra_info('socket').getpeername()\n" @@ -343,9 +343,10 @@ msgid "" " print(line)\n" " if not line.strip():\n" " break\n" -" writer.write(line)\n" "\n" -" writer.write(render_goodbye())\n" +" writer.write(b'HTTP/1.1 200 OK\\r\\n') # status line\n" +" writer.write(b'\\r\\n') # headers\n" +" writer.write(render_goodbye()) # body\n" " writer.close()\n" "\n" "async def main():\n" @@ -357,6 +358,7 @@ msgid "" "\n" "asyncio.run(main())\n" "\n" -"# To test it you can use telnet:\n" -"# telnet 127.0.0.1 8081" +"# To test it you can use telnet or curl:\n" +"# telnet 127.0.0.1 8081\n" +"# curl 127.0.0.1:8081" msgstr "" diff --git a/library/dataclasses.po b/library/dataclasses.po index 3725bca2be..f6f692492e 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -584,7 +584,7 @@ msgid "" "mechanism. Multiple third-parties can each have their own key, to use as a " "namespace in the metadata." msgstr "" -"*metadata*:這可以是映射或無。 None 被視為空字典。此值包含在 :func:`~types." +"*metadata*:這可以是對映或無。 None 被視為空字典。此值包含在 :func:`~types." "MappingProxyType` 中以使其成為只讀的,並暴露在 :class:`Field` 對像上。它根本" "不被資料類別使用,而是作為第三方擴充機制提供的。多個第三方可以各自擁有自己的" "密鑰,用作元資料中的命名空間。" @@ -1186,9 +1186,9 @@ msgid "" msgstr "" "當 :func:`@dataclass ` 裝飾器建立資料類別時,它會以反向 MRO(即" "從 :class:`object` 開始)查看該類的所有基底類別,並且對於它找到的每個資料類" -"別,將該基底類別中的欄位新增到欄位的有序映射中。新增所有基底類別欄位後,它會" -"將自己的欄位新增到有序映射中。所有生成的方法都將使用這種組合的、計算的有序欄" -"位映射。因為欄位是按插入順序排列的,所以派生類會覆蓋基底類別。一個例子: ::" +"別,將該基底類別中的欄位新增到欄位的有序對映中。新增所有基底類別欄位後,它會" +"將自己的欄位新增到有序對映中。所有生成的方法都將使用這種組合的、計算的有序欄" +"位對映。因為欄位是按插入順序排列的,所以派生類會覆蓋基底類別。一個例子: ::" #: ../../library/dataclasses.rst:652 msgid "" diff --git a/library/datetime.po b/library/datetime.po index 886165ae86..21b3d8a2d7 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" "Last-Translator: Griiid \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -422,9 +422,9 @@ msgstr "" ">>> (d.days, d.seconds, d.microseconds)\n" "(-1, 86399, 999999)" -#: ../../library/datetime.rst:265 ../../library/datetime.rst:552 -#: ../../library/datetime.rst:1108 ../../library/datetime.rst:1746 -#: ../../library/datetime.rst:2351 +#: ../../library/datetime.rst:265 ../../library/datetime.rst:566 +#: ../../library/datetime.rst:1122 ../../library/datetime.rst:1760 +#: ../../library/datetime.rst:2365 msgid "Class attributes:" msgstr "類別屬性:" @@ -451,8 +451,8 @@ msgid "" "`timedelta` object." msgstr "" -#: ../../library/datetime.rst:287 ../../library/datetime.rst:570 -#: ../../library/datetime.rst:1128 ../../library/datetime.rst:1766 +#: ../../library/datetime.rst:287 ../../library/datetime.rst:584 +#: ../../library/datetime.rst:1142 ../../library/datetime.rst:1780 msgid "Instance attributes (read-only):" msgstr "" @@ -464,194 +464,217 @@ msgstr "在 -999,999,999 到 999,999,999 (含)之間" msgid "Between 0 and 86,399 inclusive." msgstr "在 0 到 86,399 (含)之間" -#: ../../library/datetime.rst:301 +#: ../../library/datetime.rst:300 +msgid "" +"It is a somewhat common bug for code to unintentionally use this attribute " +"when it is actually intended to get a :meth:`~timedelta.total_seconds` value " +"instead:" +msgstr "" + +#: ../../library/datetime.rst:304 +msgid "" +">>> from datetime import timedelta\n" +">>> duration = timedelta(seconds=11235813)\n" +">>> duration.days, duration.seconds\n" +"(130, 3813)\n" +">>> duration.total_seconds()\n" +"11235813.0" +msgstr "" +">>> from datetime import timedelta\n" +">>> duration = timedelta(seconds=11235813)\n" +">>> duration.days, duration.seconds\n" +"(130, 3813)\n" +">>> duration.total_seconds()\n" +"11235813.0" + +#: ../../library/datetime.rst:315 msgid "Between 0 and 999,999 inclusive." msgstr "在 0 到 999,999 (含)之間" -#: ../../library/datetime.rst:304 ../../library/datetime.rst:587 -#: ../../library/datetime.rst:1181 +#: ../../library/datetime.rst:318 ../../library/datetime.rst:601 +#: ../../library/datetime.rst:1195 msgid "Supported operations:" msgstr "" -#: ../../library/datetime.rst:309 ../../library/datetime.rst:590 -#: ../../library/datetime.rst:1184 +#: ../../library/datetime.rst:323 ../../library/datetime.rst:604 +#: ../../library/datetime.rst:1198 msgid "Operation" msgstr "" -#: ../../library/datetime.rst:309 ../../library/datetime.rst:590 -#: ../../library/datetime.rst:1184 +#: ../../library/datetime.rst:323 ../../library/datetime.rst:604 +#: ../../library/datetime.rst:1198 msgid "Result" msgstr "" -#: ../../library/datetime.rst:311 +#: ../../library/datetime.rst:325 msgid "``t1 = t2 + t3``" msgstr "``t1 = t2 + t3``" -#: ../../library/datetime.rst:311 +#: ../../library/datetime.rst:325 msgid "" "Sum of ``t2`` and ``t3``. Afterwards ``t1 - t2 == t3`` and ``t1 - t3 == t2`` " "are true. (1)" msgstr "" -#: ../../library/datetime.rst:315 +#: ../../library/datetime.rst:329 msgid "``t1 = t2 - t3``" msgstr "``t1 = t2 - t3``" -#: ../../library/datetime.rst:315 +#: ../../library/datetime.rst:329 msgid "" "Difference of ``t2`` and ``t3``. Afterwards ``t1 == t2 - t3`` and ``t2 == " "t1 + t3`` are true. (1)(6)" msgstr "" -#: ../../library/datetime.rst:319 +#: ../../library/datetime.rst:333 msgid "``t1 = t2 * i or t1 = i * t2``" msgstr "``t1 = t2 * i or t1 = i * t2``" -#: ../../library/datetime.rst:319 +#: ../../library/datetime.rst:333 msgid "" "Delta multiplied by an integer. Afterwards ``t1 // i == t2`` is true, " "provided ``i != 0``." msgstr "" -#: ../../library/datetime.rst:323 +#: ../../library/datetime.rst:337 msgid "In general, ``t1 * i == t1 * (i-1) + t1`` is true. (1)" msgstr "" -#: ../../library/datetime.rst:326 +#: ../../library/datetime.rst:340 msgid "``t1 = t2 * f or t1 = f * t2``" msgstr "``t1 = t2 * f or t1 = f * t2``" -#: ../../library/datetime.rst:326 +#: ../../library/datetime.rst:340 msgid "" "Delta multiplied by a float. The result is rounded to the nearest multiple " "of timedelta.resolution using round-half-to-even." msgstr "" -#: ../../library/datetime.rst:330 +#: ../../library/datetime.rst:344 msgid "``f = t2 / t3``" msgstr "``f = t2 / t3``" -#: ../../library/datetime.rst:330 +#: ../../library/datetime.rst:344 msgid "" "Division (3) of overall duration ``t2`` by interval unit ``t3``. Returns a :" "class:`float` object." msgstr "" -#: ../../library/datetime.rst:334 +#: ../../library/datetime.rst:348 msgid "``t1 = t2 / f or t1 = t2 / i``" msgstr "``t1 = t2 / f or t1 = t2 / i``" -#: ../../library/datetime.rst:334 +#: ../../library/datetime.rst:348 msgid "" "Delta divided by a float or an int. The result is rounded to the nearest " "multiple of timedelta.resolution using round-half-to-even." msgstr "" -#: ../../library/datetime.rst:338 +#: ../../library/datetime.rst:352 msgid "``t1 = t2 // i`` or ``t1 = t2 // t3``" msgstr "``t1 = t2 // i`` or ``t1 = t2 // t3``" -#: ../../library/datetime.rst:338 +#: ../../library/datetime.rst:352 msgid "" "The floor is computed and the remainder (if any) is thrown away. In the " "second case, an integer is returned. (3)" msgstr "" -#: ../../library/datetime.rst:342 +#: ../../library/datetime.rst:356 msgid "``t1 = t2 % t3``" msgstr "``t1 = t2 % t3``" -#: ../../library/datetime.rst:342 +#: ../../library/datetime.rst:356 msgid "The remainder is computed as a :class:`timedelta` object. (3)" msgstr "" -#: ../../library/datetime.rst:345 +#: ../../library/datetime.rst:359 msgid "``q, r = divmod(t1, t2)``" msgstr "``q, r = divmod(t1, t2)``" -#: ../../library/datetime.rst:345 +#: ../../library/datetime.rst:359 msgid "" "Computes the quotient and the remainder: ``q = t1 // t2`` (3) and ``r = t1 % " "t2``. q is an integer and r is a :class:`timedelta` object." msgstr "" -#: ../../library/datetime.rst:350 +#: ../../library/datetime.rst:364 msgid "``+t1``" msgstr "``+t1``" -#: ../../library/datetime.rst:350 +#: ../../library/datetime.rst:364 msgid "Returns a :class:`timedelta` object with the same value. (2)" msgstr "" -#: ../../library/datetime.rst:353 +#: ../../library/datetime.rst:367 msgid "``-t1``" msgstr "``-t1``" -#: ../../library/datetime.rst:353 +#: ../../library/datetime.rst:367 msgid "" -"Equivalent to ``timedelta(-t1.days, -t1.seconds*, -t1.microseconds)``, and " -"to ``t1 * -1``. (1)(4)" +"Equivalent to ``timedelta(-t1.days, -t1.seconds, -t1.microseconds)``, and to " +"``t1 * -1``. (1)(4)" msgstr "" -#: ../../library/datetime.rst:357 +#: ../../library/datetime.rst:371 msgid "``abs(t)``" msgstr "``abs(t)``" -#: ../../library/datetime.rst:357 +#: ../../library/datetime.rst:371 msgid "" "Equivalent to ``+t`` when ``t.days >= 0``, and to ``-t`` when ``t.days < " "0``. (2)" msgstr "" -#: ../../library/datetime.rst:360 +#: ../../library/datetime.rst:374 msgid "``str(t)``" msgstr "``str(t)``" -#: ../../library/datetime.rst:360 +#: ../../library/datetime.rst:374 msgid "" "Returns a string in the form ``[D day[s], ][H]H:MM:SS[.UUUUUU]``, where D is " "negative for negative ``t``. (5)" msgstr "" -#: ../../library/datetime.rst:364 +#: ../../library/datetime.rst:378 msgid "``repr(t)``" msgstr "``repr(t)``" -#: ../../library/datetime.rst:364 +#: ../../library/datetime.rst:378 msgid "" "Returns a string representation of the :class:`timedelta` object as a " "constructor call with canonical attribute values." msgstr "" -#: ../../library/datetime.rst:370 ../../library/datetime.rst:609 -#: ../../library/datetime.rst:2582 +#: ../../library/datetime.rst:384 ../../library/datetime.rst:623 +#: ../../library/datetime.rst:2596 msgid "Notes:" msgstr "註解:" -#: ../../library/datetime.rst:373 +#: ../../library/datetime.rst:387 msgid "This is exact but may overflow." msgstr "這是精確的,但可能會溢位。" -#: ../../library/datetime.rst:376 +#: ../../library/datetime.rst:390 msgid "This is exact and cannot overflow." msgstr "這是精確的,且不會溢位。" -#: ../../library/datetime.rst:379 +#: ../../library/datetime.rst:393 msgid "Division by zero raises :exc:`ZeroDivisionError`." msgstr "" -#: ../../library/datetime.rst:382 +#: ../../library/datetime.rst:396 msgid "``-timedelta.max`` is not representable as a :class:`timedelta` object." msgstr "" -#: ../../library/datetime.rst:385 +#: ../../library/datetime.rst:399 msgid "" "String representations of :class:`timedelta` objects are normalized " "similarly to their internal representation. This leads to somewhat unusual " "results for negative timedeltas. For example::" msgstr "" -#: ../../library/datetime.rst:389 +#: ../../library/datetime.rst:403 msgid "" ">>> timedelta(hours=-5)\n" "datetime.timedelta(days=-1, seconds=68400)\n" @@ -663,21 +686,21 @@ msgstr "" ">>> print(_)\n" "-1 day, 19:00:00" -#: ../../library/datetime.rst:395 +#: ../../library/datetime.rst:409 msgid "" "The expression ``t2 - t3`` will always be equal to the expression ``t2 + (-" "t3)`` except when t3 is equal to ``timedelta.max``; in that case the former " "will produce a result while the latter will overflow." msgstr "" -#: ../../library/datetime.rst:399 +#: ../../library/datetime.rst:413 msgid "" "In addition to the operations listed above, :class:`timedelta` objects " "support certain additions and subtractions with :class:`date` and :class:`." "datetime` objects (see below)." msgstr "" -#: ../../library/datetime.rst:403 +#: ../../library/datetime.rst:417 msgid "" "Floor division and true division of a :class:`timedelta` object by another :" "class:`timedelta` object are now supported, as are remainder operations and " @@ -685,43 +708,43 @@ msgid "" "`timedelta` object by a :class:`float` object are now supported." msgstr "" -#: ../../library/datetime.rst:409 +#: ../../library/datetime.rst:423 msgid ":class:`timedelta` objects support equality and order comparisons." msgstr "" -#: ../../library/datetime.rst:411 +#: ../../library/datetime.rst:425 msgid "" "In Boolean contexts, a :class:`timedelta` object is considered to be true if " "and only if it isn't equal to ``timedelta(0)``." msgstr "" -#: ../../library/datetime.rst:414 ../../library/datetime.rst:651 -#: ../../library/datetime.rst:1271 ../../library/datetime.rst:1873 +#: ../../library/datetime.rst:428 ../../library/datetime.rst:665 +#: ../../library/datetime.rst:1285 ../../library/datetime.rst:1887 msgid "Instance methods:" msgstr "實例方法:" -#: ../../library/datetime.rst:418 +#: ../../library/datetime.rst:432 msgid "" "Return the total number of seconds contained in the duration. Equivalent to " "``td / timedelta(seconds=1)``. For interval units other than seconds, use " "the division form directly (e.g. ``td / timedelta(microseconds=1)``)." msgstr "" -#: ../../library/datetime.rst:422 +#: ../../library/datetime.rst:436 msgid "" "Note that for very large time intervals (greater than 270 years on most " "platforms) this method will lose microsecond accuracy." msgstr "" -#: ../../library/datetime.rst:428 +#: ../../library/datetime.rst:442 msgid "Examples of usage: :class:`timedelta`" msgstr "用法範例::class:`timedelta`" -#: ../../library/datetime.rst:430 +#: ../../library/datetime.rst:444 msgid "An additional example of normalization::" msgstr "" -#: ../../library/datetime.rst:432 +#: ../../library/datetime.rst:446 msgid "" ">>> # Components of another_year add up to exactly 365 days\n" ">>> from datetime import timedelta\n" @@ -734,11 +757,11 @@ msgid "" "31536000.0" msgstr "" -#: ../../library/datetime.rst:442 +#: ../../library/datetime.rst:456 msgid "Examples of :class:`timedelta` arithmetic::" msgstr "" -#: ../../library/datetime.rst:444 +#: ../../library/datetime.rst:458 msgid "" ">>> from datetime import timedelta\n" ">>> year = timedelta(days=365)\n" @@ -768,65 +791,65 @@ msgstr "" ">>> three_years, three_years.days // 365\n" "(datetime.timedelta(days=1095), 3)" -#: ../../library/datetime.rst:461 +#: ../../library/datetime.rst:475 msgid ":class:`date` Objects" msgstr ":class:`date` 物件" -#: ../../library/datetime.rst:463 +#: ../../library/datetime.rst:477 msgid "" "A :class:`date` object represents a date (year, month and day) in an " "idealized calendar, the current Gregorian calendar indefinitely extended in " "both directions." msgstr "" -#: ../../library/datetime.rst:467 +#: ../../library/datetime.rst:481 msgid "" "January 1 of year 1 is called day number 1, January 2 of year 1 is called " "day number 2, and so on. [#]_" msgstr "" -#: ../../library/datetime.rst:472 +#: ../../library/datetime.rst:486 msgid "" "All arguments are required. Arguments must be integers, in the following " "ranges:" msgstr "" -#: ../../library/datetime.rst:475 +#: ../../library/datetime.rst:489 msgid "``MINYEAR <= year <= MAXYEAR``" msgstr "``MINYEAR <= year <= MAXYEAR``" -#: ../../library/datetime.rst:476 +#: ../../library/datetime.rst:490 msgid "``1 <= month <= 12``" msgstr "``1 <= month <= 12``" -#: ../../library/datetime.rst:477 +#: ../../library/datetime.rst:491 msgid "``1 <= day <= number of days in the given month and year``" msgstr "" -#: ../../library/datetime.rst:479 ../../library/datetime.rst:869 +#: ../../library/datetime.rst:493 ../../library/datetime.rst:883 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised." msgstr "" -#: ../../library/datetime.rst:482 ../../library/datetime.rst:874 +#: ../../library/datetime.rst:496 ../../library/datetime.rst:888 msgid "Other constructors, all class methods:" msgstr "" -#: ../../library/datetime.rst:486 +#: ../../library/datetime.rst:500 msgid "Return the current local date." msgstr "回傳目前的本地日期。" -#: ../../library/datetime.rst:488 +#: ../../library/datetime.rst:502 msgid "This is equivalent to ``date.fromtimestamp(time.time())``." msgstr "這等同於 ``date.fromtimestamp(time.time())``。" -#: ../../library/datetime.rst:492 +#: ../../library/datetime.rst:506 msgid "" "Return the local date corresponding to the POSIX timestamp, such as is " "returned by :func:`time.time`." msgstr "" -#: ../../library/datetime.rst:495 +#: ../../library/datetime.rst:509 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " "values supported by the platform C :c:func:`localtime` function, and :exc:" @@ -836,7 +859,7 @@ msgid "" "ignored by :meth:`fromtimestamp`." msgstr "" -#: ../../library/datetime.rst:502 +#: ../../library/datetime.rst:516 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -844,45 +867,45 @@ msgid "" "`localtime` failure." msgstr "" -#: ../../library/datetime.rst:511 +#: ../../library/datetime.rst:525 msgid "" "Return the date corresponding to the proleptic Gregorian ordinal, where " "January 1 of year 1 has ordinal 1." msgstr "" -#: ../../library/datetime.rst:514 +#: ../../library/datetime.rst:528 msgid "" ":exc:`ValueError` is raised unless ``1 <= ordinal <= date.max.toordinal()``. " "For any date *d*, ``date.fromordinal(d.toordinal()) == d``." msgstr "" -#: ../../library/datetime.rst:521 +#: ../../library/datetime.rst:535 msgid "" "Return a :class:`date` corresponding to a *date_string* given in any valid " "ISO 8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:524 ../../library/datetime.rst:1030 +#: ../../library/datetime.rst:538 ../../library/datetime.rst:1044 msgid "" "Reduced precision dates are not currently supported (``YYYY-MM``, ``YYYY``)." msgstr "" -#: ../../library/datetime.rst:526 ../../library/datetime.rst:1032 +#: ../../library/datetime.rst:540 ../../library/datetime.rst:1046 msgid "" "Extended date representations are not currently supported (``±YYYYYY-MM-" "DD``)." msgstr "" -#: ../../library/datetime.rst:528 ../../library/datetime.rst:1034 +#: ../../library/datetime.rst:542 ../../library/datetime.rst:1048 msgid "Ordinal dates are not currently supported (``YYYY-OOO``)." msgstr "" -#: ../../library/datetime.rst:530 ../../library/datetime.rst:1036 -#: ../../library/datetime.rst:1502 +#: ../../library/datetime.rst:544 ../../library/datetime.rst:1050 +#: ../../library/datetime.rst:1516 msgid "Examples::" msgstr "範例: ::" -#: ../../library/datetime.rst:532 +#: ../../library/datetime.rst:546 msgid "" ">>> from datetime import date\n" ">>> date.fromisoformat('2019-12-04')\n" @@ -900,64 +923,64 @@ msgstr "" ">>> date.fromisoformat('2021-W01-1')\n" "datetime.date(2021, 1, 4)" -#: ../../library/datetime.rst:541 +#: ../../library/datetime.rst:555 msgid "Previously, this method only supported the format ``YYYY-MM-DD``." msgstr "" -#: ../../library/datetime.rst:546 +#: ../../library/datetime.rst:560 msgid "" "Return a :class:`date` corresponding to the ISO calendar date specified by " "year, week and day. This is the inverse of the function :meth:`date." "isocalendar`." msgstr "" -#: ../../library/datetime.rst:556 +#: ../../library/datetime.rst:570 msgid "The earliest representable date, ``date(MINYEAR, 1, 1)``." msgstr "" -#: ../../library/datetime.rst:561 +#: ../../library/datetime.rst:575 msgid "The latest representable date, ``date(MAXYEAR, 12, 31)``." msgstr "" -#: ../../library/datetime.rst:566 +#: ../../library/datetime.rst:580 msgid "" "The smallest possible difference between non-equal date objects, " "``timedelta(days=1)``." msgstr "" -#: ../../library/datetime.rst:574 ../../library/datetime.rst:1132 +#: ../../library/datetime.rst:588 ../../library/datetime.rst:1146 msgid "Between :const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: ../../library/datetime.rst:579 ../../library/datetime.rst:1137 +#: ../../library/datetime.rst:593 ../../library/datetime.rst:1151 msgid "Between 1 and 12 inclusive." msgstr "在 1 到 12 (含)之間。" -#: ../../library/datetime.rst:584 ../../library/datetime.rst:1142 +#: ../../library/datetime.rst:598 ../../library/datetime.rst:1156 msgid "Between 1 and the number of days in the given month of the given year." msgstr "" -#: ../../library/datetime.rst:592 +#: ../../library/datetime.rst:606 msgid "``date2 = date1 + timedelta``" msgstr "``date2 = date1 + timedelta``" -#: ../../library/datetime.rst:592 +#: ../../library/datetime.rst:606 msgid "``date2`` will be ``timedelta.days`` days after ``date1``. (1)" msgstr "" -#: ../../library/datetime.rst:595 +#: ../../library/datetime.rst:609 msgid "``date2 = date1 - timedelta``" msgstr "``date2 = date1 - timedelta``" -#: ../../library/datetime.rst:595 +#: ../../library/datetime.rst:609 msgid "Computes ``date2`` such that ``date2 + timedelta == date1``. (2)" msgstr "" -#: ../../library/datetime.rst:598 +#: ../../library/datetime.rst:612 msgid "``timedelta = date1 - date2``" msgstr "``timedelta = date1 - date2``" -#: ../../library/datetime.rst:598 ../../library/datetime.rst:1190 +#: ../../library/datetime.rst:612 ../../library/datetime.rst:1204 msgid "\\(3)" msgstr "\\(3)" @@ -969,7 +992,7 @@ msgstr "``date1 == date2``" msgid "``date1 != date2``" msgstr "``date1 != date2``" -#: ../../library/datetime.rst:600 ../../library/datetime.rst:1192 +#: ../../library/datetime.rst:614 ../../library/datetime.rst:1206 msgid "Equality comparison. (4)" msgstr "" @@ -989,11 +1012,11 @@ msgstr "``date1 <= date2``" msgid "``date1 >= date2``" msgstr "``date1 >= date2``" -#: ../../library/datetime.rst:603 ../../library/datetime.rst:1195 +#: ../../library/datetime.rst:617 ../../library/datetime.rst:1209 msgid "Order comparison. (5)" msgstr "" -#: ../../library/datetime.rst:612 +#: ../../library/datetime.rst:626 msgid "" "*date2* is moved forward in time if ``timedelta.days > 0``, or backward if " "``timedelta.days < 0``. Afterward ``date2 - date1 == timedelta.days``. " @@ -1002,41 +1025,41 @@ msgid "" "`MINYEAR` or larger than :const:`MAXYEAR`." msgstr "" -#: ../../library/datetime.rst:619 +#: ../../library/datetime.rst:633 msgid "``timedelta.seconds`` and ``timedelta.microseconds`` are ignored." msgstr "``timedelta.seconds`` 和 ``timedelta.microseconds`` 被忽略。" -#: ../../library/datetime.rst:622 +#: ../../library/datetime.rst:636 msgid "" "This is exact, and cannot overflow. ``timedelta.seconds`` and ``timedelta." "microseconds`` are 0, and ``date2 + timedelta == date1`` after." msgstr "" -#: ../../library/datetime.rst:626 +#: ../../library/datetime.rst:640 msgid ":class:`date` objects are equal if they represent the same date." msgstr "" -#: ../../library/datetime.rst:628 +#: ../../library/datetime.rst:642 msgid "" ":class:`!date` objects that are not also :class:`.datetime` instances are " "never equal to :class:`!datetime` objects, even if they represent the same " "date." msgstr "" -#: ../../library/datetime.rst:633 +#: ../../library/datetime.rst:647 msgid "" "*date1* is considered less than *date2* when *date1* precedes *date2* in " "time. In other words, ``date1 < date2`` if and only if ``date1.toordinal() < " "date2.toordinal()``." msgstr "" -#: ../../library/datetime.rst:637 +#: ../../library/datetime.rst:651 msgid "" "Order comparison between a :class:`!date` object that is not also a :class:`." "datetime` instance and a :class:`!datetime` object raises :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:641 ../../library/datetime.rst:1263 +#: ../../library/datetime.rst:655 ../../library/datetime.rst:1277 msgid "" "Comparison between :class:`.datetime` object and an instance of the :class:" "`date` subclass that is not a :class:`!datetime` subclass no longer converts " @@ -1045,22 +1068,22 @@ msgid "" "in subclasses." msgstr "" -#: ../../library/datetime.rst:649 +#: ../../library/datetime.rst:663 msgid "" "In Boolean contexts, all :class:`date` objects are considered to be true." msgstr "" -#: ../../library/datetime.rst:655 +#: ../../library/datetime.rst:669 msgid "" "Return a date with the same value, except for those parameters given new " "values by whichever keyword arguments are specified." msgstr "" -#: ../../library/datetime.rst:658 ../../library/datetime.rst:1919 +#: ../../library/datetime.rst:672 ../../library/datetime.rst:1933 msgid "Example::" msgstr "範例: ::" -#: ../../library/datetime.rst:660 +#: ../../library/datetime.rst:674 msgid "" ">>> from datetime import date\n" ">>> d = date(2002, 12, 31)\n" @@ -1072,47 +1095,47 @@ msgstr "" ">>> d.replace(day=26)\n" "datetime.date(2002, 12, 26)" -#: ../../library/datetime.rst:665 +#: ../../library/datetime.rst:679 msgid "" ":class:`date` objects are also supported by generic function :func:`copy." "replace`." msgstr "" -#: ../../library/datetime.rst:671 ../../library/datetime.rst:1387 +#: ../../library/datetime.rst:685 ../../library/datetime.rst:1401 msgid "" "Return a :class:`time.struct_time` such as returned by :func:`time." "localtime`." msgstr "" "回傳一個 :class:`time.struct_time`,如同 :func:`time.localtime` 所回傳。" -#: ../../library/datetime.rst:673 +#: ../../library/datetime.rst:687 msgid "The hours, minutes and seconds are 0, and the DST flag is -1." msgstr "" -#: ../../library/datetime.rst:675 ../../library/datetime.rst:1389 +#: ../../library/datetime.rst:689 ../../library/datetime.rst:1403 msgid "``d.timetuple()`` is equivalent to::" msgstr "``d.timetuple()`` 等價於: ::" -#: ../../library/datetime.rst:677 +#: ../../library/datetime.rst:691 msgid "" "time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" msgstr "" "time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" -#: ../../library/datetime.rst:679 +#: ../../library/datetime.rst:693 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " "day number within the current year starting with 1 for January 1st." msgstr "" -#: ../../library/datetime.rst:685 +#: ../../library/datetime.rst:699 msgid "" "Return the proleptic Gregorian ordinal of the date, where January 1 of year " "1 has ordinal 1. For any :class:`date` object *d*, ``date.fromordinal(d." "toordinal()) == d``." msgstr "" -#: ../../library/datetime.rst:692 +#: ../../library/datetime.rst:706 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "For example, ``date(2002, 12, 4).weekday() == 2``, a Wednesday. See also :" @@ -1121,25 +1144,25 @@ msgstr "" "回傳一個代表星期幾的整數,星期一為 0、星期日為 6。例如 ``date(2002, 12, 4)." "weekday() == 2`` 為星期三。也請參考 :meth:`isoweekday`。" -#: ../../library/datetime.rst:699 +#: ../../library/datetime.rst:713 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " "For example, ``date(2002, 12, 4).isoweekday() == 3``, a Wednesday. See also :" "meth:`weekday`, :meth:`isocalendar`." msgstr "" -#: ../../library/datetime.rst:706 +#: ../../library/datetime.rst:720 msgid "" "Return a :term:`named tuple` object with three components: ``year``, " "``week`` and ``weekday``." msgstr "" -#: ../../library/datetime.rst:709 +#: ../../library/datetime.rst:723 msgid "" "The ISO calendar is a widely used variant of the Gregorian calendar. [#]_" msgstr "" -#: ../../library/datetime.rst:711 +#: ../../library/datetime.rst:725 msgid "" "The ISO year consists of 52 or 53 full weeks, and where a week starts on a " "Monday and ends on a Sunday. The first week of an ISO year is the first " @@ -1148,13 +1171,13 @@ msgid "" "Gregorian year." msgstr "" -#: ../../library/datetime.rst:716 +#: ../../library/datetime.rst:730 msgid "" "For example, 2004 begins on a Thursday, so the first week of ISO year 2004 " "begins on Monday, 29 Dec 2003 and ends on Sunday, 4 Jan 2004::" msgstr "" -#: ../../library/datetime.rst:719 +#: ../../library/datetime.rst:733 msgid "" ">>> from datetime import date\n" ">>> date(2003, 12, 29).isocalendar()\n" @@ -1168,16 +1191,16 @@ msgstr "" ">>> date(2004, 1, 4).isocalendar()\n" "datetime.IsoCalendarDate(year=2004, week=1, weekday=7)" -#: ../../library/datetime.rst:725 +#: ../../library/datetime.rst:739 msgid "Result changed from a tuple to a :term:`named tuple`." msgstr "" -#: ../../library/datetime.rst:730 +#: ../../library/datetime.rst:744 msgid "" "Return a string representing the date in ISO 8601 format, ``YYYY-MM-DD``::" msgstr "回傳一以 ISO 8601 格式 ``YYYY-MM-DD`` 表示的日期字串: ::" -#: ../../library/datetime.rst:732 +#: ../../library/datetime.rst:746 msgid "" ">>> from datetime import date\n" ">>> date(2002, 12, 4).isoformat()\n" @@ -1187,15 +1210,15 @@ msgstr "" ">>> date(2002, 12, 4).isoformat()\n" "'2002-12-04'" -#: ../../library/datetime.rst:738 +#: ../../library/datetime.rst:752 msgid "For a date *d*, ``str(d)`` is equivalent to ``d.isoformat()``." msgstr "" -#: ../../library/datetime.rst:743 +#: ../../library/datetime.rst:757 msgid "Return a string representing the date::" msgstr "" -#: ../../library/datetime.rst:745 +#: ../../library/datetime.rst:759 msgid "" ">>> from datetime import date\n" ">>> date(2002, 12, 4).ctime()\n" @@ -1205,22 +1228,22 @@ msgstr "" ">>> date(2002, 12, 4).ctime()\n" "'Wed Dec 4 00:00:00 2002'" -#: ../../library/datetime.rst:749 ../../library/datetime.rst:1573 +#: ../../library/datetime.rst:763 ../../library/datetime.rst:1587 msgid "``d.ctime()`` is equivalent to::" msgstr "``d.ctime()`` 等價於: ::" -#: ../../library/datetime.rst:751 ../../library/datetime.rst:1575 +#: ../../library/datetime.rst:765 ../../library/datetime.rst:1589 msgid "time.ctime(time.mktime(d.timetuple()))" msgstr "time.ctime(time.mktime(d.timetuple()))" -#: ../../library/datetime.rst:753 +#: ../../library/datetime.rst:767 msgid "" "on platforms where the native C :c:func:`ctime` function (which :func:`time." "ctime` invokes, but which :meth:`date.ctime` does not invoke) conforms to " "the C standard." msgstr "" -#: ../../library/datetime.rst:760 +#: ../../library/datetime.rst:774 msgid "" "Return a string representing the date, controlled by an explicit format " "string. Format codes referring to hours, minutes or seconds will see 0 " @@ -1228,7 +1251,7 @@ msgid "" "isoformat`." msgstr "" -#: ../../library/datetime.rst:767 +#: ../../library/datetime.rst:781 msgid "" "Same as :meth:`.date.strftime`. This makes it possible to specify a format " "string for a :class:`.date` object in :ref:`formatted string literals >> import time\n" ">>> from datetime import date\n" @@ -1280,11 +1303,11 @@ msgstr "" ">>> time_to_birthday.days\n" "202" -#: ../../library/datetime.rst:794 +#: ../../library/datetime.rst:808 msgid "More examples of working with :class:`date`:" msgstr "更多 :class:`date` 的用法範例:" -#: ../../library/datetime.rst:796 +#: ../../library/datetime.rst:810 msgid "" ">>> from datetime import date\n" ">>> d = date.fromordinal(730920) # 730920th day after 1. 1. 0001\n" @@ -1328,17 +1351,17 @@ msgid "" "datetime.date(2005, 3, 11)" msgstr "" -#: ../../library/datetime.rst:843 +#: ../../library/datetime.rst:857 msgid ":class:`.datetime` Objects" msgstr ":class:`.datetime` 物件" -#: ../../library/datetime.rst:845 +#: ../../library/datetime.rst:859 msgid "" "A :class:`.datetime` object is a single object containing all the " "information from a :class:`date` object and a :class:`.time` object." msgstr "" -#: ../../library/datetime.rst:848 +#: ../../library/datetime.rst:862 msgid "" "Like a :class:`date` object, :class:`.datetime` assumes the current " "Gregorian calendar extended in both directions; like a :class:`.time` " @@ -1346,81 +1369,81 @@ msgid "" "every day." msgstr "" -#: ../../library/datetime.rst:852 +#: ../../library/datetime.rst:866 msgid "Constructor:" msgstr "" -#: ../../library/datetime.rst:856 +#: ../../library/datetime.rst:870 msgid "" "The *year*, *month* and *day* arguments are required. *tzinfo* may be " "``None``, or an instance of a :class:`tzinfo` subclass. The remaining " "arguments must be integers in the following ranges:" msgstr "" -#: ../../library/datetime.rst:860 +#: ../../library/datetime.rst:874 msgid "``MINYEAR <= year <= MAXYEAR``," msgstr "``MINYEAR <= year <= MAXYEAR``," -#: ../../library/datetime.rst:861 +#: ../../library/datetime.rst:875 msgid "``1 <= month <= 12``," msgstr "``1 <= month <= 12``," -#: ../../library/datetime.rst:862 +#: ../../library/datetime.rst:876 msgid "``1 <= day <= number of days in the given month and year``," msgstr "" -#: ../../library/datetime.rst:863 ../../library/datetime.rst:1737 +#: ../../library/datetime.rst:877 ../../library/datetime.rst:1751 msgid "``0 <= hour < 24``," msgstr "``0 <= hour < 24``," -#: ../../library/datetime.rst:864 ../../library/datetime.rst:1738 +#: ../../library/datetime.rst:878 ../../library/datetime.rst:1752 msgid "``0 <= minute < 60``," msgstr "``0 <= minute < 60``," -#: ../../library/datetime.rst:865 ../../library/datetime.rst:1739 +#: ../../library/datetime.rst:879 ../../library/datetime.rst:1753 msgid "``0 <= second < 60``," msgstr "``0 <= second < 60``," -#: ../../library/datetime.rst:866 ../../library/datetime.rst:1740 +#: ../../library/datetime.rst:880 ../../library/datetime.rst:1754 msgid "``0 <= microsecond < 1000000``," msgstr "``0 <= microsecond < 1000000``," -#: ../../library/datetime.rst:867 ../../library/datetime.rst:1741 +#: ../../library/datetime.rst:881 ../../library/datetime.rst:1755 msgid "``fold in [0, 1]``." msgstr "" -#: ../../library/datetime.rst:871 ../../library/datetime.rst:1308 -#: ../../library/datetime.rst:1886 +#: ../../library/datetime.rst:885 ../../library/datetime.rst:1322 +#: ../../library/datetime.rst:1900 msgid "Added the *fold* parameter." msgstr "新增 *fold* 參數。" -#: ../../library/datetime.rst:878 +#: ../../library/datetime.rst:892 msgid "Return the current local date and time, with :attr:`.tzinfo` ``None``." msgstr "回傳目前的本地日期與時間,且 :attr:`.tzinfo` 為 ``None``。" -#: ../../library/datetime.rst:880 +#: ../../library/datetime.rst:894 msgid "Equivalent to::" msgstr "等價於: ::" -#: ../../library/datetime.rst:882 +#: ../../library/datetime.rst:896 msgid "datetime.fromtimestamp(time.time())" msgstr "datetime.fromtimestamp(time.time())" -#: ../../library/datetime.rst:884 +#: ../../library/datetime.rst:898 msgid "See also :meth:`now`, :meth:`fromtimestamp`." msgstr "也請見 :meth:`now`、:meth:`fromtimestamp`。" -#: ../../library/datetime.rst:886 +#: ../../library/datetime.rst:900 msgid "" "This method is functionally equivalent to :meth:`now`, but without a ``tz`` " "parameter." msgstr "" -#: ../../library/datetime.rst:891 +#: ../../library/datetime.rst:905 msgid "Return the current local date and time." msgstr "" -#: ../../library/datetime.rst:893 +#: ../../library/datetime.rst:907 msgid "" "If optional argument *tz* is ``None`` or not specified, this is like :meth:" "`today`, but, if possible, supplies more precision than can be gotten from " @@ -1431,28 +1454,28 @@ msgstr "" "供比透過 :func:`time.time` 取得的時間戳記更多位數的資訊(例如,這在有提供 C :" "c:func:`gettimeofday` 函式的平台上可能可行)。" -#: ../../library/datetime.rst:899 +#: ../../library/datetime.rst:913 msgid "" "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " "subclass, and the current date and time are converted to *tz*’s time zone." msgstr "" -#: ../../library/datetime.rst:902 +#: ../../library/datetime.rst:916 msgid "This function is preferred over :meth:`today` and :meth:`utcnow`." msgstr "" -#: ../../library/datetime.rst:907 +#: ../../library/datetime.rst:921 msgid "Return the current UTC date and time, with :attr:`.tzinfo` ``None``." msgstr "" -#: ../../library/datetime.rst:909 +#: ../../library/datetime.rst:923 msgid "" "This is like :meth:`now`, but returns the current UTC date and time, as a " "naive :class:`.datetime` object. An aware current UTC datetime can be " "obtained by calling ``datetime.now(timezone.utc)``. See also :meth:`now`." msgstr "" -#: ../../library/datetime.rst:915 +#: ../../library/datetime.rst:929 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1460,11 +1483,11 @@ msgid "" "current time in UTC is by calling ``datetime.now(timezone.utc)``." msgstr "" -#: ../../library/datetime.rst:922 +#: ../../library/datetime.rst:936 msgid "Use :meth:`datetime.now` with :attr:`UTC` instead." msgstr "" -#: ../../library/datetime.rst:927 +#: ../../library/datetime.rst:941 msgid "" "Return the local date and time corresponding to the POSIX timestamp, such as " "is returned by :func:`time.time`. If optional argument *tz* is ``None`` or " @@ -1472,13 +1495,13 @@ msgid "" "time, and the returned :class:`.datetime` object is naive." msgstr "" -#: ../../library/datetime.rst:932 +#: ../../library/datetime.rst:946 msgid "" "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " "subclass, and the timestamp is converted to *tz*’s time zone." msgstr "" -#: ../../library/datetime.rst:935 +#: ../../library/datetime.rst:949 msgid "" ":meth:`fromtimestamp` may raise :exc:`OverflowError`, if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -1491,7 +1514,7 @@ msgid "" "preferred over :meth:`utcfromtimestamp`." msgstr "" -#: ../../library/datetime.rst:946 +#: ../../library/datetime.rst:960 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -1499,17 +1522,17 @@ msgid "" "`ValueError` on :c:func:`localtime` or :c:func:`gmtime` failure." msgstr "" -#: ../../library/datetime.rst:953 +#: ../../library/datetime.rst:967 msgid ":meth:`fromtimestamp` may return instances with :attr:`.fold` set to 1." msgstr "" -#: ../../library/datetime.rst:958 +#: ../../library/datetime.rst:972 msgid "" "Return the UTC :class:`.datetime` corresponding to the POSIX timestamp, " "with :attr:`.tzinfo` ``None``. (The resulting object is naive.)" msgstr "" -#: ../../library/datetime.rst:961 +#: ../../library/datetime.rst:975 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " "values supported by the platform C :c:func:`gmtime` function, and :exc:" @@ -1517,33 +1540,33 @@ msgid "" "to years in 1970 through 2038." msgstr "" -#: ../../library/datetime.rst:966 +#: ../../library/datetime.rst:980 msgid "To get an aware :class:`.datetime` object, call :meth:`fromtimestamp`::" msgstr "" -#: ../../library/datetime.rst:968 +#: ../../library/datetime.rst:982 msgid "datetime.fromtimestamp(timestamp, timezone.utc)" msgstr "datetime.fromtimestamp(timestamp, timezone.utc)" -#: ../../library/datetime.rst:970 +#: ../../library/datetime.rst:984 msgid "" "On the POSIX compliant platforms, it is equivalent to the following " "expression::" msgstr "" -#: ../../library/datetime.rst:973 +#: ../../library/datetime.rst:987 msgid "" "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" msgstr "" "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" -#: ../../library/datetime.rst:975 +#: ../../library/datetime.rst:989 msgid "" "except the latter formula always supports the full years range: between :" "const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: ../../library/datetime.rst:980 +#: ../../library/datetime.rst:994 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1552,7 +1575,7 @@ msgid "" "tz=timezone.utc)``." msgstr "" -#: ../../library/datetime.rst:986 +#: ../../library/datetime.rst:1000 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`gmtime` " @@ -1560,11 +1583,11 @@ msgid "" "`gmtime` failure." msgstr "" -#: ../../library/datetime.rst:994 +#: ../../library/datetime.rst:1008 msgid "Use :meth:`datetime.fromtimestamp` with :attr:`UTC` instead." msgstr "" -#: ../../library/datetime.rst:999 +#: ../../library/datetime.rst:1013 msgid "" "Return the :class:`.datetime` corresponding to the proleptic Gregorian " "ordinal, where January 1 of year 1 has ordinal 1. :exc:`ValueError` is " @@ -1573,7 +1596,7 @@ msgid "" "is ``None``." msgstr "" -#: ../../library/datetime.rst:1007 +#: ../../library/datetime.rst:1021 msgid "" "Return a new :class:`.datetime` object whose date components are equal to " "the given :class:`date` object's, and whose time components are equal to the " @@ -1584,35 +1607,35 @@ msgid "" "attr:`.tzinfo` attributes are ignored." msgstr "" -#: ../../library/datetime.rst:1015 +#: ../../library/datetime.rst:1029 msgid "" "For any :class:`.datetime` object *d*, ``d == datetime.combine(d.date(), d." "time(), d.tzinfo)``." msgstr "" -#: ../../library/datetime.rst:1018 +#: ../../library/datetime.rst:1032 msgid "Added the *tzinfo* argument." msgstr "新增 *tzinfo* 引數。" -#: ../../library/datetime.rst:1024 +#: ../../library/datetime.rst:1038 msgid "" "Return a :class:`.datetime` corresponding to a *date_string* in any valid " "ISO 8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:1027 ../../library/datetime.rst:1837 +#: ../../library/datetime.rst:1041 ../../library/datetime.rst:1851 msgid "Time zone offsets may have fractional seconds." msgstr "" -#: ../../library/datetime.rst:1028 +#: ../../library/datetime.rst:1042 msgid "The ``T`` separator may be replaced by any single unicode character." msgstr "" -#: ../../library/datetime.rst:1029 ../../library/datetime.rst:1842 +#: ../../library/datetime.rst:1043 ../../library/datetime.rst:1856 msgid "Fractional hours and minutes are not supported." msgstr "" -#: ../../library/datetime.rst:1038 +#: ../../library/datetime.rst:1052 msgid "" ">>> from datetime import datetime\n" ">>> datetime.fromisoformat('2011-11-04')\n" @@ -1658,13 +1681,13 @@ msgstr "" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" -#: ../../library/datetime.rst:1060 +#: ../../library/datetime.rst:1074 msgid "" "Previously, this method only supported formats that could be emitted by :" "meth:`date.isoformat` or :meth:`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1067 +#: ../../library/datetime.rst:1081 msgid "" "Return a :class:`.datetime` corresponding to the ISO calendar date specified " "by year, week and day. The non-date components of the datetime are populated " @@ -1672,23 +1695,23 @@ msgid "" "`datetime.isocalendar`." msgstr "" -#: ../../library/datetime.rst:1076 +#: ../../library/datetime.rst:1090 msgid "" "Return a :class:`.datetime` corresponding to *date_string*, parsed according " "to *format*." msgstr "" -#: ../../library/datetime.rst:1079 +#: ../../library/datetime.rst:1093 msgid "" "If *format* does not contain microseconds or time zone information, this is " "equivalent to::" msgstr "" -#: ../../library/datetime.rst:1081 ../../library/datetime.rst:2562 +#: ../../library/datetime.rst:1095 ../../library/datetime.rst:2576 msgid "datetime(*(time.strptime(date_string, format)[0:6]))" msgstr "datetime(*(time.strptime(date_string, format)[0:6]))" -#: ../../library/datetime.rst:1083 +#: ../../library/datetime.rst:1097 msgid "" ":exc:`ValueError` is raised if the date_string and format can't be parsed " "by :func:`time.strptime` or if it returns a value which isn't a time tuple. " @@ -1696,7 +1719,7 @@ msgid "" "fromisoformat`." msgstr "" -#: ../../library/datetime.rst:1090 +#: ../../library/datetime.rst:1104 msgid "" "If *format* specifies a day of month without a year a :exc:" "`DeprecationWarning` is now emitted. This is to avoid a quadrennial leap " @@ -1707,7 +1730,7 @@ msgid "" "not have a year, explicitly add a year that is a leap year before parsing:" msgstr "" -#: ../../library/datetime.rst:1099 +#: ../../library/datetime.rst:1113 msgid "" ">>> from datetime import datetime\n" ">>> date_string = \"02/29\"\n" @@ -1717,44 +1740,44 @@ msgid "" "'February 29'" msgstr "" -#: ../../library/datetime.rst:1112 +#: ../../library/datetime.rst:1126 msgid "" "The earliest representable :class:`.datetime`, ``datetime(MINYEAR, 1, 1, " "tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1118 +#: ../../library/datetime.rst:1132 msgid "" "The latest representable :class:`.datetime`, ``datetime(MAXYEAR, 12, 31, 23, " "59, 59, 999999, tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1124 +#: ../../library/datetime.rst:1138 msgid "" "The smallest possible difference between non-equal :class:`.datetime` " "objects, ``timedelta(microseconds=1)``." msgstr "" -#: ../../library/datetime.rst:1147 ../../library/datetime.rst:1770 +#: ../../library/datetime.rst:1161 ../../library/datetime.rst:1784 msgid "In ``range(24)``." msgstr "" -#: ../../library/datetime.rst:1152 ../../library/datetime.rst:1157 -#: ../../library/datetime.rst:1775 ../../library/datetime.rst:1780 +#: ../../library/datetime.rst:1166 ../../library/datetime.rst:1171 +#: ../../library/datetime.rst:1789 ../../library/datetime.rst:1794 msgid "In ``range(60)``." msgstr "" -#: ../../library/datetime.rst:1162 ../../library/datetime.rst:1785 +#: ../../library/datetime.rst:1176 ../../library/datetime.rst:1799 msgid "In ``range(1000000)``." msgstr "" -#: ../../library/datetime.rst:1167 +#: ../../library/datetime.rst:1181 msgid "" "The object passed as the *tzinfo* argument to the :class:`.datetime` " "constructor, or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1173 ../../library/datetime.rst:1796 +#: ../../library/datetime.rst:1187 ../../library/datetime.rst:1810 msgid "" "In ``[0, 1]``. Used to disambiguate wall times during a repeated interval. " "(A repeated interval occurs when clocks are rolled back at the end of " @@ -1764,26 +1787,26 @@ msgid "" "time representation." msgstr "" -#: ../../library/datetime.rst:1186 +#: ../../library/datetime.rst:1200 msgid "``datetime2 = datetime1 + timedelta``" msgstr "``datetime2 = datetime1 + timedelta``" -#: ../../library/datetime.rst:1186 ../../library/datetime.rst:2409 -#: ../../library/datetime.rst:2414 ../../library/datetime.rst:2426 -#: ../../library/datetime.rst:2431 ../../library/datetime.rst:2491 -#: ../../library/datetime.rst:2496 ../../library/datetime.rst:2500 +#: ../../library/datetime.rst:1200 ../../library/datetime.rst:2423 +#: ../../library/datetime.rst:2428 ../../library/datetime.rst:2440 +#: ../../library/datetime.rst:2445 ../../library/datetime.rst:2505 +#: ../../library/datetime.rst:2510 ../../library/datetime.rst:2514 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/datetime.rst:1188 +#: ../../library/datetime.rst:1202 msgid "``datetime2 = datetime1 - timedelta``" msgstr "``datetime2 = datetime1 - timedelta``" -#: ../../library/datetime.rst:1188 ../../library/datetime.rst:2442 +#: ../../library/datetime.rst:1202 ../../library/datetime.rst:2456 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/datetime.rst:1190 +#: ../../library/datetime.rst:1204 msgid "``timedelta = datetime1 - datetime2``" msgstr "``timedelta = datetime1 - datetime2``" @@ -1811,7 +1834,7 @@ msgstr "``datetime1 <= datetime2``" msgid "``datetime1 >= datetime2``" msgstr "``datetime1 >= datetime2``" -#: ../../library/datetime.rst:1202 +#: ../../library/datetime.rst:1216 msgid "" "``datetime2`` is a duration of ``timedelta`` removed from ``datetime1``, " "moving forward in time if ``timedelta.days > 0``, or backward if ``timedelta." @@ -1822,7 +1845,7 @@ msgid "" "adjustments are done even if the input is an aware object." msgstr "" -#: ../../library/datetime.rst:1211 +#: ../../library/datetime.rst:1225 msgid "" "Computes the ``datetime2`` such that ``datetime2 + timedelta == datetime1``. " "As for addition, the result has the same :attr:`~.datetime.tzinfo` attribute " @@ -1830,14 +1853,14 @@ msgid "" "input is aware." msgstr "" -#: ../../library/datetime.rst:1216 +#: ../../library/datetime.rst:1230 msgid "" "Subtraction of a :class:`.datetime` from a :class:`.datetime` is defined " "only if both operands are naive, or if both are aware. If one is aware and " "the other is naive, :exc:`TypeError` is raised." msgstr "" -#: ../../library/datetime.rst:1220 +#: ../../library/datetime.rst:1234 msgid "" "If both are naive, or both are aware and have the same :attr:`~.datetime." "tzinfo` attribute, the :attr:`~.datetime.tzinfo` attributes are ignored, and " @@ -1845,7 +1868,7 @@ msgid "" "datetime1``. No time zone adjustments are done in this case." msgstr "" -#: ../../library/datetime.rst:1225 +#: ../../library/datetime.rst:1239 msgid "" "If both are aware and have different :attr:`~.datetime.tzinfo` attributes, " "``a-b`` acts as if *a* and *b* were first converted to naive UTC datetimes. " @@ -1854,17 +1877,17 @@ msgid "" "overflows." msgstr "" -#: ../../library/datetime.rst:1231 +#: ../../library/datetime.rst:1245 msgid "" ":class:`.datetime` objects are equal if they represent the same date and " "time, taking into account the time zone." msgstr "" -#: ../../library/datetime.rst:1234 +#: ../../library/datetime.rst:1248 msgid "Naive and aware :class:`!datetime` objects are never equal." msgstr "" -#: ../../library/datetime.rst:1236 +#: ../../library/datetime.rst:1250 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1875,19 +1898,19 @@ msgid "" "interval are never equal to :class:`!datetime` instances in other time zone." msgstr "" -#: ../../library/datetime.rst:1246 +#: ../../library/datetime.rst:1260 msgid "" "*datetime1* is considered less than *datetime2* when *datetime1* precedes " "*datetime2* in time, taking into account the time zone." msgstr "" -#: ../../library/datetime.rst:1249 +#: ../../library/datetime.rst:1263 msgid "" "Order comparison between naive and aware :class:`.datetime` objects raises :" "exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1252 +#: ../../library/datetime.rst:1266 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1897,33 +1920,33 @@ msgid "" "implementation never overflows." msgstr "" -#: ../../library/datetime.rst:1259 +#: ../../library/datetime.rst:1273 msgid "" "Equality comparisons between aware and naive :class:`.datetime` instances " "don't raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1275 +#: ../../library/datetime.rst:1289 msgid "Return :class:`date` object with same year, month and day." msgstr "" -#: ../../library/datetime.rst:1280 +#: ../../library/datetime.rst:1294 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond and " "fold. :attr:`.tzinfo` is ``None``. See also method :meth:`timetz`." msgstr "" -#: ../../library/datetime.rst:1283 ../../library/datetime.rst:1292 +#: ../../library/datetime.rst:1297 ../../library/datetime.rst:1306 msgid "The fold value is copied to the returned :class:`.time` object." msgstr "" -#: ../../library/datetime.rst:1289 +#: ../../library/datetime.rst:1303 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond, " "fold, and tzinfo attributes. See also method :meth:`time`." msgstr "" -#: ../../library/datetime.rst:1300 +#: ../../library/datetime.rst:1314 msgid "" "Return a datetime with the same attributes, except for those attributes " "given new values by whichever keyword arguments are specified. Note that " @@ -1931,27 +1954,27 @@ msgid "" "datetime with no conversion of date and time data." msgstr "" -#: ../../library/datetime.rst:1305 +#: ../../library/datetime.rst:1319 msgid "" ":class:`.datetime` objects are also supported by generic function :func:" "`copy.replace`." msgstr "" -#: ../../library/datetime.rst:1314 +#: ../../library/datetime.rst:1328 msgid "" "Return a :class:`.datetime` object with new :attr:`.tzinfo` attribute *tz*, " "adjusting the date and time data so the result is the same UTC time as " "*self*, but in *tz*'s local time." msgstr "" -#: ../../library/datetime.rst:1318 +#: ../../library/datetime.rst:1332 msgid "" "If provided, *tz* must be an instance of a :class:`tzinfo` subclass, and " "its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. If " "*self* is naive, it is presumed to represent time in the system time zone." msgstr "" -#: ../../library/datetime.rst:1322 +#: ../../library/datetime.rst:1336 msgid "" "If called without arguments (or with ``tz=None``) the system local time zone " "is assumed for the target time zone. The ``.tzinfo`` attribute of the " @@ -1959,7 +1982,7 @@ msgid "" "with the zone name and offset obtained from the OS." msgstr "" -#: ../../library/datetime.rst:1327 +#: ../../library/datetime.rst:1341 msgid "" "If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no " "adjustment of date or time data is performed. Else the result is local time " @@ -1968,7 +1991,7 @@ msgid "" "date and time data as ``dt - dt.utcoffset()``." msgstr "" -#: ../../library/datetime.rst:1333 +#: ../../library/datetime.rst:1347 msgid "" "If you merely want to attach a :class:`timezone` object *tz* to a datetime " "*dt* without adjustment of date and time data, use ``dt." @@ -1977,14 +2000,14 @@ msgid "" "use ``dt.replace(tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1338 +#: ../../library/datetime.rst:1352 msgid "" "Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :" "class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. " "Ignoring error cases, :meth:`astimezone` acts like::" msgstr "" -#: ../../library/datetime.rst:1342 +#: ../../library/datetime.rst:1356 msgid "" "def astimezone(self, tz):\n" " if self.tzinfo is tz:\n" @@ -1995,49 +2018,49 @@ msgid "" " return tz.fromutc(utc)" msgstr "" -#: ../../library/datetime.rst:1350 +#: ../../library/datetime.rst:1364 msgid "*tz* now can be omitted." msgstr "" -#: ../../library/datetime.rst:1353 +#: ../../library/datetime.rst:1367 msgid "" "The :meth:`astimezone` method can now be called on naive instances that are " "presumed to represent system local time." msgstr "" -#: ../../library/datetime.rst:1360 +#: ../../library/datetime.rst:1374 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "utcoffset(self)``, and raises an exception if the latter doesn't return " "``None`` or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: ../../library/datetime.rst:1364 ../../library/datetime.rst:1959 -#: ../../library/datetime.rst:2066 ../../library/datetime.rst:2311 -#: ../../library/datetime.rst:2323 ../../library/datetime.rst:2635 +#: ../../library/datetime.rst:1378 ../../library/datetime.rst:1973 +#: ../../library/datetime.rst:2080 ../../library/datetime.rst:2325 +#: ../../library/datetime.rst:2337 ../../library/datetime.rst:2649 msgid "The UTC offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1370 +#: ../../library/datetime.rst:1384 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "dst(self)``, and raises an exception if the latter doesn't return ``None`` " "or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: ../../library/datetime.rst:1374 ../../library/datetime.rst:1969 -#: ../../library/datetime.rst:2120 +#: ../../library/datetime.rst:1388 ../../library/datetime.rst:1983 +#: ../../library/datetime.rst:2134 msgid "The DST offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1380 +#: ../../library/datetime.rst:1394 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "tzname(self)``, raises an exception if the latter doesn't return ``None`` or " "a string object," msgstr "" -#: ../../library/datetime.rst:1391 +#: ../../library/datetime.rst:1405 msgid "" "time.struct_time((d.year, d.month, d.day,\n" " d.hour, d.minute, d.second,\n" @@ -2047,7 +2070,7 @@ msgstr "" " d.hour, d.minute, d.second,\n" " d.weekday(), yday, dst))" -#: ../../library/datetime.rst:1395 +#: ../../library/datetime.rst:1409 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " "day number within the current year starting with 1 for January 1st. The :" @@ -2058,7 +2081,7 @@ msgid "" "to 0." msgstr "" -#: ../../library/datetime.rst:1406 +#: ../../library/datetime.rst:1420 msgid "" "If :class:`.datetime` instance *d* is naive, this is the same as ``d." "timetuple()`` except that :attr:`~.time.struct_time.tm_isdst` is forced to 0 " @@ -2066,7 +2089,7 @@ msgid "" "time." msgstr "" -#: ../../library/datetime.rst:1410 +#: ../../library/datetime.rst:1424 msgid "" "If *d* is aware, *d* is normalized to UTC time, by subtracting ``d." "utcoffset()``, and a :class:`time.struct_time` for the normalized time is " @@ -2075,7 +2098,7 @@ msgid "" "and UTC adjustment spills over a year boundary." msgstr "" -#: ../../library/datetime.rst:1419 +#: ../../library/datetime.rst:1433 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -2085,20 +2108,20 @@ msgid "" "meth:`.datetime.timetuple`." msgstr "" -#: ../../library/datetime.rst:1428 +#: ../../library/datetime.rst:1442 msgid "" "Return the proleptic Gregorian ordinal of the date. The same as ``self." "date().toordinal()``." msgstr "" -#: ../../library/datetime.rst:1433 +#: ../../library/datetime.rst:1447 msgid "" "Return POSIX timestamp corresponding to the :class:`.datetime` instance. The " "return value is a :class:`float` similar to that returned by :func:`time." "time`." msgstr "" -#: ../../library/datetime.rst:1437 +#: ../../library/datetime.rst:1451 msgid "" "Naive :class:`.datetime` instances are assumed to represent local time and " "this method relies on the platform C :c:func:`mktime` function to perform " @@ -2108,22 +2131,22 @@ msgid "" "future." msgstr "" -#: ../../library/datetime.rst:1444 +#: ../../library/datetime.rst:1458 msgid "" "For aware :class:`.datetime` instances, the return value is computed as::" msgstr "" -#: ../../library/datetime.rst:1447 +#: ../../library/datetime.rst:1461 msgid "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" msgstr "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" -#: ../../library/datetime.rst:1451 +#: ../../library/datetime.rst:1465 msgid "" "The :meth:`timestamp` method uses the :attr:`.fold` attribute to " "disambiguate the times during a repeated interval." msgstr "" -#: ../../library/datetime.rst:1457 +#: ../../library/datetime.rst:1471 msgid "" "There is no method to obtain the POSIX timestamp directly from a naive :" "class:`.datetime` instance representing UTC time. If your application uses " @@ -2131,57 +2154,57 @@ msgid "" "the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" msgstr "" -#: ../../library/datetime.rst:1463 +#: ../../library/datetime.rst:1477 msgid "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" msgstr "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" -#: ../../library/datetime.rst:1465 +#: ../../library/datetime.rst:1479 msgid "or by calculating the timestamp directly::" msgstr "" -#: ../../library/datetime.rst:1467 +#: ../../library/datetime.rst:1481 msgid "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" msgstr "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" -#: ../../library/datetime.rst:1471 +#: ../../library/datetime.rst:1485 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "The same as ``self.date().weekday()``. See also :meth:`isoweekday`." msgstr "" -#: ../../library/datetime.rst:1477 +#: ../../library/datetime.rst:1491 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " "The same as ``self.date().isoweekday()``. See also :meth:`weekday`, :meth:" "`isocalendar`." msgstr "" -#: ../../library/datetime.rst:1484 +#: ../../library/datetime.rst:1498 msgid "" "Return a :term:`named tuple` with three components: ``year``, ``week`` and " "``weekday``. The same as ``self.date().isocalendar()``." msgstr "" -#: ../../library/datetime.rst:1490 +#: ../../library/datetime.rst:1504 msgid "Return a string representing the date and time in ISO 8601 format:" msgstr "" -#: ../../library/datetime.rst:1492 +#: ../../library/datetime.rst:1506 msgid "``YYYY-MM-DDTHH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "``YYYY-MM-DDTHH:MM:SS.ffffff``,如果 :attr:`microsecond` 不是 0" -#: ../../library/datetime.rst:1493 +#: ../../library/datetime.rst:1507 msgid "``YYYY-MM-DDTHH:MM:SS``, if :attr:`microsecond` is 0" msgstr "``YYYY-MM-DDTHH:MM:SS``,如果 :attr:`microsecond` 是 0" -#: ../../library/datetime.rst:1495 +#: ../../library/datetime.rst:1509 msgid "" "If :meth:`utcoffset` does not return ``None``, a string is appended, giving " "the UTC offset:" msgstr "" "如果 :meth:`utcoffset` 没有回傳 ``None``,則會附加一个字串,給出 UTC 偏移:" -#: ../../library/datetime.rst:1498 +#: ../../library/datetime.rst:1512 msgid "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` " "is not 0" @@ -2189,13 +2212,13 @@ msgstr "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``,如果 :attr:`microsecond` " "不是 0" -#: ../../library/datetime.rst:1500 +#: ../../library/datetime.rst:1514 msgid "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0" msgstr "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``,如果 :attr:`microsecond` 是 0" -#: ../../library/datetime.rst:1504 +#: ../../library/datetime.rst:1518 msgid "" ">>> from datetime import datetime, timezone\n" ">>> datetime(2019, 5, 18, 15, 17, 8, 132263).isoformat()\n" @@ -2209,13 +2232,13 @@ msgstr "" ">>> datetime(2019, 5, 18, 15, 17, tzinfo=timezone.utc).isoformat()\n" "'2019-05-18T15:17:00+00:00'" -#: ../../library/datetime.rst:1510 +#: ../../library/datetime.rst:1524 msgid "" "The optional argument *sep* (default ``'T'``) is a one-character separator, " "placed between the date and time portions of the result. For example::" msgstr "" -#: ../../library/datetime.rst:1513 +#: ../../library/datetime.rst:1527 msgid "" ">>> from datetime import tzinfo, timedelta, datetime\n" ">>> class TZ(tzinfo):\n" @@ -2229,53 +2252,53 @@ msgid "" "'2009-11-27T00:00:00.000100-06:39'" msgstr "" -#: ../../library/datetime.rst:1524 ../../library/datetime.rst:1899 +#: ../../library/datetime.rst:1538 ../../library/datetime.rst:1913 msgid "" "The optional argument *timespec* specifies the number of additional " "components of the time to include (the default is ``'auto'``). It can be one " "of the following:" msgstr "" -#: ../../library/datetime.rst:1528 ../../library/datetime.rst:1903 +#: ../../library/datetime.rst:1542 ../../library/datetime.rst:1917 msgid "" "``'auto'``: Same as ``'seconds'`` if :attr:`microsecond` is 0, same as " "``'microseconds'`` otherwise." msgstr "" -#: ../../library/datetime.rst:1530 ../../library/datetime.rst:1905 +#: ../../library/datetime.rst:1544 ../../library/datetime.rst:1919 msgid "``'hours'``: Include the :attr:`hour` in the two-digit ``HH`` format." msgstr "" -#: ../../library/datetime.rst:1531 ../../library/datetime.rst:1906 +#: ../../library/datetime.rst:1545 ../../library/datetime.rst:1920 msgid "" "``'minutes'``: Include :attr:`hour` and :attr:`minute` in ``HH:MM`` format." msgstr "" -#: ../../library/datetime.rst:1532 ../../library/datetime.rst:1907 +#: ../../library/datetime.rst:1546 ../../library/datetime.rst:1921 msgid "" "``'seconds'``: Include :attr:`hour`, :attr:`minute`, and :attr:`second` in " "``HH:MM:SS`` format." msgstr "" -#: ../../library/datetime.rst:1534 ../../library/datetime.rst:1909 +#: ../../library/datetime.rst:1548 ../../library/datetime.rst:1923 msgid "" "``'milliseconds'``: Include full time, but truncate fractional second part " "to milliseconds. ``HH:MM:SS.sss`` format." msgstr "" -#: ../../library/datetime.rst:1536 ../../library/datetime.rst:1911 +#: ../../library/datetime.rst:1550 ../../library/datetime.rst:1925 msgid "``'microseconds'``: Include full time in ``HH:MM:SS.ffffff`` format." msgstr "" -#: ../../library/datetime.rst:1540 ../../library/datetime.rst:1915 +#: ../../library/datetime.rst:1554 ../../library/datetime.rst:1929 msgid "Excluded time components are truncated, not rounded." msgstr "" -#: ../../library/datetime.rst:1542 +#: ../../library/datetime.rst:1556 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument::" msgstr "" -#: ../../library/datetime.rst:1545 +#: ../../library/datetime.rst:1559 msgid "" ">>> from datetime import datetime\n" ">>> datetime.now().isoformat(timespec='minutes') \n" @@ -2291,21 +2314,21 @@ msgstr "" ">>> dt.isoformat(timespec='microseconds')\n" "'2015-01-01T12:30:59.000000'" -#: ../../library/datetime.rst:1552 ../../library/datetime.rst:1930 +#: ../../library/datetime.rst:1566 ../../library/datetime.rst:1944 msgid "Added the *timespec* parameter." msgstr "新增 *timespec* 參數。" -#: ../../library/datetime.rst:1558 +#: ../../library/datetime.rst:1572 msgid "" "For a :class:`.datetime` instance *d*, ``str(d)`` is equivalent to ``d." "isoformat(' ')``." msgstr "" -#: ../../library/datetime.rst:1564 +#: ../../library/datetime.rst:1578 msgid "Return a string representing the date and time::" msgstr "" -#: ../../library/datetime.rst:1566 +#: ../../library/datetime.rst:1580 msgid "" ">>> from datetime import datetime\n" ">>> datetime(2002, 12, 4, 20, 30, 40).ctime()\n" @@ -2315,27 +2338,27 @@ msgstr "" ">>> datetime(2002, 12, 4, 20, 30, 40).ctime()\n" "'Wed Dec 4 20:30:40 2002'" -#: ../../library/datetime.rst:1570 +#: ../../library/datetime.rst:1584 msgid "" "The output string will *not* include time zone information, regardless of " "whether the input is aware or naive." msgstr "" -#: ../../library/datetime.rst:1577 +#: ../../library/datetime.rst:1591 msgid "" "on platforms where the native C :c:func:`ctime` function (which :func:`time." "ctime` invokes, but which :meth:`datetime.ctime` does not invoke) conforms " "to the C standard." msgstr "" -#: ../../library/datetime.rst:1584 +#: ../../library/datetime.rst:1598 msgid "" "Return a string representing the date and time, controlled by an explicit " "format string. See also :ref:`strftime-strptime-behavior` and :meth:" "`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1591 +#: ../../library/datetime.rst:1605 msgid "" "Same as :meth:`.datetime.strftime`. This makes it possible to specify a " "format string for a :class:`.datetime` object in :ref:`formatted string " @@ -2343,15 +2366,15 @@ msgid "" "`strftime-strptime-behavior` and :meth:`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1598 +#: ../../library/datetime.rst:1612 msgid "Examples of Usage: :class:`.datetime`" msgstr "用法範例::class:`.datetime`" -#: ../../library/datetime.rst:1600 +#: ../../library/datetime.rst:1614 msgid "Examples of working with :class:`.datetime` objects:" msgstr "更多 :class:`.datetime` 的用法範例:" -#: ../../library/datetime.rst:1602 +#: ../../library/datetime.rst:1616 msgid "" ">>> from datetime import datetime, date, time, timezone\n" "\n" @@ -2405,14 +2428,14 @@ msgid "" "'The day is 21, the month is November, the time is 04:30PM.'" msgstr "" -#: ../../library/datetime.rst:1653 +#: ../../library/datetime.rst:1667 msgid "" "The example below defines a :class:`tzinfo` subclass capturing time zone " "information for Kabul, Afghanistan, which used +4 UTC until 1945 and then " "+4:30 UTC thereafter::" msgstr "" -#: ../../library/datetime.rst:1657 +#: ../../library/datetime.rst:1671 msgid "" "from datetime import timedelta, datetime, tzinfo, timezone\n" "\n" @@ -2459,11 +2482,11 @@ msgid "" " return \"+04\"" msgstr "" -#: ../../library/datetime.rst:1700 +#: ../../library/datetime.rst:1714 msgid "Usage of ``KabulTz`` from above::" msgstr "" -#: ../../library/datetime.rst:1702 +#: ../../library/datetime.rst:1716 msgid "" ">>> tz1 = KabulTz()\n" "\n" @@ -2487,63 +2510,63 @@ msgid "" "True" msgstr "" -#: ../../library/datetime.rst:1726 +#: ../../library/datetime.rst:1740 msgid ":class:`.time` Objects" msgstr ":class:`.time` 物件" -#: ../../library/datetime.rst:1728 +#: ../../library/datetime.rst:1742 msgid "" "A :class:`.time` object represents a (local) time of day, independent of any " "particular day, and subject to adjustment via a :class:`tzinfo` object." msgstr "" -#: ../../library/datetime.rst:1733 +#: ../../library/datetime.rst:1747 msgid "" "All arguments are optional. *tzinfo* may be ``None``, or an instance of a :" "class:`tzinfo` subclass. The remaining arguments must be integers in the " "following ranges:" msgstr "" -#: ../../library/datetime.rst:1743 +#: ../../library/datetime.rst:1757 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised. " "All default to 0 except *tzinfo*, which defaults to ``None``." msgstr "" -#: ../../library/datetime.rst:1751 +#: ../../library/datetime.rst:1765 msgid "The earliest representable :class:`.time`, ``time(0, 0, 0, 0)``." msgstr "" -#: ../../library/datetime.rst:1756 +#: ../../library/datetime.rst:1770 msgid "The latest representable :class:`.time`, ``time(23, 59, 59, 999999)``." msgstr "" -#: ../../library/datetime.rst:1761 +#: ../../library/datetime.rst:1775 msgid "" "The smallest possible difference between non-equal :class:`.time` objects, " "``timedelta(microseconds=1)``, although note that arithmetic on :class:`." "time` objects is not supported." msgstr "" -#: ../../library/datetime.rst:1790 +#: ../../library/datetime.rst:1804 msgid "" "The object passed as the tzinfo argument to the :class:`.time` constructor, " "or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1804 +#: ../../library/datetime.rst:1818 msgid "" ":class:`.time` objects support equality and order comparisons, where *a* is " "considered less than *b* when *a* precedes *b* in time." msgstr "" -#: ../../library/datetime.rst:1807 +#: ../../library/datetime.rst:1821 msgid "" "Naive and aware :class:`!time` objects are never equal. Order comparison " "between naive and aware :class:`!time` objects raises :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1811 +#: ../../library/datetime.rst:1825 msgid "" "If both comparands are aware, and have the same :attr:`~.time.tzinfo` " "attribute, the :attr:`!tzinfo` and :attr:`!fold` attributes are ignored and " @@ -2552,18 +2575,18 @@ msgid "" "subtracting their UTC offsets (obtained from ``self.utcoffset()``)." msgstr "" -#: ../../library/datetime.rst:1817 +#: ../../library/datetime.rst:1831 msgid "" "Equality comparisons between aware and naive :class:`.time` instances don't " "raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1821 +#: ../../library/datetime.rst:1835 msgid "" "In Boolean contexts, a :class:`.time` object is always considered to be true." msgstr "" -#: ../../library/datetime.rst:1823 +#: ../../library/datetime.rst:1837 msgid "" "Before Python 3.5, a :class:`.time` object was considered to be false if it " "represented midnight in UTC. This behavior was considered obscure and error-" @@ -2571,33 +2594,33 @@ msgid "" "details." msgstr "" -#: ../../library/datetime.rst:1830 +#: ../../library/datetime.rst:1844 msgid "Other constructor:" msgstr "" -#: ../../library/datetime.rst:1834 +#: ../../library/datetime.rst:1848 msgid "" "Return a :class:`.time` corresponding to a *time_string* in any valid ISO " "8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:1838 +#: ../../library/datetime.rst:1852 msgid "" "The leading ``T``, normally required in cases where there may be ambiguity " "between a date and a time, is not required." msgstr "" -#: ../../library/datetime.rst:1840 +#: ../../library/datetime.rst:1854 msgid "" "Fractional seconds may have any number of digits (anything beyond 6 will be " "truncated)." msgstr "" -#: ../../library/datetime.rst:1844 +#: ../../library/datetime.rst:1858 msgid "Examples:" msgstr "範例: ::" -#: ../../library/datetime.rst:1846 +#: ../../library/datetime.rst:1860 msgid "" ">>> from datetime import time\n" ">>> time.fromisoformat('04:23:01')\n" @@ -2637,13 +2660,13 @@ msgstr "" ">>> time.fromisoformat('04:23:01+00:00')\n" "datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)" -#: ../../library/datetime.rst:1868 +#: ../../library/datetime.rst:1882 msgid "" "Previously, this method only supported formats that could be emitted by :" "meth:`time.isoformat`." msgstr "" -#: ../../library/datetime.rst:1878 +#: ../../library/datetime.rst:1892 msgid "" "Return a :class:`.time` with the same value, except for those attributes " "given new values by whichever keyword arguments are specified. Note that " @@ -2651,41 +2674,41 @@ msgid "" "aware :class:`.time`, without conversion of the time data." msgstr "" -#: ../../library/datetime.rst:1883 +#: ../../library/datetime.rst:1897 msgid "" ":class:`.time` objects are also supported by generic function :func:`copy." "replace`." msgstr "" -#: ../../library/datetime.rst:1892 +#: ../../library/datetime.rst:1906 msgid "Return a string representing the time in ISO 8601 format, one of:" msgstr "" -#: ../../library/datetime.rst:1894 +#: ../../library/datetime.rst:1908 msgid "``HH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "" -#: ../../library/datetime.rst:1895 +#: ../../library/datetime.rst:1909 msgid "``HH:MM:SS``, if :attr:`microsecond` is 0" msgstr "" -#: ../../library/datetime.rst:1896 +#: ../../library/datetime.rst:1910 msgid "" "``HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :meth:`utcoffset` does not " "return ``None``" msgstr "" -#: ../../library/datetime.rst:1897 +#: ../../library/datetime.rst:1911 msgid "" "``HH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0 and :meth:" "`utcoffset` does not return ``None``" msgstr "" -#: ../../library/datetime.rst:1917 +#: ../../library/datetime.rst:1931 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument." msgstr "" -#: ../../library/datetime.rst:1921 +#: ../../library/datetime.rst:1935 msgid "" ">>> from datetime import time\n" ">>> time(hour=12, minute=34, second=56, microsecond=123456)." @@ -2707,18 +2730,18 @@ msgstr "" ">>> dt.isoformat(timespec='auto')\n" "'12:34:56'" -#: ../../library/datetime.rst:1936 +#: ../../library/datetime.rst:1950 msgid "For a time *t*, ``str(t)`` is equivalent to ``t.isoformat()``." msgstr "" -#: ../../library/datetime.rst:1941 +#: ../../library/datetime.rst:1955 msgid "" "Return a string representing the time, controlled by an explicit format " "string. See also :ref:`strftime-strptime-behavior` and :meth:`time." "isoformat`." msgstr "" -#: ../../library/datetime.rst:1947 +#: ../../library/datetime.rst:1961 msgid "" "Same as :meth:`.time.strftime`. This makes it possible to specify a format " "string for a :class:`.time` object in :ref:`formatted string literals >> from datetime import time, tzinfo, timedelta\n" ">>> class TZ1(tzinfo):\n" @@ -2807,18 +2830,18 @@ msgstr "" ">>> 'The {} is {:%H:%M}.'.format(\"time\", t)\n" "'The time is 12:10.'" -#: ../../library/datetime.rst:2012 +#: ../../library/datetime.rst:2026 msgid ":class:`tzinfo` Objects" msgstr ":class:`tzinfo` 物件" -#: ../../library/datetime.rst:2016 +#: ../../library/datetime.rst:2030 msgid "" "This is an abstract base class, meaning that this class should not be " "instantiated directly. Define a subclass of :class:`tzinfo` to capture " "information about a particular time zone." msgstr "" -#: ../../library/datetime.rst:2020 +#: ../../library/datetime.rst:2034 msgid "" "An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the " "constructors for :class:`.datetime` and :class:`.time` objects. The latter " @@ -2828,7 +2851,7 @@ msgid "" "object passed to them." msgstr "" -#: ../../library/datetime.rst:2026 +#: ../../library/datetime.rst:2040 msgid "" "You need to derive a concrete subclass, and (at least) supply " "implementations of the standard :class:`tzinfo` methods needed by the :class:" @@ -2838,7 +2861,7 @@ msgid "" "American EST and EDT." msgstr "" -#: ../../library/datetime.rst:2033 +#: ../../library/datetime.rst:2047 msgid "" "Special requirement for pickling: A :class:`tzinfo` subclass must have an :" "meth:`~object.__init__` method that can be called with no arguments, " @@ -2846,20 +2869,20 @@ msgid "" "technical requirement that may be relaxed in the future." msgstr "" -#: ../../library/datetime.rst:2039 +#: ../../library/datetime.rst:2053 msgid "" "A concrete subclass of :class:`tzinfo` may need to implement the following " "methods. Exactly which methods are needed depends on the uses made of aware :" "mod:`!datetime` objects. If in doubt, simply implement all of them." msgstr "" -#: ../../library/datetime.rst:2046 +#: ../../library/datetime.rst:2060 msgid "" "Return offset of local time from UTC, as a :class:`timedelta` object that is " "positive east of UTC. If local time is west of UTC, this should be negative." msgstr "" -#: ../../library/datetime.rst:2049 +#: ../../library/datetime.rst:2063 msgid "" "This represents the *total* offset from UTC; for example, if a :class:" "`tzinfo` object represents both time zone and DST adjustments, :meth:" @@ -2870,31 +2893,31 @@ msgid "" "meth:`utcoffset` will probably look like one of these two::" msgstr "" -#: ../../library/datetime.rst:2057 +#: ../../library/datetime.rst:2071 msgid "" "return CONSTANT # fixed-offset class\n" "return CONSTANT + self.dst(dt) # daylight-aware class" msgstr "" -#: ../../library/datetime.rst:2060 +#: ../../library/datetime.rst:2074 msgid "" "If :meth:`utcoffset` does not return ``None``, :meth:`dst` should not return " "``None`` either." msgstr "" -#: ../../library/datetime.rst:2063 +#: ../../library/datetime.rst:2077 msgid "" "The default implementation of :meth:`utcoffset` raises :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2072 +#: ../../library/datetime.rst:2086 msgid "" "Return the daylight saving time (DST) adjustment, as a :class:`timedelta` " "object or ``None`` if DST information isn't known." msgstr "" -#: ../../library/datetime.rst:2076 +#: ../../library/datetime.rst:2090 msgid "" "Return ``timedelta(0)`` if DST is not in effect. If DST is in effect, return " "the offset as a :class:`timedelta` object (see :meth:`utcoffset` for " @@ -2907,17 +2930,17 @@ msgid "" "to account for DST changes when crossing time zones." msgstr "" -#: ../../library/datetime.rst:2086 +#: ../../library/datetime.rst:2100 msgid "" "An instance *tz* of a :class:`tzinfo` subclass that models both standard and " "daylight times must be consistent in this sense:" msgstr "" -#: ../../library/datetime.rst:2089 +#: ../../library/datetime.rst:2103 msgid "``tz.utcoffset(dt) - tz.dst(dt)``" msgstr "``tz.utcoffset(dt) - tz.dst(dt)``" -#: ../../library/datetime.rst:2091 +#: ../../library/datetime.rst:2105 msgid "" "must return the same result for every :class:`.datetime` *dt* with ``dt." "tzinfo == tz``. For sane :class:`tzinfo` subclasses, this expression yields " @@ -2930,24 +2953,24 @@ msgid "" "astimezone` regardless." msgstr "" -#: ../../library/datetime.rst:2100 +#: ../../library/datetime.rst:2114 msgid "" "Most implementations of :meth:`dst` will probably look like one of these " "two::" msgstr "" -#: ../../library/datetime.rst:2102 +#: ../../library/datetime.rst:2116 msgid "" "def dst(self, dt):\n" " # a fixed-offset class: doesn't account for DST\n" " return timedelta(0)" msgstr "" -#: ../../library/datetime.rst:2106 +#: ../../library/datetime.rst:2120 msgid "or::" msgstr "或是: ::" -#: ../../library/datetime.rst:2108 +#: ../../library/datetime.rst:2122 msgid "" "def dst(self, dt):\n" " # Code to set dston and dstoff to the time zone's DST\n" @@ -2960,12 +2983,12 @@ msgid "" " return timedelta(0)" msgstr "" -#: ../../library/datetime.rst:2118 +#: ../../library/datetime.rst:2132 msgid "" "The default implementation of :meth:`dst` raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2126 +#: ../../library/datetime.rst:2140 msgid "" "Return the time zone name corresponding to the :class:`.datetime` object " "*dt*, as a string. Nothing about string names is defined by the :mod:`!" @@ -2979,13 +3002,13 @@ msgid "" "accounting for daylight time." msgstr "" -#: ../../library/datetime.rst:2136 +#: ../../library/datetime.rst:2150 msgid "" "The default implementation of :meth:`tzname` raises :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2139 +#: ../../library/datetime.rst:2153 msgid "" "These methods are called by a :class:`.datetime` or :class:`.time` object, " "in response to their methods of the same names. A :class:`.datetime` object " @@ -2995,7 +3018,7 @@ msgid "" "datetime`." msgstr "" -#: ../../library/datetime.rst:2145 +#: ../../library/datetime.rst:2159 msgid "" "When ``None`` is passed, it's up to the class designer to decide the best " "response. For example, returning ``None`` is appropriate if the class wishes " @@ -3004,7 +3027,7 @@ msgid "" "offset, as there is no other convention for discovering the standard offset." msgstr "" -#: ../../library/datetime.rst:2151 +#: ../../library/datetime.rst:2165 msgid "" "When a :class:`.datetime` object is passed in response to a :class:`." "datetime` method, ``dt.tzinfo`` is the same object as *self*. :class:" @@ -3014,13 +3037,13 @@ msgid "" "zones." msgstr "" -#: ../../library/datetime.rst:2157 +#: ../../library/datetime.rst:2171 msgid "" "There is one more :class:`tzinfo` method that a subclass may wish to " "override:" msgstr "" -#: ../../library/datetime.rst:2162 +#: ../../library/datetime.rst:2176 msgid "" "This is called from the default :meth:`datetime.astimezone` implementation. " "When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time " @@ -3029,7 +3052,7 @@ msgid "" "datetime in *self*'s local time." msgstr "" -#: ../../library/datetime.rst:2168 +#: ../../library/datetime.rst:2182 msgid "" "Most :class:`tzinfo` subclasses should be able to inherit the default :meth:" "`fromutc` implementation without problems. It's strong enough to handle " @@ -3044,13 +3067,13 @@ msgid "" "offset changes." msgstr "" -#: ../../library/datetime.rst:2179 +#: ../../library/datetime.rst:2193 msgid "" "Skipping code for error cases, the default :meth:`fromutc` implementation " "acts like::" msgstr "" -#: ../../library/datetime.rst:2182 +#: ../../library/datetime.rst:2196 msgid "" "def fromutc(self, dt):\n" " # raise ValueError error if dt.tzinfo is not self\n" @@ -3068,13 +3091,13 @@ msgid "" " return dt" msgstr "" -#: ../../library/datetime.rst:2197 +#: ../../library/datetime.rst:2211 msgid "" "In the following :download:`tzinfo_examples.py <../includes/tzinfo_examples." "py>` file there are some examples of :class:`tzinfo` classes:" msgstr "" -#: ../../library/datetime.rst:2201 +#: ../../library/datetime.rst:2215 msgid "" "from datetime import tzinfo, timedelta, datetime\n" "\n" @@ -3254,7 +3277,7 @@ msgid "" "Pacific = USTimeZone(-8, \"Pacific\", \"PST\", \"PDT\")\n" msgstr "" -#: ../../library/datetime.rst:2203 +#: ../../library/datetime.rst:2217 msgid "" "Note that there are unavoidable subtleties twice per year in a :class:" "`tzinfo` subclass accounting for both standard and daylight time, at the DST " @@ -3263,7 +3286,7 @@ msgid "" "ends the minute after 1:59 (EDT) on the first Sunday in November::" msgstr "" -#: ../../library/datetime.rst:2209 +#: ../../library/datetime.rst:2223 msgid "" " UTC 3:MM 4:MM 5:MM 6:MM 7:MM 8:MM\n" " EST 22:MM 23:MM 0:MM 1:MM 2:MM 3:MM\n" @@ -3281,7 +3304,7 @@ msgstr "" "\n" " end 23:MM 0:MM 1:MM 1:MM 2:MM 3:MM" -#: ../../library/datetime.rst:2217 +#: ../../library/datetime.rst:2231 msgid "" "When DST starts (the \"start\" line), the local wall clock leaps from 1:59 " "to 3:00. A wall time of the form 2:MM doesn't really make sense on that day, " @@ -3290,7 +3313,7 @@ msgid "" "get::" msgstr "" -#: ../../library/datetime.rst:2222 +#: ../../library/datetime.rst:2236 msgid "" ">>> from datetime import datetime, timezone\n" ">>> from tzinfo_examples import HOUR, Eastern\n" @@ -3318,7 +3341,7 @@ msgstr "" "07:00:00 UTC = 03:00:00 EDT\n" "08:00:00 UTC = 04:00:00 EDT" -#: ../../library/datetime.rst:2236 +#: ../../library/datetime.rst:2250 msgid "" "When DST ends (the \"end\" line), there's a potentially worse problem: " "there's an hour that can't be spelled unambiguously in local wall time: the " @@ -3333,7 +3356,7 @@ msgid "" "Fall back transition of 2016, we get::" msgstr "" -#: ../../library/datetime.rst:2247 +#: ../../library/datetime.rst:2261 msgid "" ">>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n" ">>> for i in range(4):\n" @@ -3357,13 +3380,13 @@ msgstr "" "06:00:00 UTC = 01:00:00 EST 1\n" "07:00:00 UTC = 02:00:00 EST 0" -#: ../../library/datetime.rst:2258 +#: ../../library/datetime.rst:2272 msgid "" "Note that the :class:`.datetime` instances that differ only by the value of " "the :attr:`~.datetime.fold` attribute are considered equal in comparisons." msgstr "" -#: ../../library/datetime.rst:2261 +#: ../../library/datetime.rst:2275 msgid "" "Applications that can't bear wall-time ambiguities should explicitly check " "the value of the :attr:`~.datetime.fold` attribute or avoid using hybrid :" @@ -3373,28 +3396,28 @@ msgid "" "offset -4 hours))." msgstr "" -#: ../../library/datetime.rst:2269 +#: ../../library/datetime.rst:2283 msgid ":mod:`zoneinfo`" msgstr ":mod:`zoneinfo`" -#: ../../library/datetime.rst:2270 +#: ../../library/datetime.rst:2284 msgid "" "The :mod:`!datetime` module has a basic :class:`timezone` class (for " "handling arbitrary fixed offsets from UTC) and its :attr:`timezone.utc` " "attribute (a UTC :class:`!timezone` instance)." msgstr "" -#: ../../library/datetime.rst:2274 +#: ../../library/datetime.rst:2288 msgid "" "``zoneinfo`` brings the *IANA time zone database* (also known as the Olson " "database) to Python, and its usage is recommended." msgstr "" -#: ../../library/datetime.rst:2277 +#: ../../library/datetime.rst:2291 msgid "`IANA time zone database `_" msgstr "`IANA 時區資料庫 `_" -#: ../../library/datetime.rst:2278 +#: ../../library/datetime.rst:2292 msgid "" "The Time Zone Database (often called tz, tzdata or zoneinfo) contains code " "and data that represent the history of local time for many representative " @@ -3403,24 +3426,24 @@ msgid "" "saving rules." msgstr "" -#: ../../library/datetime.rst:2288 +#: ../../library/datetime.rst:2302 msgid ":class:`timezone` Objects" msgstr ":class:`timezone` 物件" -#: ../../library/datetime.rst:2290 +#: ../../library/datetime.rst:2304 msgid "" "The :class:`timezone` class is a subclass of :class:`tzinfo`, each instance " "of which represents a time zone defined by a fixed offset from UTC." msgstr "" -#: ../../library/datetime.rst:2294 +#: ../../library/datetime.rst:2308 msgid "" "Objects of this class cannot be used to represent time zone information in " "the locations where different offsets are used in different days of the year " "or where historical changes have been made to civil time." msgstr "" -#: ../../library/datetime.rst:2301 +#: ../../library/datetime.rst:2315 msgid "" "The *offset* argument must be specified as a :class:`timedelta` object " "representing the difference between the local time and UTC. It must be " @@ -3428,25 +3451,25 @@ msgid "" "otherwise :exc:`ValueError` is raised." msgstr "" -#: ../../library/datetime.rst:2306 +#: ../../library/datetime.rst:2320 msgid "" "The *name* argument is optional. If specified it must be a string that will " "be used as the value returned by the :meth:`datetime.tzname` method." msgstr "" -#: ../../library/datetime.rst:2317 ../../library/datetime.rst:2328 +#: ../../library/datetime.rst:2331 ../../library/datetime.rst:2342 msgid "" "Return the fixed value specified when the :class:`timezone` instance is " "constructed." msgstr "" -#: ../../library/datetime.rst:2320 +#: ../../library/datetime.rst:2334 msgid "" "The *dt* argument is ignored. The return value is a :class:`timedelta` " "instance equal to the difference between the local time and UTC." msgstr "" -#: ../../library/datetime.rst:2331 +#: ../../library/datetime.rst:2345 msgid "" "If *name* is not provided in the constructor, the name returned by " "``tzname(dt)`` is generated from the value of the ``offset`` as follows. If " @@ -3455,119 +3478,119 @@ msgid "" "are two digits of ``offset.hours`` and ``offset.minutes`` respectively." msgstr "" -#: ../../library/datetime.rst:2337 +#: ../../library/datetime.rst:2351 msgid "" "Name generated from ``offset=timedelta(0)`` is now plain ``'UTC'``, not " "``'UTC+00:00'``." msgstr "" -#: ../../library/datetime.rst:2344 +#: ../../library/datetime.rst:2358 msgid "Always returns ``None``." msgstr "總是回傳 ``None``。" -#: ../../library/datetime.rst:2348 +#: ../../library/datetime.rst:2362 msgid "" "Return ``dt + offset``. The *dt* argument must be an aware :class:`." "datetime` instance, with ``tzinfo`` set to ``self``." msgstr "" -#: ../../library/datetime.rst:2355 +#: ../../library/datetime.rst:2369 msgid "The UTC time zone, ``timezone(timedelta(0))``." msgstr "UTC 時區,``timezone(timedelta(0))``。" -#: ../../library/datetime.rst:2364 +#: ../../library/datetime.rst:2378 msgid ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Behavior" msgstr ":meth:`~.datetime.strftime` 與 :meth:`~.datetime.strptime` 的行為" -#: ../../library/datetime.rst:2366 +#: ../../library/datetime.rst:2380 msgid "" ":class:`date`, :class:`.datetime`, and :class:`.time` objects all support a " "``strftime(format)`` method, to create a string representing the time under " "the control of an explicit format string." msgstr "" -#: ../../library/datetime.rst:2370 +#: ../../library/datetime.rst:2384 msgid "" "Conversely, the :meth:`datetime.strptime` class method creates a :class:`." "datetime` object from a string representing a date and time and a " "corresponding format string." msgstr "" -#: ../../library/datetime.rst:2374 +#: ../../library/datetime.rst:2388 msgid "" "The table below provides a high-level comparison of :meth:`~.datetime." "strftime` versus :meth:`~.datetime.strptime`:" msgstr "" -#: ../../library/datetime.rst:2378 +#: ../../library/datetime.rst:2392 msgid "``strftime``" msgstr "``strftime``" -#: ../../library/datetime.rst:2378 +#: ../../library/datetime.rst:2392 msgid "``strptime``" msgstr "``strptime``" -#: ../../library/datetime.rst:2380 +#: ../../library/datetime.rst:2394 msgid "Usage" msgstr "用法" -#: ../../library/datetime.rst:2380 +#: ../../library/datetime.rst:2394 msgid "Convert object to a string according to a given format" msgstr "" -#: ../../library/datetime.rst:2380 +#: ../../library/datetime.rst:2394 msgid "" "Parse a string into a :class:`.datetime` object given a corresponding format" msgstr "" -#: ../../library/datetime.rst:2382 +#: ../../library/datetime.rst:2396 msgid "Type of method" msgstr "" -#: ../../library/datetime.rst:2382 +#: ../../library/datetime.rst:2396 msgid "Instance method" msgstr "實例方法" -#: ../../library/datetime.rst:2382 +#: ../../library/datetime.rst:2396 msgid "Class method" msgstr "類別方法" -#: ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2398 msgid "Method of" msgstr "" -#: ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2398 msgid ":class:`date`; :class:`.datetime`; :class:`.time`" msgstr ":class:`date`; :class:`.datetime`; :class:`.time`" -#: ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2398 msgid ":class:`.datetime`" msgstr ":class:`.datetime`" -#: ../../library/datetime.rst:2386 +#: ../../library/datetime.rst:2400 msgid "Signature" msgstr "" -#: ../../library/datetime.rst:2386 +#: ../../library/datetime.rst:2400 msgid "``strftime(format)``" msgstr "``strftime(format)``" -#: ../../library/datetime.rst:2386 +#: ../../library/datetime.rst:2400 msgid "``strptime(date_string, format)``" msgstr "``strptime(date_string, format)``" -#: ../../library/datetime.rst:2393 +#: ../../library/datetime.rst:2407 msgid "" ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Format Codes" msgstr ":meth:`~.datetime.strftime` 與 :meth:`~.datetime.strptime` 格式碼" -#: ../../library/datetime.rst:2395 +#: ../../library/datetime.rst:2409 msgid "" "These methods accept format codes that can be used to parse and format " "dates::" msgstr "" -#: ../../library/datetime.rst:2397 +#: ../../library/datetime.rst:2411 msgid "" ">>> datetime.strptime('31/01/22 23:59:59.999999',\n" "... '%d/%m/%y %H:%M:%S.%f')\n" @@ -3581,33 +3604,33 @@ msgstr "" ">>> _.strftime('%a %d %b %Y, %I:%M%p')\n" "'Mon 31 Jan 2022, 11:59PM'" -#: ../../library/datetime.rst:2403 +#: ../../library/datetime.rst:2417 msgid "" "The following is a list of all the format codes that the 1989 C standard " "requires, and these work on all platforms with a standard C implementation." msgstr "" -#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2510 +#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 msgid "Directive" msgstr "" -#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2510 +#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 msgid "Meaning" msgstr "含義" -#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2510 +#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 msgid "Example" msgstr "範例" -#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2510 +#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 msgid "Notes" msgstr "註解" -#: ../../library/datetime.rst:2409 +#: ../../library/datetime.rst:2423 msgid "``%a``" msgstr "``%a``" -#: ../../library/datetime.rst:2409 +#: ../../library/datetime.rst:2423 msgid "Weekday as locale's abbreviated name." msgstr "" @@ -3619,11 +3642,11 @@ msgstr "" msgid "So, Mo, ..., Sa (de_DE)" msgstr "" -#: ../../library/datetime.rst:2414 +#: ../../library/datetime.rst:2428 msgid "``%A``" msgstr "``%A``" -#: ../../library/datetime.rst:2414 +#: ../../library/datetime.rst:2428 msgid "Weekday as locale's full name." msgstr "" @@ -3635,42 +3658,42 @@ msgstr "" msgid "Sonntag, Montag, ..., Samstag (de_DE)" msgstr "" -#: ../../library/datetime.rst:2419 +#: ../../library/datetime.rst:2433 msgid "``%w``" msgstr "``%w``" -#: ../../library/datetime.rst:2419 +#: ../../library/datetime.rst:2433 msgid "Weekday as a decimal number, where 0 is Sunday and 6 is Saturday." msgstr "" -#: ../../library/datetime.rst:2419 +#: ../../library/datetime.rst:2433 msgid "0, 1, ..., 6" msgstr "0, 1, ..., 6" -#: ../../library/datetime.rst:2423 +#: ../../library/datetime.rst:2437 msgid "``%d``" msgstr "``%d``" -#: ../../library/datetime.rst:2423 +#: ../../library/datetime.rst:2437 msgid "Day of the month as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2423 +#: ../../library/datetime.rst:2437 msgid "01, 02, ..., 31" msgstr "01, 02, ..., 31" -#: ../../library/datetime.rst:2423 ../../library/datetime.rst:2436 -#: ../../library/datetime.rst:2439 ../../library/datetime.rst:2445 -#: ../../library/datetime.rst:2448 ../../library/datetime.rst:2454 -#: ../../library/datetime.rst:2472 +#: ../../library/datetime.rst:2437 ../../library/datetime.rst:2450 +#: ../../library/datetime.rst:2453 ../../library/datetime.rst:2459 +#: ../../library/datetime.rst:2462 ../../library/datetime.rst:2468 +#: ../../library/datetime.rst:2486 msgid "\\(9)" msgstr "\\(9)" -#: ../../library/datetime.rst:2426 +#: ../../library/datetime.rst:2440 msgid "``%b``" msgstr "``%b``" -#: ../../library/datetime.rst:2426 +#: ../../library/datetime.rst:2440 msgid "Month as locale's abbreviated name." msgstr "" @@ -3682,11 +3705,11 @@ msgstr "" msgid "Jan, Feb, ..., Dez (de_DE)" msgstr "" -#: ../../library/datetime.rst:2431 +#: ../../library/datetime.rst:2445 msgid "``%B``" msgstr "``%B``" -#: ../../library/datetime.rst:2431 +#: ../../library/datetime.rst:2445 msgid "Month as locale's full name." msgstr "" @@ -3698,67 +3721,67 @@ msgstr "" msgid "Januar, Februar, ..., Dezember (de_DE)" msgstr "" -#: ../../library/datetime.rst:2436 +#: ../../library/datetime.rst:2450 msgid "``%m``" msgstr "``%m``" -#: ../../library/datetime.rst:2436 +#: ../../library/datetime.rst:2450 msgid "Month as a zero-padded decimal number." msgstr "以零填充的並以十進位數字表示的月份。" -#: ../../library/datetime.rst:2436 ../../library/datetime.rst:2448 +#: ../../library/datetime.rst:2450 ../../library/datetime.rst:2462 msgid "01, 02, ..., 12" msgstr "01, 02, ..., 12" -#: ../../library/datetime.rst:2439 +#: ../../library/datetime.rst:2453 msgid "``%y``" msgstr "``%y``" -#: ../../library/datetime.rst:2439 +#: ../../library/datetime.rst:2453 msgid "Year without century as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2439 +#: ../../library/datetime.rst:2453 msgid "00, 01, ..., 99" msgstr "00, 01, ..., 99" -#: ../../library/datetime.rst:2442 +#: ../../library/datetime.rst:2456 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/datetime.rst:2442 +#: ../../library/datetime.rst:2456 msgid "Year with century as a decimal number." msgstr "" -#: ../../library/datetime.rst:2442 ../../library/datetime.rst:2512 +#: ../../library/datetime.rst:2456 ../../library/datetime.rst:2526 msgid "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" msgstr "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" -#: ../../library/datetime.rst:2445 +#: ../../library/datetime.rst:2459 msgid "``%H``" msgstr "``%H``" -#: ../../library/datetime.rst:2445 +#: ../../library/datetime.rst:2459 msgid "Hour (24-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2445 +#: ../../library/datetime.rst:2459 msgid "00, 01, ..., 23" msgstr "00, 01, ..., 23" -#: ../../library/datetime.rst:2448 +#: ../../library/datetime.rst:2462 msgid "``%I``" msgstr "``%I``" -#: ../../library/datetime.rst:2448 +#: ../../library/datetime.rst:2462 msgid "Hour (12-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2451 +#: ../../library/datetime.rst:2465 msgid "``%p``" msgstr "``%p``" -#: ../../library/datetime.rst:2451 +#: ../../library/datetime.rst:2465 msgid "Locale's equivalent of either AM or PM." msgstr "" @@ -3770,128 +3793,128 @@ msgstr "AM, PM (en_US);" msgid "am, pm (de_DE)" msgstr "am, pm (de_DE)" -#: ../../library/datetime.rst:2451 +#: ../../library/datetime.rst:2465 msgid "\\(1), \\(3)" msgstr "\\(1), \\(3)" -#: ../../library/datetime.rst:2454 +#: ../../library/datetime.rst:2468 msgid "``%M``" msgstr "``%M``" -#: ../../library/datetime.rst:2454 +#: ../../library/datetime.rst:2468 msgid "Minute as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2454 ../../library/datetime.rst:2457 +#: ../../library/datetime.rst:2468 ../../library/datetime.rst:2471 msgid "00, 01, ..., 59" msgstr "00, 01, ..., 59" -#: ../../library/datetime.rst:2457 +#: ../../library/datetime.rst:2471 msgid "``%S``" msgstr "``%S``" -#: ../../library/datetime.rst:2457 +#: ../../library/datetime.rst:2471 msgid "Second as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2457 +#: ../../library/datetime.rst:2471 msgid "\\(4), \\(9)" msgstr "\\(4), \\(9)" -#: ../../library/datetime.rst:2460 +#: ../../library/datetime.rst:2474 msgid "``%f``" msgstr "``%f``" -#: ../../library/datetime.rst:2460 +#: ../../library/datetime.rst:2474 msgid "Microsecond as a decimal number, zero-padded to 6 digits." msgstr "" -#: ../../library/datetime.rst:2460 +#: ../../library/datetime.rst:2474 msgid "000000, 000001, ..., 999999" msgstr "000000, 000001, ..., 999999" -#: ../../library/datetime.rst:2460 +#: ../../library/datetime.rst:2474 msgid "\\(5)" msgstr "\\(5)" -#: ../../library/datetime.rst:2464 ../../library/datetime.rst:2623 +#: ../../library/datetime.rst:2478 ../../library/datetime.rst:2637 msgid "``%z``" msgstr "``%z``" -#: ../../library/datetime.rst:2464 +#: ../../library/datetime.rst:2478 msgid "" "UTC offset in the form ``±HHMM[SS[.ffffff]]`` (empty string if the object is " "naive)." msgstr "" -#: ../../library/datetime.rst:2464 +#: ../../library/datetime.rst:2478 msgid "(empty), +0000, -0400, +1030, +063415, -030712.345216" msgstr "" -#: ../../library/datetime.rst:2464 ../../library/datetime.rst:2469 -#: ../../library/datetime.rst:2526 +#: ../../library/datetime.rst:2478 ../../library/datetime.rst:2483 +#: ../../library/datetime.rst:2540 msgid "\\(6)" msgstr "\\(6)" -#: ../../library/datetime.rst:2469 ../../library/datetime.rst:2649 +#: ../../library/datetime.rst:2483 ../../library/datetime.rst:2663 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/datetime.rst:2469 +#: ../../library/datetime.rst:2483 msgid "Time zone name (empty string if the object is naive)." msgstr "" -#: ../../library/datetime.rst:2469 +#: ../../library/datetime.rst:2483 msgid "(empty), UTC, GMT" msgstr "" -#: ../../library/datetime.rst:2472 +#: ../../library/datetime.rst:2486 msgid "``%j``" msgstr "``%j``" -#: ../../library/datetime.rst:2472 +#: ../../library/datetime.rst:2486 msgid "Day of the year as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2472 +#: ../../library/datetime.rst:2486 msgid "001, 002, ..., 366" msgstr "001, 002, ..., 366" -#: ../../library/datetime.rst:2475 +#: ../../library/datetime.rst:2489 msgid "``%U``" msgstr "``%U``" -#: ../../library/datetime.rst:2475 +#: ../../library/datetime.rst:2489 msgid "" "Week number of the year (Sunday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Sunday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2475 ../../library/datetime.rst:2483 +#: ../../library/datetime.rst:2489 ../../library/datetime.rst:2497 msgid "00, 01, ..., 53" msgstr "00, 01, ..., 53" -#: ../../library/datetime.rst:2475 ../../library/datetime.rst:2483 +#: ../../library/datetime.rst:2489 ../../library/datetime.rst:2497 msgid "\\(7), \\(9)" msgstr "\\(7), \\(9)" -#: ../../library/datetime.rst:2483 +#: ../../library/datetime.rst:2497 msgid "``%W``" msgstr "``%W``" -#: ../../library/datetime.rst:2483 +#: ../../library/datetime.rst:2497 msgid "" "Week number of the year (Monday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Monday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2491 +#: ../../library/datetime.rst:2505 msgid "``%c``" msgstr "``%c``" -#: ../../library/datetime.rst:2491 +#: ../../library/datetime.rst:2505 msgid "Locale's appropriate date and time representation." msgstr "" @@ -3903,11 +3926,11 @@ msgstr "" msgid "Di 16 Aug 21:30:00 1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2496 +#: ../../library/datetime.rst:2510 msgid "``%x``" msgstr "``%x``" -#: ../../library/datetime.rst:2496 +#: ../../library/datetime.rst:2510 msgid "Locale's appropriate date representation." msgstr "" @@ -3923,11 +3946,11 @@ msgstr "" msgid "16.08.1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2500 +#: ../../library/datetime.rst:2514 msgid "``%X``" msgstr "``%X``" -#: ../../library/datetime.rst:2500 +#: ../../library/datetime.rst:2514 msgid "Locale's appropriate time representation." msgstr "" @@ -3939,83 +3962,83 @@ msgstr "" msgid "21:30:00 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2503 +#: ../../library/datetime.rst:2517 msgid "``%%``" msgstr "``%%``" -#: ../../library/datetime.rst:2503 +#: ../../library/datetime.rst:2517 msgid "A literal ``'%'`` character." msgstr "" -#: ../../library/datetime.rst:2503 +#: ../../library/datetime.rst:2517 msgid "%" msgstr "%" -#: ../../library/datetime.rst:2506 +#: ../../library/datetime.rst:2520 msgid "" "Several additional directives not required by the C89 standard are included " "for convenience. These parameters all correspond to ISO 8601 date values." msgstr "" -#: ../../library/datetime.rst:2512 +#: ../../library/datetime.rst:2526 msgid "``%G``" msgstr "``%G``" -#: ../../library/datetime.rst:2512 +#: ../../library/datetime.rst:2526 msgid "" "ISO 8601 year with century representing the year that contains the greater " "part of the ISO week (``%V``)." msgstr "" -#: ../../library/datetime.rst:2512 +#: ../../library/datetime.rst:2526 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2531 msgid "``%u``" msgstr "``%u``" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2531 msgid "ISO 8601 weekday as a decimal number where 1 is Monday." msgstr "" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2531 msgid "1, 2, ..., 7" msgstr "1, 2, ..., 7" -#: ../../library/datetime.rst:2520 +#: ../../library/datetime.rst:2534 msgid "``%V``" msgstr "``%V``" -#: ../../library/datetime.rst:2520 +#: ../../library/datetime.rst:2534 msgid "" "ISO 8601 week as a decimal number with Monday as the first day of the week. " "Week 01 is the week containing Jan 4." msgstr "" -#: ../../library/datetime.rst:2520 +#: ../../library/datetime.rst:2534 msgid "01, 02, ..., 53" msgstr "01, 02, ..., 53" -#: ../../library/datetime.rst:2520 +#: ../../library/datetime.rst:2534 msgid "\\(8), \\(9)" msgstr "\\(8), \\(9)" -#: ../../library/datetime.rst:2526 ../../library/datetime.rst:2645 +#: ../../library/datetime.rst:2540 ../../library/datetime.rst:2659 msgid "``%:z``" msgstr "``%:z``" -#: ../../library/datetime.rst:2526 +#: ../../library/datetime.rst:2540 msgid "" "UTC offset in the form ``±HH:MM[:SS[.ffffff]]`` (empty string if the object " "is naive)." msgstr "" -#: ../../library/datetime.rst:2526 +#: ../../library/datetime.rst:2540 msgid "(empty), +00:00, -04:00, +10:30, +06:34:15, -03:07:12.345216" msgstr "" -#: ../../library/datetime.rst:2532 +#: ../../library/datetime.rst:2546 msgid "" "These may not be available on all platforms when used with the :meth:`~." "datetime.strftime` method. The ISO 8601 year and ISO 8601 week directives " @@ -4024,7 +4047,7 @@ msgid "" "directives will raise a :exc:`ValueError`." msgstr "" -#: ../../library/datetime.rst:2537 +#: ../../library/datetime.rst:2551 msgid "" "The full set of format codes supported varies across platforms, because " "Python calls the platform C library's :c:func:`strftime` function, and " @@ -4034,44 +4057,44 @@ msgid "" "unsupported format specifiers." msgstr "" -#: ../../library/datetime.rst:2543 +#: ../../library/datetime.rst:2557 msgid "``%G``, ``%u`` and ``%V`` were added." msgstr "新增 ``%G``、``%u`` 與 ``%V``。" -#: ../../library/datetime.rst:2546 +#: ../../library/datetime.rst:2560 msgid "``%:z`` was added." msgstr "新增 ``%:z``。" -#: ../../library/datetime.rst:2550 +#: ../../library/datetime.rst:2564 msgid "Technical Detail" msgstr "技術細節" -#: ../../library/datetime.rst:2552 +#: ../../library/datetime.rst:2566 msgid "" "Broadly speaking, ``d.strftime(fmt)`` acts like the :mod:`time` module's " "``time.strftime(fmt, d.timetuple())`` although not all objects support a :" "meth:`~date.timetuple` method." msgstr "" -#: ../../library/datetime.rst:2556 +#: ../../library/datetime.rst:2570 msgid "" "For the :meth:`.datetime.strptime` class method, the default value is " "``1900-01-01T00:00:00.000``: any components not specified in the format " "string will be pulled from the default value. [#]_" msgstr "" -#: ../../library/datetime.rst:2560 +#: ../../library/datetime.rst:2574 msgid "Using ``datetime.strptime(date_string, format)`` is equivalent to::" msgstr "" -#: ../../library/datetime.rst:2564 +#: ../../library/datetime.rst:2578 msgid "" "except when the format includes sub-second components or time zone offset " "information, which are supported in ``datetime.strptime`` but are discarded " "by ``time.strptime``." msgstr "" -#: ../../library/datetime.rst:2568 +#: ../../library/datetime.rst:2582 msgid "" "For :class:`.time` objects, the format codes for year, month, and day should " "not be used, as :class:`!time` objects have no such values. If they're used " @@ -4081,7 +4104,7 @@ msgstr "" "time` 物件並沒有這些值。如果使用這些格式碼,年份會以 1900 代替、月及日會以 1 " "代替。" -#: ../../library/datetime.rst:2572 +#: ../../library/datetime.rst:2586 msgid "" "For :class:`date` objects, the format codes for hours, minutes, seconds, and " "microseconds should not be used, as :class:`date` objects have no such " @@ -4090,7 +4113,7 @@ msgstr "" "對 :class:`.date` 物件來說,不應該使用時、分、秒、微秒的格式碼,因為 :class:" "`date` 物件並沒有這些值。如果使用這些格式碼,這些值都會以 0 代替。" -#: ../../library/datetime.rst:2576 +#: ../../library/datetime.rst:2590 msgid "" "For the same reason, handling of format strings containing Unicode code " "points that can't be represented in the charset of the current locale is " @@ -4099,7 +4122,7 @@ msgid "" "`UnicodeError` or return an empty string instead." msgstr "" -#: ../../library/datetime.rst:2585 +#: ../../library/datetime.rst:2599 msgid "" "Because the format depends on the current locale, care should be taken when " "making assumptions about the output value. Field orderings will vary (for " @@ -4107,38 +4130,38 @@ msgid "" "contain non-ASCII characters." msgstr "" -#: ../../library/datetime.rst:2591 +#: ../../library/datetime.rst:2605 msgid "" "The :meth:`~.datetime.strptime` method can parse years in the full [1, 9999] " "range, but years < 1000 must be zero-filled to 4-digit width." msgstr "" -#: ../../library/datetime.rst:2594 +#: ../../library/datetime.rst:2608 msgid "" "In previous versions, :meth:`~.datetime.strftime` method was restricted to " "years >= 1900." msgstr "" -#: ../../library/datetime.rst:2598 +#: ../../library/datetime.rst:2612 msgid "" "In version 3.2, :meth:`~.datetime.strftime` method was restricted to years " ">= 1000." msgstr "" -#: ../../library/datetime.rst:2603 +#: ../../library/datetime.rst:2617 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%p`` directive " "only affects the output hour field if the ``%I`` directive is used to parse " "the hour." msgstr "" -#: ../../library/datetime.rst:2607 +#: ../../library/datetime.rst:2621 msgid "" "Unlike the :mod:`time` module, the :mod:`!datetime` module does not support " "leap seconds." msgstr "" -#: ../../library/datetime.rst:2611 +#: ../../library/datetime.rst:2625 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%f`` directive " "accepts from one to six digits and zero pads on the right. ``%f`` is an " @@ -4146,17 +4169,17 @@ msgid "" "separately in datetime objects, and therefore always available)." msgstr "" -#: ../../library/datetime.rst:2618 +#: ../../library/datetime.rst:2632 msgid "" "For a naive object, the ``%z``, ``%:z`` and ``%Z`` format codes are replaced " "by empty strings." msgstr "" -#: ../../library/datetime.rst:2621 +#: ../../library/datetime.rst:2635 msgid "For an aware object:" msgstr "" -#: ../../library/datetime.rst:2624 +#: ../../library/datetime.rst:2638 msgid "" ":meth:`~.datetime.utcoffset` is transformed into a string of the form " "``±HHMM[SS[.ffffff]]``, where ``HH`` is a 2-digit string giving the number " @@ -4170,7 +4193,7 @@ msgid "" "replaced with the string ``'-0330'``." msgstr "" -#: ../../library/datetime.rst:2638 +#: ../../library/datetime.rst:2652 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, the UTC offsets can have a colon as a separator between hours, " @@ -4179,53 +4202,53 @@ msgid "" "``'+00:00'``." msgstr "" -#: ../../library/datetime.rst:2646 +#: ../../library/datetime.rst:2660 msgid "" "Behaves exactly as ``%z``, but has a colon separator added between hours, " "minutes and seconds." msgstr "" -#: ../../library/datetime.rst:2650 +#: ../../library/datetime.rst:2664 msgid "" "In :meth:`~.datetime.strftime`, ``%Z`` is replaced by an empty string if :" "meth:`~.datetime.tzname` returns ``None``; otherwise ``%Z`` is replaced by " "the returned value, which must be a string." msgstr "" -#: ../../library/datetime.rst:2654 +#: ../../library/datetime.rst:2668 msgid ":meth:`~.datetime.strptime` only accepts certain values for ``%Z``:" msgstr "" -#: ../../library/datetime.rst:2656 +#: ../../library/datetime.rst:2670 msgid "any value in ``time.tzname`` for your machine's locale" msgstr "" -#: ../../library/datetime.rst:2657 +#: ../../library/datetime.rst:2671 msgid "the hard-coded values ``UTC`` and ``GMT``" msgstr "" -#: ../../library/datetime.rst:2659 +#: ../../library/datetime.rst:2673 msgid "" "So someone living in Japan may have ``JST``, ``UTC``, and ``GMT`` as valid " "values, but probably not ``EST``. It will raise ``ValueError`` for invalid " "values." msgstr "" -#: ../../library/datetime.rst:2663 +#: ../../library/datetime.rst:2677 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, an aware :class:`.datetime` object will be produced. The ``tzinfo`` " "of the result will be set to a :class:`timezone` instance." msgstr "" -#: ../../library/datetime.rst:2669 +#: ../../library/datetime.rst:2683 msgid "" "When used with the :meth:`~.datetime.strptime` method, ``%U`` and ``%W`` are " "only used in calculations when the day of the week and the calendar year " "(``%Y``) are specified." msgstr "" -#: ../../library/datetime.rst:2674 +#: ../../library/datetime.rst:2688 msgid "" "Similar to ``%U`` and ``%W``, ``%V`` is only used in calculations when the " "day of the week and the ISO year (``%G``) are specified in a :meth:`~." @@ -4233,7 +4256,7 @@ msgid "" "interchangeable." msgstr "" -#: ../../library/datetime.rst:2680 +#: ../../library/datetime.rst:2694 msgid "" "When used with the :meth:`~.datetime.strptime` method, the leading zero is " "optional for formats ``%d``, ``%m``, ``%H``, ``%I``, ``%M``, ``%S``, " @@ -4241,7 +4264,7 @@ msgid "" "zero." msgstr "" -#: ../../library/datetime.rst:2685 +#: ../../library/datetime.rst:2699 msgid "" "When parsing a month and day using :meth:`~.datetime.strptime`, always " "include a year in the format. If the value you need to parse lacks a year, " @@ -4250,7 +4273,7 @@ msgid "" "parser is not a leap year. Users run into this bug every four years..." msgstr "" -#: ../../library/datetime.rst:2691 +#: ../../library/datetime.rst:2705 msgid "" ">>> month_day = \"02/29\"\n" ">>> datetime.strptime(f\"{month_day};1984\", \"%m/%d;%Y\") # No leap year " @@ -4258,7 +4281,7 @@ msgid "" "datetime.datetime(1984, 2, 29, 0, 0)" msgstr "" -#: ../../library/datetime.rst:2697 +#: ../../library/datetime.rst:2711 msgid "" ":meth:`~.datetime.strptime` calls using a format string containing a day of " "month without a year now emit a :exc:`DeprecationWarning`. In 3.15 or later " @@ -4266,15 +4289,15 @@ msgid "" "See :gh:`70647`." msgstr "" -#: ../../library/datetime.rst:2704 +#: ../../library/datetime.rst:2718 msgid "Footnotes" msgstr "註解" -#: ../../library/datetime.rst:2705 +#: ../../library/datetime.rst:2719 msgid "If, that is, we ignore the effects of Relativity" msgstr "也就是說,我們會忽略相對論的效應" -#: ../../library/datetime.rst:2707 +#: ../../library/datetime.rst:2721 msgid "" "This matches the definition of the \"proleptic Gregorian\" calendar in " "Dershowitz and Reingold's book *Calendrical Calculations*, where it's the " @@ -4283,23 +4306,23 @@ msgid "" "systems." msgstr "" -#: ../../library/datetime.rst:2713 +#: ../../library/datetime.rst:2727 msgid "" "See R. H. van Gent's `guide to the mathematics of the ISO 8601 calendar " "`_ for a good explanation." msgstr "" -#: ../../library/datetime.rst:2717 +#: ../../library/datetime.rst:2731 msgid "" "Passing ``datetime.strptime('Feb 29', '%b %d')`` will fail since 1900 is not " "a leap year." msgstr "" -#: ../../library/datetime.rst:2358 +#: ../../library/datetime.rst:2372 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/datetime.rst:2358 +#: ../../library/datetime.rst:2372 msgid "datetime format" msgstr "datetime format(日期時間格式)" diff --git a/library/email.contentmanager.po b/library/email.contentmanager.po index 2c155e66b3..a03eead9b1 100644 --- a/library/email.contentmanager.po +++ b/library/email.contentmanager.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -98,46 +98,46 @@ msgid "" msgstr "" #: ../../library/email.contentmanager.rst:61 -msgid "the type's qualname (``typ.__qualname__``)" +msgid "the type's :attr:`qualname ` (``typ.__qualname__``)" msgstr "" #: ../../library/email.contentmanager.rst:62 -msgid "the type's name (``typ.__name__``)." +msgid "the type's :attr:`name ` (``typ.__name__``)." msgstr "" #: ../../library/email.contentmanager.rst:64 msgid "" "If none of the above match, repeat all of the checks above for each of the " -"types in the :term:`MRO` (``typ.__mro__``). Finally, if no other key yields " -"a handler, check for a handler for the key ``None``. If there is no handler " -"for ``None``, raise a :exc:`KeyError` for the fully qualified name of the " -"type." +"types in the :term:`MRO` (:attr:`typ.__mro__ `). Finally, if " +"no other key yields a handler, check for a handler for the key ``None``. If " +"there is no handler for ``None``, raise a :exc:`KeyError` for the fully " +"qualified name of the type." msgstr "" -#: ../../library/email.contentmanager.rst:70 +#: ../../library/email.contentmanager.rst:71 msgid "" "Also add a :mailheader:`MIME-Version` header if one is not present (see " "also :class:`.MIMEPart`)." msgstr "" -#: ../../library/email.contentmanager.rst:76 +#: ../../library/email.contentmanager.rst:77 msgid "" "Record the function *handler* as the handler for *key*. For the possible " "values of *key*, see :meth:`get_content`." msgstr "" -#: ../../library/email.contentmanager.rst:82 +#: ../../library/email.contentmanager.rst:83 msgid "" "Record *handler* as the function to call when an object of a type matching " "*typekey* is passed to :meth:`set_content`. For the possible values of " "*typekey*, see :meth:`set_content`." msgstr "" -#: ../../library/email.contentmanager.rst:88 +#: ../../library/email.contentmanager.rst:89 msgid "Content Manager Instances" msgstr "" -#: ../../library/email.contentmanager.rst:90 +#: ../../library/email.contentmanager.rst:91 msgid "" "Currently the email package provides only one concrete content manager, :" "data:`raw_data_manager`, although more may be added in the future. :data:" @@ -145,7 +145,7 @@ msgid "" "provided by :attr:`~email.policy.EmailPolicy` and its derivatives." msgstr "" -#: ../../library/email.contentmanager.rst:99 +#: ../../library/email.contentmanager.rst:100 msgid "" "This content manager provides only a minimum interface beyond that provided " "by :class:`~email.message.Message` itself: it deals only with text, raw " @@ -158,7 +158,7 @@ msgid "" "simplifying the creation of multipart messages." msgstr "" -#: ../../library/email.contentmanager.rst:111 +#: ../../library/email.contentmanager.rst:112 msgid "" "Return the payload of the part as either a string (for ``text`` parts), an :" "class:`~email.message.EmailMessage` object (for ``message/rfc822`` parts), " @@ -168,28 +168,28 @@ msgid "" "to unicode. The default error handler is ``replace``." msgstr "" -#: ../../library/email.contentmanager.rst:130 +#: ../../library/email.contentmanager.rst:131 msgid "Add headers and payload to *msg*:" msgstr "" -#: ../../library/email.contentmanager.rst:132 +#: ../../library/email.contentmanager.rst:133 msgid "" "Add a :mailheader:`Content-Type` header with a ``maintype/subtype`` value." msgstr "" -#: ../../library/email.contentmanager.rst:135 +#: ../../library/email.contentmanager.rst:136 msgid "" "For ``str``, set the MIME ``maintype`` to ``text``, and set the subtype to " "*subtype* if it is specified, or ``plain`` if it is not." msgstr "" -#: ../../library/email.contentmanager.rst:137 +#: ../../library/email.contentmanager.rst:138 msgid "" "For ``bytes``, use the specified *maintype* and *subtype*, or raise a :exc:" "`TypeError` if they are not specified." msgstr "" -#: ../../library/email.contentmanager.rst:139 +#: ../../library/email.contentmanager.rst:140 msgid "" "For :class:`~email.message.EmailMessage` objects, set the maintype to " "``message``, and set the subtype to *subtype* if it is specified or " @@ -197,7 +197,7 @@ msgid "" "(``bytes`` objects must be used to construct ``message/partial`` parts)." msgstr "" -#: ../../library/email.contentmanager.rst:145 +#: ../../library/email.contentmanager.rst:146 msgid "" "If *charset* is provided (which is valid only for ``str``), encode the " "string to bytes using the specified character set. The default is " @@ -205,7 +205,7 @@ msgid "" "charset name, use the standard charset instead." msgstr "" -#: ../../library/email.contentmanager.rst:150 +#: ../../library/email.contentmanager.rst:151 msgid "" "If *cte* is set, encode the payload using the specified content transfer " "encoding, and set the :mailheader:`Content-Transfer-Encoding` header to that " @@ -215,13 +215,13 @@ msgid "" "that contains non-ASCII values), raise a :exc:`ValueError`." msgstr "" -#: ../../library/email.contentmanager.rst:158 +#: ../../library/email.contentmanager.rst:159 msgid "" "For ``str`` objects, if *cte* is not set use heuristics to determine the " "most compact encoding." msgstr "" -#: ../../library/email.contentmanager.rst:160 +#: ../../library/email.contentmanager.rst:161 msgid "" "For :class:`~email.message.EmailMessage`, per :rfc:`2046`, raise an error if " "a *cte* of ``quoted-printable`` or ``base64`` is requested for *subtype* " @@ -230,14 +230,14 @@ msgid "" "For all other values of *subtype*, use ``7bit``." msgstr "" -#: ../../library/email.contentmanager.rst:167 +#: ../../library/email.contentmanager.rst:168 msgid "" "A *cte* of ``binary`` does not actually work correctly yet. The " "``EmailMessage`` object as modified by ``set_content`` is correct, but :" "class:`~email.generator.BytesGenerator` does not serialize it correctly." msgstr "" -#: ../../library/email.contentmanager.rst:172 +#: ../../library/email.contentmanager.rst:173 msgid "" "If *disposition* is set, use it as the value of the :mailheader:`Content-" "Disposition` header. If not specified, and *filename* is specified, add the " @@ -246,37 +246,37 @@ msgid "" "values for *disposition* are ``attachment`` and ``inline``." msgstr "" -#: ../../library/email.contentmanager.rst:179 +#: ../../library/email.contentmanager.rst:180 msgid "" "If *filename* is specified, use it as the value of the ``filename`` " "parameter of the :mailheader:`Content-Disposition` header." msgstr "" -#: ../../library/email.contentmanager.rst:182 +#: ../../library/email.contentmanager.rst:183 msgid "" "If *cid* is specified, add a :mailheader:`Content-ID` header with *cid* as " "its value." msgstr "" -#: ../../library/email.contentmanager.rst:185 +#: ../../library/email.contentmanager.rst:186 msgid "" "If *params* is specified, iterate its ``items`` method and use the resulting " "``(key, value)`` pairs to set additional parameters on the :mailheader:" "`Content-Type` header." msgstr "" -#: ../../library/email.contentmanager.rst:189 +#: ../../library/email.contentmanager.rst:190 msgid "" "If *headers* is specified and is a list of strings of the form ``headername: " "headervalue`` or a list of ``header`` objects (distinguished from strings by " "having a ``name`` attribute), add the headers to *msg*." msgstr "" -#: ../../library/email.contentmanager.rst:196 +#: ../../library/email.contentmanager.rst:197 msgid "Footnotes" msgstr "註解" -#: ../../library/email.contentmanager.rst:197 +#: ../../library/email.contentmanager.rst:198 msgid "" "Originally added in 3.4 as a :term:`provisional module `" msgstr "" diff --git a/library/email.headerregistry.po b/library/email.headerregistry.po index a55e5e9a83..7d6b290f43 100644 --- a/library/email.headerregistry.po +++ b/library/email.headerregistry.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -390,7 +390,7 @@ msgid "" "class. When *use_default_map* is ``True`` (the default), the standard " "mapping of header names to classes is copied in to the registry during " "initialization. *base_class* is always the last class in the generated " -"class's ``__bases__`` list." +"class's :class:`~type.__bases__` list." msgstr "" #: ../../library/email.headerregistry.rst:322 diff --git a/library/functions.po b/library/functions.po index 1ac9b3f1e4..0703f10a5b 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -514,13 +514,12 @@ msgid "" "ways." msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" -#: ../../library/functions.rst:141 ../../library/functions.rst:929 -#: ../../library/functions.rst:1308 +#: ../../library/functions.rst:141 ../../library/functions.rst:931 +#: ../../library/functions.rst:1311 msgid "See also :func:`format` for more information." msgstr "可參考 :func:`format` 獲取更多資訊。" #: ../../library/functions.rst:146 -#, fuzzy msgid "" "Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is " "converted using the standard :ref:`truth testing procedure `. If the " @@ -529,13 +528,13 @@ msgid "" "`typesnumeric`). It cannot be subclassed further. Its only instances are " "``False`` and ``True`` (see :ref:`typebool`)." msgstr "" -"回傳一個布林值,即 ``True`` 或者 ``False``。*x* 使用標準的\\ :ref:`真值測試程" -"序 `\\ 來轉換。如果 *x* 為假或者被省略,則回傳 ``False``;其他情況回" +"回傳一個布林值,即 ``True`` 或者 ``False``。引數會使用標準的\\ :ref:`真值測試" +"程序 `\\ 來轉換。如果引數為假或者被省略,則回傳 ``False``;其他情況回" "傳 ``True``。:class:`bool` class(類別)是 :class:`int` 的 subclass(子類別)" "(參見 :ref:`typesnumeric`),其他 class 不能繼承自它。它只有 ``False`` 和 " "``True`` 兩個實例(參見 :ref:`typebool`)。" -#: ../../library/functions.rst:156 ../../library/functions.rst:794 +#: ../../library/functions.rst:156 ../../library/functions.rst:796 msgid "The parameter is now positional-only." msgstr "現在為僅限位置參數。" @@ -764,15 +763,17 @@ msgstr "" #: ../../library/functions.rst:285 msgid "" -"Class methods now inherit the method attributes (``__module__``, " -"``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``) and " -"have a new ``__wrapped__`` attribute." +"Class methods now inherit the method attributes (:attr:`~function." +"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" +"attr:`~function.__doc__` and :attr:`~function.__annotations__`) and have a " +"new ``__wrapped__`` attribute." msgstr "" -"Class method 現在繼承了 method 屬性(``__module__``、``__name__``、" -"``__qualname__``、``__doc__`` 和 ``__annotations__``),並擁有一個新的 " +"Class method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" +"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." +"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " "``__wrapped__`` 屬性。" -#: ../../library/functions.rst:290 +#: ../../library/functions.rst:292 msgid "" "Class methods can no longer wrap other :term:`descriptors ` such " "as :func:`property`." @@ -780,7 +781,7 @@ msgstr "" "Class methods 不能再包裝其他的\\ :term:`描述器 `,例如 :func:" "`property`。" -#: ../../library/functions.rst:297 +#: ../../library/functions.rst:299 msgid "" "Compile the *source* into a code or AST object. Code objects can be " "executed by :func:`exec` or :func:`eval`. *source* can either be a normal " @@ -791,7 +792,7 @@ msgstr "" "`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。參見 :mod:" "`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" -#: ../../library/functions.rst:302 +#: ../../library/functions.rst:304 msgid "" "The *filename* argument should give the file from which the code was read; " "pass some recognizable value if it wasn't read from a file (``''`` " @@ -800,7 +801,7 @@ msgstr "" "*filename* 引數必須是程式碼的檔名;如果程式碼不是從檔案中讀取,可以傳入一些可" "辨識的值(經常會使用 ``''`` 來替代)。" -#: ../../library/functions.rst:306 +#: ../../library/functions.rst:308 msgid "" "The *mode* argument specifies what kind of code must be compiled; it can be " "``'exec'`` if *source* consists of a sequence of statements, ``'eval'`` if " @@ -813,7 +814,7 @@ msgstr "" "式,可以是 ``'single'``\\ (在最後一種情況下,如果運算式執行結果不是 " "``None`` 則會被印出來)。" -#: ../../library/functions.rst:312 +#: ../../library/functions.rst:314 msgid "" "The optional arguments *flags* and *dont_inherit* control which :ref:" "`compiler options ` should be activated and which :ref:" @@ -833,7 +834,7 @@ msgstr "" "引數所指定的編譯器選項和未來陳述式。如果 *dont_inherit* 是一個非零整數,則使" "用 *flags* 引數 -- 周圍程式碼中的旗標(未來功能和編譯器選項)將被忽略。" -#: ../../library/functions.rst:323 +#: ../../library/functions.rst:325 msgid "" "Compiler options and future statements are specified by bits which can be " "bitwise ORed together to specify multiple options. The bitfield required to " @@ -848,7 +849,7 @@ msgstr "" "compiler_flag` 屬性來獲得。:ref:`編譯器旗標 `\\ 可以在 :" "mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名稱。" -#: ../../library/functions.rst:331 +#: ../../library/functions.rst:333 msgid "" "The argument *optimize* specifies the optimization level of the compiler; " "the default value of ``-1`` selects the optimization level of the " @@ -861,7 +862,7 @@ msgstr "" "``__debug__`` 為真值)、``1``\\ (assert 被刪除,``__debug__`` 為假值)或 " "``2``\\ (說明字串 (docstring) 也被刪除)。" -#: ../../library/functions.rst:337 +#: ../../library/functions.rst:339 msgid "" "This function raises :exc:`SyntaxError` if the compiled source is invalid, " "and :exc:`ValueError` if the source contains null bytes." @@ -869,13 +870,13 @@ msgstr "" "如果編譯的原始碼無效,此函式會引發 :exc:`SyntaxError`,如果原始碼包含 null " "bytes,則會引發 :exc:`ValueError`。" -#: ../../library/functions.rst:340 +#: ../../library/functions.rst:342 msgid "" "If you want to parse Python code into its AST representation, see :func:`ast." "parse`." msgstr "如果你想解析 Python 程式碼為 AST 運算式,請參閱 :func:`ast.parse`。" -#: ../../library/functions.rst:343 ../../library/functions.rst:345 +#: ../../library/functions.rst:345 ../../library/functions.rst:347 msgid "" "Raises an :ref:`auditing event ` ``compile`` with arguments " "``source`` and ``filename``. This event may also be raised by implicit " @@ -884,7 +885,7 @@ msgstr "" "引發一個附帶引數 ``source``、``filename`` 的\\ :ref:`稽核事件 ` " "``compile``。此事件也可能由隱式編譯 (implicit compilation) 所引發。" -#: ../../library/functions.rst:351 +#: ../../library/functions.rst:353 msgid "" "When compiling a string with multi-line code in ``'single'`` or ``'eval'`` " "mode, input must be terminated by at least one newline character. This is " @@ -894,7 +895,7 @@ msgstr "" "在 ``'single'`` 或 ``'eval'`` 模式編譯多行程式碼時,輸入必須以至少一個換行符" "結尾。這使 :mod:`code` module 更容易檢測陳述式的完整性。" -#: ../../library/functions.rst:358 +#: ../../library/functions.rst:360 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string when compiling to an AST object due to stack depth " @@ -903,7 +904,7 @@ msgstr "" "如果編譯足夠大或者足夠複雜的字串成 AST 物件時,Python 直譯器會因為 Python " "AST 編譯器的 stack 深度限制而崩潰。" -#: ../../library/functions.rst:362 +#: ../../library/functions.rst:364 msgid "" "Allowed use of Windows and Mac newlines. Also, input in ``'exec'`` mode " "does not have to end in a newline anymore. Added the *optimize* parameter." @@ -911,13 +912,13 @@ msgstr "" "允許使用 Windows 和 Mac 的換行符號。此外,在 ``'exec'`` 模式不需要以換行符號" "結尾。增加了 *optimize* 參數。" -#: ../../library/functions.rst:366 +#: ../../library/functions.rst:368 msgid "" "Previously, :exc:`TypeError` was raised when null bytes were encountered in " "*source*." msgstr "在之前的版本,*source* 中包含 null bytes 會引發 :exc:`TypeError`。" -#: ../../library/functions.rst:370 +#: ../../library/functions.rst:372 msgid "" "``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable " "support for top-level ``await``, ``async for``, and ``async with``." @@ -925,18 +926,18 @@ msgstr "" "``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` 現在可以傳遞旗標以啟用對頂層 ``await``、" "``async for`` 和 ``async with`` 的支援。" -#: ../../library/functions.rst:379 +#: ../../library/functions.rst:381 msgid "" "Convert a single string or number to a complex number, or create a complex " "number from real and imaginary parts." msgstr "" -#: ../../library/functions.rst:382 ../../library/functions.rst:739 -#: ../../library/functions.rst:985 +#: ../../library/functions.rst:384 ../../library/functions.rst:741 +#: ../../library/functions.rst:987 msgid "Examples:" msgstr "例如: ::" -#: ../../library/functions.rst:384 +#: ../../library/functions.rst:386 msgid "" ">>> complex('+1.23')\n" "(1.23+0j)\n" @@ -972,7 +973,7 @@ msgstr "" ">>> complex(-1.23, 4.5)\n" "(-1.23+4.5j)" -#: ../../library/functions.rst:403 +#: ../../library/functions.rst:405 msgid "" "If the argument is a string, it must contain either a real part (in the same " "format as for :func:`float`) or an imaginary part (in the same format but " @@ -987,8 +988,7 @@ msgid "" "parentheses and leading and trailing whitespace characters are removed:" msgstr "" -#: ../../library/functions.rst:422 -#, fuzzy +#: ../../library/functions.rst:424 msgid "" "If the argument is a number, the constructor serves as a numeric conversion " "like :class:`int` and :class:`float`. For a general Python object ``x``, " @@ -997,12 +997,13 @@ msgid "" "If :meth:`!__float__` is not defined then it falls back to :meth:`~object." "__index__`." msgstr "" -"對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 ``x." +"如果引數是一個數字,則建構函式會像 :class:`int` 和 :class:`float` 一樣進行數" +"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 ``x." "__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " "back) 到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未定義,則會再回" "退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:431 +#: ../../library/functions.rst:433 msgid "" "If two arguments are provided or keyword arguments are used, each argument " "may be any numeric type (including complex). If both arguments are real " @@ -1013,20 +1014,20 @@ msgid "" "number, only its real component is used in the above expressions." msgstr "" -#: ../../library/functions.rst:441 +#: ../../library/functions.rst:443 msgid "If all arguments are omitted, returns ``0j``." msgstr "" -#: ../../library/functions.rst:443 +#: ../../library/functions.rst:445 msgid "The complex type is described in :ref:`typesnumeric`." msgstr "複數型別在 :ref:`typesnumeric` 中有相關描述。" -#: ../../library/functions.rst:445 ../../library/functions.rst:791 -#: ../../library/functions.rst:1034 +#: ../../library/functions.rst:447 ../../library/functions.rst:793 +#: ../../library/functions.rst:1036 msgid "Grouping digits with underscores as in code literals is allowed." msgstr "可以使用底線將程式碼文字中的數字進行分組。" -#: ../../library/functions.rst:448 +#: ../../library/functions.rst:450 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :" "meth:`~object.__float__` are not defined." @@ -1034,7 +1035,7 @@ msgstr "" "如果 :meth:`~object.__complex__` 和 :meth:`~object.__float__` 未定義,則會回" "退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:455 +#: ../../library/functions.rst:457 msgid "" "This is a relative of :func:`setattr`. The arguments are an object and a " "string. The string must be the name of one of the object's attributes. The " @@ -1047,7 +1048,7 @@ msgstr "" "'foobar')`` 等價於 ``del x.foobar``。*name* 不必是個 Python 識別符 " "(identifier)(請見 :func:`setattr`)。" -#: ../../library/functions.rst:468 +#: ../../library/functions.rst:470 msgid "" "Create a new dictionary. The :class:`dict` object is the dictionary class. " "See :class:`dict` and :ref:`typesmapping` for documentation about this class." @@ -1055,7 +1056,7 @@ msgstr "" "建立一個新的 dictionary(字典)。:class:`dict` 物件是一個 dictionary class。" "參見 :class:`dict` 和 :ref:`typesmapping` 來瞭解這個 class。" -#: ../../library/functions.rst:471 +#: ../../library/functions.rst:473 msgid "" "For other containers see the built-in :class:`list`, :class:`set`, and :" "class:`tuple` classes, as well as the :mod:`collections` module." @@ -1063,7 +1064,7 @@ msgstr "" "其他容器型別,請參見內建的 :class:`list`、:class:`set` 和 :class:`tuple` " "class,以及 :mod:`collections` module。" -#: ../../library/functions.rst:478 +#: ../../library/functions.rst:480 msgid "" "Without arguments, return the list of names in the current local scope. " "With an argument, attempt to return a list of valid attributes for that " @@ -1072,7 +1073,7 @@ msgstr "" "如果沒有引數,則回傳當前區域作用域 (local scope) 中的名稱列表。如果有引數,它" "會嘗試回傳該物件的有效屬性列表。" -#: ../../library/functions.rst:481 +#: ../../library/functions.rst:483 msgid "" "If the object has a method named :meth:`~object.__dir__`, this method will " "be called and must return the list of attributes. This allows objects that " @@ -1085,7 +1086,7 @@ msgstr "" "或 :func:`~object.__getattribute__` 函式的物件能夠自定義 :func:`dir` 來報告它" "們的屬性。" -#: ../../library/functions.rst:488 +#: ../../library/functions.rst:490 msgid "" "If the object does not provide :meth:`~object.__dir__`, the function tries " "its best to gather information from the object's :attr:`~object.__dict__` " @@ -1097,7 +1098,7 @@ msgstr "" "`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的,如果物件有" "自定義 :func:`~object.__getattr__`,那結果可能不準確。" -#: ../../library/functions.rst:494 +#: ../../library/functions.rst:496 msgid "" "The default :func:`dir` mechanism behaves differently with different types " "of objects, as it attempts to produce the most relevant, rather than " @@ -1106,13 +1107,13 @@ msgstr "" "預設的 :func:`dir` 機制對不同型別的物件有不同行為,它會試圖回傳最相關而非最完" "整的資訊:" -#: ../../library/functions.rst:498 +#: ../../library/functions.rst:500 msgid "" "If the object is a module object, the list contains the names of the " "module's attributes." msgstr "如果物件是 module 物件,則列表包含 module 的屬性名稱。" -#: ../../library/functions.rst:501 +#: ../../library/functions.rst:503 msgid "" "If the object is a type or class object, the list contains the names of its " "attributes, and recursively of the attributes of its bases." @@ -1120,7 +1121,7 @@ msgstr "" "如果物件是型別或 class 物件,則列表包含它們的屬性名稱,並且遞迴查詢其基礎的所" "有屬性。" -#: ../../library/functions.rst:504 +#: ../../library/functions.rst:506 msgid "" "Otherwise, the list contains the object's attributes' names, the names of " "its class's attributes, and recursively of the attributes of its class's " @@ -1129,11 +1130,11 @@ msgstr "" "否則,包含物件的屬性名稱列表、它的 class 屬性名稱,並且遞迴查詢它的 class 的" "所有基礎 class 的屬性。" -#: ../../library/functions.rst:508 +#: ../../library/functions.rst:510 msgid "The resulting list is sorted alphabetically. For example:" msgstr "回傳的列表按字母表排序,例如:" -#: ../../library/functions.rst:528 +#: ../../library/functions.rst:530 msgid "" "Because :func:`dir` is supplied primarily as a convenience for use at an " "interactive prompt, it tries to supply an interesting set of names more than " @@ -1146,7 +1147,7 @@ msgstr "" "版本之間改變。例如,當引數是一個 class 時,metaclass 的屬性不包含在結果列表" "中。" -#: ../../library/functions.rst:538 +#: ../../library/functions.rst:540 msgid "" "Take two (non-complex) numbers as arguments and return a pair of numbers " "consisting of their quotient and remainder when using integer division. " @@ -1164,7 +1165,7 @@ msgstr "" "等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % b) < " "abs(b)``。" -#: ../../library/functions.rst:550 +#: ../../library/functions.rst:552 msgid "" "Return an enumerate object. *iterable* must be a sequence, an :term:" "`iterator`, or some other object which supports iteration. The :meth:" @@ -1177,11 +1178,11 @@ msgstr "" "__next__` method 回傳一個 tuple(元組),裡面包含一個計數值(從 *start* 開" "始,預設為 0)和透過疊代 *iterable* 獲得的值。" -#: ../../library/functions.rst:562 +#: ../../library/functions.rst:564 msgid "Equivalent to::" msgstr "等價於: ::" -#: ../../library/functions.rst:564 +#: ../../library/functions.rst:566 msgid "" "def enumerate(iterable, start=0):\n" " n = start\n" @@ -1199,15 +1200,15 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/functions.rst:574 +#: ../../library/functions.rst:576 msgid "A Python expression." msgstr "" -#: ../../library/functions.rst:578 +#: ../../library/functions.rst:580 msgid "The global namespace (default: ``None``)." msgstr "" -#: ../../library/functions.rst:582 +#: ../../library/functions.rst:584 msgid "The local namespace (default: ``None``)." msgstr "" @@ -1215,7 +1216,7 @@ msgstr "" msgid "Returns" msgstr "" -#: ../../library/functions.rst:586 +#: ../../library/functions.rst:588 msgid "The result of the evaluated expression." msgstr "" @@ -1223,12 +1224,11 @@ msgstr "" msgid "raises" msgstr "引發" -#: ../../library/functions.rst:587 +#: ../../library/functions.rst:589 msgid "Syntax errors are reported as exceptions." msgstr "" -#: ../../library/functions.rst:589 -#, fuzzy +#: ../../library/functions.rst:591 msgid "" "The *expression* argument is parsed and evaluated as a Python expression " "(technically speaking, a condition list) using the *globals* and *locals* " @@ -1247,20 +1247,22 @@ msgid "" "`nonlocal` statement)." msgstr "" "*expression* 引數會被視為一條 Python 運算式(技術上而言,是條件列表)來剖析及" -"求值,而 *globals* 和 *locals* dictionaries 分別用作全域和區域命名空間。如果 " +"求值,而 *globals* 和 *locals* 對映分別用作全域和區域命名空間。如果 " "*globals* dictionary 存在但缺少 ``__builtins__`` 的鍵值,那 *expression* 被剖" "析之前,將為該鍵插入對內建 :mod:`builtins` module dictionary 的引用。這麼一" "來,在將 ``__builtins__`` dictionary 傳入 :func:`eval` 之前,你可以透過將它插" -"入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 被省略,那它" -"的預設值是 *globals* dictionary。如果兩個 dictionary 引數都被省略,則在 :" -"func:`eval` 被呼叫的環境中執行運算式。請注意,*eval()* 在封閉 (enclosing) 環" -"境中無法存取\\ :term:`巢狀作用域 ` (non-locals)。" - -#: ../../library/functions.rst:605 +"入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 對映被省略," +"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以在 :func:" +"`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意,*eval()* 在" +"封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-" +"locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透過 :keyword:" +"`nonlocal` 陳述式)。" + +#: ../../library/functions.rst:607 msgid "Example:" msgstr "範例:" -#: ../../library/functions.rst:611 +#: ../../library/functions.rst:613 msgid "" "This function can also be used to execute arbitrary code objects (such as " "those created by :func:`compile`). In this case, pass a code object instead " @@ -1271,7 +1273,7 @@ msgstr "" "情況下,傳入的引數是程式碼物件而不是字串。如果編譯該物件時的 *mode* 引數是 " "``'exec'``,那麼 :func:`eval` 回傳值為 ``None``。" -#: ../../library/functions.rst:616 +#: ../../library/functions.rst:618 msgid "" "Hints: dynamic execution of statements is supported by the :func:`exec` " "function. The :func:`globals` and :func:`locals` functions return the " @@ -1282,13 +1284,13 @@ msgstr "" "函式分別回傳當前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" "`eval` 或 :func:`exec` 可能會方便許多。" -#: ../../library/functions.rst:621 +#: ../../library/functions.rst:623 msgid "" "If the given source is a string, then leading and trailing spaces and tabs " "are stripped." msgstr "如果給定來源是一個字串,那麼其前後的空格和定位字元會被移除。" -#: ../../library/functions.rst:624 +#: ../../library/functions.rst:626 msgid "" "See :func:`ast.literal_eval` for a function that can safely evaluate strings " "with expressions containing only literals." @@ -1296,8 +1298,8 @@ msgstr "" "另外可以參閱 :func:`ast.literal_eval`,該函式可以安全執行僅包含文字的運算式字" "串。" -#: ../../library/functions.rst:627 ../../library/functions.rst:629 -#: ../../library/functions.rst:683 ../../library/functions.rst:685 +#: ../../library/functions.rst:629 ../../library/functions.rst:631 +#: ../../library/functions.rst:685 ../../library/functions.rst:687 msgid "" "Raises an :ref:`auditing event ` ``exec`` with the code object as " "the argument. Code compilation events may also be raised." @@ -1305,18 +1307,17 @@ msgstr "" "引發一個附帶程式碼物件為引數的\\ :ref:`稽核事件 ` ``exec``。也可能" "會引發程式碼編譯事件。" -#: ../../library/functions.rst:634 ../../library/functions.rst:705 +#: ../../library/functions.rst:636 ../../library/functions.rst:707 msgid "The *globals* and *locals* arguments can now be passed as keywords." msgstr "" -#: ../../library/functions.rst:638 ../../library/functions.rst:709 +#: ../../library/functions.rst:640 ../../library/functions.rst:711 msgid "" "The semantics of the default *locals* namespace have been adjusted as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:645 -#, fuzzy +#: ../../library/functions.rst:647 msgid "" "This function supports dynamic execution of Python code. *source* must be " "either a string or a code object. If it is a string, the string is parsed " @@ -1328,7 +1329,7 @@ msgid "" "not be used outside of function definitions even within the context of code " "passed to the :func:`exec` function. The return value is ``None``." msgstr "" -"這個函式支援動態執行 Python 程式碼。*object* 必須是字串或者程式碼物件。如果是" +"這個函式支援動態執行 Python 程式碼。*source* 必須是字串或者程式碼物件。如果是" "字串,那麼該字串將被剖析為一系列 Python 陳述式並執行(除非發生語法錯誤)。" "[#]_ 如果是程式碼物件,它將被直接執行。無論哪種情況,被執行的程式碼都需要和檔" "案輸入一樣是有效的(可參閱語言參考手冊中關於\\ :ref:`file-input`\\ 的章節)。" @@ -1336,8 +1337,7 @@ msgstr "" "`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使" "用。該函式回傳值是 ``None``。" -#: ../../library/functions.rst:656 -#, fuzzy +#: ../../library/functions.rst:658 msgid "" "In all cases, if the optional parts are omitted, the code is executed in the " "current scope. If only *globals* is provided, it must be a dictionary (and " @@ -1347,13 +1347,13 @@ msgid "" "any mapping object. Remember that at the module level, globals and locals " "are the same dictionary." msgstr "" -"無論哪種情況,如果省略了選擇性引數,程式碼將在當前作用域內執行。如果只提供了 " -"*globals* 引數,就必須是 dictionary 型別,而且會被用作全域性和本地變數。如果" -"同時提供了 *globals* 和 *locals* 引數,它們分別被用作全域性和本地變數。如果提" -"供了 *locals* 引數,則它可以是任何映射物件。請記住在 module 層級中全域性和本" -"地變數是相同的 dictionary。" +"無論哪種情況,如果省略了選擇性的部分,程式碼將在當前作用域內執行。如果只提供" +"了 *globals* 引數,就必須是 dictionary 型別(且不能是 dictionary 的子類別)," +"而且會被用作全域和區域變數。如果同時提供了 *globals* 和 *locals*,它們分別被" +"用作全域和區域變數。如果提供了 *locals*,則它可以是任何對映物件。請記住在 " +"module 層級中全域和區域變數是相同的 dictionary。" -#: ../../library/functions.rst:666 +#: ../../library/functions.rst:668 msgid "" "When ``exec`` gets two separate objects as *globals* and *locals*, the code " "will be executed as if it were embedded in a class definition. This means " @@ -1362,7 +1362,7 @@ msgid "" "are treated as class variables in a class definition)." msgstr "" -#: ../../library/functions.rst:672 +#: ../../library/functions.rst:674 msgid "" "If the *globals* dictionary does not contain a value for the key " "``__builtins__``, a reference to the dictionary of the built-in module :mod:" @@ -1375,7 +1375,7 @@ msgstr "" "dictionary 傳入 :func:`exec` 之前,你可以透過將它插入 *globals* 來控制你需要" "哪些內建函式來執行程式碼。" -#: ../../library/functions.rst:678 +#: ../../library/functions.rst:680 msgid "" "The *closure* argument specifies a closure--a tuple of cellvars. It's only " "valid when the *object* is a code object containing free variables. The " @@ -1386,32 +1386,30 @@ msgstr "" "只有在 *object* 是一個含有自由變數 (free variable) 的程式碼物件時,它才有效。" "Tuple 的長度必須與程式碼物件所引用的自由變數數量完全匹配。" -#: ../../library/functions.rst:690 -#, fuzzy +#: ../../library/functions.rst:692 msgid "" "The built-in functions :func:`globals` and :func:`locals` return the current " "global and local namespace, respectively, which may be useful to pass around " "for use as the second and third argument to :func:`exec`." msgstr "" -"內建 :func:`globals` 和 :func:`locals` 函式各自回傳當前的全域性和本地 " -"dictionary,因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數。" +"內建 :func:`globals` 和 :func:`locals` 函式各自回傳當前的全域和區域命名空間," +"因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數以供後續使用。" -#: ../../library/functions.rst:696 -#, fuzzy +#: ../../library/functions.rst:698 msgid "" "The default *locals* act as described for function :func:`locals` below. " "Pass an explicit *locals* dictionary if you need to see effects of the code " "on *locals* after function :func:`exec` returns." msgstr "" -"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣:不要試圖改變" -"預設的 *locals* dictionary。如果你想在 :func:`exec` 函式回傳時知道程式碼對 " -"*locals* 的變動,請明確地傳遞 *locals* dictionary 。" +"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想在 :" +"func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 *locals* " +"dictionary 。" -#: ../../library/functions.rst:700 +#: ../../library/functions.rst:702 msgid "Added the *closure* parameter." msgstr "增加了 *closure* 參數。" -#: ../../library/functions.rst:715 +#: ../../library/functions.rst:717 msgid "" "Construct an iterator from those elements of *iterable* for which *function* " "is true. *iterable* may be either a sequence, a container which supports " @@ -1423,7 +1421,7 @@ msgstr "" "*function* 是 ``None``,則會假設它是一個識別性函式,即 *iterable* 中所有假值" "元素會被移除。" -#: ../../library/functions.rst:721 +#: ../../library/functions.rst:723 msgid "" "Note that ``filter(function, iterable)`` is equivalent to the generator " "expression ``(item for item in iterable if function(item))`` if function is " @@ -1434,7 +1432,7 @@ msgstr "" "是 ``None`` 的時候為 ``(item for item in iterable if function(item))``;" "function 是 ``None`` 的時候為 ``(item for item in iterable if item)``。" -#: ../../library/functions.rst:726 +#: ../../library/functions.rst:728 msgid "" "See :func:`itertools.filterfalse` for the complementary function that " "returns elements of *iterable* for which *function* is false." @@ -1442,11 +1440,11 @@ msgstr "" "請參閱 :func:`itertools.filterfalse`,只有 *function* 為 false 時才選取 " "*iterable* 中元素的互補函式。" -#: ../../library/functions.rst:737 +#: ../../library/functions.rst:739 msgid "Return a floating-point number constructed from a number or a string." msgstr "回傳從數字或字串生成的浮點數。" -#: ../../library/functions.rst:741 +#: ../../library/functions.rst:743 msgid "" ">>> float('+1.23')\n" "1.23\n" @@ -1470,7 +1468,7 @@ msgstr "" ">>> float('-Infinity')\n" "-inf" -#: ../../library/functions.rst:754 +#: ../../library/functions.rst:756 msgid "" "If the argument is a string, it should contain a decimal number, optionally " "preceded by a sign, and optionally embedded in whitespace. The optional " @@ -1485,7 +1483,7 @@ msgstr "" "數也可以是 NaN(非數字)或正負無窮大的字串。確切地說,除去首尾的空格後,輸入" "必須遵循以下語法中 :token:`~float:floatvalue` 的生成規則:" -#: ../../library/functions.rst:775 +#: ../../library/functions.rst:777 msgid "" "Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", " "and \"iNfINity\" are all acceptable spellings for positive infinity." @@ -1493,7 +1491,7 @@ msgstr "" "字母大小寫不影響,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表" "示正無窮大。" -#: ../../library/functions.rst:778 +#: ../../library/functions.rst:780 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 " @@ -1503,7 +1501,7 @@ msgstr "" "否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的" "浮點數。如果引數在 Python 浮點精度範圍外,則會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:783 +#: ../../library/functions.rst:785 msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." "__float__()``. If :meth:`~object.__float__` is not defined then it falls " @@ -1512,22 +1510,22 @@ msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" "定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:787 +#: ../../library/functions.rst:789 msgid "If no argument is given, ``0.0`` is returned." msgstr "如果沒有引數,則回傳 ``0.0``。" -#: ../../library/functions.rst:789 +#: ../../library/functions.rst:791 msgid "The float type is described in :ref:`typesnumeric`." msgstr ":ref:`typesnumeric` 描述了浮點數型別。" -#: ../../library/functions.rst:797 +#: ../../library/functions.rst:799 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not " "defined." msgstr "" "如果 :meth:`~object.__float__` 未定義,則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:807 +#: ../../library/functions.rst:809 msgid "" "Convert a *value* to a \"formatted\" representation, as controlled by " "*format_spec*. The interpretation of *format_spec* will depend on the type " @@ -1538,7 +1536,7 @@ msgstr "" "取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" "`formatspec`。" -#: ../../library/functions.rst:812 +#: ../../library/functions.rst:814 msgid "" "The default *format_spec* is an empty string which usually gives the same " "effect as calling :func:`str(value) `." @@ -1546,7 +1544,7 @@ msgstr "" "預設的 *format_spec* 是一個空字串,它通常和呼叫 :func:`str(value) ` 的效" "果相同。" -#: ../../library/functions.rst:815 +#: ../../library/functions.rst:817 msgid "" "A call to ``format(value, format_spec)`` is translated to ``type(value)." "__format__(value, format_spec)`` which bypasses the instance dictionary when " @@ -1560,7 +1558,7 @@ msgstr "" "實例中的字典。如果搜尋到 :mod:`object` 這個 method 但 *format_spec* 不為空," "或是 *format_spec* 或回傳值不是字串,則會引發 :exc:`TypeError`。" -#: ../../library/functions.rst:822 +#: ../../library/functions.rst:824 msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." @@ -1568,7 +1566,7 @@ msgstr "" "當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:831 +#: ../../library/functions.rst:833 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " "*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" @@ -1578,7 +1576,7 @@ msgstr "" "``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" "`frozenset` 和 :ref:`types-set`。" -#: ../../library/functions.rst:835 +#: ../../library/functions.rst:837 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." @@ -1586,7 +1584,7 @@ msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" -#: ../../library/functions.rst:843 +#: ../../library/functions.rst:845 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 " @@ -1601,7 +1599,7 @@ msgstr "" "`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" "`setattr`)。" -#: ../../library/functions.rst:852 +#: ../../library/functions.rst:854 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " @@ -1612,7 +1610,7 @@ msgstr "" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" "使用 :func:`getattr` 來取得它。" -#: ../../library/functions.rst:860 +#: ../../library/functions.rst:862 msgid "" "Return the dictionary implementing the current module namespace. For code " "within functions, this is set when the function is defined and remains the " @@ -1621,7 +1619,7 @@ msgstr "" "回傳代表當前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" "函式時設定且不論該函式是在何處呼叫都會保持相同。" -#: ../../library/functions.rst:867 +#: ../../library/functions.rst:869 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. " @@ -1632,7 +1630,7 @@ msgstr "" "則回傳 ``False``。(此功能是透過呼叫 ``getattr(object, name)`` 並檢查是否引" "發 :exc:`AttributeError` 來實作的。)" -#: ../../library/functions.rst:875 +#: ../../library/functions.rst:877 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 " @@ -1643,7 +1641,7 @@ msgstr "" "時用來快速比較 dictionary 的鍵。相同大小的數字數值有相同的雜湊值(即使它們型" "別不同,如 1 和 1.0)。" -#: ../../library/functions.rst:882 +#: ../../library/functions.rst:884 msgid "" "For objects with custom :meth:`~object.__hash__` methods, note that :func:" "`hash` truncates the return value based on the bit width of the host machine." @@ -1651,7 +1649,7 @@ msgstr "" "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" "運行機器的位元長度來截斷回傳值。" -#: ../../library/functions.rst:889 +#: ../../library/functions.rst:891 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 " @@ -1665,7 +1663,7 @@ msgstr "" "關鍵字或說明文件主題中搜索該字串,並在控制台上列印幫助資訊。如果引數是其他任" "意物件,則會生成該物件的幫助頁。" -#: ../../library/functions.rst:896 +#: ../../library/functions.rst:898 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 " @@ -1676,12 +1674,12 @@ msgstr "" "前面的參數是僅限位置 (positional-only) 參數。有關更多資訊,請參閱\\ :ref:`常" "見問答集中的僅限位置參數條目 `。" -#: ../../library/functions.rst:901 +#: ../../library/functions.rst:903 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." msgstr "此函式會被 :mod:`site` module 加入到內建命名空間。" -#: ../../library/functions.rst:903 +#: ../../library/functions.rst:905 msgid "" "Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " "for callables are now more comprehensive and consistent." @@ -1689,7 +1687,7 @@ msgstr "" "對於 :mod:`pydoc` 和 :mod:`inspect` 的變更,使得可呼叫物件回報的的簽名 " "(signature) 更加全面和一致。" -#: ../../library/functions.rst:910 +#: ../../library/functions.rst:912 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 :" @@ -1699,7 +1697,7 @@ msgstr "" "class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並且回傳一" "個整數。舉例來說:" -#: ../../library/functions.rst:919 +#: ../../library/functions.rst:921 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 " @@ -1708,20 +1706,20 @@ msgstr "" "如果要將整數轉換為大寫或小寫的十六進位制字串,並可選擇有無 \"0x\" 前綴,則可" "以使用如下方法:" -#: ../../library/functions.rst:931 +#: ../../library/functions.rst:933 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:936 +#: ../../library/functions.rst:938 msgid "" "To obtain a hexadecimal string representation for a float, use the :meth:" "`float.hex` method." msgstr "" "如果要獲取浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" -#: ../../library/functions.rst:942 +#: ../../library/functions.rst:944 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. " @@ -1731,18 +1729,18 @@ msgstr "" "回傳物件的 \"識別性\" 。該值是一個整數,在此物件的生命週期中保證是唯一且恆定" "的。兩個生命期不重疊的物件可能具有相同的 :func:`id` 值。" -#: ../../library/functions.rst:947 +#: ../../library/functions.rst:949 msgid "This is the address of the object in memory." msgstr "這是該物件在記憶體中的位址。" -#: ../../library/functions.rst:949 +#: ../../library/functions.rst:951 msgid "" "Raises an :ref:`auditing event ` ``builtins.id`` with argument " "``id``." msgstr "" "引發一個附帶引數 ``id`` 的\\ :ref:`稽核事件 ` ``builtins.id``。" -#: ../../library/functions.rst:955 +#: ../../library/functions.rst:957 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, " @@ -1753,7 +1751,7 @@ msgstr "" "從輸入中讀取一行,將其轉換為字串(去除末尾的換行符)並回傳。當讀取到 EOF 時," "則引發 :exc:`EOFError`。例如: ::" -#: ../../library/functions.rst:960 +#: ../../library/functions.rst:962 msgid "" ">>> s = input('--> ') \n" "--> Monty Python's Flying Circus\n" @@ -1765,7 +1763,7 @@ msgstr "" ">>> s \n" "\"Monty Python's Flying Circus\"" -#: ../../library/functions.rst:965 +#: ../../library/functions.rst:967 msgid "" "If the :mod:`readline` module was loaded, then :func:`input` will use it to " "provide elaborate line editing and history features." @@ -1773,7 +1771,7 @@ msgstr "" "如果載入了 :mod:`readline` module,:func:`input` 將使用它來提供複雜的行編輯和" "歷史記錄功能。" -#: ../../library/functions.rst:968 ../../library/functions.rst:970 +#: ../../library/functions.rst:970 ../../library/functions.rst:972 msgid "" "Raises an :ref:`auditing event ` ``builtins.input`` with argument " "``prompt`` before reading input" @@ -1781,7 +1779,7 @@ msgstr "" "引發一個附帶讀取輸入前的引數 ``prompt`` 的\\ :ref:`稽核事件 ` " "``builtins.input``。" -#: ../../library/functions.rst:973 ../../library/functions.rst:975 +#: ../../library/functions.rst:975 ../../library/functions.rst:977 msgid "" "Raises an :ref:`auditing event ` ``builtins.input/result`` with " "the result after successfully reading input." @@ -1789,13 +1787,13 @@ msgstr "" "引發一個附帶成功讀取結果的\\ :ref:`稽核事件 ` ``builtins.input/" "result``。" -#: ../../library/functions.rst:982 +#: ../../library/functions.rst:984 msgid "" "Return an integer object constructed from a number or a string, or return " "``0`` if no arguments are given." msgstr "" -#: ../../library/functions.rst:987 +#: ../../library/functions.rst:989 msgid "" ">>> int(123.45)\n" "123\n" @@ -1823,7 +1821,7 @@ msgstr "" ">>> int('01110011', base=2)\n" "115" -#: ../../library/functions.rst:1002 +#: ../../library/functions.rst:1004 msgid "" "If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." "__int__()``. If the argument defines :meth:`~object.__index__`, it returns " @@ -1836,7 +1834,7 @@ msgstr "" "義了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數,則會向零" "的方向無條件捨去。" -#: ../../library/functions.rst:1008 +#: ../../library/functions.rst:1010 msgid "" "If the argument is not a number or if *base* is given, then it must be a " "string, :class:`bytes`, or :class:`bytearray` instance representing an " @@ -1849,7 +1847,7 @@ msgstr "" "以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在" "數字間有單一底線。" -#: ../../library/functions.rst:1014 +#: ../../library/functions.rst:1016 msgid "" "A base-n integer string contains digits, each representing a value from 0 to " "n-1. The values 0--9 can be represented by any Unicode decimal digit. The " @@ -1871,11 +1869,11 @@ msgstr "" "進制中的一個,所以 ``int('010', 0)`` 是非法的,但 ``int('010')`` 和 " "``int('010', 8)`` 是有效的。" -#: ../../library/functions.rst:1025 +#: ../../library/functions.rst:1027 msgid "The integer type is described in :ref:`typesnumeric`." msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" -#: ../../library/functions.rst:1027 +#: ../../library/functions.rst:1029 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 " @@ -1887,22 +1885,22 @@ msgstr "" "的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." "__index__ `。" -#: ../../library/functions.rst:1037 +#: ../../library/functions.rst:1039 msgid "The first parameter is now positional-only." msgstr "第一個參數為僅限位置參數。" -#: ../../library/functions.rst:1040 +#: ../../library/functions.rst:1042 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not " "defined." msgstr "" "如果未定義 :meth:`~object.__int__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:1043 +#: ../../library/functions.rst:1045 msgid "The delegation to :meth:`~object.__trunc__` is deprecated." msgstr "對 :meth:`~object.__trunc__` 的委派已棄用。" -#: ../../library/functions.rst:1046 +#: ../../library/functions.rst:1048 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 " @@ -1916,7 +1914,7 @@ msgstr "" "`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" "數字串轉換的長度限制 `\\ 說明文件。" -#: ../../library/functions.rst:1056 +#: ../../library/functions.rst:1058 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 " @@ -1956,7 +1954,7 @@ msgstr "" "是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:1088 +#: ../../library/functions.rst:1090 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " @@ -1980,11 +1978,11 @@ msgstr "" "__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 *sentinel* 則引發 :" "exc:`StopIteration`,否則回傳呼叫結果。" -#: ../../library/functions.rst:1102 +#: ../../library/functions.rst:1104 msgid "See also :ref:`typeiter`." msgstr "另請參閱 :ref:`typeiter`。" -#: ../../library/functions.rst:1104 +#: ../../library/functions.rst:1106 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 " @@ -1993,7 +1991,7 @@ msgstr "" ":func:`iter` 的第二種形式有一個好用的應用,是能夠建立一個區塊閱讀器 (block-" "reader)。例如,從二進位資料庫檔案中讀取固定寬度的區塊,直到檔案的結尾: ::" -#: ../../library/functions.rst:1108 +#: ../../library/functions.rst:1110 msgid "" "from functools import partial\n" "with open('mydata.db', 'rb') as f:\n" @@ -2005,7 +2003,7 @@ msgstr "" " for block in iter(partial(f.read, 64), b''):\n" " process_block(block)" -#: ../../library/functions.rst:1116 +#: ../../library/functions.rst:1118 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 " @@ -2014,7 +2012,7 @@ msgstr "" "回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 " "range)或集合(如 dictionary、set 或 frozen set)。" -#: ../../library/functions.rst:1122 +#: ../../library/functions.rst:1124 msgid "" "``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." "maxsize`, such as :class:`range(2 ** 100) `." @@ -2022,7 +2020,7 @@ msgstr "" "如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," "則 ``len`` 會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:1131 +#: ../../library/functions.rst:1133 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." @@ -2030,33 +2028,33 @@ msgstr "" "除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` " "和 :ref:`typesseq`。" -#: ../../library/functions.rst:1137 +#: ../../library/functions.rst:1139 msgid "" "Return a mapping object representing the current local symbol table, with " "variable names as the keys, and their currently bound references as the " "values." msgstr "" -#: ../../library/functions.rst:1141 +#: ../../library/functions.rst:1143 msgid "" "At module scope, as well as when using :func:`exec` or :func:`eval` with a " "single namespace, this function returns the same namespace as :func:" "`globals`." msgstr "" -#: ../../library/functions.rst:1145 +#: ../../library/functions.rst:1147 msgid "" "At class scope, it returns the namespace that will be passed to the " "metaclass constructor." msgstr "" -#: ../../library/functions.rst:1148 +#: ../../library/functions.rst:1150 msgid "" "When using ``exec()`` or ``eval()`` with separate local and global " "arguments, it returns the local namespace passed in to the function call." msgstr "" -#: ../../library/functions.rst:1151 +#: ../../library/functions.rst:1153 msgid "" "In all of the above cases, each call to ``locals()`` in a given frame of " "execution will return the *same* mapping object. Changes made through the " @@ -2066,7 +2064,7 @@ msgid "" "returned mapping object." msgstr "" -#: ../../library/functions.rst:1158 +#: ../../library/functions.rst:1160 msgid "" "In an :term:`optimized scope` (including functions, generators, and " "coroutines), each call to ``locals()`` instead returns a fresh dictionary " @@ -2078,7 +2076,7 @@ msgid "" "previously returned dictionaries." msgstr "" -#: ../../library/functions.rst:1167 +#: ../../library/functions.rst:1169 msgid "" "Calling ``locals()`` as part of a comprehension in a function, generator, or " "coroutine is equivalent to calling it in the containing scope, except that " @@ -2087,19 +2085,19 @@ msgid "" "function." msgstr "" -#: ../../library/functions.rst:1173 +#: ../../library/functions.rst:1175 msgid "" "Calling ``locals()`` as part of a generator expression is equivalent to " "calling it in a nested generator function." msgstr "" -#: ../../library/functions.rst:1176 +#: ../../library/functions.rst:1178 msgid "" "The behaviour of ``locals()`` in a comprehension has been updated as " "described in :pep:`709`." msgstr "" -#: ../../library/functions.rst:1180 +#: ../../library/functions.rst:1182 msgid "" "As part of :pep:`667`, the semantics of mutating the mapping objects " "returned from this function are now defined. The behavior in :term:" @@ -2108,7 +2106,7 @@ msgid "" "versions." msgstr "" -#: ../../library/functions.rst:1190 +#: ../../library/functions.rst:1192 msgid "" "Return an iterator that applies *function* to every item of *iterable*, " "yielding the results. If additional *iterables* arguments are passed, " @@ -2123,13 +2121,13 @@ msgstr "" "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," "請參閱 :func:`itertools.starmap`。" -#: ../../library/functions.rst:1202 +#: ../../library/functions.rst:1204 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." msgstr "回傳 iterable 中最大的元素,或者回傳兩個以上的引數中最大的。" -#: ../../library/functions.rst:1205 +#: ../../library/functions.rst:1207 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 " @@ -2138,7 +2136,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素" "會被回傳。如果提供了兩個或以上的位置引數,則回傳最大的位置引數。" -#: ../../library/functions.rst:1210 ../../library/functions.rst:1248 +#: ../../library/functions.rst:1212 ../../library/functions.rst:1250 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 " @@ -2151,7 +2149,7 @@ msgstr "" "的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" "`ValueError`。" -#: ../../library/functions.rst:1216 +#: ../../library/functions.rst:1218 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2162,15 +2160,15 @@ msgstr "" "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " "iterable, key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1221 ../../library/functions.rst:1259 +#: ../../library/functions.rst:1223 ../../library/functions.rst:1261 msgid "Added the *default* keyword-only parameter." msgstr "新增 *default* 僅限關鍵字參數。" -#: ../../library/functions.rst:1224 ../../library/functions.rst:1262 +#: ../../library/functions.rst:1226 ../../library/functions.rst:1264 msgid "The *key* can be ``None``." msgstr "*key* 可以為 ``None``。" -#: ../../library/functions.rst:1232 +#: ../../library/functions.rst:1234 msgid "" "Return a \"memory view\" object created from the given argument. See :ref:" "`typememoryview` for more information." @@ -2178,13 +2176,13 @@ msgstr "" "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" "閱\\ :ref:`typememoryview`。" -#: ../../library/functions.rst:1240 +#: ../../library/functions.rst:1242 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." msgstr "回傳 iterable 中最小的元素,或者回傳兩個以上的引數中最小的。" -#: ../../library/functions.rst:1243 +#: ../../library/functions.rst:1245 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 " @@ -2193,7 +2191,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" "被回傳。如果提供了兩個以上的位置引數,則回傳最小的位置引數。" -#: ../../library/functions.rst:1254 +#: ../../library/functions.rst:1256 msgid "" "If multiple items are minimal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2204,7 +2202,7 @@ msgstr "" "``sorted(iterable, key=keyfunc)[0]`` 和 ``heapq.nsmallest(1, iterable, " "key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1269 +#: ../../library/functions.rst:1271 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 " @@ -2214,7 +2212,7 @@ msgstr "" "素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" "exc:`StopIteration`。" -#: ../../library/functions.rst:1276 +#: ../../library/functions.rst:1278 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 " @@ -2223,15 +2221,15 @@ msgstr "" "回傳一個沒有特徵的新物件。:class:`object` 是所有 class 的基礎,它具有所有 " "Python class 實例的通用 method。這個函式不接受任何引數。" -#: ../../library/functions.rst:1282 +#: ../../library/functions.rst:1284 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." +":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, " +"so you can't assign arbitrary attributes to an instance of :class:`object`." msgstr "" -"由於 :class:`object` *沒有* :attr:`~object.__dict__`,因此無法將任意屬性賦" -"給 :class:`object` class 的實例。" +"由於 :class:`object` 實例\\ *沒有* :attr:`~object.__dict__` 屬性,因此無法將" +"任意屬性賦給 :class:`object` 的實例。" -#: ../../library/functions.rst:1288 +#: ../../library/functions.rst:1291 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` " @@ -2242,7 +2240,7 @@ msgstr "" "Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" "`~object.__index__` method 回傳一個整數。舉例來說:" -#: ../../library/functions.rst:1298 +#: ../../library/functions.rst:1301 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." @@ -2250,7 +2248,7 @@ msgstr "" "如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方" "法。" -#: ../../library/functions.rst:1315 +#: ../../library/functions.rst:1318 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 " @@ -2260,7 +2258,7 @@ msgstr "" "啟,則引發 :exc:`OSError`。關於使用此函式的更多方法,請參閱\\ :ref:`tut-" "files`。" -#: ../../library/functions.rst:1319 +#: ../../library/functions.rst:1322 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 " @@ -2273,7 +2271,7 @@ msgstr "" "器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關" "閉,除非 *closefd* 被設為 ``False``。)" -#: ../../library/functions.rst:1325 +#: ../../library/functions.rst:1328 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. " @@ -2294,71 +2292,71 @@ msgstr "" "getencoding` 來獲取當前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" "式且不要指定 *encoding*。)可用的模式有:" -#: ../../library/functions.rst:1342 +#: ../../library/functions.rst:1345 msgid "Character" msgstr "字元" -#: ../../library/functions.rst:1342 +#: ../../library/functions.rst:1345 msgid "Meaning" msgstr "意義" -#: ../../library/functions.rst:1344 +#: ../../library/functions.rst:1347 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/functions.rst:1344 +#: ../../library/functions.rst:1347 msgid "open for reading (default)" msgstr "讀取(預設)" -#: ../../library/functions.rst:1345 +#: ../../library/functions.rst:1348 msgid "``'w'``" msgstr "``'w'``" -#: ../../library/functions.rst:1345 +#: ../../library/functions.rst:1348 msgid "open for writing, truncating the file first" msgstr "寫入,會先清除檔案內容" -#: ../../library/functions.rst:1346 +#: ../../library/functions.rst:1349 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/functions.rst:1346 +#: ../../library/functions.rst:1349 msgid "open for exclusive creation, failing if the file already exists" msgstr "唯一性建立,如果文件已存在則會失敗" -#: ../../library/functions.rst:1347 +#: ../../library/functions.rst:1350 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/functions.rst:1347 +#: ../../library/functions.rst:1350 msgid "open for writing, appending to the end of file if it exists" msgstr "寫入,如果檔案存在則在其末端附加內容" -#: ../../library/functions.rst:1348 +#: ../../library/functions.rst:1351 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/functions.rst:1348 ../../library/functions.rst:1492 +#: ../../library/functions.rst:1351 ../../library/functions.rst:1495 msgid "binary mode" msgstr "二進制模式" -#: ../../library/functions.rst:1349 +#: ../../library/functions.rst:1352 msgid "``'t'``" msgstr "``'t'``" -#: ../../library/functions.rst:1349 +#: ../../library/functions.rst:1352 msgid "text mode (default)" msgstr "文字模式(預設)" -#: ../../library/functions.rst:1350 +#: ../../library/functions.rst:1353 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/functions.rst:1350 +#: ../../library/functions.rst:1353 msgid "open for updating (reading and writing)" msgstr "更新(讀取並寫入)" -#: ../../library/functions.rst:1353 +#: ../../library/functions.rst:1356 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 " @@ -2368,7 +2366,7 @@ msgstr "" "``'w+b'`` 模式會開啟並清除檔案。``'r+'`` 和 ``'r+b'`` 模式會開啟且保留檔案內" "容。" -#: ../../library/functions.rst:1357 +#: ../../library/functions.rst:1360 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* " @@ -2384,7 +2382,7 @@ msgstr "" "``'t'``),檔案的內容會以 :class:`str` 回傳,其位元組已經先被解碼,使用的是取" "決於平台的編碼系統或是給定的 *encoding*。" -#: ../../library/functions.rst:1367 +#: ../../library/functions.rst:1370 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 " @@ -2393,7 +2391,7 @@ msgstr "" "Python 不會使用底層作業系統對於文字檔案的操作概念;所有的處理都是由 Python 獨" "自完成的,因此能獨立於不同平台。" -#: ../../library/functions.rst:1371 +#: ../../library/functions.rst:1374 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 " @@ -2414,7 +2412,7 @@ msgstr "" "``write_through`` 旗標。若未給定 *buffering* 引數,則預設的緩衝策略會運作如" "下:" -#: ../../library/functions.rst:1381 +#: ../../library/functions.rst:1384 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 " @@ -2426,7 +2424,7 @@ msgstr "" "DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 8192 個位元" "組。" -#: ../../library/functions.rst:1386 +#: ../../library/functions.rst:1389 msgid "" "\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " "returns ``True``) use line buffering. Other text files use the policy " @@ -2435,7 +2433,7 @@ msgstr "" "「互動式」文字檔(:meth:`~io.IOBase.isatty` 回傳 ``True`` 的檔案)會使用列緩" "衝。其他文字檔則使用上述的二進制檔案緩衝策略。" -#: ../../library/functions.rst:1390 +#: ../../library/functions.rst:1393 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 " @@ -2448,7 +2446,7 @@ msgstr "" "Python 支援的任何 :term:`text encoding`\\ (文字編碼)都是可以使用的。關於支" "援的編碼系統清單,請參閱 :mod:`codecs` module。" -#: ../../library/functions.rst:1396 +#: ../../library/functions.rst:1399 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 " @@ -2461,7 +2459,7 @@ msgstr "" "handlers`\\ 有列出清單),不過任何已註冊到 :func:`codecs.register_error` 的錯" "誤處理程式名稱也都是有效的。標準的名稱包括:" -#: ../../library/functions.rst:1404 +#: ../../library/functions.rst:1407 msgid "" "``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " "error. The default value of ``None`` has the same effect." @@ -2469,20 +2467,20 @@ msgstr "" "``'strict'`` 如果發生編碼錯誤,則引發 :exc:`ValueError` 例外。預設值 " "``None`` 也有相同的效果。" -#: ../../library/functions.rst:1408 +#: ../../library/functions.rst:1411 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." msgstr "``'ignore'`` 忽略錯誤。請注意,忽略編碼錯誤可能導致資料遺失。" -#: ../../library/functions.rst:1411 +#: ../../library/functions.rst:1414 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." msgstr "" "``'replace'`` 會在格式不正確的資料位置插入一個替換標誌(像是 ``'?'``)。" -#: ../../library/functions.rst:1414 +#: ../../library/functions.rst:1417 msgid "" "``'surrogateescape'`` will represent any incorrect bytes as low surrogate " "code units ranging from U+DC80 to U+DCFF. These surrogate code units will " @@ -2495,7 +2493,7 @@ msgstr "" "被還原回 ``surrogateescape`` 錯誤處理程式當時所處理的那些相同位元組。這對於處" "理未知編碼方式的檔案會很好用。" -#: ../../library/functions.rst:1421 +#: ../../library/functions.rst:1424 msgid "" "``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " "not supported by the encoding are replaced with the appropriate XML " @@ -2504,7 +2502,7 @@ msgstr "" "``'xmlcharrefreplace'`` 僅在寫入檔案時可支援。編碼系統不支援的字元會被替換為" "適當的 XML 字元參考 (character reference) ``&#nnn;``。" -#: ../../library/functions.rst:1425 +#: ../../library/functions.rst:1428 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." @@ -2512,7 +2510,7 @@ msgstr "" "``'backslashreplace'`` 會用 Python 的反斜線跳脫序列 (backslashed escape " "sequence) 替換格式不正確的資料。" -#: ../../library/functions.rst:1428 +#: ../../library/functions.rst:1431 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." @@ -2520,7 +2518,7 @@ msgstr "" "``'namereplace'``\\ (也僅在寫入時支援)會將不支援的字元替換為 ``\\N{...}`` " "跳脫序列。" -#: ../../library/functions.rst:1436 +#: ../../library/functions.rst:1439 msgid "" "*newline* determines how to parse newline characters from the stream. It can " "be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " @@ -2529,7 +2527,7 @@ msgstr "" "*newline* 會決定如何剖析資料串流 (stream) 中的換行字元。它可以是 ``None``、" "``''``、``'\\n'``、``'\\r'`` 或 ``'\\r\\n'``。它的運作規則如下:" -#: ../../library/functions.rst:1440 +#: ../../library/functions.rst:1443 msgid "" "When reading input from the stream, if *newline* is ``None``, universal " "newlines mode is enabled. Lines in the input can end in ``'\\n'``, " @@ -2545,7 +2543,7 @@ msgstr "" "傳給呼叫方時,行尾符號不會被轉換。如果它是任何其他有效的值,則輸入資料的行只" "會由給定的字串做結尾,且在回傳給呼叫方時,行尾符號不會被轉換。" -#: ../../library/functions.rst:1448 +#: ../../library/functions.rst:1451 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -2558,7 +2556,7 @@ msgstr "" "``''`` 或 ``'\\n'``,則不做任何轉換。如果 *newline* 是任何其他有效的值,則寫" "入的任何 ``'\\n'`` 字元都將轉換為給定的字串。" -#: ../../library/functions.rst:1454 +#: ../../library/functions.rst:1457 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 " @@ -2569,7 +2567,7 @@ msgstr "" "則當檔案關閉時,底層的檔案描述器會保持開啟狀態。如果有給定一個檔名,則 " "*closefd* 必須是 ``True``\\ (預設值);否則將引發錯誤。" -#: ../../library/functions.rst:1459 +#: ../../library/functions.rst:1462 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 " @@ -2582,11 +2580,11 @@ msgstr "" "必須回傳一個開啟的檔案描述器(將 :mod:`os.open` 作為 *opener* 傳入,在功能上" "的結果會相當於傳入 ``None``)。" -#: ../../library/functions.rst:1465 +#: ../../library/functions.rst:1468 msgid "The newly created file is :ref:`non-inheritable `." msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" -#: ../../library/functions.rst:1467 +#: ../../library/functions.rst:1470 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::" @@ -2594,7 +2592,7 @@ msgstr "" "下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" -#: ../../library/functions.rst:1470 +#: ../../library/functions.rst:1473 msgid "" ">>> import os\n" ">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" @@ -2607,7 +2605,7 @@ msgid "" ">>> os.close(dir_fd) # don't leak a file descriptor" msgstr "" -#: ../../library/functions.rst:1480 +#: ../../library/functions.rst:1483 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 " @@ -2631,7 +2629,7 @@ msgstr "" "BufferedRandom`。當緩衝被停用時,會回傳原始資料串流 :class:`io.FileIO`,它" "是 :class:`io.RawIOBase` 的一個 subclass。" -#: ../../library/functions.rst:1501 +#: ../../library/functions.rst:1504 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " "(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" @@ -2641,7 +2639,7 @@ msgstr "" "`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" "`shutil`。" -#: ../../library/functions.rst:1505 +#: ../../library/functions.rst:1508 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -2649,25 +2647,25 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/functions.rst:1507 +#: ../../library/functions.rst:1510 msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." msgstr "``mode`` 和 ``flags`` 引數可能會被原始的呼叫所修改或推論 (infer)。" -#: ../../library/functions.rst:1512 +#: ../../library/functions.rst:1515 msgid "The *opener* parameter was added." msgstr "增加了 *opener* 參數。" -#: ../../library/functions.rst:1513 +#: ../../library/functions.rst:1516 msgid "The ``'x'`` mode was added." msgstr "增加了 ``'x'`` 模式。" -#: ../../library/functions.rst:1514 +#: ../../library/functions.rst:1517 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "過去引發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" -#: ../../library/functions.rst:1515 +#: ../../library/functions.rst:1518 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." @@ -2675,11 +2673,11 @@ msgstr "" "如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" "`FileExistsError`。" -#: ../../library/functions.rst:1520 +#: ../../library/functions.rst:1523 msgid "The file is now non-inheritable." msgstr "檔案在此版本開始是不可繼承的。" -#: ../../library/functions.rst:1524 +#: ../../library/functions.rst:1527 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 :" @@ -2688,15 +2686,15 @@ msgstr "" "如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" "不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" -#: ../../library/functions.rst:1527 +#: ../../library/functions.rst:1530 msgid "The ``'namereplace'`` error handler was added." msgstr "增加了 ``'namereplace'`` 錯誤處理程式。" -#: ../../library/functions.rst:1531 +#: ../../library/functions.rst:1534 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" -#: ../../library/functions.rst:1532 +#: ../../library/functions.rst:1535 msgid "" "On Windows, opening a console buffer may return a subclass of :class:`io." "RawIOBase` other than :class:`io.FileIO`." @@ -2704,11 +2702,11 @@ msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" -#: ../../library/functions.rst:1535 +#: ../../library/functions.rst:1538 msgid "The ``'U'`` mode has been removed." msgstr "``'U'`` 模式被移除。" -#: ../../library/functions.rst:1540 +#: ../../library/functions.rst:1543 msgid "" "Given a string representing one Unicode character, return an integer " "representing the Unicode code point of that character. For example, " @@ -2719,7 +2717,7 @@ msgstr "" "``ord('a')`` 回傳整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這" "是 :func:`chr` 的逆函式。" -#: ../../library/functions.rst:1548 +#: ../../library/functions.rst:1551 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) % " @@ -2730,8 +2728,7 @@ msgstr "" "*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" -#: ../../library/functions.rst:1553 -#, fuzzy +#: ../../library/functions.rst:1556 msgid "" "The arguments must have numeric types. With mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " @@ -2745,15 +2742,17 @@ msgid "" "`float` with an integral exponent, a float result is delivered. For example, " "``pow(-9, 2.0)`` returns ``81.0``." msgstr "" -"引數必須是數值型別。對於不同型別的運算元,會套用二元算術運算子的強制轉型 " +"引數必須是數值型別。對於混合型別的運算元,會套用二元算術運算子的強制轉型 " "(coercion) 規則。對於 :class:`int` 運算元,運算結果會(在強制轉型後)與運算元" "的型別相同,除非第二個引數是負數;在這種情況下,所有的引數都會被轉換為浮點數" "並得到浮點數的結果。例如,``pow(10, 2)`` 會回傳 ``100``,但 ``pow(10, -2)`` " "會回傳 ``0.01``。如果底數 (base) 是型別為 :class:`int` 或 :class:`float` 的負" -"數,且指數 (exponent) 不是整數,則會得到一個複數的結果。例如,``pow(-9, " -"0.5)`` 會回傳一個接近 ``3j`` 的值。" +"數且指數 (exponent) 不是整數,則會得到一個複數的結果,例如 ``pow(-9, 0.5)`` " +"會回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` 或 :class:" +"`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 ``pow(-9, 2.0)`` " +"會回傳 ``81.0``。" -#: ../../library/functions.rst:1565 +#: ../../library/functions.rst:1568 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 " @@ -2766,11 +2765,11 @@ msgstr "" "與 *mod* 互質。在這種情況下,會回傳 ``pow(inv_base, -exp, mod)``,其中 " "*inv_base* 是 *base* 對 *mod* 的模倒數 (inverse modulo)。" -#: ../../library/functions.rst:1571 +#: ../../library/functions.rst:1574 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "以下是一個計算 ``38`` 對 ``97`` 取模倒數的範例: ::" -#: ../../library/functions.rst:1573 +#: ../../library/functions.rst:1576 msgid "" ">>> pow(38, -1, mod=97)\n" "23\n" @@ -2782,7 +2781,7 @@ msgstr "" ">>> 23 * 38 % 97 == 1\n" "True" -#: ../../library/functions.rst:1578 +#: ../../library/functions.rst:1581 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." @@ -2790,12 +2789,12 @@ msgstr "" "對於 :class:`int` 運算元,現在 ``pow`` 的三引數形式允許第二個引數為負數,也容" "許模倒數的計算。" -#: ../../library/functions.rst:1583 +#: ../../library/functions.rst:1586 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "允許關鍵字引數。在此之前只支援位置引數。" -#: ../../library/functions.rst:1590 +#: ../../library/functions.rst:1593 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 " @@ -2804,7 +2803,7 @@ msgstr "" "將 *objects* 列印到文字資料串流 *file*,用 *sep* 分隔並以 *end* 結尾。如果有" "給定 *sep*、*end*、*file* 和 *flush*,那麼它們必須是關鍵字引數的形式。" -#: ../../library/functions.rst:1594 +#: ../../library/functions.rst:1597 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* " @@ -2817,7 +2816,7 @@ msgstr "" "以是 ``None``,這表示使用預設值。如果沒有給定 *objects*,:func:`print` 就只會" "寫入 *end*。" -#: ../../library/functions.rst:1600 +#: ../../library/functions.rst:1603 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 " @@ -2829,7 +2828,7 @@ msgstr "" "串,所以 :func:`print` 不能用於二進位模式的檔案物件。對於此類物件,請改用 " "``file.write(...)``。" -#: ../../library/functions.rst:1605 +#: ../../library/functions.rst:1608 msgid "" "Output buffering is usually determined by *file*. However, if *flush* is " "true, the stream is forcibly flushed." @@ -2837,15 +2836,15 @@ msgstr "" "輸出緩衝通常會由 *file* 決定。但是如果 *flush* 為 true,則資料串流會被強制清" "除。" -#: ../../library/functions.rst:1609 +#: ../../library/functions.rst:1612 msgid "Added the *flush* keyword argument." msgstr "增加了 *flush* 關鍵字引數。" -#: ../../library/functions.rst:1615 +#: ../../library/functions.rst:1618 msgid "Return a property attribute." msgstr "回傳 property 屬性。" -#: ../../library/functions.rst:1617 +#: ../../library/functions.rst:1620 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 " @@ -2854,11 +2853,11 @@ msgstr "" "*fget* 是一個用於取得屬性值的函式,*fset* 是一個用於設定屬性值的函式,*fdel* " "是一個用於刪除屬性值的函式,而 *doc* 會為該屬性建立一個說明字串。" -#: ../../library/functions.rst:1621 +#: ../../library/functions.rst:1624 msgid "A typical use is to define a managed attribute ``x``::" msgstr "一個典型的用途是定義一個受管理的屬性 ``x``: ::" -#: ../../library/functions.rst:1623 +#: ../../library/functions.rst:1626 msgid "" "class C:\n" " def __init__(self):\n" @@ -2890,7 +2889,7 @@ msgstr "" "\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" -#: ../../library/functions.rst:1638 +#: ../../library/functions.rst:1641 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." @@ -2898,7 +2897,7 @@ msgstr "" "如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會呼叫取得器 (getter),``c.x = " "value`` 會呼叫設定器 (setter),而 ``del c.x`` 會呼叫刪除器 (deleter)。" -#: ../../library/functions.rst:1641 +#: ../../library/functions.rst:1644 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 " @@ -2909,7 +2908,7 @@ msgstr "" "*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" "`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" -#: ../../library/functions.rst:1645 +#: ../../library/functions.rst:1648 msgid "" "class Parrot:\n" " def __init__(self):\n" @@ -2921,14 +2920,14 @@ msgid "" " return self._voltage" msgstr "" -#: ../../library/functions.rst:1654 +#: ../../library/functions.rst:1657 msgid "" "The ``@property`` decorator turns the :meth:`!voltage` method into a " "\"getter\" for a read-only attribute with the same name, and it sets the " "docstring for *voltage* to \"Get the current voltage.\"" msgstr "" -#: ../../library/functions.rst:1662 +#: ../../library/functions.rst:1665 msgid "" "A property object has ``getter``, ``setter``, and ``deleter`` methods usable " "as decorators that create a copy of the property with the corresponding " @@ -2936,7 +2935,7 @@ msgid "" "with an example:" msgstr "" -#: ../../library/functions.rst:1667 +#: ../../library/functions.rst:1670 msgid "" "class C:\n" " def __init__(self):\n" @@ -2972,36 +2971,36 @@ msgstr "" " def x(self):\n" " del self._x" -#: ../../library/functions.rst:1686 +#: ../../library/functions.rst:1689 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:1690 +#: ../../library/functions.rst:1693 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." msgstr "" -#: ../../library/functions.rst:1693 +#: ../../library/functions.rst:1696 msgid "The docstrings of property objects are now writeable." msgstr "" -#: ../../library/functions.rst:1698 +#: ../../library/functions.rst:1701 msgid "" "Attribute holding the name of the property. The name of the property can be " "changed at runtime." msgstr "" -#: ../../library/functions.rst:1709 +#: ../../library/functions.rst:1712 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:1715 +#: ../../library/functions.rst:1718 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 " @@ -3014,11 +3013,11 @@ msgid "" "raise :exc:`RuntimeError`." msgstr "" -#: ../../library/functions.rst:1726 +#: ../../library/functions.rst:1729 msgid "This class has a custom representation that can be evaluated::" msgstr "" -#: ../../library/functions.rst:1728 +#: ../../library/functions.rst:1731 msgid "" "class Person:\n" " def __init__(self, name, age):\n" @@ -3036,7 +3035,7 @@ msgstr "" " def __repr__(self):\n" " return f\"Person('{self.name}', {self.age})\"" -#: ../../library/functions.rst:1739 +#: ../../library/functions.rst:1742 msgid "" "Return a reverse :term:`iterator`. *seq* must be an object which has a :" "meth:`~object.__reversed__` method or supports the sequence protocol (the :" @@ -3044,14 +3043,14 @@ msgid "" "with integer arguments starting at ``0``)." msgstr "" -#: ../../library/functions.rst:1747 +#: ../../library/functions.rst:1750 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:1751 +#: ../../library/functions.rst:1754 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 " @@ -3062,13 +3061,13 @@ msgid "" "``None``. Otherwise, the return value has the same type as *number*." msgstr "" -#: ../../library/functions.rst:1760 +#: ../../library/functions.rst:1763 msgid "" "For a general Python object ``number``, ``round`` delegates to ``number." "__round__``." msgstr "" -#: ../../library/functions.rst:1765 +#: ../../library/functions.rst:1768 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 " @@ -3077,21 +3076,21 @@ msgid "" "information." msgstr "" -#: ../../library/functions.rst:1777 +#: ../../library/functions.rst:1780 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:1781 +#: ../../library/functions.rst:1784 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:1788 +#: ../../library/functions.rst:1791 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 " @@ -3100,7 +3099,7 @@ msgid "" "is equivalent to ``x.foobar = 123``." msgstr "" -#: ../../library/functions.rst:1794 +#: ../../library/functions.rst:1797 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:" @@ -3109,21 +3108,21 @@ msgid "" "notation, but is accessible through :func:`getattr` etc.." msgstr "" -#: ../../library/functions.rst:1802 +#: ../../library/functions.rst:1805 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:1811 +#: ../../library/functions.rst:1814 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " "``None``." msgstr "" -#: ../../library/functions.rst:1819 +#: ../../library/functions.rst:1822 msgid "" "Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, " "and :attr:`!step` which merely return the argument values (or their " @@ -3131,48 +3130,48 @@ msgid "" "by NumPy and other third-party packages." msgstr "" -#: ../../library/functions.rst:1824 +#: ../../library/functions.rst:1827 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " "example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" "`itertools.islice` for an alternate version that returns an :term:`iterator`." msgstr "" -#: ../../library/functions.rst:1829 +#: ../../library/functions.rst:1832 msgid "" "Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" "`~slice.stop`, and :attr:`~slice.step` are hashable)." msgstr "" -#: ../../library/functions.rst:1835 +#: ../../library/functions.rst:1838 msgid "Return a new sorted list from the items in *iterable*." msgstr "" -#: ../../library/functions.rst:1837 +#: ../../library/functions.rst:1840 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" -#: ../../library/functions.rst:1839 +#: ../../library/functions.rst:1842 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:1843 +#: ../../library/functions.rst:1846 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:1846 +#: ../../library/functions.rst:1849 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." msgstr "" -#: ../../library/functions.rst:1849 +#: ../../library/functions.rst:1852 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 " @@ -3180,7 +3179,7 @@ msgid "" "example, sort by department, then by salary grade)." msgstr "" -#: ../../library/functions.rst:1854 +#: ../../library/functions.rst:1857 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -3192,22 +3191,22 @@ msgid "" "method." msgstr "" -#: ../../library/functions.rst:1863 +#: ../../library/functions.rst:1866 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functions.rst:1867 +#: ../../library/functions.rst:1870 msgid "Transform a method into a static method." msgstr "" -#: ../../library/functions.rst:1869 +#: ../../library/functions.rst:1872 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -#: ../../library/functions.rst:1872 +#: ../../library/functions.rst:1875 msgid "" "class C:\n" " @staticmethod\n" @@ -3217,7 +3216,7 @@ msgstr "" " @staticmethod\n" " def f(arg1, arg2, argN): ..." -#: ../../library/functions.rst:1876 +#: ../../library/functions.rst:1879 msgid "" "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -3225,7 +3224,7 @@ msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" -#: ../../library/functions.rst:1879 +#: ../../library/functions.rst:1882 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " "an instance (such as ``C().f()``). Moreover, the static method :term:" @@ -3233,14 +3232,14 @@ msgid "" "(such as ``f()``)." msgstr "" -#: ../../library/functions.rst:1884 +#: ../../library/functions.rst:1887 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:1888 +#: ../../library/functions.rst:1891 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 " @@ -3249,7 +3248,7 @@ msgid "" "cases, use this idiom::" msgstr "" -#: ../../library/functions.rst:1894 +#: ../../library/functions.rst:1897 msgid "" "def regular_function():\n" " ...\n" @@ -3263,36 +3262,41 @@ msgstr "" "class C:\n" " method = staticmethod(regular_function)" -#: ../../library/functions.rst:1900 +#: ../../library/functions.rst:1903 msgid "For more information on static methods, see :ref:`types`." msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" -#: ../../library/functions.rst:1902 +#: ../../library/functions.rst:1905 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." +"Static methods now inherit the method attributes (:attr:`~function." +"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" +"attr:`~function.__doc__` and :attr:`~function.__annotations__`), have a new " +"``__wrapped__`` attribute, and are now callable as regular functions." msgstr "" +"Static method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" +"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." +"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " +"``__wrapped__`` 屬性,且為如一般函式的可呼叫物件。" -#: ../../library/functions.rst:1917 +#: ../../library/functions.rst:1921 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" -#: ../../library/functions.rst:1919 +#: ../../library/functions.rst:1923 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -#: ../../library/functions.rst:1925 +#: ../../library/functions.rst:1929 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:1929 +#: ../../library/functions.rst:1933 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 ``''." @@ -3301,45 +3305,45 @@ msgid "" "using :func:`itertools.chain`." msgstr "" -#: ../../library/functions.rst:1935 +#: ../../library/functions.rst:1939 msgid "The *start* parameter can be specified as a keyword argument." msgstr "*start* 參數可被指定為關鍵字引數。" -#: ../../library/functions.rst:1938 +#: ../../library/functions.rst:1942 msgid "" "Summation of floats switched to an algorithm that gives higher accuracy and " "better commutativity on most builds." msgstr "" -#: ../../library/functions.rst:1945 +#: ../../library/functions.rst:1949 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:1949 +#: ../../library/functions.rst:1953 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:1953 +#: ../../library/functions.rst:1957 msgid "" -"For example, if :attr:`~class.__mro__` of *object_or_type* is ``D -> B -> C -" +"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" "> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -#: ../../library/functions.rst:1957 +#: ../../library/functions.rst:1961 msgid "" -"The :attr:`~class.__mro__` attribute of the class corresponding to " +"The :attr:`~type.__mro__` attribute of the class corresponding to " "*object_or_type* lists the method resolution search order used by both :func:" "`getattr` and :func:`super`. The attribute is dynamic and can change " "whenever the inheritance hierarchy is updated." msgstr "" -#: ../../library/functions.rst:1962 +#: ../../library/functions.rst:1966 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. " @@ -3347,7 +3351,7 @@ msgid "" "(this is useful for classmethods)." msgstr "" -#: ../../library/functions.rst:1967 +#: ../../library/functions.rst:1971 msgid "" "When called directly within an ordinary method of a class, both arguments " "may be omitted (\"zero-argument :func:`!super`\"). In this case, *type* will " @@ -3357,7 +3361,7 @@ msgid "" "including generator expressions, which implicitly create nested functions.)" msgstr "" -#: ../../library/functions.rst:1974 +#: ../../library/functions.rst:1978 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 " @@ -3365,7 +3369,7 @@ msgid "" "closely parallels the use of *super* in other programming languages." msgstr "" -#: ../../library/functions.rst:1979 +#: ../../library/functions.rst:1983 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 " @@ -3378,11 +3382,11 @@ msgid "" "classes that are unknown prior to runtime)." msgstr "" -#: ../../library/functions.rst:1989 +#: ../../library/functions.rst:1993 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" -#: ../../library/functions.rst:1991 +#: ../../library/functions.rst:1995 msgid "" "class C(B):\n" " def method(self, arg):\n" @@ -3390,14 +3394,14 @@ msgid "" " # super(C, self).method(arg)" msgstr "" -#: ../../library/functions.rst:1996 +#: ../../library/functions.rst:2000 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:2000 +#: ../../library/functions.rst:2004 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -3407,7 +3411,7 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" -#: ../../library/functions.rst:2008 +#: ../../library/functions.rst:2012 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 " @@ -3417,50 +3421,60 @@ msgid "" "accessing the current instance for ordinary methods." msgstr "" -#: ../../library/functions.rst:2015 +#: ../../library/functions.rst:2019 msgid "" "For practical suggestions on how to design cooperative classes using :func:" "`super`, see `guide to using super() `_." msgstr "" -#: ../../library/functions.rst:2025 +#: ../../library/functions.rst:2029 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:2034 +#: ../../library/functions.rst:2038 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__ `." +"__class__`." msgstr "" -#: ../../library/functions.rst:2038 +#: ../../library/functions.rst:2042 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:2042 +#: ../../library/functions.rst:2045 msgid "" "With three arguments, return a new type object. This is essentially a " "dynamic form of the :keyword:`class` statement. The *name* string is the " -"class name and becomes the :attr:`~definition.__name__` attribute. The " -"*bases* tuple contains the base classes and becomes the :attr:`~class." -"__bases__` attribute; if empty, :class:`object`, the ultimate base of all " -"classes, is added. The *dict* dictionary contains attribute and method " -"definitions for the class body; it may be copied or wrapped before becoming " -"the :attr:`~object.__dict__` attribute. The following two statements create " -"identical :class:`type` objects:" +"class name and becomes the :attr:`~type.__name__` attribute. The *bases* " +"tuple contains the base classes and becomes the :attr:`~type.__bases__` " +"attribute; if empty, :class:`object`, the ultimate base of all classes, is " +"added. The *dict* dictionary contains attribute and method definitions for " +"the class body; it may be copied or wrapped before becoming the :attr:`~type." +"__dict__` attribute. The following two statements create identical :class:`!" +"type` objects:" msgstr "" -#: ../../library/functions.rst:2057 -msgid "See also :ref:`bltin-type-objects`." -msgstr "另請參閱 :ref:`bltin-type-objects`。" +#: ../../library/functions.rst:2060 +msgid "See also:" +msgstr "" -#: ../../library/functions.rst:2059 +#: ../../library/functions.rst:2062 +msgid "" +":ref:`Documentation on attributes and methods on classes `." +msgstr "" + +#: ../../library/functions.rst:2063 +msgid ":ref:`bltin-type-objects`" +msgstr ":ref:`bltin-type-objects`" + +#: ../../library/functions.rst:2065 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -3468,58 +3482,58 @@ msgid "" "would." msgstr "" -#: ../../library/functions.rst:2064 +#: ../../library/functions.rst:2070 msgid "See also :ref:`class-customization`." msgstr "另請參閱 :ref:`class-customization`。" -#: ../../library/functions.rst:2066 +#: ../../library/functions.rst:2072 msgid "" -"Subclasses of :class:`type` which don't override ``type.__new__`` may no " +"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:2073 +#: ../../library/functions.rst:2079 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " -"or any other object with a :attr:`~object.__dict__` attribute." +"or any other object with a :attr:`!__dict__` attribute." msgstr "" -#: ../../library/functions.rst:2076 +#: ../../library/functions.rst:2082 msgid "" "Objects such as modules and instances have an updateable :attr:`~object." "__dict__` attribute; however, other objects may have write restrictions on " -"their :attr:`~object.__dict__` attributes (for example, classes use a :class:" -"`types.MappingProxyType` to prevent direct dictionary updates)." +"their :attr:`!__dict__` attributes (for example, classes use a :class:`types." +"MappingProxyType` to prevent direct dictionary updates)." msgstr "" -#: ../../library/functions.rst:2081 +#: ../../library/functions.rst:2087 msgid "Without an argument, :func:`vars` acts like :func:`locals`." msgstr "" -#: ../../library/functions.rst:2083 +#: ../../library/functions.rst:2089 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:2089 +#: ../../library/functions.rst:2095 msgid "" "The result of calling this function without an argument has been updated as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:2095 +#: ../../library/functions.rst:2101 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." msgstr "" -#: ../../library/functions.rst:2098 +#: ../../library/functions.rst:2104 msgid "Example::" msgstr "例如: ::" -#: ../../library/functions.rst:2100 +#: ../../library/functions.rst:2106 msgid "" ">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" "... print(item)\n" @@ -3535,27 +3549,27 @@ msgstr "" "(2, 'spice')\n" "(3, 'everything nice')" -#: ../../library/functions.rst:2107 +#: ../../library/functions.rst:2113 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:2110 +#: ../../library/functions.rst:2116 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:2114 +#: ../../library/functions.rst:2120 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:2118 +#: ../../library/functions.rst:2124 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 " @@ -3563,14 +3577,14 @@ msgid "" "approaches to dealing with this issue:" msgstr "" -#: ../../library/functions.rst:2123 +#: ../../library/functions.rst:2129 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:2127 +#: ../../library/functions.rst:2133 msgid "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" @@ -3578,14 +3592,14 @@ msgstr "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" -#: ../../library/functions.rst:2130 +#: ../../library/functions.rst:2136 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:2134 +#: ../../library/functions.rst:2140 msgid "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" @@ -3593,37 +3607,37 @@ msgstr "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" -#: ../../library/functions.rst:2137 +#: ../../library/functions.rst:2143 msgid "" "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " "is exhausted before the others:" msgstr "" -#: ../../library/functions.rst:2155 +#: ../../library/functions.rst:2161 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:2159 +#: ../../library/functions.rst:2165 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:2163 +#: ../../library/functions.rst:2169 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:2166 +#: ../../library/functions.rst:2172 msgid "Tips and tricks:" msgstr "" -#: ../../library/functions.rst:2168 +#: ../../library/functions.rst:2174 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 " @@ -3632,13 +3646,13 @@ msgid "" "iterator. This has the effect of dividing the input into n-length chunks." msgstr "" -#: ../../library/functions.rst:2174 +#: ../../library/functions.rst:2180 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -#: ../../library/functions.rst:2177 +#: ../../library/functions.rst:2183 msgid "" ">>> x = [1, 2, 3]\n" ">>> y = [4, 5, 6]\n" @@ -3656,17 +3670,17 @@ msgstr "" ">>> x == list(x2) and y == list(y2)\n" "True" -#: ../../library/functions.rst:2185 +#: ../../library/functions.rst:2191 msgid "Added the ``strict`` argument." msgstr "增加了 ``strict`` 引數。" -#: ../../library/functions.rst:2197 +#: ../../library/functions.rst:2203 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2200 +#: ../../library/functions.rst:2206 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -3678,7 +3692,7 @@ msgid "" "discouraged in favor of :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2209 +#: ../../library/functions.rst:2215 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -3688,7 +3702,7 @@ msgid "" "determine the package context of the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2216 +#: ../../library/functions.rst:2222 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -3697,7 +3711,7 @@ msgid "" "details)." msgstr "" -#: ../../library/functions.rst:2222 +#: ../../library/functions.rst:2228 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 " @@ -3705,37 +3719,37 @@ msgid "" "given, the module named by *name* is returned." msgstr "" -#: ../../library/functions.rst:2227 +#: ../../library/functions.rst:2233 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" msgstr "" -#: ../../library/functions.rst:2230 +#: ../../library/functions.rst:2236 msgid "spam = __import__('spam', globals(), locals(), [], 0)" msgstr "spam = __import__('spam', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2232 +#: ../../library/functions.rst:2238 msgid "The statement ``import spam.ham`` results in this call::" msgstr "" -#: ../../library/functions.rst:2234 +#: ../../library/functions.rst:2240 msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2236 +#: ../../library/functions.rst:2242 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:2239 +#: ../../library/functions.rst:2245 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" msgstr "" -#: ../../library/functions.rst:2242 +#: ../../library/functions.rst:2248 msgid "" "_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" "eggs = _temp.eggs\n" @@ -3745,36 +3759,36 @@ msgstr "" "eggs = _temp.eggs\n" "saus = _temp.sausage" -#: ../../library/functions.rst:2246 +#: ../../library/functions.rst:2252 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:2250 +#: ../../library/functions.rst:2256 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2253 +#: ../../library/functions.rst:2259 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." msgstr "" -#: ../../library/functions.rst:2257 +#: ../../library/functions.rst:2263 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:2262 +#: ../../library/functions.rst:2268 msgid "Footnotes" msgstr "註解" -#: ../../library/functions.rst:2263 +#: ../../library/functions.rst:2269 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 " @@ -3787,107 +3801,107 @@ msgstr "" msgid "Boolean" msgstr "Boolean(布林值)" -#: ../../library/functions.rst:154 ../../library/functions.rst:2032 +#: ../../library/functions.rst:154 ../../library/functions.rst:2036 msgid "type" msgstr "type(型別)" -#: ../../library/functions.rst:641 +#: ../../library/functions.rst:643 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/functions.rst:641 +#: ../../library/functions.rst:643 msgid "exec" msgstr "exec" -#: ../../library/functions.rst:733 +#: ../../library/functions.rst:735 msgid "NaN" msgstr "NaN" -#: ../../library/functions.rst:733 +#: ../../library/functions.rst:735 msgid "Infinity" msgstr "Infinity(無窮)" -#: ../../library/functions.rst:801 +#: ../../library/functions.rst:803 msgid "__format__" msgstr "__format__" -#: ../../library/functions.rst:801 ../../library/functions.rst:1909 +#: ../../library/functions.rst:803 ../../library/functions.rst:1913 msgid "string" msgstr "string(字串)" -#: ../../library/functions.rst:801 +#: ../../library/functions.rst:803 msgid "format() (built-in function)" msgstr "format()(內建函式)" -#: ../../library/functions.rst:1310 +#: ../../library/functions.rst:1313 msgid "file object" msgstr "file object(檔案物件)" -#: ../../library/functions.rst:1310 ../../library/functions.rst:1431 +#: ../../library/functions.rst:1313 ../../library/functions.rst:1434 msgid "open() built-in function" msgstr "open() 內建函式" -#: ../../library/functions.rst:1338 +#: ../../library/functions.rst:1341 msgid "file" msgstr "file(檔案)" -#: ../../library/functions.rst:1338 +#: ../../library/functions.rst:1341 msgid "modes" msgstr "modes(模式)" -#: ../../library/functions.rst:1431 +#: ../../library/functions.rst:1434 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "line-buffered I/O" msgstr "line-buffered I/O(行緩衝 I/O)" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "unbuffered I/O" msgstr "unbuffered I/O(非緩衝 I/O)" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "buffer size, I/O" msgstr "buffer size, I/O(緩衝區大小、I/O)" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "text mode" msgstr "text mode(文字模式)" -#: ../../library/functions.rst:1492 ../../library/functions.rst:2191 +#: ../../library/functions.rst:1495 ../../library/functions.rst:2197 msgid "module" msgstr "module(模組)" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "sys" msgstr "sys" -#: ../../library/functions.rst:1909 +#: ../../library/functions.rst:1913 msgid "str() (built-in function)" msgstr "str() (內建函式)" -#: ../../library/functions.rst:2032 +#: ../../library/functions.rst:2036 msgid "object" msgstr "object(物件)" -#: ../../library/functions.rst:2191 +#: ../../library/functions.rst:2197 msgid "statement" msgstr "statement(陳述式)" -#: ../../library/functions.rst:2191 +#: ../../library/functions.rst:2197 msgid "import" msgstr "import(引入)" -#: ../../library/functions.rst:2191 +#: ../../library/functions.rst:2197 msgid "builtins" msgstr "builtins(內建)" diff --git a/library/functools.po b/library/functools.po index cc8ce0e7f8..af426e5f3d 100644 --- a/library/functools.po +++ b/library/functools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2024-05-11 16:02+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -690,7 +690,6 @@ msgstr "" "True" #: ../../library/functools.rst:408 -#, fuzzy 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 " @@ -705,16 +704,15 @@ msgstr "" "從左到右,將兩個引數的 *function* 累加運用到 *iterable* 的項目上,從而將可疊" "代物件減少為單一值。例如,``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` 會計" "算出 ``((((1+2)+3)+4)+5)``。左邊的引數 *x* 是累積值,右邊的引數 *y* 是來自 " -"*iterable* 的更新值。如果可選的 *initializer* 存在,則在計算中會將其放置在可" -"疊代物件的項目之前,並在可疊代物件為空時作為預設值。如果未給定 *initializer* " -"且 *iterable* 僅包含一個項目,則回傳第一個項目。" +"*iterable* 的更新值。如果可選的 *initial* 存在,則在計算中會將其放置在可疊代" +"物件的項目之前,並在可疊代物件為空時作為預設值。如果未給定 *initial* 且 " +"*iterable* 僅包含一個項目,則回傳第一個項目。" #: ../../library/functools.rst:417 msgid "Roughly equivalent to::" msgstr "大致相當於: ::" #: ../../library/functools.rst:419 -#, fuzzy msgid "" "initial_missing = object()\n" "\n" @@ -728,12 +726,14 @@ msgid "" " value = function(value, element)\n" " return value" msgstr "" -"def reduce(function, iterable, initializer=None):\n" +"initial_missing = object()\n" +"\n" +"def reduce(function, iterable, initial=initial_missing, /):\n" " it = iter(iterable)\n" -" if initializer is None:\n" +" if initial is initial_missing:\n" " value = next(it)\n" " else:\n" -" value = initializer\n" +" value = initial\n" " for element in it:\n" " value = function(value, element)\n" " return value" @@ -877,7 +877,39 @@ msgstr "" "... print(arg.real, arg.imag)\n" "..." -#: ../../library/functools.rst:496 +#: ../../library/functools.rst:495 +msgid "" +"For code that dispatches on a collections type (e.g., ``list``), but wants " +"to typehint the items of the collection (e.g., ``list[int]``), the dispatch " +"type should be passed explicitly to the decorator itself with the typehint " +"going into the function definition::" +msgstr "" + +#: ../../library/functools.rst:500 +msgid "" +">>> @fun.register(list)\n" +"... def _(arg: list[int], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)" +msgstr "" +">>> @fun.register(list)\n" +"... def _(arg: list[int], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)" + +#: ../../library/functools.rst:509 +msgid "" +"At runtime the function will dispatch on an instance of a list regardless of " +"the type contained within the list i.e. ``[1,2,3]`` will be dispatched the " +"same as ``[\"foo\", \"bar\", \"baz\"]``. The annotation provided in this " +"example is for static type checkers only and has no runtime impact." +msgstr "" + +#: ../../library/functools.rst:515 msgid "" "To enable registering :term:`lambdas` and pre-existing functions, " "the :func:`register` attribute can also be used in a functional form::" @@ -885,7 +917,7 @@ msgstr "" "若要啟用註冊 :term:`lambdas` 和預先存在的函式,:func:`register` 屬性" "也能以函式形式使用: ::" -#: ../../library/functools.rst:499 +#: ../../library/functools.rst:518 msgid "" ">>> def nothing(arg, verbose=False):\n" "... print(\"Nothing.\")\n" @@ -897,7 +929,7 @@ msgstr "" "...\n" ">>> fun.register(type(None), nothing)" -#: ../../library/functools.rst:504 +#: ../../library/functools.rst:523 msgid "" "The :func:`register` attribute returns the undecorated function. This " "enables decorator stacking, :mod:`pickling`, and the creation of " @@ -906,7 +938,7 @@ msgstr "" ":func:`register` 屬性回傳未加裝飾器的函式。這讓使得裝飾器堆疊 (decorator " "stacking)、:mod:`pickling` 以及為每個變體獨立建立單元測試成為可能:" -#: ../../library/functools.rst:508 +#: ../../library/functools.rst:527 msgid "" ">>> @fun.register(float)\n" "... @fun.register(Decimal)\n" @@ -928,13 +960,13 @@ msgstr "" ">>> fun_num is fun\n" "False" -#: ../../library/functools.rst:518 +#: ../../library/functools.rst:537 msgid "" "When called, the generic function dispatches on the type of the first " "argument::" msgstr "呼叫時,泛型函式會分派第一個引數的型別: ::" -#: ../../library/functools.rst:521 +#: ../../library/functools.rst:540 msgid "" ">>> fun(\"Hello, world.\")\n" "Hello, world.\n" @@ -970,7 +1002,7 @@ msgstr "" ">>> fun(1.23)\n" "0.615" -#: ../../library/functools.rst:538 +#: ../../library/functools.rst:557 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 " @@ -982,7 +1014,7 @@ msgstr "" "尋找更通用的實作。用 ``@singledispatch`` 裝飾的原始函式是為基底 :class:" "`object` 型別註冊的,這意味著如果沒有找到更好的實作就會使用它。" -#: ../../library/functools.rst:544 +#: ../../library/functools.rst:563 msgid "" "If an implementation is registered to an :term:`abstract base class`, " "virtual subclasses of the base class will be dispatched to that " @@ -991,7 +1023,7 @@ msgstr "" "如果一個實作有被註冊到一個\\ :term:`抽象基底類別 `,則基" "底類別的虛擬子類別將被分派到該實作: ::" -#: ../../library/functools.rst:548 +#: ../../library/functools.rst:567 msgid "" ">>> from collections.abc import Mapping\n" ">>> @fun.register\n" @@ -1015,14 +1047,14 @@ msgstr "" ">>> fun({\"a\": \"b\"})\n" "a => b" -#: ../../library/functools.rst:559 +#: ../../library/functools.rst:578 msgid "" "To check which implementation the generic function will choose for a given " "type, use the ``dispatch()`` attribute::" msgstr "" "若要檢查泛型函式將為給定型別選擇哪種實作,請使用 ``dispatch()`` 屬性: ::" -#: ../../library/functools.rst:562 +#: ../../library/functools.rst:581 msgid "" ">>> fun.dispatch(float)\n" "\n" @@ -1030,13 +1062,13 @@ msgid "" "" msgstr "" -#: ../../library/functools.rst:567 +#: ../../library/functools.rst:586 msgid "" "To access all registered implementations, use the read-only ``registry`` " "attribute::" msgstr "若要存取所有已註冊的實作,請使用唯讀 ``registry`` 屬性: ::" -#: ../../library/functools.rst:570 +#: ../../library/functools.rst:589 msgid "" ">>> fun.registry.keys()\n" "dict_keys([, , ,\n" @@ -1056,11 +1088,11 @@ msgstr "" ">>> fun.registry[object]\n" "" -#: ../../library/functools.rst:581 +#: ../../library/functools.rst:600 msgid "The :func:`register` attribute now supports using type annotations." msgstr ":func:`register` 屬性現在支援使用型別註釋。" -#: ../../library/functools.rst:584 +#: ../../library/functools.rst:603 msgid "" "The :func:`register` attribute now supports :data:`types.UnionType` and :" "data:`typing.Union` as type annotations." @@ -1068,7 +1100,7 @@ msgstr "" ":func:`register` 屬性現在支援以 :data:`types.UnionType` 和 :data:`typing." "Union` 作為型別註釋。" -#: ../../library/functools.rst:591 +#: ../../library/functools.rst:610 msgid "" "Transform a method into a :term:`single-dispatch ` :term:" "`generic function`." @@ -1076,7 +1108,7 @@ msgstr "" "將方法轉換為\\ :term:`單一調度 `\\ :term:`泛型函式 `。" -#: ../../library/functools.rst:594 +#: ../../library/functools.rst:613 msgid "" "To define a generic method, decorate it with the ``@singledispatchmethod`` " "decorator. When defining a function using ``@singledispatchmethod``, note " @@ -1087,7 +1119,7 @@ msgstr "" "用 ``@singledispatchmethod`` 定義函式時,分派調度是發生在第一個非 *self* 或" "非 *cls* 引數的型別上: ::" -#: ../../library/functools.rst:599 +#: ../../library/functools.rst:618 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1115,7 +1147,7 @@ msgstr "" " def _(self, arg: bool):\n" " return not arg" -#: ../../library/functools.rst:612 +#: ../../library/functools.rst:631 msgid "" "``@singledispatchmethod`` supports nesting with other decorators such as :" "func:`@classmethod`. Note that to allow for ``dispatcher." @@ -1128,7 +1160,7 @@ msgstr "" "``singledispatchmethod`` 必須是\\ *最外面的*\\ 裝飾器。以下範例是 " "``Negator`` 類別,其 ``neg`` 方法繫結到該類別,而不是該類別的實例: ::" -#: ../../library/functools.rst:618 +#: ../../library/functools.rst:637 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1162,7 +1194,7 @@ msgstr "" " def _(cls, arg: bool):\n" " return not arg" -#: ../../library/functools.rst:634 +#: ../../library/functools.rst:653 msgid "" "The same pattern can be used for other similar decorators: :func:" "`@staticmethod`, :func:`@abstractmethod`, " @@ -1171,7 +1203,7 @@ msgstr "" "相同的模式可用於其他類似的裝飾器::func:`@staticmethod`、:func:" "`@abstractmethod` 等。" -#: ../../library/functools.rst:643 +#: ../../library/functools.rst:662 msgid "" "Update a *wrapper* function to look like the *wrapped* function. The " "optional arguments are tuples to specify which attributes of the original " @@ -1179,19 +1211,23 @@ msgid "" "function and which attributes of the wrapper function are updated with the " "corresponding attributes from the original function. The default values for " "these arguments are the module level constants ``WRAPPER_ASSIGNMENTS`` " -"(which assigns to the wrapper function's ``__module__``, ``__name__``, " -"``__qualname__``, ``__annotations__``, ``__type_params__``, and ``__doc__``, " -"the documentation string) and ``WRAPPER_UPDATES`` (which updates the wrapper " -"function's ``__dict__``, i.e. the instance dictionary)." +"(which assigns to the wrapper function's :attr:`~function.__module__`, :attr:" +"`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function." +"__annotations__`, :attr:`~function.__type_params__`, and :attr:`~function." +"__doc__`, the documentation string) and ``WRAPPER_UPDATES`` (which updates " +"the wrapper function's :attr:`~function.__dict__`, i.e. the instance " +"dictionary)." msgstr "" "更新 *wrapper* 函式,使其看起來像 *wrapped* 函式。可選引數是元組,用於指定原" "始函式的哪些屬性直接賦值給包裝函式上的匹配屬性,以及包裝函式的哪些屬性使用原" "始函式中的對應屬性進行更新。這些引數的預設值是模組層級的常數 " -"``WRAPPER_ASSIGNMENTS``\\ (它賦值給包裝函式的 ``__module__``、``__name__``、" -"``__qualname__``、``__annotations__`` 和 ``__doc__`` 文件字串 (docstring)和 " -"``WRAPPER_UPDATES``\\ (更新包裝器函式的 ``__dict__``,即實例字典)。" +"``WRAPPER_ASSIGNMENTS``\\ (它賦值給包裝函式的 :attr:`~function." +"__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:" +"attr:`~function.__annotations__`、:attr:`~function.__type_params__` 和 :attr:" +"`~function.__doc__` 文件字串 (docstring))和 ``WRAPPER_UPDATES``\\ (更新包" +"裝器函式的 :attr:`~function.__dict__`,即實例字典)。" -#: ../../library/functools.rst:654 +#: ../../library/functools.rst:674 msgid "" "To allow access to the original function for introspection and other " "purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), " @@ -1202,7 +1238,7 @@ msgstr "" "飾器,如 :func:`lru_cache`),此函式會自動向包裝器新增 ``__wrapped__`` 屬性," "該包裝器參照被包裝的函式。" -#: ../../library/functools.rst:659 +#: ../../library/functools.rst:679 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 " @@ -1214,7 +1250,7 @@ msgstr "" "裝器函式未更新,則回傳函式的元資料 (metadata) 將反映包裝器定義而非原始函式定" "義,這通常不太會有幫助。" -#: ../../library/functools.rst:665 +#: ../../library/functools.rst:685 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 " @@ -1227,16 +1263,16 @@ msgstr "" "器函式上設定它們)。如果包裝函式本身缺少 *updated* 中指定的任何屬性,仍然會引" "發 :exc:`AttributeError`。" -#: ../../library/functools.rst:671 +#: ../../library/functools.rst:691 msgid "" -"The ``__wrapped__`` attribute is now automatically added. The " -"``__annotations__`` attribute is now copied by default. Missing attributes " -"no longer trigger an :exc:`AttributeError`." +"The ``__wrapped__`` attribute is now automatically added. The :attr:" +"`~function.__annotations__` attribute is now copied by default. Missing " +"attributes no longer trigger an :exc:`AttributeError`." msgstr "" -"現在會自動新增 ``__wrapped__`` 屬性。現在預設會複製 ``__annotations__`` 屬" -"性。缺少的屬性不再觸發 :exc:`AttributeError`。" +"現在會自動新增 ``__wrapped__`` 屬性。現在預設會複製 :attr:`~function." +"__annotations__` 屬性。缺少的屬性不再觸發 :exc:`AttributeError`。" -#: ../../library/functools.rst:676 +#: ../../library/functools.rst:696 msgid "" "The ``__wrapped__`` attribute now always refers to the wrapped function, " "even if that function defined a ``__wrapped__`` attribute. (see :issue:" @@ -1245,11 +1281,12 @@ msgstr "" "``__wrapped__`` 屬性現在都會參照包裝函式,即便函式有定義 ``__wrapped__`` 屬" "性。(參見 :issue:`17482`)" -#: ../../library/functools.rst:681 -msgid "The ``__type_params__`` attribute is now copied by default." -msgstr "現在預設會複製 ``__type_params__`` 屬性。" +#: ../../library/functools.rst:701 +msgid "" +"The :attr:`~function.__type_params__` attribute is now copied by default." +msgstr "現在預設會複製 :attr:`~function.__type_params__` 屬性。" -#: ../../library/functools.rst:687 +#: ../../library/functools.rst:707 msgid "" "This is a convenience function for invoking :func:`update_wrapper` as a " "function decorator when defining a wrapper function. It is equivalent to " @@ -1260,7 +1297,7 @@ msgstr "" "式裝飾器。它相當於 ``partial(update_wrapper, wrapped=wrapped, " "assigned=assigned, updated=updated)``。例如: ::" -#: ../../library/functools.rst:692 +#: ../../library/functools.rst:712 msgid "" ">>> from functools import wraps\n" ">>> def my_decorator(f):\n" @@ -1284,7 +1321,7 @@ msgid "" "'Docstring'" msgstr "" -#: ../../library/functools.rst:713 +#: ../../library/functools.rst:733 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:" @@ -1293,11 +1330,11 @@ msgstr "" "如果不使用這個裝飾器工廠 (decorator factory),範例函式的名稱將會是 " "``'wrapper'``,並且原始 :func:`example` 的文件字串將會遺失。" -#: ../../library/functools.rst:721 +#: ../../library/functools.rst:741 msgid ":class:`partial` Objects" msgstr ":class:`partial` 物件" -#: ../../library/functools.rst:723 +#: ../../library/functools.rst:743 msgid "" ":class:`partial` objects are callable objects created by :func:`partial`. " "They have three read-only attributes:" @@ -1305,7 +1342,7 @@ msgstr "" ":class:`partial` 物件是由 :func:`partial` 所建立的可呼叫物件。它們有三個唯讀" "屬性:" -#: ../../library/functools.rst:729 +#: ../../library/functools.rst:749 msgid "" "A callable object or function. Calls to the :class:`partial` object will be " "forwarded to :attr:`func` with new arguments and keywords." @@ -1313,7 +1350,7 @@ msgstr "" "一個可呼叫的物件或函式。對 :class:`partial` 物件的呼叫將被轉送到帶有新引數和" "關鍵字的 :attr:`func`。" -#: ../../library/functools.rst:735 +#: ../../library/functools.rst:755 msgid "" "The leftmost positional arguments that will be prepended to the positional " "arguments provided to a :class:`partial` object call." @@ -1321,23 +1358,24 @@ msgstr "" "最左邊的位置引數將會被加入到提供給 :class:`partial` 物件呼叫的位置引數的前" "面。" -#: ../../library/functools.rst:741 +#: ../../library/functools.rst:761 msgid "" "The keyword arguments that will be supplied when the :class:`partial` object " "is called." msgstr "呼叫 :class:`partial` 物件時將提供的關鍵字引數。" -#: ../../library/functools.rst:744 -msgid "" -":class:`partial` objects are like :class:`function` objects in that they are " -"callable, weak referenceable, and can have attributes. There are some " -"important differences. For instance, the :attr:`~definition.__name__` and :" -"attr:`__doc__` attributes are not created automatically. Also, :class:" -"`partial` objects defined in classes behave like static methods and do not " -"transform into bound methods during instance attribute look-up." -msgstr "" -":class:`partial` 物件與 :class:`function` 物件類似,因為它們是可呼叫的、可弱" -"參照的 (weak referencable) 且可以具有屬性。有一些重要的區別,例如,:attr:" -"`~definition.__name__` 和 :attr:`__doc__` 屬性不會自動建立。此外,類別中定義" -"的 :class:`partial` 物件的行為類似於靜態方法,並且在實例屬性查找期間不會轉換" -"為繫結方法。" +#: ../../library/functools.rst:764 +msgid "" +":class:`partial` objects are like :ref:`function objects ` in that they are callable, weak referenceable, and can have " +"attributes. There are some important differences. For instance, the :attr:" +"`~function.__name__` and :attr:`function.__doc__` attributes are not created " +"automatically. Also, :class:`partial` objects defined in classes behave " +"like static methods and do not transform into bound methods during instance " +"attribute look-up." +msgstr "" +":class:`partial` 物件與\\ :ref:`函式物件 `\\ 類似,因為它" +"們是可呼叫的、可弱參照的 (weak referencable) 且可以具有屬性。有一些重要的區" +"別,例如,:attr:`~function.__name__` 和 :attr:`function.__doc__` 屬性不會自動" +"建立。此外,類別中定義的 :class:`partial` 物件的行為類似於靜態方法,並且在實" +"例屬性查找期間不會轉換為繫結方法。" diff --git a/library/gc.po b/library/gc.po index 9e8bf39153..dd5103866b 100644 --- a/library/gc.po +++ b/library/gc.po @@ -1,16 +1,15 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Liang-Bo Wang , 2015 -# Matt Wang , 2022 +# Matt Wang , 2022-2024 # msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-01 00:15+0000\n" "PO-Revision-Date: 2023-04-24 21:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -64,12 +63,11 @@ msgid "Return ``True`` if automatic collection is enabled." msgstr "如果啟用了自動回收則回傳 ``True``。" #: ../../library/gc.rst:43 -#, fuzzy msgid "" -"Perform a collection. The optional argument *generation* may be an integer " -"specifying which generation to collect (from 0 to 2). A :exc:`ValueError` " -"is raised if the generation number is invalid. The sum of collected objects " -"and uncollectable objects is returned." +"With no arguments, run a full collection. The optional argument " +"*generation* may be an integer specifying which generation to collect (from " +"0 to 2). A :exc:`ValueError` is raised if the generation number is invalid. " +"The sum of collected objects and uncollectable objects is returned." msgstr "" "若被呼叫時沒有引數,則啟動完整垃圾回收。可選的引數 *generation* 可以是一個指" "明需要回收哪一代垃圾的整數(從 0 到 2)。當引數 *generation* 無效時,會引發 :" @@ -77,23 +75,6 @@ msgstr "" #: ../../library/gc.rst:48 msgid "" -"Calling ``gc.collect(0)`` will perform a GC collection on the young " -"generation." -msgstr "" - -#: ../../library/gc.rst:50 -msgid "" -"Calling ``gc.collect(1)`` will perform a GC collection on the young " -"generation and an increment of the old generation." -msgstr "" - -#: ../../library/gc.rst:53 -msgid "" -"Calling ``gc.collect(2)`` or ``gc.collect()`` performs a full collection" -msgstr "" - -#: ../../library/gc.rst:55 -msgid "" "The free lists maintained for a number of built-in types are cleared " "whenever a full collection or collection of the highest generation (2) is " "run. Not all items in some free lists may be freed due to the particular " @@ -103,17 +84,13 @@ msgstr "" "為了特定型別的實現,特別是 :class:`float`,在某些空閒列表中並非所有項目都會被" "釋放。" -#: ../../library/gc.rst:60 +#: ../../library/gc.rst:53 msgid "" "The effect of calling ``gc.collect()`` while the interpreter is already " "performing a collection is undefined." -msgstr "" +msgstr "當直譯器已經執行收集時呼叫 ``gc.collect()`` 的效果是未定義的。" -#: ../../library/gc.rst:63 -msgid "``generation=1`` performs an increment of collection." -msgstr "" - -#: ../../library/gc.rst:69 +#: ../../library/gc.rst:59 msgid "" "Set the garbage collection debugging flags. Debugging information will be " "written to ``sys.stderr``. See below for a list of debugging flags which " @@ -122,43 +99,24 @@ msgstr "" "設定垃圾回收器的除錯旗標。除錯資訊會被寫入 ``sys.stderr``。請見下方的除錯旗標" "列表,可以使用位元操作 (bit operation) 進行設定以控制除錯程式。" -#: ../../library/gc.rst:76 +#: ../../library/gc.rst:66 msgid "Return the debugging flags currently set." msgstr "回傳當前設置的除錯旗標。" -#: ../../library/gc.rst:82 -#, fuzzy +#: ../../library/gc.rst:71 msgid "" "Returns a list of all objects tracked by the collector, excluding the list " -"returned. If *generation* is not ``None``, return only the objects as " -"follows:" +"returned. If *generation* is not ``None``, return only the objects tracked " +"by the collector that are in that generation." msgstr "" "回傳一個包含回收器正在追蹤的所有物件的 list,除去所回傳的 list。如果 " -"*generation* 不為 None,只回傳回收器正在追蹤且屬於該代的物件。" +"*generation* 不為 ``None``,只回傳回收器正在追蹤且屬於該代的物件。" -#: ../../library/gc.rst:85 -#, fuzzy -msgid "0: All objects in the young generation" -msgstr "回傳永久代中的物件數量。" - -#: ../../library/gc.rst:86 -msgid "1: No objects, as there is no generation 1 (as of Python 3.13)" -msgstr "" - -#: ../../library/gc.rst:87 -#, fuzzy -msgid "2: All objects in the old generation" -msgstr "回傳永久代中的物件數量。" - -#: ../../library/gc.rst:89 +#: ../../library/gc.rst:75 msgid "New *generation* parameter." msgstr "新增 *generation* 參數。" -#: ../../library/gc.rst:92 -msgid "Generation 1 is removed" -msgstr "" - -#: ../../library/gc.rst:95 +#: ../../library/gc.rst:78 msgid "" "Raises an :ref:`auditing event ` ``gc.get_objects`` with argument " "``generation``." @@ -166,7 +124,7 @@ msgstr "" "引發一個附帶引數 ``generation`` 的\\ :ref:`稽核事件 (auditing event) " "` ``gc.get_objects``。" -#: ../../library/gc.rst:99 +#: ../../library/gc.rst:82 msgid "" "Return a list of three per-generation dictionaries containing collection " "statistics since interpreter start. The number of keys may change in the " @@ -176,17 +134,17 @@ msgstr "" "的垃圾回收統計資料。字典的鍵的數目在將來可能會改變,但目前每個字典包含以下項" "目:" -#: ../../library/gc.rst:104 +#: ../../library/gc.rst:87 msgid "``collections`` is the number of times this generation was collected;" msgstr "``collections`` 是該代被回收的次數;" -#: ../../library/gc.rst:106 +#: ../../library/gc.rst:89 msgid "" "``collected`` is the total number of objects collected inside this " "generation;" msgstr "``collected`` 是該代中被回收的物件總數;" -#: ../../library/gc.rst:109 +#: ../../library/gc.rst:92 msgid "" "``uncollectable`` is the total number of objects which were found to be " "uncollectable (and were therefore moved to the :data:`garbage` list) inside " @@ -195,64 +153,54 @@ msgstr "" "``uncollectable`` 是在這一代中被發現無法回收的物件總數(因此被移到 :data:" "`garbage` list 中)。" -#: ../../library/gc.rst:118 +#: ../../library/gc.rst:101 msgid "" "Set the garbage collection thresholds (the collection frequency). Setting " "*threshold0* to zero disables collection." msgstr "設定垃圾回收閾值(回收頻率)。 將 *threshold0* 設為零會停止回收。" -#: ../../library/gc.rst:121 -msgid "" -"The GC classifies objects into two generations depending on whether they " -"have survived a collection. New objects are placed in the young generation. " -"If an object survives a collection it is moved into the old generation." -msgstr "" - -#: ../../library/gc.rst:125 -msgid "" -"In order to decide when to run, the collector keeps track of the number of " -"object allocations and deallocations since the last collection. When the " -"number of allocations minus the number of deallocations exceeds " -"*threshold0*, collection starts. For each collection, all the objects in the " -"young generation and some fraction of the old generation is collected." -msgstr "" - -#: ../../library/gc.rst:131 -msgid "" -"The fraction of the old generation that is collected is **inversely** " -"proportional to *threshold1*. The larger *threshold1* is, the slower objects " -"in the old generation are collected. For the default value of 10, 1% of the " -"old generation is scanned during each collection." -msgstr "" - -#: ../../library/gc.rst:136 -msgid "*threshold2* is ignored." -msgstr "" - -#: ../../library/gc.rst:138 +#: ../../library/gc.rst:104 msgid "" -"See `Garbage collector design `_ for more information." -msgstr "" +"The GC classifies objects into three generations depending on how many " +"collection sweeps they have survived. New objects are placed in the " +"youngest generation (generation ``0``). If an object survives a collection " +"it is moved into the next older generation. Since generation ``2`` is the " +"oldest generation, objects in that generation remain there after a " +"collection. In order to decide when to run, the collector keeps track of " +"the number object allocations and deallocations since the last collection. " +"When the number of allocations minus the number of deallocations exceeds " +"*threshold0*, collection starts. Initially only generation ``0`` is " +"examined. If generation ``0`` has been examined more than *threshold1* " +"times since generation ``1`` has been examined, then generation ``1`` is " +"examined as well. With the third generation, things are a bit more " +"complicated, see `Collecting the oldest generation `_ for more " +"information." +msgstr "" +"垃圾回收器會根據物件在多少次垃圾回收後仍倖存來把所有物件分類為三代。新建物件" +"會被放在最年輕代(第 ``0`` 代)。 如果一個物件在一次垃圾回收後倖存,它會被移" +"入下一個較老代。由於第 ``2`` 代是最老代,這一代的物件在一次垃圾回收後仍會保留" +"原樣。為了確定何時要執行,垃圾回收器會追蹤自上一次回收後物件分配和釋放的數" +"量。當分配數量減去釋放數量的結果大於 *threshold0* 時,垃圾回收就會開始。初始" +"時只有第 ``0`` 代會被檢查。如果自第 ``1`` 代被檢查後第 ``0`` 代已被檢查超過 " +"*threshold1* 次,則第 ``1`` 代也會被檢查。對於第三代來說,情況還會更復雜一" +"些,請參閱 `Collecting the oldest generation `_ 來了解詳情。" -#: ../../library/gc.rst:140 -msgid "*threshold2* is ignored" -msgstr "" - -#: ../../library/gc.rst:146 +#: ../../library/gc.rst:121 msgid "" "Return the current collection counts as a tuple of ``(count0, count1, " "count2)``." msgstr "將當前回收計數以 ``(count0, count1, count2)`` 形式的 tuple 回傳。" -#: ../../library/gc.rst:152 +#: ../../library/gc.rst:127 msgid "" "Return the current collection thresholds as a tuple of ``(threshold0, " "threshold1, threshold2)``." msgstr "" "將當前回收閾值以 ``(threshold0, threshold1, threshold2)`` 形式的 tuple 回傳。" -#: ../../library/gc.rst:158 +#: ../../library/gc.rst:133 msgid "" "Return the list of objects that directly refer to any of objs. This function " "will only locate those containers which support garbage collection; " @@ -262,7 +210,7 @@ msgstr "" "回傳包含直接參照 objs 中任一個物件的物件 list。這個函式只定位支援垃圾回收的容" "器;參照了其它物件但不支援垃圾回收的擴充套件型別無法被找到。" -#: ../../library/gc.rst:163 +#: ../../library/gc.rst:138 msgid "" "Note that objects which have already been dereferenced, but which live in " "cycles and have not yet been collected by the garbage collector can be " @@ -273,7 +221,7 @@ msgstr "" "會被作為參照者出現在回傳的 list 中。若只要獲取當前正在參照的物件,需要在呼" "叫 :func:`get_referrers` 之前呼叫 :func:`collect`。" -#: ../../library/gc.rst:169 +#: ../../library/gc.rst:144 msgid "" "Care must be taken when using objects returned by :func:`get_referrers` " "because some of them could still be under construction and hence in a " @@ -284,7 +232,7 @@ msgstr "" "在建構中而處於暫時無效的狀態。不要把 :func:`get_referrers` 用於除錯以外的其它" "目的。" -#: ../../library/gc.rst:174 +#: ../../library/gc.rst:149 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referrers`` with " "argument ``objs``." @@ -292,7 +240,7 @@ msgstr "" "引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." "get_referrers``。" -#: ../../library/gc.rst:179 +#: ../../library/gc.rst:154 msgid "" "Return a list of objects directly referred to by any of the arguments. The " "referents returned are those objects visited by the arguments' C-level :c:" @@ -310,7 +258,7 @@ msgstr "" "此,可以有以下例子:一個整數對於一個引數是直接可達的,這個整數物件有可能出現" "或不出現在結果的 list 當中。" -#: ../../library/gc.rst:187 +#: ../../library/gc.rst:162 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referents`` with " "argument ``objs``." @@ -318,7 +266,7 @@ msgstr "" "引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." "get_referents``。" -#: ../../library/gc.rst:191 +#: ../../library/gc.rst:166 msgid "" "Returns ``True`` if the object is currently tracked by the garbage " "collector, ``False`` otherwise. As a general rule, instances of atomic " @@ -332,7 +280,7 @@ msgstr "" "件)會被追蹤。然而,有一些特定型別最佳化會被用來減少垃圾回收器在簡單實例(如" "只含有原子性的鍵和值的字典)上的足跡: ::" -#: ../../library/gc.rst:198 +#: ../../library/gc.rst:173 msgid "" ">>> gc.is_tracked(0)\n" "False\n" @@ -360,14 +308,14 @@ msgstr "" ">>> gc.is_tracked({\"a\": []})\n" "True" -#: ../../library/gc.rst:216 +#: ../../library/gc.rst:191 msgid "" "Returns ``True`` if the given object has been finalized by the garbage " "collector, ``False`` otherwise. ::" msgstr "" "如果給定物件已被垃圾回收器終結則回傳 ``True``,否則回傳 ``False``。: ::" -#: ../../library/gc.rst:219 +#: ../../library/gc.rst:194 msgid "" ">>> x = None\n" ">>> class Lazarus:\n" @@ -395,7 +343,7 @@ msgstr "" ">>> gc.is_finalized(x)\n" "True" -#: ../../library/gc.rst:237 +#: ../../library/gc.rst:212 msgid "" "Freeze all the objects tracked by the garbage collector; move them to a " "permanent generation and ignore them in all the future collections." @@ -403,7 +351,7 @@ msgstr "" "凍結 (freeze) 垃圾回收器所追蹤的所有物件;將它們移至永久代並忽略所有未來的收" "集動作。" -#: ../../library/gc.rst:240 +#: ../../library/gc.rst:215 msgid "" "If a process will ``fork()`` without ``exec()``, avoiding unnecessary copy-" "on-write in child processes will maximize memory sharing and reduce overall " @@ -421,23 +369,23 @@ msgstr "" "disable()``,在 ``fork()`` 之前呼叫 ``gc.freeze()``,並儘早在子行程中呼叫 " "``gc.enable()``。" -#: ../../library/gc.rst:254 +#: ../../library/gc.rst:229 msgid "" "Unfreeze the objects in the permanent generation, put them back into the " "oldest generation." msgstr "解凍 (unfreeze) 永久代中的物件,並將它們放回到最年老代中。" -#: ../../library/gc.rst:262 +#: ../../library/gc.rst:237 msgid "Return the number of objects in the permanent generation." msgstr "回傳永久代中的物件數量。" -#: ../../library/gc.rst:267 +#: ../../library/gc.rst:242 msgid "" "The following variables are provided for read-only access (you can mutate " "the values but should not rebind them):" msgstr "以下變數僅供唯讀存取(你可以修改其值但不應該重新繫結 (rebind) 它們):" -#: ../../library/gc.rst:272 +#: ../../library/gc.rst:247 msgid "" "A list of objects which the collector found to be unreachable but could not " "be freed (uncollectable objects). Starting with Python 3.4, this list " @@ -448,7 +396,7 @@ msgstr "" "開始,該 list 在大多數時候都應該是空的,除非使用了有非 ``NULL`` ``tp_del`` 槽" "位的 C 擴充套件型別的實例。" -#: ../../library/gc.rst:277 +#: ../../library/gc.rst:252 msgid "" "If :const:`DEBUG_SAVEALL` is set, then all unreachable objects will be added " "to this list rather than freed." @@ -456,7 +404,7 @@ msgstr "" "如果設定了 :const:`DEBUG_SAVEALL`,則所有不可達物件將被加進該 list 而不會被釋" "放。" -#: ../../library/gc.rst:280 +#: ../../library/gc.rst:255 msgid "" "If this list is non-empty at :term:`interpreter shutdown`, a :exc:" "`ResourceWarning` is emitted, which is silent by default. If :const:" @@ -467,7 +415,7 @@ msgstr "" "`ResourceWarning`,在預設情況下此警告不會被提醒。如果設定了 :const:" "`DEBUG_UNCOLLECTABLE`,所有無法被回收的物件會被印出。" -#: ../../library/gc.rst:286 +#: ../../library/gc.rst:261 msgid "" "Following :pep:`442`, objects with a :meth:`~object.__del__` method don't " "end up in :data:`gc.garbage` anymore." @@ -475,7 +423,7 @@ msgstr "" "根據 :pep:`442`,帶有 :meth:`~object.__del__` method 的物件最終不會在 :data:" "`gc.garbage` 內。" -#: ../../library/gc.rst:292 +#: ../../library/gc.rst:267 msgid "" "A list of callbacks that will be invoked by the garbage collector before and " "after collection. The callbacks will be called with two arguments, *phase* " @@ -484,29 +432,29 @@ msgstr "" "會被垃圾回收器在回收開始前和完成後呼叫的一系列回呼函式 (callback) 。這些回呼" "函式在被呼叫時附帶兩個引數:*phase* 和 *info*。" -#: ../../library/gc.rst:296 +#: ../../library/gc.rst:271 msgid "*phase* can be one of two values:" msgstr "*phase* 可為以下兩者之一:" -#: ../../library/gc.rst:298 +#: ../../library/gc.rst:273 msgid "\"start\": The garbage collection is about to start." msgstr "\"start\":垃圾回收即將開始。" -#: ../../library/gc.rst:300 +#: ../../library/gc.rst:275 msgid "\"stop\": The garbage collection has finished." msgstr "\"stop\":垃圾回收已結束。" -#: ../../library/gc.rst:302 +#: ../../library/gc.rst:277 msgid "" "*info* is a dict providing more information for the callback. The following " "keys are currently defined:" msgstr "*info* 是一個字典,提供回呼函式更多資訊。已有定義的鍵有:" -#: ../../library/gc.rst:305 +#: ../../library/gc.rst:280 msgid "\"generation\": The oldest generation being collected." msgstr "\"generation\"(代):正在被回收的最年老的一代。" -#: ../../library/gc.rst:307 +#: ../../library/gc.rst:282 msgid "" "\"collected\": When *phase* is \"stop\", the number of objects successfully " "collected." @@ -514,7 +462,7 @@ msgstr "" "\"collected\"(已回收的):當 *phase* 為 \"stop\" 時,被成功回收的物件的數" "目。" -#: ../../library/gc.rst:310 +#: ../../library/gc.rst:285 msgid "" "\"uncollectable\": When *phase* is \"stop\", the number of objects that " "could not be collected and were put in :data:`garbage`." @@ -522,40 +470,40 @@ msgstr "" "\"uncollectable\"(不可回收的):當 *phase* 為 \"stop\" 時,不能被回收並被放" "入 :data:`garbage` 的物件的數目。" -#: ../../library/gc.rst:313 +#: ../../library/gc.rst:288 msgid "" "Applications can add their own callbacks to this list. The primary use " "cases are:" msgstr "應用程式可以把他們自己的回呼函式加入此 list。主要的使用場景有:" -#: ../../library/gc.rst:316 +#: ../../library/gc.rst:291 msgid "" "Gathering statistics about garbage collection, such as how often various " "generations are collected, and how long the collection takes." msgstr "收集垃圾回收的統計資料,如:不同代的回收頻率、回收任務所花費的時間。" -#: ../../library/gc.rst:320 +#: ../../library/gc.rst:295 msgid "" "Allowing applications to identify and clear their own uncollectable types " "when they appear in :data:`garbage`." msgstr "" "讓應用程式可以識別和清理他們自己在 :data:`garbage` 中的不可回收型別物件。" -#: ../../library/gc.rst:326 +#: ../../library/gc.rst:301 msgid "The following constants are provided for use with :func:`set_debug`:" msgstr "以下常數是為了和 :func:`set_debug` 一起使用所提供:" -#: ../../library/gc.rst:331 +#: ../../library/gc.rst:306 msgid "" "Print statistics during collection. This information can be useful when " "tuning the collection frequency." msgstr "在回收完成後印出統計資訊。當調校回收頻率設定時,這些資訊會很有用。" -#: ../../library/gc.rst:337 +#: ../../library/gc.rst:312 msgid "Print information on collectable objects found." msgstr "當發現可回收物件時印出資訊。" -#: ../../library/gc.rst:342 +#: ../../library/gc.rst:317 msgid "" "Print information of uncollectable objects found (objects which are not " "reachable but cannot be freed by the collector). These objects will be " @@ -564,7 +512,7 @@ msgstr "" "印出找到的不可回收物件的資訊(指不能被回收器回收的不可達物件)。這些物件會被" "新增到 ``garbage`` list 中。" -#: ../../library/gc.rst:346 +#: ../../library/gc.rst:321 msgid "" "Also print the contents of the :data:`garbage` list at :term:`interpreter " "shutdown`, if it isn't empty." @@ -572,7 +520,7 @@ msgstr "" "當 :term:`interpreter shutdown`\\ (直譯器關閉)時,若 :data:`garbage` list " "不是空的,那這些內容也會被印出。" -#: ../../library/gc.rst:352 +#: ../../library/gc.rst:327 msgid "" "When set, all unreachable objects found will be appended to *garbage* rather " "than being freed. This can be useful for debugging a leaking program." @@ -580,7 +528,7 @@ msgstr "" "設定後,所有回收器找到的不可達物件會被加進 *garbage* 而不是直接被釋放。這在為" "一個記憶體流失的程式除錯時會很有用。" -#: ../../library/gc.rst:358 +#: ../../library/gc.rst:333 msgid "" "The debugging flags necessary for the collector to print information about a " "leaking program (equal to ``DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | " @@ -588,31 +536,3 @@ msgid "" msgstr "" "要印出記憶體流失程式之相關資訊時,回收器所需的除錯旗標。(等同於 " "``DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | DEBUG_SAVEALL``)。" - -#~ msgid "" -#~ "The GC classifies objects into three generations depending on how many " -#~ "collection sweeps they have survived. New objects are placed in the " -#~ "youngest generation (generation ``0``). If an object survives a " -#~ "collection it is moved into the next older generation. Since generation " -#~ "``2`` is the oldest generation, objects in that generation remain there " -#~ "after a collection. In order to decide when to run, the collector keeps " -#~ "track of the number object allocations and deallocations since the last " -#~ "collection. When the number of allocations minus the number of " -#~ "deallocations exceeds *threshold0*, collection starts. Initially only " -#~ "generation ``0`` is examined. If generation ``0`` has been examined more " -#~ "than *threshold1* times since generation ``1`` has been examined, then " -#~ "generation ``1`` is examined as well. With the third generation, things " -#~ "are a bit more complicated, see `Collecting the oldest generation " -#~ "`_ for more information." -#~ msgstr "" -#~ "垃圾回收器會根據物件在多少次垃圾回收後仍倖存來把所有物件分類為三代。新建物" -#~ "件會被放在最年輕代(第 ``0`` 代)。 如果一個物件在一次垃圾回收後倖存,它會" -#~ "被移入下一個較老代。由於第 ``2`` 代是最老代,這一代的物件在一次垃圾回收後" -#~ "仍會保留原樣。為了確定何時要執行,垃圾回收器會追蹤自上一次回收後物件分配和" -#~ "釋放的數量。當分配數量減去釋放數量的結果大於 *threshold0* 時,垃圾回收就會" -#~ "開始。初始時只有第 ``0`` 代會被檢查。如果自第 ``1`` 代被檢查後第 ``0`` 代" -#~ "已被檢查超過 *threshold1* 次,則第 ``1`` 代也會被檢查。對於第三代來說,情" -#~ "況還會更復雜一些,請參閱 `Collecting the oldest generation `_ 來了解詳情。" diff --git a/library/importlib.po b/library/importlib.po index 77865d2b32..9946fd1bea 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1366,7 +1366,7 @@ msgstr "" msgid "Multi-phase init is now required for use in subinterpreters." msgstr "" -#: ../../library/importlib.rst:1109 ../../library/importlib.rst:1300 +#: ../../library/importlib.rst:1109 ../../library/importlib.rst:1293 msgid "Name of the module the loader supports." msgstr "" @@ -1426,109 +1426,85 @@ msgstr "" #: ../../library/importlib.rst:1168 msgid "" "A specification for a module's import-system-related state. This is " -"typically exposed as the module's :attr:`__spec__` attribute. In the " -"descriptions below, the names in parentheses give the corresponding " -"attribute available directly on the module object, e.g. ``module.__spec__." -"origin == module.__file__``. Note, however, that while the *values* are " -"usually equivalent, they can differ since there is no synchronization " -"between the two objects. For example, it is possible to update the " -"module's :attr:`__file__` at runtime and this will not be automatically " -"reflected in the module's :attr:`__spec__.origin`, and vice versa." +"typically exposed as the module's :attr:`__spec__` attribute. Many of these " +"attributes are also available directly on a module: for example, ``module." +"__spec__.origin == module.__file__``. Note, however, that while the " +"*values* are usually equivalent, they can differ since there is no " +"synchronization between the two objects. For example, it is possible to " +"update the module's :attr:`__file__` at runtime and this will not be " +"automatically reflected in the module's :attr:`__spec__.origin`, and vice " +"versa." msgstr "" -#: ../../library/importlib.rst:1182 -msgid "(:attr:`__name__`)" -msgstr "(:attr:`__name__`)" - -#: ../../library/importlib.rst:1184 +#: ../../library/importlib.rst:1181 msgid "" -"The module's fully qualified name. The :term:`finder` should always set this " -"attribute to a non-empty string." +"The module's fully qualified name (see :attr:`__name__` attributes on " +"modules). The :term:`finder` should always set this attribute to a non-empty " +"string." msgstr "" -#: ../../library/importlib.rst:1189 -msgid "(:attr:`__loader__`)" -msgstr "(:attr:`__loader__`)" - -#: ../../library/importlib.rst:1191 +#: ../../library/importlib.rst:1187 msgid "" -"The :term:`loader` used to load the module. The :term:`finder` should always " -"set this attribute." +"The :term:`loader` used to load the module (see :attr:`__loader__` " +"attributes on modules). The :term:`finder` should always set this attribute." msgstr "" -#: ../../library/importlib.rst:1196 -msgid "(:attr:`__file__`)" -msgstr "(:attr:`__file__`)" - -#: ../../library/importlib.rst:1198 +#: ../../library/importlib.rst:1193 msgid "" -"The location the :term:`loader` should use to load the module. For example, " -"for modules loaded from a .py file this is the filename. The :term:`finder` " -"should always set this attribute to a meaningful value for the :term:" -"`loader` to use. In the uncommon case that there is not one (like for " -"namespace packages), it should be set to ``None``." +"The location the :term:`loader` should use to load the module (see :attr:" +"`__file__` attributes on modules). For example, for modules loaded from a ." +"py file this is the filename. The :term:`finder` should always set this " +"attribute to a meaningful value for the :term:`loader` to use. In the " +"uncommon case that there is not one (like for namespace packages), it should " +"be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1206 -msgid "(:attr:`__path__`)" -msgstr "(:attr:`__path__`)" - -#: ../../library/importlib.rst:1208 +#: ../../library/importlib.rst:1202 msgid "" -"The list of locations where the package's submodules will be found. Most of " -"the time this is a single directory. The :term:`finder` should set this " -"attribute to a list, even an empty one, to indicate to the import system " -"that the module is a package. It should be set to ``None`` for non-package " -"modules. It is set automatically later to a special object for namespace " -"packages." +"The list of locations where the package's submodules will be found (see :" +"attr:`__path__` attributes on modules). Most of the time this is a single " +"directory. The :term:`finder` should set this attribute to a list, even an " +"empty one, to indicate to the import system that the module is a package. " +"It should be set to ``None`` for non-package modules. It is set " +"automatically later to a special object for namespace packages." msgstr "" -#: ../../library/importlib.rst:1217 +#: ../../library/importlib.rst:1212 msgid "" "The :term:`finder` may set this attribute to an object containing " "additional, module-specific data to use when loading the module. Otherwise " "it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1223 -msgid "(:attr:`__cached__`)" -msgstr "(:attr:`__cached__`)" - -#: ../../library/importlib.rst:1225 +#: ../../library/importlib.rst:1218 msgid "" -"The filename of a compiled version of the module's code. The :term:`finder` " -"should always set this attribute but it may be ``None`` for modules that do " -"not need compiled code stored." +"The filename of a compiled version of the module's code (see :attr:" +"`__cached__` attributes on modules). The :term:`finder` should always set " +"this attribute but it may be ``None`` for modules that do not need compiled " +"code stored." msgstr "" -#: ../../library/importlib.rst:1231 -msgid "(:attr:`__package__`)" -msgstr "(:attr:`__package__`)" - -#: ../../library/importlib.rst:1233 +#: ../../library/importlib.rst:1225 msgid "" "(Read-only) The fully qualified name of the package the module is in (or the " -"empty string for a top-level module). If the module is a package then this " -"is the same as :attr:`name`." -msgstr "" - -#: ../../library/importlib.rst:1239 -msgid "``True`` if the spec's :attr:`origin` refers to a loadable location," +"empty string for a top-level module). See :attr:`__package__` attributes on " +"modules. If the module is a package then this is the same as :attr:`name`." msgstr "" -#: ../../library/importlib.rst:1240 +#: ../../library/importlib.rst:1232 msgid "" +"``True`` if the spec's :attr:`origin` refers to a loadable location, " "``False`` otherwise. This value impacts how :attr:`origin` is interpreted " "and how the module's :attr:`__file__` is populated." msgstr "" -#: ../../library/importlib.rst:1246 +#: ../../library/importlib.rst:1239 msgid "" "A specialization of :class:`importlib.machinery.ExtensionFileLoader` that is " "able to load extension modules in Framework format." msgstr "" -#: ../../library/importlib.rst:1249 +#: ../../library/importlib.rst:1242 msgid "" "For compatibility with the iOS App Store, *all* binary modules in an iOS app " "must be dynamic libraries, contained in a framework with appropriate " @@ -1537,7 +1513,7 @@ msgid "" "material outside the Frameworks folder." msgstr "" -#: ../../library/importlib.rst:1255 +#: ../../library/importlib.rst:1248 msgid "" "To accommodate this requirement, when running on iOS, extension module " "binaries are *not* packaged as ``.so`` files on ``sys.path``, but as " @@ -1551,7 +1527,7 @@ msgid "" "fwork`` file, relative to the app bundle." msgstr "" -#: ../../library/importlib.rst:1266 +#: ../../library/importlib.rst:1259 msgid "" "For example, consider the case of an import ``from foo.bar import _whiz``, " "where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" @@ -1567,7 +1543,7 @@ msgid "" "_whiz.origin``, containing the path to the ``.fwork`` file." msgstr "" -#: ../../library/importlib.rst:1280 +#: ../../library/importlib.rst:1273 msgid "" "When a module is loaded with this loader, the ``__file__`` for the module " "will report as the location of the ``.fwork`` file. This allows code to use " @@ -1576,7 +1552,7 @@ msgid "" "in the ``.framework`` folder." msgstr "" -#: ../../library/importlib.rst:1286 +#: ../../library/importlib.rst:1279 msgid "" "The Xcode project building the app is responsible for converting any ``.so`` " "files from wherever they exist in the ``PYTHONPATH`` into frameworks in the " @@ -1587,35 +1563,35 @@ msgid "" "details on how to construct this build step." msgstr "" -#: ../../library/importlib.rst:1296 +#: ../../library/importlib.rst:1289 msgid ":ref:`Availability `: iOS." msgstr "" -#: ../../library/importlib.rst:1304 +#: ../../library/importlib.rst:1297 msgid "Path to the ``.fwork`` file for the extension module." msgstr "" -#: ../../library/importlib.rst:1308 +#: ../../library/importlib.rst:1301 msgid ":mod:`importlib.util` -- Utility code for importers" msgstr "" -#: ../../library/importlib.rst:1314 +#: ../../library/importlib.rst:1307 msgid "**Source code:** :source:`Lib/importlib/util.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/util.py`" -#: ../../library/importlib.rst:1318 +#: ../../library/importlib.rst:1311 msgid "" "This module contains the various objects that help in the construction of " "an :term:`importer`." msgstr "" -#: ../../library/importlib.rst:1323 +#: ../../library/importlib.rst:1316 msgid "" "The bytes which represent the bytecode version number. If you need help with " "loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`." msgstr "" -#: ../../library/importlib.rst:1330 +#: ../../library/importlib.rst:1323 msgid "" "Return the :pep:`3147`/:pep:`488` path to the byte-compiled file associated " "with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the " @@ -1625,7 +1601,7 @@ msgid "" "`NotImplementedError` will be raised)." msgstr "" -#: ../../library/importlib.rst:1337 +#: ../../library/importlib.rst:1330 msgid "" "The *optimization* parameter is used to specify the optimization level of " "the bytecode file. An empty string represents no optimization, so ``/foo/bar/" @@ -1638,7 +1614,7 @@ msgid "" "be alphanumeric, else :exc:`ValueError` is raised." msgstr "" -#: ../../library/importlib.rst:1347 +#: ../../library/importlib.rst:1340 msgid "" "The *debug_override* parameter is deprecated and can be used to override the " "system's value for ``__debug__``. A ``True`` value is the equivalent of " @@ -1647,18 +1623,18 @@ msgid "" "are not ``None`` then :exc:`TypeError` is raised." msgstr "" -#: ../../library/importlib.rst:1355 +#: ../../library/importlib.rst:1348 msgid "" "The *optimization* parameter was added and the *debug_override* parameter " "was deprecated." msgstr "" -#: ../../library/importlib.rst:1359 ../../library/importlib.rst:1375 -#: ../../library/importlib.rst:1464 +#: ../../library/importlib.rst:1352 ../../library/importlib.rst:1368 +#: ../../library/importlib.rst:1457 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/importlib.rst:1365 +#: ../../library/importlib.rst:1358 msgid "" "Given the *path* to a :pep:`3147` file name, return the associated source " "code file path. For example, if *path* is ``/foo/bar/__pycache__/baz." @@ -1668,25 +1644,25 @@ msgid "" "cache_tag` is not defined, :exc:`NotImplementedError` is raised." msgstr "" -#: ../../library/importlib.rst:1380 +#: ../../library/importlib.rst:1373 msgid "" "Decode the given bytes representing source code and return it as a string " "with universal newlines (as required by :meth:`importlib.abc.InspectLoader." "get_source`)." msgstr "" -#: ../../library/importlib.rst:1388 +#: ../../library/importlib.rst:1381 msgid "Resolve a relative module name to an absolute one." msgstr "" -#: ../../library/importlib.rst:1390 +#: ../../library/importlib.rst:1383 msgid "" "If **name** has no leading dots, then **name** is simply returned. This " "allows for usage such as ``importlib.util.resolve_name('sys', __spec__." "parent)`` without doing a check to see if the **package** argument is needed." msgstr "" -#: ../../library/importlib.rst:1395 +#: ../../library/importlib.rst:1388 msgid "" ":exc:`ImportError` is raised if **name** is a relative module name but " "**package** is a false value (e.g. ``None`` or the empty string). :exc:" @@ -1694,13 +1670,13 @@ msgid "" "package (e.g. requesting ``..bacon`` from within the ``spam`` package)." msgstr "" -#: ../../library/importlib.rst:1403 +#: ../../library/importlib.rst:1396 msgid "" "To improve consistency with import statements, raise :exc:`ImportError` " "instead of :exc:`ValueError` for invalid relative import attempts." msgstr "" -#: ../../library/importlib.rst:1410 +#: ../../library/importlib.rst:1403 msgid "" "Find the :term:`spec ` for a module, optionally relative to the " "specified **package** name. If the module is in :data:`sys.modules`, then " @@ -1710,30 +1686,30 @@ msgid "" "if no spec is found." msgstr "" -#: ../../library/importlib.rst:1417 +#: ../../library/importlib.rst:1410 msgid "" "If **name** is for a submodule (contains a dot), the parent module is " "automatically imported." msgstr "" -#: ../../library/importlib.rst:1420 +#: ../../library/importlib.rst:1413 msgid "**name** and **package** work the same as for :func:`import_module`." msgstr "" -#: ../../library/importlib.rst:1424 +#: ../../library/importlib.rst:1417 msgid "" "Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if " "**package** is in fact not a package (i.e. lacks a :attr:`__path__` " "attribute)." msgstr "" -#: ../../library/importlib.rst:1431 +#: ../../library/importlib.rst:1424 msgid "" "Create a new module based on **spec** and :meth:`spec.loader.create_module " "`." msgstr "" -#: ../../library/importlib.rst:1434 +#: ../../library/importlib.rst:1427 msgid "" "If :meth:`spec.loader.create_module ` " "does not return ``None``, then any pre-existing attributes will not be " @@ -1741,14 +1717,14 @@ msgid "" "accessing **spec** or setting an attribute on the module." msgstr "" -#: ../../library/importlib.rst:1439 +#: ../../library/importlib.rst:1432 msgid "" "This function is preferred over using :class:`types.ModuleType` to create a " "new module as **spec** is used to set as many import-controlled attributes " "on the module as possible." msgstr "" -#: ../../library/importlib.rst:1447 +#: ../../library/importlib.rst:1440 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on a loader. The parameters have the same meaning as they do " @@ -1757,7 +1733,7 @@ msgid "" "spec." msgstr "" -#: ../../library/importlib.rst:1457 +#: ../../library/importlib.rst:1450 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on the path to a file. Missing information will be filled in " @@ -1765,14 +1741,14 @@ msgid "" "module will be file-based." msgstr "" -#: ../../library/importlib.rst:1469 +#: ../../library/importlib.rst:1462 msgid "" "Return the hash of *source_bytes* as bytes. A hash-based ``.pyc`` file " "embeds the :func:`source_hash` of the corresponding source file's contents " "in its header." msgstr "" -#: ../../library/importlib.rst:1477 +#: ../../library/importlib.rst:1470 msgid "" "A context manager that can temporarily skip the compatibility check for " "extension modules. By default the check is enabled and will fail when a " @@ -1781,33 +1757,33 @@ msgid "" "interpreter GIL, when imported in an interpreter with its own GIL." msgstr "" -#: ../../library/importlib.rst:1484 +#: ../../library/importlib.rst:1477 msgid "" "Note that this function is meant to accommodate an unusual case; one which " "is likely to eventually go away. There's is a pretty good chance this is " "not what you were looking for." msgstr "" -#: ../../library/importlib.rst:1488 +#: ../../library/importlib.rst:1481 msgid "" "You can get the same effect as this function by implementing the basic " "interface of multi-phase init (:pep:`489`) and lying about support for " "multiple interpreters (or per-interpreter GIL)." msgstr "" -#: ../../library/importlib.rst:1493 +#: ../../library/importlib.rst:1486 msgid "" "Using this function to disable the check can lead to unexpected behavior and " "even crashes. It should only be used during extension module development." msgstr "" -#: ../../library/importlib.rst:1501 +#: ../../library/importlib.rst:1494 msgid "" "A class which postpones the execution of the loader of a module until the " "module has an attribute accessed." msgstr "" -#: ../../library/importlib.rst:1504 +#: ../../library/importlib.rst:1497 msgid "" "This class **only** works with loaders that define :meth:`~importlib.abc." "Loader.exec_module` as control over what module type is used for the module " @@ -1820,7 +1796,7 @@ msgid "" "raised if such a substitution is detected." msgstr "" -#: ../../library/importlib.rst:1515 +#: ../../library/importlib.rst:1508 msgid "" "For projects where startup time is critical, this class allows for " "potentially minimizing the cost of loading a module if it is never used. For " @@ -1829,21 +1805,21 @@ msgid "" "postponed and thus occurring out of context." msgstr "" -#: ../../library/importlib.rst:1523 +#: ../../library/importlib.rst:1516 msgid "" "Began calling :meth:`~importlib.abc.Loader.create_module`, removing the " "compatibility warning for :class:`importlib.machinery.BuiltinImporter` and :" "class:`importlib.machinery.ExtensionFileLoader`." msgstr "" -#: ../../library/importlib.rst:1530 +#: ../../library/importlib.rst:1523 msgid "" "A class method which returns a callable that creates a lazy loader. This is " "meant to be used in situations where the loader is passed by class instead " "of by instance. ::" msgstr "" -#: ../../library/importlib.rst:1535 +#: ../../library/importlib.rst:1528 msgid "" "suffixes = importlib.machinery.SOURCE_SUFFIXES\n" "loader = importlib.machinery.SourceFileLoader\n" @@ -1855,20 +1831,20 @@ msgstr "" "lazy_loader = importlib.util.LazyLoader.factory(loader)\n" "finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes))" -#: ../../library/importlib.rst:1543 +#: ../../library/importlib.rst:1536 msgid "Examples" msgstr "範例" -#: ../../library/importlib.rst:1546 +#: ../../library/importlib.rst:1539 msgid "Importing programmatically" msgstr "" -#: ../../library/importlib.rst:1548 +#: ../../library/importlib.rst:1541 msgid "" "To programmatically import a module, use :func:`importlib.import_module`. ::" msgstr "" -#: ../../library/importlib.rst:1551 +#: ../../library/importlib.rst:1544 msgid "" "import importlib\n" "\n" @@ -1878,23 +1854,23 @@ msgstr "" "\n" "itertools = importlib.import_module('itertools')" -#: ../../library/importlib.rst:1557 +#: ../../library/importlib.rst:1550 msgid "Checking if a module can be imported" msgstr "" -#: ../../library/importlib.rst:1559 +#: ../../library/importlib.rst:1552 msgid "" "If you need to find out if a module can be imported without actually doing " "the import, then you should use :func:`importlib.util.find_spec`." msgstr "" -#: ../../library/importlib.rst:1562 +#: ../../library/importlib.rst:1555 msgid "" "Note that if ``name`` is a submodule (contains a dot), :func:`importlib.util." "find_spec` will import the parent module. ::" msgstr "" -#: ../../library/importlib.rst:1566 +#: ../../library/importlib.rst:1559 msgid "" "import importlib.util\n" "import sys\n" @@ -1914,11 +1890,11 @@ msgid "" " print(f\"can't find the {name!r} module\")" msgstr "" -#: ../../library/importlib.rst:1585 +#: ../../library/importlib.rst:1578 msgid "Importing a source file directly" msgstr "" -#: ../../library/importlib.rst:1587 +#: ../../library/importlib.rst:1580 msgid "" "This recipe should be used with caution: it is an approximation of an import " "statement where the file path is specified directly, rather than :data:`sys." @@ -1928,13 +1904,13 @@ msgid "" "file is appropriate." msgstr "" -#: ../../library/importlib.rst:1594 +#: ../../library/importlib.rst:1587 msgid "" "To import a Python source file directly from a path, use the following " "recipe::" msgstr "" -#: ../../library/importlib.rst:1596 +#: ../../library/importlib.rst:1589 msgid "" "import importlib.util\n" "import sys\n" @@ -1957,15 +1933,15 @@ msgid "" "json = import_from_path(module_name, file_path)" msgstr "" -#: ../../library/importlib.rst:1618 +#: ../../library/importlib.rst:1611 msgid "Implementing lazy imports" msgstr "" -#: ../../library/importlib.rst:1620 +#: ../../library/importlib.rst:1613 msgid "The example below shows how to implement lazy imports::" msgstr "" -#: ../../library/importlib.rst:1622 +#: ../../library/importlib.rst:1615 msgid "" ">>> import importlib.util\n" ">>> import sys\n" @@ -1985,11 +1961,11 @@ msgid "" "False" msgstr "" -#: ../../library/importlib.rst:1641 +#: ../../library/importlib.rst:1634 msgid "Setting up an importer" msgstr "" -#: ../../library/importlib.rst:1643 +#: ../../library/importlib.rst:1636 msgid "" "For deep customizations of import, you typically want to implement an :term:" "`importer`. This means managing both the :term:`finder` and :term:`loader` " @@ -2003,7 +1979,7 @@ msgid "" "for the appropriate classes defined within this package)::" msgstr "" -#: ../../library/importlib.rst:1654 +#: ../../library/importlib.rst:1647 msgid "" "import importlib.machinery\n" "import sys\n" @@ -2027,11 +2003,11 @@ msgid "" "sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))" msgstr "" -#: ../../library/importlib.rst:1675 +#: ../../library/importlib.rst:1668 msgid "Approximating :func:`importlib.import_module`" msgstr "" -#: ../../library/importlib.rst:1677 +#: ../../library/importlib.rst:1670 msgid "" "Import itself is implemented in Python code, making it possible to expose " "most of the import machinery through importlib. The following helps " @@ -2039,7 +2015,7 @@ msgid "" "approximate implementation of :func:`importlib.import_module`::" msgstr "" -#: ../../library/importlib.rst:1683 +#: ../../library/importlib.rst:1676 msgid "" "import importlib.util\n" "import sys\n" @@ -2079,3 +2055,21 @@ msgstr "universal newlines" #: ../../library/importlib.rst:443 msgid "importlib.abc.InspectLoader.get_source method" msgstr "importlib.abc.InspectLoader.get_source 方法" + +#~ msgid "(:attr:`__name__`)" +#~ msgstr "(:attr:`__name__`)" + +#~ msgid "(:attr:`__loader__`)" +#~ msgstr "(:attr:`__loader__`)" + +#~ msgid "(:attr:`__file__`)" +#~ msgstr "(:attr:`__file__`)" + +#~ msgid "(:attr:`__path__`)" +#~ msgstr "(:attr:`__path__`)" + +#~ msgid "(:attr:`__cached__`)" +#~ msgstr "(:attr:`__cached__`)" + +#~ msgid "(:attr:`__package__`)" +#~ msgstr "(:attr:`__package__`)" diff --git a/library/inspect.po b/library/inspect.po index d8ce3640b7..4b2f07941b 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -840,7 +840,7 @@ msgid "" "has a :meth:`~object.__get__` method, but not a :meth:`~object.__set__` " "method or a :meth:`~object.__delete__` method. Beyond that, the set of " "attributes varies. A :attr:`~definition.__name__` attribute is usually " -"sensible, and :attr:`!__doc__` often is." +"sensible, and :attr:`~definition.__doc__` often is." msgstr "" #: ../../library/inspect.rst:525 diff --git a/library/logging.po b/library/logging.po index dbfd2969fc..8bfdaea17d 100644 --- a/library/logging.po +++ b/library/logging.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-03-28 22:40+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -346,7 +346,7 @@ msgid "" "level." msgstr "" -#: ../../library/logging.rst:211 ../../library/logging.rst:554 +#: ../../library/logging.rst:211 ../../library/logging.rst:555 msgid "See :ref:`levels` for a list of levels." msgstr "層級清單請見 :ref:`levels`。" @@ -464,13 +464,13 @@ msgstr "" #: ../../library/logging.rst:306 msgid "" "The fourth keyword argument is *extra* which can be used to pass a " -"dictionary which is used to populate the __dict__ of the :class:`LogRecord` " -"created for the logging event with user-defined attributes. These custom " -"attributes can then be used as you like. For example, they could be " -"incorporated into logged messages. For example::" +"dictionary which is used to populate the :attr:`~object.__dict__` of the :" +"class:`LogRecord` created for the logging event with user-defined " +"attributes. These custom attributes can then be used as you like. For " +"example, they could be incorporated into logged messages. For example::" msgstr "" -#: ../../library/logging.rst:312 +#: ../../library/logging.rst:313 msgid "" "FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'\n" "logging.basicConfig(format=FORMAT)\n" @@ -484,24 +484,24 @@ msgstr "" "logger = logging.getLogger('tcpserver')\n" "logger.warning('Protocol problem: %s', 'connection reset', extra=d)" -#: ../../library/logging.rst:318 +#: ../../library/logging.rst:319 msgid "would print something like" msgstr "" -#: ../../library/logging.rst:320 +#: ../../library/logging.rst:321 msgid "" "2006-02-08 22:20:02,165 192.168.0.1 fbloggs Protocol problem: connection " "reset" msgstr "" -#: ../../library/logging.rst:324 +#: ../../library/logging.rst:325 msgid "" "The keys in the dictionary passed in *extra* should not clash with the keys " "used by the logging system. (See the section on :ref:`logrecord-attributes` " "for more information on which keys are used by the logging system.)" msgstr "" -#: ../../library/logging.rst:328 +#: ../../library/logging.rst:329 msgid "" "If you choose to use these attributes in logged messages, you need to " "exercise some care. In the above example, for instance, the :class:" @@ -512,7 +512,7 @@ msgid "" "dictionary with these keys." msgstr "" -#: ../../library/logging.rst:335 +#: ../../library/logging.rst:336 msgid "" "While this might be annoying, this feature is intended for use in " "specialized circumstances, such as multi-threaded servers where the same " @@ -523,32 +523,32 @@ msgid "" "particular :class:`Handler`\\ s." msgstr "" -#: ../../library/logging.rst:342 +#: ../../library/logging.rst:343 msgid "" "If no handler is attached to this logger (or any of its ancestors, taking " "into account the relevant :attr:`Logger.propagate` attributes), the message " "will be sent to the handler set on :attr:`lastResort`." msgstr "" -#: ../../library/logging.rst:346 +#: ../../library/logging.rst:347 msgid "The *stack_info* parameter was added." msgstr "新增 *stack_info* 參數。" -#: ../../library/logging.rst:349 +#: ../../library/logging.rst:350 msgid "The *exc_info* parameter can now accept exception instances." msgstr "" -#: ../../library/logging.rst:352 +#: ../../library/logging.rst:353 msgid "The *stacklevel* parameter was added." msgstr "新增 *stacklevel* 參數。" -#: ../../library/logging.rst:358 +#: ../../library/logging.rst:359 msgid "" "Logs a message with level :const:`INFO` on this logger. The arguments are " "interpreted as for :meth:`debug`." msgstr "" -#: ../../library/logging.rst:364 +#: ../../library/logging.rst:365 msgid "" "Logs a message with level :const:`WARNING` on this logger. The arguments are " "interpreted as for :meth:`debug`." @@ -556,47 +556,47 @@ msgstr "" "在此記錄器上記錄一條層級為 :const:`WARNING` 的訊息。這些引數被直譯的方式與 :" "meth:`debug` 相同。" -#: ../../library/logging.rst:367 +#: ../../library/logging.rst:368 msgid "" "There is an obsolete method ``warn`` which is functionally identical to " "``warning``. As ``warn`` is deprecated, please do not use it - use " "``warning`` instead." msgstr "" -#: ../../library/logging.rst:373 +#: ../../library/logging.rst:374 msgid "" "Logs a message with level :const:`ERROR` on this logger. The arguments are " "interpreted as for :meth:`debug`." msgstr "" -#: ../../library/logging.rst:379 +#: ../../library/logging.rst:380 msgid "" "Logs a message with level :const:`CRITICAL` on this logger. The arguments " "are interpreted as for :meth:`debug`." msgstr "" -#: ../../library/logging.rst:385 +#: ../../library/logging.rst:386 msgid "" "Logs a message with integer level *level* on this logger. The other " "arguments are interpreted as for :meth:`debug`." msgstr "" -#: ../../library/logging.rst:391 +#: ../../library/logging.rst:392 msgid "" "Logs a message with level :const:`ERROR` on this logger. The arguments are " "interpreted as for :meth:`debug`. Exception info is added to the logging " "message. This method should only be called from an exception handler." msgstr "" -#: ../../library/logging.rst:398 +#: ../../library/logging.rst:399 msgid "Adds the specified filter *filter* to this logger." msgstr "在該 logger 內增加指定的 filter *filter*。" -#: ../../library/logging.rst:403 +#: ../../library/logging.rst:404 msgid "Removes the specified filter *filter* from this logger." msgstr "在該 logger 內移除指定的 filter *filter*。" -#: ../../library/logging.rst:408 +#: ../../library/logging.rst:409 msgid "" "Apply this logger's filters to the record and return ``True`` if the record " "is to be processed. The filters are consulted in turn, until one of them " @@ -605,22 +605,22 @@ msgid "" "processing of the record occurs." msgstr "" -#: ../../library/logging.rst:417 +#: ../../library/logging.rst:418 msgid "Adds the specified handler *hdlr* to this logger." msgstr "" -#: ../../library/logging.rst:422 +#: ../../library/logging.rst:423 msgid "Removes the specified handler *hdlr* from this logger." msgstr "" -#: ../../library/logging.rst:427 +#: ../../library/logging.rst:428 msgid "" "Finds the caller's source filename and line number. Returns the filename, " "line number, function name and stack information as a 4-element tuple. The " "stack information is returned as ``None`` unless *stack_info* is ``True``." msgstr "" -#: ../../library/logging.rst:431 +#: ../../library/logging.rst:432 msgid "" "The *stacklevel* parameter is passed from code calling the :meth:`debug` and " "other APIs. If greater than 1, the excess is used to skip stack frames " @@ -630,7 +630,7 @@ msgid "" "calls it." msgstr "" -#: ../../library/logging.rst:441 +#: ../../library/logging.rst:442 msgid "" "Handles a record by passing it to all handlers associated with this logger " "and its ancestors (until a false value of *propagate* is found). This method " @@ -639,13 +639,13 @@ msgid "" "filter`." msgstr "" -#: ../../library/logging.rst:449 +#: ../../library/logging.rst:450 msgid "" "This is a factory method which can be overridden in subclasses to create " "specialized :class:`LogRecord` instances." msgstr "" -#: ../../library/logging.rst:454 +#: ../../library/logging.rst:455 msgid "" "Checks to see if this logger has any handlers configured. This is done by " "looking for handlers in this logger and its parents in the logger hierarchy. " @@ -655,15 +655,15 @@ msgid "" "the existence of handlers." msgstr "" -#: ../../library/logging.rst:463 +#: ../../library/logging.rst:464 msgid "Loggers can now be pickled and unpickled." msgstr "" -#: ../../library/logging.rst:469 +#: ../../library/logging.rst:470 msgid "Logging Levels" msgstr "" -#: ../../library/logging.rst:471 +#: ../../library/logging.rst:472 msgid "" "The numeric values of logging levels are given in the following table. These " "are primarily of interest if you want to define your own levels, and need " @@ -672,83 +672,83 @@ msgid "" "value; the predefined name is lost." msgstr "" -#: ../../library/logging.rst:478 +#: ../../library/logging.rst:479 msgid "Level" msgstr "" -#: ../../library/logging.rst:478 +#: ../../library/logging.rst:479 msgid "Numeric value" msgstr "" -#: ../../library/logging.rst:478 +#: ../../library/logging.rst:479 msgid "What it means / When to use it" msgstr "" -#: ../../library/logging.rst:480 +#: ../../library/logging.rst:481 msgid "0" msgstr "0" -#: ../../library/logging.rst:480 +#: ../../library/logging.rst:481 msgid "" "When set on a logger, indicates that ancestor loggers are to be consulted to " "determine the effective level. If that still resolves to :const:`!NOTSET`, " "then all events are logged. When set on a handler, all events are handled." msgstr "" -#: ../../library/logging.rst:488 +#: ../../library/logging.rst:489 msgid "10" msgstr "10" -#: ../../library/logging.rst:488 +#: ../../library/logging.rst:489 msgid "" "Detailed information, typically only of interest to a developer trying to " "diagnose a problem." msgstr "" -#: ../../library/logging.rst:492 +#: ../../library/logging.rst:493 msgid "20" msgstr "20" -#: ../../library/logging.rst:492 +#: ../../library/logging.rst:493 msgid "Confirmation that things are working as expected." msgstr "" -#: ../../library/logging.rst:495 +#: ../../library/logging.rst:496 msgid "30" msgstr "30" -#: ../../library/logging.rst:495 +#: ../../library/logging.rst:496 msgid "" "An indication that something unexpected happened, or that a problem might " "occur in the near future (e.g. 'disk space low'). The software is still " "working as expected." msgstr "" -#: ../../library/logging.rst:502 +#: ../../library/logging.rst:503 msgid "40" msgstr "40" -#: ../../library/logging.rst:502 +#: ../../library/logging.rst:503 msgid "" "Due to a more serious problem, the software has not been able to perform " "some function." msgstr "" -#: ../../library/logging.rst:506 +#: ../../library/logging.rst:507 msgid "50" msgstr "50" -#: ../../library/logging.rst:506 +#: ../../library/logging.rst:507 msgid "" "A serious error, indicating that the program itself may be unable to " "continue running." msgstr "" -#: ../../library/logging.rst:515 +#: ../../library/logging.rst:516 msgid "Handler Objects" msgstr "" -#: ../../library/logging.rst:517 +#: ../../library/logging.rst:518 msgid "" "Handlers have the following attributes and methods. Note that :class:" "`Handler` is never instantiated directly; this class acts as a base for more " @@ -756,53 +756,53 @@ msgid "" "to call :meth:`Handler.__init__`." msgstr "" -#: ../../library/logging.rst:526 +#: ../../library/logging.rst:527 msgid "" "Initializes the :class:`Handler` instance by setting its level, setting the " "list of filters to the empty list and creating a lock (using :meth:" "`createLock`) for serializing access to an I/O mechanism." msgstr "" -#: ../../library/logging.rst:533 +#: ../../library/logging.rst:534 msgid "" "Initializes a thread lock which can be used to serialize access to " "underlying I/O functionality which may not be threadsafe." msgstr "" -#: ../../library/logging.rst:539 +#: ../../library/logging.rst:540 msgid "Acquires the thread lock created with :meth:`createLock`." msgstr "" -#: ../../library/logging.rst:544 +#: ../../library/logging.rst:545 msgid "Releases the thread lock acquired with :meth:`acquire`." msgstr "" -#: ../../library/logging.rst:549 +#: ../../library/logging.rst:550 msgid "" "Sets the threshold for this handler to *level*. Logging messages which are " "less severe than *level* will be ignored. When a handler is created, the " "level is set to :const:`NOTSET` (which causes all messages to be processed)." msgstr "" -#: ../../library/logging.rst:556 +#: ../../library/logging.rst:557 msgid "" "The *level* parameter now accepts a string representation of the level such " "as 'INFO' as an alternative to the integer constants such as :const:`INFO`." msgstr "" -#: ../../library/logging.rst:564 +#: ../../library/logging.rst:565 msgid "Sets the :class:`Formatter` for this handler to *fmt*." msgstr "" -#: ../../library/logging.rst:569 +#: ../../library/logging.rst:570 msgid "Adds the specified filter *filter* to this handler." msgstr "" -#: ../../library/logging.rst:574 +#: ../../library/logging.rst:575 msgid "Removes the specified filter *filter* from this handler." msgstr "" -#: ../../library/logging.rst:579 +#: ../../library/logging.rst:580 msgid "" "Apply this handler's filters to the record and return ``True`` if the record " "is to be processed. The filters are consulted in turn, until one of them " @@ -811,13 +811,13 @@ msgid "" "record." msgstr "" -#: ../../library/logging.rst:588 +#: ../../library/logging.rst:589 msgid "" "Ensure all logging output has been flushed. This version does nothing and is " "intended to be implemented by subclasses." msgstr "" -#: ../../library/logging.rst:594 +#: ../../library/logging.rst:595 msgid "" "Tidy up any resources used by the handler. This version does no output but " "removes the handler from an internal list of handlers which is closed when :" @@ -825,14 +825,14 @@ msgid "" "from overridden :meth:`close` methods." msgstr "" -#: ../../library/logging.rst:602 +#: ../../library/logging.rst:603 msgid "" "Conditionally emits the specified logging record, depending on filters which " "may have been added to the handler. Wraps the actual emission of the record " "with acquisition/release of the I/O thread lock." msgstr "" -#: ../../library/logging.rst:609 +#: ../../library/logging.rst:610 msgid "" "This method should be called from handlers when an exception is encountered " "during an :meth:`emit` call. If the module-level attribute :data:" @@ -845,20 +845,20 @@ msgid "" "is more useful during development)." msgstr "" -#: ../../library/logging.rst:622 +#: ../../library/logging.rst:623 msgid "" "Do formatting for a record - if a formatter is set, use it. Otherwise, use " "the default formatter for the module." msgstr "" -#: ../../library/logging.rst:628 +#: ../../library/logging.rst:629 msgid "" "Do whatever it takes to actually log the specified logging record. This " "version is intended to be implemented by subclasses and so raises a :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/logging.rst:632 +#: ../../library/logging.rst:633 msgid "" "This method is called after a handler-level lock is acquired, which is " "released after this method returns. When you override this method, note that " @@ -867,13 +867,13 @@ msgid "" "Specifically:" msgstr "" -#: ../../library/logging.rst:638 +#: ../../library/logging.rst:639 msgid "" "Logging configuration APIs acquire the module-level lock, and then " "individual handler-level locks as those handlers are configured." msgstr "" -#: ../../library/logging.rst:641 +#: ../../library/logging.rst:642 msgid "" "Many logging APIs lock the module-level lock. If such an API is called from " "this method, it could cause a deadlock if a configuration call is made on " @@ -883,16 +883,16 @@ msgid "" "method, the handler-level lock has already been acquired)." msgstr "" -#: ../../library/logging.rst:648 +#: ../../library/logging.rst:649 msgid "" "For a list of handlers included as standard, see :mod:`logging.handlers`." msgstr "" -#: ../../library/logging.rst:653 +#: ../../library/logging.rst:654 msgid "Formatter Objects" msgstr "" -#: ../../library/logging.rst:659 +#: ../../library/logging.rst:660 msgid "" "Responsible for converting a :class:`LogRecord` to an output string to be " "interpreted by a human or external system." @@ -902,7 +902,7 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/logging.rst:662 +#: ../../library/logging.rst:663 msgid "" "A format string in the given *style* for the logged output as a whole. The " "possible mapping keys are drawn from the :class:`LogRecord` object's :ref:" @@ -910,14 +910,14 @@ msgid "" "is just the logged message." msgstr "" -#: ../../library/logging.rst:670 +#: ../../library/logging.rst:671 msgid "" "A format string in the given *style* for the date/time portion of the logged " "output. If not specified, the default described in :meth:`formatTime` is " "used." msgstr "" -#: ../../library/logging.rst:675 +#: ../../library/logging.rst:676 msgid "" "Can be one of ``'%'``, ``'{'`` or ``'$'`` and determines how the format " "string will be merged with its data: using one of :ref:`old-string-" @@ -928,32 +928,32 @@ msgid "" "use ``{``- and ``$``-formatting for log messages." msgstr "" -#: ../../library/logging.rst:685 +#: ../../library/logging.rst:686 msgid "" "If ``True`` (the default), incorrect or mismatched *fmt* and *style* will " "raise a :exc:`ValueError`; for example, ``logging.Formatter('%(asctime)s - " "%(message)s', style='{')``." msgstr "" -#: ../../library/logging.rst:690 +#: ../../library/logging.rst:691 msgid "" "A dictionary with default values to use in custom fields. For example, " "``logging.Formatter('%(ip)s %(message)s', defaults={\"ip\": None})``" msgstr "" -#: ../../library/logging.rst:695 +#: ../../library/logging.rst:696 msgid "Added the *style* parameter." msgstr "新增 *style* 參數。" -#: ../../library/logging.rst:698 +#: ../../library/logging.rst:699 msgid "Added the *validate* parameter." msgstr "新增 *validate* 參數。" -#: ../../library/logging.rst:701 +#: ../../library/logging.rst:702 msgid "Added the *defaults* parameter." msgstr "新增 *defaults* 參數。" -#: ../../library/logging.rst:707 +#: ../../library/logging.rst:708 msgid "" "The record's attribute dictionary is used as the operand to a string " "formatting operation. Returns the resulting string. Before formatting the " @@ -972,13 +972,13 @@ msgid "" "recalculates it afresh." msgstr "" -#: ../../library/logging.rst:723 +#: ../../library/logging.rst:724 msgid "" "If stack information is available, it's appended after the exception " "information, using :meth:`formatStack` to transform it if necessary." msgstr "" -#: ../../library/logging.rst:729 +#: ../../library/logging.rst:730 msgid "" "This method should be called from :meth:`format` by a formatter which wants " "to make use of a formatted time. This method can be overridden in formatters " @@ -991,7 +991,7 @@ msgid "" "resulting string is returned." msgstr "" -#: ../../library/logging.rst:739 +#: ../../library/logging.rst:740 msgid "" "This function uses a user-configurable function to convert the creation time " "to a tuple. By default, :func:`time.localtime` is used; to change this for a " @@ -1001,7 +1001,7 @@ msgid "" "be shown in GMT, set the ``converter`` attribute in the ``Formatter`` class." msgstr "" -#: ../../library/logging.rst:747 +#: ../../library/logging.rst:748 msgid "" "Previously, the default format was hard-coded as in this example: " "``2010-09-06 22:38:15,292`` where the part before the comma is handled by a " @@ -1016,11 +1016,11 @@ msgid "" "the millisecond value)." msgstr "" -#: ../../library/logging.rst:760 +#: ../../library/logging.rst:761 msgid "The ``default_msec_format`` can be ``None``." msgstr "" -#: ../../library/logging.rst:765 +#: ../../library/logging.rst:766 msgid "" "Formats the specified exception information (a standard exception tuple as " "returned by :func:`sys.exc_info`) as a string. This default implementation " @@ -1028,14 +1028,14 @@ msgid "" "returned." msgstr "" -#: ../../library/logging.rst:772 +#: ../../library/logging.rst:773 msgid "" "Formats the specified stack information (a string as returned by :func:" "`traceback.print_stack`, but with the last newline removed) as a string. " "This default implementation just returns the input value." msgstr "" -#: ../../library/logging.rst:778 +#: ../../library/logging.rst:779 msgid "" "A base formatter class suitable for subclassing when you want to format a " "number of records. You can pass a :class:`Formatter` instance which you want " @@ -1044,7 +1044,7 @@ msgid "" "used as the line formatter." msgstr "" -#: ../../library/logging.rst:786 +#: ../../library/logging.rst:787 msgid "" "Return a header for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " @@ -1052,14 +1052,14 @@ msgid "" "separator line." msgstr "" -#: ../../library/logging.rst:793 +#: ../../library/logging.rst:794 msgid "" "Return a footer for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " "specific behaviour, e.g. to show the count of records or a separator line." msgstr "" -#: ../../library/logging.rst:800 +#: ../../library/logging.rst:801 msgid "" "Return formatted text for a list of *records*. The base implementation just " "returns the empty string if there are no records; otherwise, it returns the " @@ -1067,11 +1067,11 @@ msgid "" "and the footer." msgstr "" -#: ../../library/logging.rst:808 +#: ../../library/logging.rst:809 msgid "Filter Objects" msgstr "" -#: ../../library/logging.rst:810 +#: ../../library/logging.rst:811 msgid "" "``Filters`` can be used by ``Handlers`` and ``Loggers`` for more " "sophisticated filtering than is provided by levels. The base filter class " @@ -1081,7 +1081,7 @@ msgid "" "If initialized with the empty string, all events are passed." msgstr "" -#: ../../library/logging.rst:820 +#: ../../library/logging.rst:821 msgid "" "Returns an instance of the :class:`Filter` class. If *name* is specified, it " "names a logger which, together with its children, will have its events " @@ -1089,7 +1089,7 @@ msgid "" "event." msgstr "" -#: ../../library/logging.rst:827 +#: ../../library/logging.rst:828 msgid "" "Is the specified record to be logged? Returns false for no, true for yes. " "Filters can either modify log records in-place or return a completely " @@ -1097,7 +1097,7 @@ msgid "" "future processing of the event." msgstr "" -#: ../../library/logging.rst:832 +#: ../../library/logging.rst:833 msgid "" "Note that filters attached to handlers are consulted before an event is " "emitted by the handler, whereas filters attached to loggers are consulted " @@ -1107,13 +1107,13 @@ msgid "" "setting, unless the filter has also been applied to those descendant loggers." msgstr "" -#: ../../library/logging.rst:839 +#: ../../library/logging.rst:840 msgid "" "You don't actually need to subclass ``Filter``: you can pass any instance " "which has a ``filter`` method with the same semantics." msgstr "" -#: ../../library/logging.rst:842 +#: ../../library/logging.rst:843 msgid "" "You don't need to create specialized ``Filter`` classes, or use other " "classes with a ``filter`` method: you can use a function (or other callable) " @@ -1124,7 +1124,7 @@ msgid "" "value should conform to that returned by :meth:`~Filter.filter`." msgstr "" -#: ../../library/logging.rst:852 +#: ../../library/logging.rst:853 msgid "" "You can now return a :class:`LogRecord` instance from filters to replace the " "log record rather than modifying it in place. This allows filters attached " @@ -1132,7 +1132,7 @@ msgid "" "having side effects on other handlers." msgstr "" -#: ../../library/logging.rst:858 +#: ../../library/logging.rst:859 msgid "" "Although filters are used primarily to filter records based on more " "sophisticated criteria than levels, they get to see every record which is " @@ -1144,11 +1144,11 @@ msgid "" "contextual information into logs (see :ref:`filters-contextual`)." msgstr "" -#: ../../library/logging.rst:871 +#: ../../library/logging.rst:872 msgid "LogRecord Objects" msgstr "LogRecord 物件" -#: ../../library/logging.rst:873 +#: ../../library/logging.rst:874 msgid "" ":class:`LogRecord` instances are created automatically by the :class:" "`Logger` every time something is logged, and can be created manually via :" @@ -1156,17 +1156,17 @@ msgid "" "wire)." msgstr "" -#: ../../library/logging.rst:881 +#: ../../library/logging.rst:882 msgid "Contains all the information pertinent to the event being logged." msgstr "" -#: ../../library/logging.rst:883 +#: ../../library/logging.rst:884 msgid "" "The primary information is passed in *msg* and *args*, which are combined " "using ``msg % args`` to create the :attr:`!message` attribute of the record." msgstr "" -#: ../../library/logging.rst:887 +#: ../../library/logging.rst:888 msgid "" "The name of the logger used to log the event represented by this :class:`!" "LogRecord`. Note that the logger name in the :class:`!LogRecord` will always " @@ -1174,7 +1174,7 @@ msgid "" "different (ancestor) logger." msgstr "" -#: ../../library/logging.rst:895 +#: ../../library/logging.rst:896 msgid "" "The :ref:`numeric level ` of the logging event (such as ``10`` for " "``DEBUG``, ``20`` for ``INFO``, etc). Note that this is converted to *two* " @@ -1182,46 +1182,46 @@ msgid "" "attr:`!levelname` for the corresponding level name." msgstr "" -#: ../../library/logging.rst:902 +#: ../../library/logging.rst:903 msgid "" "The full string path of the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:906 +#: ../../library/logging.rst:907 msgid "The line number in the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:910 +#: ../../library/logging.rst:911 msgid "" "The event description message, which can be a %-format string with " "placeholders for variable data, or an arbitrary object (see :ref:`arbitrary-" "object-messages`)." msgstr "" -#: ../../library/logging.rst:915 +#: ../../library/logging.rst:916 msgid "" "Variable data to merge into the *msg* argument to obtain the event " "description." msgstr "" -#: ../../library/logging.rst:919 +#: ../../library/logging.rst:920 msgid "" "An exception tuple with the current exception information, as returned by :" "func:`sys.exc_info`, or ``None`` if no exception information is available." msgstr "" -#: ../../library/logging.rst:924 +#: ../../library/logging.rst:925 msgid "" "The name of the function or method from which the logging call was invoked." msgstr "" -#: ../../library/logging.rst:928 +#: ../../library/logging.rst:929 msgid "" "A text string representing stack information from the base of the stack in " "the current thread, up to the logging call." msgstr "" -#: ../../library/logging.rst:935 +#: ../../library/logging.rst:936 msgid "" "Returns the message for this :class:`LogRecord` instance after merging any " "user-supplied arguments with the message. If the user-supplied message " @@ -1230,7 +1230,7 @@ msgid "" "whose ``__str__`` method can return the actual format string to be used." msgstr "" -#: ../../library/logging.rst:942 +#: ../../library/logging.rst:943 msgid "" "The creation of a :class:`LogRecord` has been made more configurable by " "providing a factory which is used to create the record. The factory can be " @@ -1238,13 +1238,13 @@ msgid "" "this for the factory's signature)." msgstr "" -#: ../../library/logging.rst:948 +#: ../../library/logging.rst:949 msgid "" "This functionality can be used to inject your own values into a :class:" "`LogRecord` at creation time. You can use the following pattern::" msgstr "" -#: ../../library/logging.rst:951 +#: ../../library/logging.rst:952 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -1264,18 +1264,18 @@ msgstr "" "\n" "logging.setLogRecordFactory(record_factory)" -#: ../../library/logging.rst:960 +#: ../../library/logging.rst:961 msgid "" "With this pattern, multiple factories could be chained, and as long as they " "don't overwrite each other's attributes or unintentionally overwrite the " "standard attributes listed above, there should be no surprises." msgstr "" -#: ../../library/logging.rst:969 +#: ../../library/logging.rst:970 msgid "LogRecord attributes" -msgstr "" +msgstr "LogRecord 屬性" -#: ../../library/logging.rst:971 +#: ../../library/logging.rst:972 msgid "" "The LogRecord has a number of attributes, most of which are derived from the " "parameters to the constructor. (Note that the names do not always correspond " @@ -1286,7 +1286,7 @@ msgid "" "style format string." msgstr "" -#: ../../library/logging.rst:979 +#: ../../library/logging.rst:980 msgid "" "If you are using {}-formatting (:func:`str.format`), you can use ``{attrname}" "`` as the placeholder in the format string. If you are using $-formatting (:" @@ -1294,7 +1294,7 @@ msgid "" "course, replace ``attrname`` with the actual attribute name you want to use." msgstr "" -#: ../../library/logging.rst:985 +#: ../../library/logging.rst:986 msgid "" "In the case of {}-formatting, you can specify formatting flags by placing " "them after the attribute name, separated from it with a colon. For example: " @@ -1303,318 +1303,318 @@ msgid "" "on the options available to you." msgstr "" -#: ../../library/logging.rst:992 +#: ../../library/logging.rst:993 msgid "Attribute name" -msgstr "" +msgstr "屬性名稱" -#: ../../library/logging.rst:992 ../../library/logging.rst:1362 +#: ../../library/logging.rst:993 ../../library/logging.rst:1363 msgid "Format" msgstr "格式" -#: ../../library/logging.rst:992 ../../library/logging.rst:1362 +#: ../../library/logging.rst:993 ../../library/logging.rst:1363 msgid "Description" msgstr "描述" -#: ../../library/logging.rst:0 ../../library/logging.rst:994 +#: ../../library/logging.rst:0 ../../library/logging.rst:995 msgid "args" -msgstr "" +msgstr "args" -#: ../../library/logging.rst:994 ../../library/logging.rst:1008 -#: ../../library/logging.rst:1036 ../../library/logging.rst:1054 +#: ../../library/logging.rst:995 ../../library/logging.rst:1009 +#: ../../library/logging.rst:1037 ../../library/logging.rst:1055 msgid "You shouldn't need to format this yourself." msgstr "你不應該需要自己格式化它。" -#: ../../library/logging.rst:994 +#: ../../library/logging.rst:995 msgid "" "The tuple of arguments merged into ``msg`` to produce ``message``, or a dict " "whose values are used for the merge (when there is only one argument, and it " "is a dictionary)." msgstr "" -#: ../../library/logging.rst:999 +#: ../../library/logging.rst:1000 msgid "asctime" -msgstr "" +msgstr "asctime" -#: ../../library/logging.rst:999 +#: ../../library/logging.rst:1000 msgid "``%(asctime)s``" msgstr "``%(asctime)s``" -#: ../../library/logging.rst:999 +#: ../../library/logging.rst:1000 msgid "" "Human-readable time when the :class:`LogRecord` was created. By default " "this is of the form '2003-07-08 16:49:45,896' (the numbers after the comma " "are millisecond portion of the time)." msgstr "" -#: ../../library/logging.rst:1005 +#: ../../library/logging.rst:1006 msgid "created" -msgstr "" +msgstr "created" -#: ../../library/logging.rst:1005 +#: ../../library/logging.rst:1006 msgid "``%(created)f``" msgstr "``%(created)f``" -#: ../../library/logging.rst:1005 +#: ../../library/logging.rst:1006 msgid "" "Time when the :class:`LogRecord` was created (as returned by :func:`time." "time_ns` / 1e9)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1008 +#: ../../library/logging.rst:0 ../../library/logging.rst:1009 msgid "exc_info" msgstr "exc_info" -#: ../../library/logging.rst:1008 +#: ../../library/logging.rst:1009 msgid "" "Exception tuple (à la ``sys.exc_info``) or, if no exception has occurred, " "``None``." msgstr "" -#: ../../library/logging.rst:1011 +#: ../../library/logging.rst:1012 msgid "filename" msgstr "filename" -#: ../../library/logging.rst:1011 +#: ../../library/logging.rst:1012 msgid "``%(filename)s``" msgstr "``%(filename)s``" -#: ../../library/logging.rst:1011 +#: ../../library/logging.rst:1012 msgid "Filename portion of ``pathname``." -msgstr "" +msgstr "``pathname`` 的檔案名稱部分。" -#: ../../library/logging.rst:1013 +#: ../../library/logging.rst:1014 msgid "funcName" -msgstr "" +msgstr "funcName" -#: ../../library/logging.rst:1013 +#: ../../library/logging.rst:1014 msgid "``%(funcName)s``" msgstr "``%(funcName)s``" -#: ../../library/logging.rst:1013 +#: ../../library/logging.rst:1014 msgid "Name of function containing the logging call." msgstr "" -#: ../../library/logging.rst:1015 +#: ../../library/logging.rst:1016 msgid "levelname" -msgstr "" +msgstr "levelname" -#: ../../library/logging.rst:1015 +#: ../../library/logging.rst:1016 msgid "``%(levelname)s``" msgstr "``%(levelname)s``" -#: ../../library/logging.rst:1015 +#: ../../library/logging.rst:1016 msgid "" "Text logging level for the message (``'DEBUG'``, ``'INFO'``, ``'WARNING'``, " "``'ERROR'``, ``'CRITICAL'``)." msgstr "" -#: ../../library/logging.rst:1019 +#: ../../library/logging.rst:1020 msgid "levelno" -msgstr "" +msgstr "levelno" -#: ../../library/logging.rst:1019 +#: ../../library/logging.rst:1020 msgid "``%(levelno)s``" msgstr "``%(levelno)s``" -#: ../../library/logging.rst:1019 +#: ../../library/logging.rst:1020 msgid "" "Numeric logging level for the message (:const:`DEBUG`, :const:`INFO`, :const:" "`WARNING`, :const:`ERROR`, :const:`CRITICAL`)." msgstr "" -#: ../../library/logging.rst:1024 +#: ../../library/logging.rst:1025 msgid "lineno" -msgstr "" +msgstr "lineno" -#: ../../library/logging.rst:1024 +#: ../../library/logging.rst:1025 msgid "``%(lineno)d``" msgstr "``%(lineno)d``" -#: ../../library/logging.rst:1024 +#: ../../library/logging.rst:1025 msgid "Source line number where the logging call was issued (if available)." msgstr "" -#: ../../library/logging.rst:1027 +#: ../../library/logging.rst:1028 msgid "message" -msgstr "" +msgstr "message" -#: ../../library/logging.rst:1027 +#: ../../library/logging.rst:1028 msgid "``%(message)s``" msgstr "``%(message)s``" -#: ../../library/logging.rst:1027 +#: ../../library/logging.rst:1028 msgid "" "The logged message, computed as ``msg % args``. This is set when :meth:" "`Formatter.format` is invoked." msgstr "" -#: ../../library/logging.rst:1031 +#: ../../library/logging.rst:1032 msgid "module" msgstr "模組" -#: ../../library/logging.rst:1031 +#: ../../library/logging.rst:1032 msgid "``%(module)s``" msgstr "``%(module)s``" -#: ../../library/logging.rst:1031 +#: ../../library/logging.rst:1032 msgid "Module (name portion of ``filename``)." -msgstr "" +msgstr "模組(``filename`` 的名稱部分)。" -#: ../../library/logging.rst:1033 +#: ../../library/logging.rst:1034 msgid "msecs" -msgstr "" +msgstr "msecs" -#: ../../library/logging.rst:1033 +#: ../../library/logging.rst:1034 msgid "``%(msecs)d``" msgstr "``%(msecs)d``" -#: ../../library/logging.rst:1033 +#: ../../library/logging.rst:1034 msgid "" "Millisecond portion of the time when the :class:`LogRecord` was created." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1036 +#: ../../library/logging.rst:0 ../../library/logging.rst:1037 msgid "msg" -msgstr "" +msgstr "msg" -#: ../../library/logging.rst:1036 +#: ../../library/logging.rst:1037 msgid "" "The format string passed in the original logging call. Merged with ``args`` " "to produce ``message``, or an arbitrary object (see :ref:`arbitrary-object-" "messages`)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1041 +#: ../../library/logging.rst:0 ../../library/logging.rst:1042 msgid "name" msgstr "name" -#: ../../library/logging.rst:1041 +#: ../../library/logging.rst:1042 msgid "``%(name)s``" msgstr "``%(name)s``" -#: ../../library/logging.rst:1041 +#: ../../library/logging.rst:1042 msgid "Name of the logger used to log the call." msgstr "" -#: ../../library/logging.rst:1043 +#: ../../library/logging.rst:1044 msgid "pathname" -msgstr "" +msgstr "pathname" -#: ../../library/logging.rst:1043 +#: ../../library/logging.rst:1044 msgid "``%(pathname)s``" msgstr "``%(pathname)s``" -#: ../../library/logging.rst:1043 +#: ../../library/logging.rst:1044 msgid "" "Full pathname of the source file where the logging call was issued (if " "available)." msgstr "" -#: ../../library/logging.rst:1046 +#: ../../library/logging.rst:1047 msgid "process" -msgstr "" +msgstr "process" -#: ../../library/logging.rst:1046 +#: ../../library/logging.rst:1047 msgid "``%(process)d``" msgstr "``%(process)d``" -#: ../../library/logging.rst:1046 +#: ../../library/logging.rst:1047 msgid "Process ID (if available)." -msgstr "" +msgstr "行程 ID(如果可用)。" -#: ../../library/logging.rst:1048 +#: ../../library/logging.rst:1049 msgid "processName" -msgstr "" +msgstr "processName" -#: ../../library/logging.rst:1048 +#: ../../library/logging.rst:1049 msgid "``%(processName)s``" msgstr "``%(processName)s``" -#: ../../library/logging.rst:1048 +#: ../../library/logging.rst:1049 msgid "Process name (if available)." -msgstr "" +msgstr "行程名稱(如果可用)。" -#: ../../library/logging.rst:1050 +#: ../../library/logging.rst:1051 msgid "relativeCreated" -msgstr "" +msgstr "relativeCreated" -#: ../../library/logging.rst:1050 +#: ../../library/logging.rst:1051 msgid "``%(relativeCreated)d``" msgstr "``%(relativeCreated)d``" -#: ../../library/logging.rst:1050 +#: ../../library/logging.rst:1051 msgid "" "Time in milliseconds when the LogRecord was created, relative to the time " "the logging module was loaded." msgstr "" -#: ../../library/logging.rst:1054 +#: ../../library/logging.rst:1055 msgid "stack_info" msgstr "stack_info" -#: ../../library/logging.rst:1054 +#: ../../library/logging.rst:1055 msgid "" "Stack frame information (where available) from the bottom of the stack in " "the current thread, up to and including the stack frame of the logging call " "which resulted in the creation of this record." msgstr "" -#: ../../library/logging.rst:1060 +#: ../../library/logging.rst:1061 msgid "thread" -msgstr "" +msgstr "thread" -#: ../../library/logging.rst:1060 +#: ../../library/logging.rst:1061 msgid "``%(thread)d``" msgstr "``%(thread)d``" -#: ../../library/logging.rst:1060 +#: ../../library/logging.rst:1061 msgid "Thread ID (if available)." -msgstr "" +msgstr "執行緒 ID(如果可用)。" -#: ../../library/logging.rst:1062 +#: ../../library/logging.rst:1063 msgid "threadName" -msgstr "" +msgstr "threadName" -#: ../../library/logging.rst:1062 +#: ../../library/logging.rst:1063 msgid "``%(threadName)s``" msgstr "``%(threadName)s``" -#: ../../library/logging.rst:1062 +#: ../../library/logging.rst:1063 msgid "Thread name (if available)." msgstr "" -#: ../../library/logging.rst:1064 +#: ../../library/logging.rst:1065 msgid "taskName" msgstr "taskName" -#: ../../library/logging.rst:1064 +#: ../../library/logging.rst:1065 msgid "``%(taskName)s``" msgstr "``%(taskName)s``" -#: ../../library/logging.rst:1064 +#: ../../library/logging.rst:1065 msgid ":class:`asyncio.Task` name (if available)." msgstr "" -#: ../../library/logging.rst:1067 +#: ../../library/logging.rst:1068 msgid "*processName* was added." msgstr "新增 *processName*。" -#: ../../library/logging.rst:1070 +#: ../../library/logging.rst:1071 msgid "*taskName* was added." msgstr "新增 *taskName*。" -#: ../../library/logging.rst:1076 +#: ../../library/logging.rst:1077 msgid "LoggerAdapter Objects" msgstr "LoggerAdapter 物件" -#: ../../library/logging.rst:1078 +#: ../../library/logging.rst:1079 msgid "" ":class:`LoggerAdapter` instances are used to conveniently pass contextual " "information into logging calls. For a usage example, see the section on :ref:" "`adding contextual information to your logging output `." msgstr "" -#: ../../library/logging.rst:1084 +#: ../../library/logging.rst:1085 msgid "" "Returns an instance of :class:`LoggerAdapter` initialized with an " "underlying :class:`Logger` instance, a dict-like object (*extra*), and a " @@ -1624,7 +1624,7 @@ msgid "" "calls and only use the one of the :class:`LoggerAdapter` instance" msgstr "" -#: ../../library/logging.rst:1093 +#: ../../library/logging.rst:1094 msgid "" "Modifies the message and/or keyword arguments passed to a logging call in " "order to insert contextual information. This implementation takes the object " @@ -1633,15 +1633,15 @@ msgid "" "(possibly modified) versions of the arguments passed in." msgstr "" -#: ../../library/logging.rst:1101 -msgid "Delegates to the underlying :attr:`!manager`` on *logger*." +#: ../../library/logging.rst:1102 +msgid "Delegates to the underlying :attr:`!manager` on *logger*." msgstr "" -#: ../../library/logging.rst:1105 -msgid "Delegates to the underlying :meth:`!_log`` method on *logger*." +#: ../../library/logging.rst:1106 +msgid "Delegates to the underlying :meth:`!_log` method on *logger*." msgstr "" -#: ../../library/logging.rst:1107 +#: ../../library/logging.rst:1108 msgid "" "In addition to the above, :class:`LoggerAdapter` supports the following " "methods of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`, :" @@ -1653,29 +1653,28 @@ msgid "" "interchangeably." msgstr "" -#: ../../library/logging.rst:1118 +#: ../../library/logging.rst:1119 msgid "" "The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:" "`~Logger.setLevel` and :meth:`~Logger.hasHandlers` methods were added to :" "class:`LoggerAdapter`. These methods delegate to the underlying logger." msgstr "" -#: ../../library/logging.rst:1124 +#: ../../library/logging.rst:1125 msgid "" "Attribute :attr:`!manager` and method :meth:`!_log` were added, which " "delegate to the underlying logger and allow adapters to be nested." msgstr "" -#: ../../library/logging.rst:1129 -#, fuzzy +#: ../../library/logging.rst:1130 msgid "The *merge_extra* argument was added." -msgstr "新增 *force* 引數。" +msgstr "新增 *merge_extra* 引數。" -#: ../../library/logging.rst:1133 +#: ../../library/logging.rst:1134 msgid "Thread Safety" -msgstr "" +msgstr "執行緒安全" -#: ../../library/logging.rst:1135 +#: ../../library/logging.rst:1136 msgid "" "The logging module is intended to be thread-safe without any special work " "needing to be done by its clients. It achieves this though using threading " @@ -1684,7 +1683,7 @@ msgid "" "O." msgstr "" -#: ../../library/logging.rst:1140 +#: ../../library/logging.rst:1141 msgid "" "If you are implementing asynchronous signal handlers using the :mod:`signal` " "module, you may not be able to use logging from within such handlers. This " @@ -1692,17 +1691,17 @@ msgid "" "always re-entrant, and so cannot be invoked from such signal handlers." msgstr "" -#: ../../library/logging.rst:1147 +#: ../../library/logging.rst:1148 msgid "Module-Level Functions" -msgstr "" +msgstr "模組層級函式" -#: ../../library/logging.rst:1149 +#: ../../library/logging.rst:1150 msgid "" "In addition to the classes described above, there are a number of module-" "level functions." msgstr "" -#: ../../library/logging.rst:1155 +#: ../../library/logging.rst:1156 msgid "" "Return a logger with the specified name or, if name is ``None``, return the " "root logger of the hierarchy. If specified, the name is typically a dot-" @@ -1712,14 +1711,14 @@ msgid "" "for not doing that, as mentioned in :ref:`logger`." msgstr "" -#: ../../library/logging.rst:1162 +#: ../../library/logging.rst:1163 msgid "" "All calls to this function with a given name return the same logger " "instance. This means that logger instances never need to be passed between " "different parts of an application." msgstr "" -#: ../../library/logging.rst:1169 +#: ../../library/logging.rst:1170 msgid "" "Return either the standard :class:`Logger` class, or the last class passed " "to :func:`setLoggerClass`. This function may be called from within a new " @@ -1728,43 +1727,45 @@ msgid "" "example::" msgstr "" -#: ../../library/logging.rst:1174 +#: ../../library/logging.rst:1175 msgid "" "class MyLogger(logging.getLoggerClass()):\n" " # ... override behaviour here" msgstr "" +"class MyLogger(logging.getLoggerClass()):\n" +" # ... 在這裡覆蓋其行為" -#: ../../library/logging.rst:1180 +#: ../../library/logging.rst:1181 msgid "Return a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1182 +#: ../../library/logging.rst:1183 msgid "" "This function has been provided, along with :func:`setLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1187 +#: ../../library/logging.rst:1188 msgid "" "See :func:`setLogRecordFactory` for more information about the how the " "factory is called." msgstr "" -#: ../../library/logging.rst:1192 +#: ../../library/logging.rst:1193 msgid "" "This is a convenience function that calls :meth:`Logger.debug`, on the root " "logger. The handling of the arguments is in every way identical to what is " "described in that method." msgstr "" -#: ../../library/logging.rst:1196 +#: ../../library/logging.rst:1197 msgid "" "The only difference is that if the root logger has no handlers, then :func:" "`basicConfig` is called, prior to calling ``debug`` on the root logger." msgstr "" -#: ../../library/logging.rst:1199 +#: ../../library/logging.rst:1200 msgid "" "For very short scripts or quick demonstrations of ``logging`` facilities, " "``debug`` and the other module-level functions may be convenient. However, " @@ -1774,38 +1775,38 @@ msgid "" "described at the beginnning of this documentation." msgstr "" -#: ../../library/logging.rst:1209 +#: ../../library/logging.rst:1210 msgid "" "Logs a message with level :const:`INFO` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1215 +#: ../../library/logging.rst:1216 msgid "" "Logs a message with level :const:`WARNING` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1218 +#: ../../library/logging.rst:1219 msgid "" "There is an obsolete function ``warn`` which is functionally identical to " "``warning``. As ``warn`` is deprecated, please do not use it - use " "``warning`` instead." msgstr "" -#: ../../library/logging.rst:1225 +#: ../../library/logging.rst:1226 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1231 +#: ../../library/logging.rst:1232 msgid "" "Logs a message with level :const:`CRITICAL` on the root logger. The " "arguments and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1237 +#: ../../library/logging.rst:1238 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`. Exception info is " @@ -1813,13 +1814,13 @@ msgid "" "exception handler." msgstr "" -#: ../../library/logging.rst:1243 +#: ../../library/logging.rst:1244 msgid "" "Logs a message with level *level* on the root logger. The arguments and " "behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1248 +#: ../../library/logging.rst:1249 msgid "" "Provides an overriding level *level* for all loggers which takes precedence " "over the logger's own level. When the need arises to temporarily throttle " @@ -1833,7 +1834,7 @@ msgid "" "individual loggers." msgstr "" -#: ../../library/logging.rst:1259 +#: ../../library/logging.rst:1260 msgid "" "Note that if you have defined any custom logging level higher than " "``CRITICAL`` (this is not recommended), you won't be able to rely on the " @@ -1841,13 +1842,13 @@ msgid "" "a suitable value." msgstr "" -#: ../../library/logging.rst:1264 +#: ../../library/logging.rst:1265 msgid "" "The *level* parameter was defaulted to level ``CRITICAL``. See :issue:" "`28524` for more information about this change." msgstr "" -#: ../../library/logging.rst:1270 +#: ../../library/logging.rst:1271 msgid "" "Associates level *level* with text *levelName* in an internal dictionary, " "which is used to map numeric levels to a textual representation, for example " @@ -1857,24 +1858,24 @@ msgid "" "and they should increase in increasing order of severity." msgstr "" -#: ../../library/logging.rst:1277 +#: ../../library/logging.rst:1278 msgid "" "If you are thinking of defining your own levels, please see the section on :" "ref:`custom-levels`." msgstr "" -#: ../../library/logging.rst:1282 +#: ../../library/logging.rst:1283 msgid "" "Returns a mapping from level names to their corresponding logging levels. " "For example, the string \"CRITICAL\" maps to :const:`CRITICAL`. The returned " "mapping is copied from an internal mapping on each call to this function." msgstr "" -#: ../../library/logging.rst:1290 +#: ../../library/logging.rst:1291 msgid "Returns the textual or numeric representation of logging level *level*." msgstr "" -#: ../../library/logging.rst:1292 +#: ../../library/logging.rst:1293 msgid "" "If *level* is one of the predefined levels :const:`CRITICAL`, :const:" "`ERROR`, :const:`WARNING`, :const:`INFO` or :const:`DEBUG` then you get the " @@ -1884,20 +1885,20 @@ msgid "" "the corresponding string representation is returned." msgstr "" -#: ../../library/logging.rst:1299 +#: ../../library/logging.rst:1300 msgid "" "The *level* parameter also accepts a string representation of the level such " "as 'INFO'. In such cases, this functions returns the corresponding numeric " "value of the level." msgstr "" -#: ../../library/logging.rst:1303 +#: ../../library/logging.rst:1304 msgid "" "If no matching numeric or string value is passed in, the string 'Level %s' % " "level is returned." msgstr "" -#: ../../library/logging.rst:1306 +#: ../../library/logging.rst:1307 msgid "" "Levels are internally integers (as they need to be compared in the logging " "logic). This function is used to convert between an integer level and the " @@ -1906,7 +1907,7 @@ msgid "" "vice versa." msgstr "" -#: ../../library/logging.rst:1312 +#: ../../library/logging.rst:1313 msgid "" "In Python versions earlier than 3.4, this function could also be passed a " "text level, and would return the corresponding numeric value of the level. " @@ -1914,17 +1915,17 @@ msgid "" "Python 3.4, but reinstated in 3.4.2 due to retain backward compatibility." msgstr "" -#: ../../library/logging.rst:1320 +#: ../../library/logging.rst:1321 msgid "" "Returns a handler with the specified *name*, or ``None`` if there is no " "handler with that name." msgstr "" -#: ../../library/logging.rst:1327 +#: ../../library/logging.rst:1328 msgid "Returns an immutable set of all known handler names." msgstr "" -#: ../../library/logging.rst:1333 +#: ../../library/logging.rst:1334 msgid "" "Creates and returns a new :class:`LogRecord` instance whose attributes are " "defined by *attrdict*. This function is useful for taking a pickled :class:" @@ -1932,7 +1933,7 @@ msgid "" "as a :class:`LogRecord` instance at the receiving end." msgstr "" -#: ../../library/logging.rst:1341 +#: ../../library/logging.rst:1342 msgid "" "Does basic configuration for the logging system by creating a :class:" "`StreamHandler` with a default :class:`Formatter` and adding it to the root " @@ -1941,13 +1942,13 @@ msgid "" "no handlers are defined for the root logger." msgstr "" -#: ../../library/logging.rst:1347 +#: ../../library/logging.rst:1348 msgid "" "This function does nothing if the root logger already has handlers " "configured, unless the keyword argument *force* is set to ``True``." msgstr "" -#: ../../library/logging.rst:1350 +#: ../../library/logging.rst:1351 msgid "" "This function should be called from the main thread before other threads are " "started. In versions of Python prior to 2.7.1 and 3.2, if this function is " @@ -1956,54 +1957,54 @@ msgid "" "unexpected results such as messages being duplicated in the log." msgstr "" -#: ../../library/logging.rst:1357 +#: ../../library/logging.rst:1358 msgid "The following keyword arguments are supported." -msgstr "" +msgstr "支援以下的關鍵字引數。" -#: ../../library/logging.rst:1364 +#: ../../library/logging.rst:1365 msgid "*filename*" msgstr "*filename*" -#: ../../library/logging.rst:1364 +#: ../../library/logging.rst:1365 msgid "" "Specifies that a :class:`FileHandler` be created, using the specified " "filename, rather than a :class:`StreamHandler`." msgstr "" -#: ../../library/logging.rst:1368 +#: ../../library/logging.rst:1369 msgid "*filemode*" msgstr "*filemode*" -#: ../../library/logging.rst:1368 +#: ../../library/logging.rst:1369 msgid "" "If *filename* is specified, open the file in this :ref:`mode `. " "Defaults to ``'a'``." msgstr "" -#: ../../library/logging.rst:1372 +#: ../../library/logging.rst:1373 msgid "*format*" msgstr "*format*" -#: ../../library/logging.rst:1372 +#: ../../library/logging.rst:1373 msgid "" "Use the specified format string for the handler. Defaults to attributes " "``levelname``, ``name`` and ``message`` separated by colons." msgstr "" -#: ../../library/logging.rst:1377 +#: ../../library/logging.rst:1378 msgid "*datefmt*" msgstr "*datefmt*" -#: ../../library/logging.rst:1377 +#: ../../library/logging.rst:1378 msgid "" "Use the specified date/time format, as accepted by :func:`time.strftime`." msgstr "" -#: ../../library/logging.rst:1380 +#: ../../library/logging.rst:1381 msgid "*style*" msgstr "*style*" -#: ../../library/logging.rst:1380 +#: ../../library/logging.rst:1381 msgid "" "If *format* is specified, use this style for the format string. One of " "``'%'``, ``'{'`` or ``'$'`` for :ref:`printf-style `." msgstr "" -#: ../../library/logging.rst:1391 +#: ../../library/logging.rst:1392 msgid "*stream*" msgstr "*stream*" -#: ../../library/logging.rst:1391 +#: ../../library/logging.rst:1392 msgid "" "Use the specified stream to initialize the :class:`StreamHandler`. Note that " "this argument is incompatible with *filename* - if both are present, a " "``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1397 +#: ../../library/logging.rst:1398 msgid "*handlers*" msgstr "*handlers*" -#: ../../library/logging.rst:1397 +#: ../../library/logging.rst:1398 msgid "" "If specified, this should be an iterable of already created handlers to add " "to the root logger. Any handlers which don't already have a formatter set " @@ -2043,33 +2044,33 @@ msgid "" "present, a ``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1406 +#: ../../library/logging.rst:1407 msgid "*force*" msgstr "*force*" -#: ../../library/logging.rst:1406 +#: ../../library/logging.rst:1407 msgid "" "If this keyword argument is specified as true, any existing handlers " "attached to the root logger are removed and closed, before carrying out the " "configuration as specified by the other arguments." msgstr "" -#: ../../library/logging.rst:1412 +#: ../../library/logging.rst:1413 msgid "*encoding*" msgstr "*encoding*" -#: ../../library/logging.rst:1412 +#: ../../library/logging.rst:1413 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " "the output file." msgstr "" -#: ../../library/logging.rst:1417 +#: ../../library/logging.rst:1418 msgid "*errors*" msgstr "*errors*" -#: ../../library/logging.rst:1417 +#: ../../library/logging.rst:1418 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " @@ -2078,39 +2079,39 @@ msgid "" "`open`, which means that it will be treated the same as passing 'errors'." msgstr "" -#: ../../library/logging.rst:1428 +#: ../../library/logging.rst:1429 msgid "The *style* argument was added." msgstr "新增 *style* 引數。" -#: ../../library/logging.rst:1431 +#: ../../library/logging.rst:1432 msgid "" "The *handlers* argument was added. Additional checks were added to catch " "situations where incompatible arguments are specified (e.g. *handlers* " "together with *stream* or *filename*, or *stream* together with *filename*)." msgstr "" -#: ../../library/logging.rst:1437 +#: ../../library/logging.rst:1438 msgid "The *force* argument was added." msgstr "新增 *force* 引數。" -#: ../../library/logging.rst:1440 +#: ../../library/logging.rst:1441 msgid "The *encoding* and *errors* arguments were added." msgstr "新增 *encoding* 與 *errors* 引數。" -#: ../../library/logging.rst:1445 +#: ../../library/logging.rst:1446 msgid "" "Informs the logging system to perform an orderly shutdown by flushing and " "closing all handlers. This should be called at application exit and no " "further use of the logging system should be made after this call." msgstr "" -#: ../../library/logging.rst:1449 +#: ../../library/logging.rst:1450 msgid "" "When the logging module is imported, it registers this function as an exit " "handler (see :mod:`atexit`), so normally there's no need to do that manually." msgstr "" -#: ../../library/logging.rst:1456 +#: ../../library/logging.rst:1457 msgid "" "Tells the logging system to use the class *klass* when instantiating a " "logger. The class should define :meth:`!__init__` such that only a name " @@ -2122,32 +2123,32 @@ msgid "" "loggers." msgstr "" -#: ../../library/logging.rst:1467 +#: ../../library/logging.rst:1468 msgid "Set a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1469 +#: ../../library/logging.rst:1470 msgid "The factory callable to be used to instantiate a log record." msgstr "" -#: ../../library/logging.rst:1471 +#: ../../library/logging.rst:1472 msgid "" "This function has been provided, along with :func:`getLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1476 +#: ../../library/logging.rst:1477 msgid "The factory has the following signature:" msgstr "" -#: ../../library/logging.rst:1478 +#: ../../library/logging.rst:1479 msgid "" "``factory(name, level, fn, lno, msg, args, exc_info, func=None, sinfo=None, " "**kwargs)``" msgstr "" -#: ../../library/logging.rst:1480 +#: ../../library/logging.rst:1481 msgid "The logger name." msgstr "" @@ -2155,7 +2156,7 @@ msgstr "" msgid "level" msgstr "" -#: ../../library/logging.rst:1481 +#: ../../library/logging.rst:1482 msgid "The logging level (numeric)." msgstr "" @@ -2163,7 +2164,7 @@ msgstr "" msgid "fn" msgstr "fn" -#: ../../library/logging.rst:1482 +#: ../../library/logging.rst:1483 msgid "The full pathname of the file where the logging call was made." msgstr "" @@ -2171,19 +2172,19 @@ msgstr "" msgid "lno" msgstr "lno" -#: ../../library/logging.rst:1483 +#: ../../library/logging.rst:1484 msgid "The line number in the file where the logging call was made." msgstr "" -#: ../../library/logging.rst:1484 +#: ../../library/logging.rst:1485 msgid "The logging message." msgstr "" -#: ../../library/logging.rst:1485 +#: ../../library/logging.rst:1486 msgid "The arguments for the logging message." msgstr "" -#: ../../library/logging.rst:1486 +#: ../../library/logging.rst:1487 msgid "An exception tuple, or ``None``." msgstr "" @@ -2191,7 +2192,7 @@ msgstr "" msgid "func" msgstr "func" -#: ../../library/logging.rst:1487 +#: ../../library/logging.rst:1488 msgid "The name of the function or method which invoked the logging call." msgstr "" @@ -2199,7 +2200,7 @@ msgstr "" msgid "sinfo" msgstr "sinfo" -#: ../../library/logging.rst:1489 +#: ../../library/logging.rst:1490 msgid "" "A stack traceback such as is provided by :func:`traceback.print_stack`, " "showing the call hierarchy." @@ -2209,15 +2210,15 @@ msgstr "" msgid "kwargs" msgstr "kwargs" -#: ../../library/logging.rst:1491 +#: ../../library/logging.rst:1492 msgid "Additional keyword arguments." msgstr "額外的關鍵字引數。" -#: ../../library/logging.rst:1495 +#: ../../library/logging.rst:1496 msgid "Module-Level Attributes" -msgstr "" +msgstr "模組層級屬性" -#: ../../library/logging.rst:1499 +#: ../../library/logging.rst:1500 msgid "" "A \"handler of last resort\" is available through this attribute. This is a :" "class:`StreamHandler` writing to ``sys.stderr`` with a level of ``WARNING``, " @@ -2228,15 +2229,15 @@ msgid "" "reason, ``lastResort`` can be set to ``None``." msgstr "" -#: ../../library/logging.rst:1511 +#: ../../library/logging.rst:1512 msgid "Used to see if exceptions during handling should be propagated." msgstr "" -#: ../../library/logging.rst:1513 +#: ../../library/logging.rst:1514 msgid "Default: ``True``." msgstr "" -#: ../../library/logging.rst:1515 +#: ../../library/logging.rst:1516 msgid "" "If :data:`raiseExceptions` is ``False``, exceptions get silently ignored. " "This is what is mostly wanted for a logging system - most users will not " @@ -2244,22 +2245,22 @@ msgid "" "application errors." msgstr "" -#: ../../library/logging.rst:1522 +#: ../../library/logging.rst:1523 msgid "Integration with the warnings module" msgstr "" -#: ../../library/logging.rst:1524 +#: ../../library/logging.rst:1525 msgid "" "The :func:`captureWarnings` function can be used to integrate :mod:`logging` " "with the :mod:`warnings` module." msgstr "" -#: ../../library/logging.rst:1529 +#: ../../library/logging.rst:1530 msgid "" "This function is used to turn the capture of warnings by logging on and off." msgstr "" -#: ../../library/logging.rst:1532 +#: ../../library/logging.rst:1533 msgid "" "If *capture* is ``True``, warnings issued by the :mod:`warnings` module will " "be redirected to the logging system. Specifically, a warning will be " @@ -2268,46 +2269,46 @@ msgid "" "`WARNING`." msgstr "" -#: ../../library/logging.rst:1537 +#: ../../library/logging.rst:1538 msgid "" "If *capture* is ``False``, the redirection of warnings to the logging system " "will stop, and warnings will be redirected to their original destinations (i." "e. those in effect before ``captureWarnings(True)`` was called)." msgstr "" -#: ../../library/logging.rst:1544 +#: ../../library/logging.rst:1545 msgid "Module :mod:`logging.config`" -msgstr "" +msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.rst:1545 +#: ../../library/logging.rst:1546 msgid "Configuration API for the logging module." msgstr "" -#: ../../library/logging.rst:1547 +#: ../../library/logging.rst:1548 msgid "Module :mod:`logging.handlers`" -msgstr "" +msgstr ":mod:`logging.handlers` 模組" -#: ../../library/logging.rst:1548 +#: ../../library/logging.rst:1549 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../library/logging.rst:1550 +#: ../../library/logging.rst:1551 msgid ":pep:`282` - A Logging System" msgstr "" -#: ../../library/logging.rst:1551 +#: ../../library/logging.rst:1552 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "" -#: ../../library/logging.rst:1554 +#: ../../library/logging.rst:1555 msgid "" "`Original Python logging package `_" msgstr "" -#: ../../library/logging.rst:1555 +#: ../../library/logging.rst:1556 msgid "" "This is the original source for the :mod:`logging` package. The version of " "the package available from this site is suitable for use with Python 1.5.2, " @@ -2322,6 +2323,3 @@ msgstr "Errors(錯誤)" #: ../../library/logging.rst:12 msgid "logging" msgstr "logging(日誌)" - -#~ msgid "The simplest example:" -#~ msgstr "最簡單的示範:" diff --git a/library/mmap.po b/library/mmap.po index 753e0bb140..2d33ddb42b 100644 --- a/library/mmap.po +++ b/library/mmap.po @@ -19,7 +19,7 @@ msgstr "" #: ../../library/mmap.rst:2 msgid ":mod:`!mmap` --- Memory-mapped file support" -msgstr ":mod:`!mmap` --- 記憶體映射檔案的支援" +msgstr ":mod:`!mmap` --- 記憶體對映檔案的支援" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." diff --git a/library/os.po b/library/os.po index 7968086daf..e840cd0740 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-04-29 15:24+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -5238,8 +5238,12 @@ msgid "See the :manpage:`pidfd_open(2)` man page for more details." msgstr "更多細節請見 :manpage:`pidfd_open(2)` 手冊頁。" #: ../../library/os.rst:4575 -msgid ":ref:`Availability `: Linux >= 5.3" -msgstr ":ref:`適用 `:Linux 5.3 以上" +msgid "" +":ref:`Availability `: Linux >= 5.3, Android >= :func:`build-" +"time ` API level 31" +msgstr "" +":ref:`適用 `:Linux 5.3 Android 6.0 以上、Android :func:`build-" +"time ` API level 31 以上" #: ../../library/os.rst:4580 msgid "" @@ -6772,6 +6776,9 @@ msgstr "path separator (POSIX)(路徑分隔器 (POSIX))" msgid "; (semicolon)" msgstr "; (分號)" +#~ msgid ":ref:`Availability `: Linux >= 5.3" +#~ msgstr ":ref:`適用 `:Linux 5.3 以上" + #~ msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." #~ msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" diff --git a/library/pydoc.po b/library/pydoc.po index 405db7041e..d301141ac0 100644 --- a/library/pydoc.po +++ b/library/pydoc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,8 +36,8 @@ msgstr "" #: ../../library/pydoc.rst:23 msgid "" "For modules, classes, functions and methods, the displayed documentation is " -"derived from the docstring (i.e. the :attr:`!__doc__` attribute) of the " -"object, and recursively of its documentable members. If there is no " +"derived from the docstring (i.e. the :attr:`~definition.__doc__` attribute) " +"of the object, and recursively of its documentable members. If there is no " "docstring, :mod:`!pydoc` tries to obtain a description from the block of " "comment lines just above the definition of the class, function or method in " "the source file, or at the top of the module (see :func:`inspect." diff --git a/library/random.po b/library/random.po index 470f0084d7..08679f4e90 100644 --- a/library/random.po +++ b/library/random.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2023-01-23 22:47+0800\n" "Last-Translator: Allen Wu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1162,7 +1162,7 @@ msgstr "" #: ../../library/random.rst:744 msgid "" -"Print a random floating-point number between 1 and N inclusive, using :meth:" +"Print a random floating-point number between 0 and N inclusive, using :meth:" "`uniform`." msgstr "" diff --git a/library/secrets.po b/library/secrets.po index 2a0d0b4b79..d2bfde8612 100644 --- a/library/secrets.po +++ b/library/secrets.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2022-11-30 13:42+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -78,7 +78,7 @@ msgid "Return a random int in the range [0, *exclusive_upper_bound*)." msgstr "回傳一個 [0, *exclusive_upper_bound*) 範圍之內的隨機整數。" #: ../../library/secrets.rst:55 -msgid "Return an int with *k* random bits." +msgid "Return a non-negative int with *k* random bits." msgstr "回傳一個具 *k* 個隨機位元的非負整數。" #: ../../library/secrets.rst:59 diff --git a/library/shutil.po b/library/shutil.po index ab9054224c..6eab863585 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-26 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -590,12 +590,13 @@ msgstr "" #: ../../library/shutil.rst:452 msgid "" -"*path* is a \"``PATH`` string\" specifying the lookup directory list. When " -"no *path* is specified, the results of :func:`os.environ` are used, " -"returning either the \"PATH\" value or a fallback of :data:`os.defpath`." +"*path* is a \"``PATH`` string\" specifying the directories to look in, " +"delimited by :data:`os.pathsep`. When no *path* is specified, the :envvar:" +"`PATH` environment variable is read from :data:`os.environ`, falling back " +"to :data:`os.defpath` if it is not set." msgstr "" -#: ../../library/shutil.rst:456 +#: ../../library/shutil.rst:457 msgid "" "On Windows, the current directory is prepended to the *path* if *mode* does " "not include ``os.X_OK``. When the *mode* does include ``os.X_OK``, the " @@ -605,16 +606,16 @@ msgid "" "environment variable ``NoDefaultCurrentDirectoryInExePath``." msgstr "" -#: ../../library/shutil.rst:463 +#: ../../library/shutil.rst:464 msgid "" -"Also on Windows, the ``PATHEXT`` variable is used to resolve commands that " -"may not already include an extension. For example, if you call ``shutil." -"which(\"python\")``, :func:`which` will search ``PATHEXT`` to know that it " -"should look for ``python.exe`` within the *path* directories. For example, " -"on Windows::" +"Also on Windows, the :envvar:`PATHEXT` environment variable is used to " +"resolve commands that may not already include an extension. For example, if " +"you call ``shutil.which(\"python\")``, :func:`which` will search ``PATHEXT`` " +"to know that it should look for ``python.exe`` within the *path* " +"directories. For example, on Windows::" msgstr "" -#: ../../library/shutil.rst:469 +#: ../../library/shutil.rst:470 msgid "" ">>> shutil.which(\"python\")\n" "'C:\\\\Python33\\\\python.EXE'" @@ -622,25 +623,25 @@ msgstr "" ">>> shutil.which(\"python\")\n" "'C:\\\\Python33\\\\python.EXE'" -#: ../../library/shutil.rst:472 +#: ../../library/shutil.rst:473 msgid "" "This is also applied when *cmd* is a path that contains a directory " "component::" msgstr "" -#: ../../library/shutil.rst:475 +#: ../../library/shutil.rst:476 msgid "" ">> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" msgstr "" -#: ../../library/shutil.rst:480 +#: ../../library/shutil.rst:481 msgid "" "The :class:`bytes` type is now accepted. If *cmd* type is :class:`bytes`, " "the result type is also :class:`bytes`." msgstr "" -#: ../../library/shutil.rst:484 +#: ../../library/shutil.rst:485 msgid "" "On Windows, the current directory is no longer prepended to the search path " "if *mode* includes ``os.X_OK`` and WinAPI " @@ -651,25 +652,25 @@ msgid "" "now be found." msgstr "" -#: ../../library/shutil.rst:493 +#: ../../library/shutil.rst:494 msgid "" "On Windows, if *mode* includes ``os.X_OK``, executables with an extension in " "``PATHEXT`` will be preferred over executables without a matching extension. " "This brings behavior closer to that of Python 3.11." msgstr "" -#: ../../library/shutil.rst:501 +#: ../../library/shutil.rst:502 msgid "" "This exception collects exceptions that are raised during a multi-file " "operation. For :func:`copytree`, the exception argument is a list of 3-" "tuples (*srcname*, *dstname*, *exception*)." msgstr "" -#: ../../library/shutil.rst:508 +#: ../../library/shutil.rst:509 msgid "Platform-dependent efficient copy operations" msgstr "" -#: ../../library/shutil.rst:510 +#: ../../library/shutil.rst:511 msgid "" "Starting from Python 3.8, all functions involving a file copy (:func:" "`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, and :func:" @@ -679,37 +680,37 @@ msgid "" "buffers in Python as in \"``outfd.write(infd.read())``\"." msgstr "" -#: ../../library/shutil.rst:518 +#: ../../library/shutil.rst:519 msgid "On macOS `fcopyfile`_ is used to copy the file content (not metadata)." msgstr "" -#: ../../library/shutil.rst:520 +#: ../../library/shutil.rst:521 msgid "On Linux :func:`os.sendfile` is used." msgstr "" -#: ../../library/shutil.rst:522 +#: ../../library/shutil.rst:523 msgid "" "On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " "instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil." "copyfileobj` is used." msgstr "" -#: ../../library/shutil.rst:526 +#: ../../library/shutil.rst:527 msgid "" "If the fast-copy operation fails and no data was written in the destination " "file then shutil will silently fallback on using less efficient :func:" "`copyfileobj` function internally." msgstr "" -#: ../../library/shutil.rst:535 +#: ../../library/shutil.rst:536 msgid "copytree example" msgstr "" -#: ../../library/shutil.rst:537 +#: ../../library/shutil.rst:538 msgid "An example that uses the :func:`ignore_patterns` helper::" msgstr "" -#: ../../library/shutil.rst:539 +#: ../../library/shutil.rst:540 msgid "" "from shutil import copytree, ignore_patterns\n" "\n" @@ -719,17 +720,17 @@ msgstr "" "\n" "copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*'))" -#: ../../library/shutil.rst:543 +#: ../../library/shutil.rst:544 msgid "" "This will copy everything except ``.pyc`` files and files or directories " "whose name starts with ``tmp``." msgstr "" -#: ../../library/shutil.rst:546 +#: ../../library/shutil.rst:547 msgid "Another example that uses the *ignore* argument to add a logging call::" msgstr "" -#: ../../library/shutil.rst:548 +#: ../../library/shutil.rst:549 msgid "" "from shutil import copytree\n" "import logging\n" @@ -741,11 +742,11 @@ msgid "" "copytree(source, destination, ignore=_logpath)" msgstr "" -#: ../../library/shutil.rst:561 +#: ../../library/shutil.rst:562 msgid "rmtree example" msgstr "rmtree 範例" -#: ../../library/shutil.rst:563 +#: ../../library/shutil.rst:564 msgid "" "This example shows how to remove a directory tree on Windows where some of " "the files have their read-only bit set. It uses the onexc callback to clear " @@ -753,7 +754,7 @@ msgid "" "propagate. ::" msgstr "" -#: ../../library/shutil.rst:568 +#: ../../library/shutil.rst:569 msgid "" "import os, stat\n" "import shutil\n" @@ -766,31 +767,31 @@ msgid "" "shutil.rmtree(directory, onexc=remove_readonly)" msgstr "" -#: ../../library/shutil.rst:581 +#: ../../library/shutil.rst:582 msgid "Archiving operations" msgstr "" -#: ../../library/shutil.rst:585 +#: ../../library/shutil.rst:586 msgid "Added support for the *xztar* format." msgstr "新增 *xztar* 格式的支援。" -#: ../../library/shutil.rst:589 +#: ../../library/shutil.rst:590 msgid "" "High-level utilities to create and read compressed and archived files are " "also provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules." msgstr "" -#: ../../library/shutil.rst:594 +#: ../../library/shutil.rst:595 msgid "Create an archive file (such as zip or tar) and return its name." msgstr "" -#: ../../library/shutil.rst:596 +#: ../../library/shutil.rst:597 msgid "" "*base_name* is the name of the file to create, including the path, minus any " "format-specific extension." msgstr "" -#: ../../library/shutil.rst:599 +#: ../../library/shutil.rst:600 msgid "" "*format* is the archive format: one of \"zip\" (if the :mod:`zlib` module is " "available), \"tar\", \"gztar\" (if the :mod:`zlib` module is available), " @@ -798,14 +799,14 @@ msgid "" "`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:604 +#: ../../library/shutil.rst:605 msgid "" "*root_dir* is a directory that will be the root directory of the archive, " "all paths in the archive will be relative to it; for example, we typically " "chdir into *root_dir* before creating the archive." msgstr "" -#: ../../library/shutil.rst:608 +#: ../../library/shutil.rst:609 msgid "" "*base_dir* is the directory where we start archiving from; i.e. *base_dir* " "will be the common prefix of all files and directories in the archive. " @@ -813,33 +814,33 @@ msgid "" "example-with-basedir` for how to use *base_dir* and *root_dir* together." msgstr "" -#: ../../library/shutil.rst:614 +#: ../../library/shutil.rst:615 msgid "*root_dir* and *base_dir* both default to the current directory." msgstr "" -#: ../../library/shutil.rst:616 +#: ../../library/shutil.rst:617 msgid "" "If *dry_run* is true, no archive is created, but the operations that would " "be executed are logged to *logger*." msgstr "" -#: ../../library/shutil.rst:619 +#: ../../library/shutil.rst:620 msgid "" "*owner* and *group* are used when creating a tar archive. By default, uses " "the current owner and group." msgstr "" -#: ../../library/shutil.rst:622 +#: ../../library/shutil.rst:623 msgid "" "*logger* must be an object compatible with :pep:`282`, usually an instance " "of :class:`logging.Logger`." msgstr "" -#: ../../library/shutil.rst:625 +#: ../../library/shutil.rst:626 msgid "The *verbose* argument is unused and deprecated." msgstr "" -#: ../../library/shutil.rst:627 +#: ../../library/shutil.rst:628 msgid "" "Raises an :ref:`auditing event ` ``shutil.make_archive`` with " "arguments ``base_name``, ``format``, ``root_dir``, ``base_dir``." @@ -847,7 +848,7 @@ msgstr "" "引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的\\ :" "ref:`稽核事件 ` ``shutil.make_archive``。" -#: ../../library/shutil.rst:631 +#: ../../library/shutil.rst:632 msgid "" "This function is not thread-safe when custom archivers registered with :func:" "`register_archive_format` do not support the *root_dir* argument. In this " @@ -855,60 +856,60 @@ msgid "" "*root_dir* to perform archiving." msgstr "" -#: ../../library/shutil.rst:637 +#: ../../library/shutil.rst:638 msgid "" "The modern pax (POSIX.1-2001) format is now used instead of the legacy GNU " "format for archives created with ``format=\"tar\"``." msgstr "" -#: ../../library/shutil.rst:641 +#: ../../library/shutil.rst:642 msgid "" "This function is now made thread-safe during creation of standard ``.zip`` " "and tar archives." msgstr "" -#: ../../library/shutil.rst:647 +#: ../../library/shutil.rst:648 msgid "" "Return a list of supported formats for archiving. Each element of the " "returned sequence is a tuple ``(name, description)``." msgstr "" -#: ../../library/shutil.rst:650 ../../library/shutil.rst:761 +#: ../../library/shutil.rst:651 ../../library/shutil.rst:762 msgid "By default :mod:`shutil` provides these formats:" msgstr "" -#: ../../library/shutil.rst:652 +#: ../../library/shutil.rst:653 msgid "*zip*: ZIP file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:653 +#: ../../library/shutil.rst:654 msgid "" "*tar*: Uncompressed tar file. Uses POSIX.1-2001 pax format for new archives." msgstr "" -#: ../../library/shutil.rst:654 ../../library/shutil.rst:766 +#: ../../library/shutil.rst:655 ../../library/shutil.rst:767 msgid "*gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:655 ../../library/shutil.rst:767 +#: ../../library/shutil.rst:656 ../../library/shutil.rst:768 msgid "*bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available)." msgstr "" -#: ../../library/shutil.rst:656 ../../library/shutil.rst:768 +#: ../../library/shutil.rst:657 ../../library/shutil.rst:769 msgid "*xztar*: xz'ed tar-file (if the :mod:`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:658 +#: ../../library/shutil.rst:659 msgid "" "You can register new formats or provide your own archiver for any existing " "formats, by using :func:`register_archive_format`." msgstr "" -#: ../../library/shutil.rst:664 +#: ../../library/shutil.rst:665 msgid "Register an archiver for the format *name*." msgstr "" -#: ../../library/shutil.rst:666 +#: ../../library/shutil.rst:667 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive the *base_name* of the file to create, followed by the " @@ -917,7 +918,7 @@ msgid "" "*dry_run* and *logger* (as passed in :func:`make_archive`)." msgstr "" -#: ../../library/shutil.rst:672 +#: ../../library/shutil.rst:673 msgid "" "If *function* has the custom attribute ``function.supports_root_dir`` set to " "``True``, the *root_dir* argument is passed as a keyword argument. Otherwise " @@ -926,37 +927,37 @@ msgid "" "not thread-safe." msgstr "" -#: ../../library/shutil.rst:678 +#: ../../library/shutil.rst:679 msgid "" "If given, *extra_args* is a sequence of ``(name, value)`` pairs that will be " "used as extra keywords arguments when the archiver callable is used." msgstr "" -#: ../../library/shutil.rst:681 +#: ../../library/shutil.rst:682 msgid "" "*description* is used by :func:`get_archive_formats` which returns the list " "of archivers. Defaults to an empty string." msgstr "" -#: ../../library/shutil.rst:684 +#: ../../library/shutil.rst:685 msgid "Added support for functions supporting the *root_dir* argument." msgstr "" -#: ../../library/shutil.rst:690 +#: ../../library/shutil.rst:691 msgid "Remove the archive format *name* from the list of supported formats." msgstr "" -#: ../../library/shutil.rst:695 +#: ../../library/shutil.rst:696 msgid "Unpack an archive. *filename* is the full path of the archive." msgstr "" -#: ../../library/shutil.rst:697 +#: ../../library/shutil.rst:698 msgid "" "*extract_dir* is the name of the target directory where the archive is " "unpacked. If not provided, the current working directory is used." msgstr "" -#: ../../library/shutil.rst:700 +#: ../../library/shutil.rst:701 msgid "" "*format* is the archive format: one of \"zip\", \"tar\", \"gztar\", " "\"bztar\", or \"xztar\". Or any other format registered with :func:" @@ -965,7 +966,7 @@ msgid "" "that extension. In case none is found, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/shutil.rst:707 +#: ../../library/shutil.rst:708 msgid "" "The keyword-only *filter* argument is passed to the underlying unpacking " "function. For zip files, *filter* is not accepted. For tar files, it is " @@ -975,7 +976,7 @@ msgid "" "Python 3.14." msgstr "" -#: ../../library/shutil.rst:715 +#: ../../library/shutil.rst:716 msgid "" "Raises an :ref:`auditing event ` ``shutil.unpack_archive`` with " "arguments ``filename``, ``extract_dir``, ``format``." @@ -983,7 +984,7 @@ msgstr "" "引發一個附帶引數 ``filename``、``extract_dir``、``format`` 的\\ :ref:`稽核事" "件 ` ``shutil.unpack_archive``。" -#: ../../library/shutil.rst:719 +#: ../../library/shutil.rst:720 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of the path specified in the " @@ -991,91 +992,91 @@ msgid "" "with \"/\" or filenames with two dots \"..\"." msgstr "" -#: ../../library/shutil.rst:724 +#: ../../library/shutil.rst:725 msgid "Accepts a :term:`path-like object` for *filename* and *extract_dir*." msgstr "" -#: ../../library/shutil.rst:727 +#: ../../library/shutil.rst:728 msgid "Added the *filter* argument." msgstr "新增 *filter* 引數。" -#: ../../library/shutil.rst:732 +#: ../../library/shutil.rst:733 msgid "" "Registers an unpack format. *name* is the name of the format and " "*extensions* is a list of extensions corresponding to the format, like ``." "zip`` for Zip files." msgstr "" -#: ../../library/shutil.rst:736 +#: ../../library/shutil.rst:737 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive:" msgstr "" -#: ../../library/shutil.rst:739 +#: ../../library/shutil.rst:740 msgid "the path of the archive, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:740 +#: ../../library/shutil.rst:741 msgid "" "the directory the archive must be extracted to, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:741 +#: ../../library/shutil.rst:742 msgid "" "possibly a *filter* keyword argument, if it was given to :func:" "`unpack_archive`;" msgstr "" -#: ../../library/shutil.rst:743 +#: ../../library/shutil.rst:744 msgid "" "additional keyword arguments, specified by *extra_args* as a sequence of " "``(name, value)`` tuples." msgstr "" -#: ../../library/shutil.rst:746 +#: ../../library/shutil.rst:747 msgid "" "*description* can be provided to describe the format, and will be returned " "by the :func:`get_unpack_formats` function." msgstr "" -#: ../../library/shutil.rst:752 +#: ../../library/shutil.rst:753 msgid "Unregister an unpack format. *name* is the name of the format." msgstr "" -#: ../../library/shutil.rst:757 +#: ../../library/shutil.rst:758 msgid "" "Return a list of all registered formats for unpacking. Each element of the " "returned sequence is a tuple ``(name, extensions, description)``." msgstr "" -#: ../../library/shutil.rst:763 +#: ../../library/shutil.rst:764 msgid "" "*zip*: ZIP file (unpacking compressed files works only if the corresponding " "module is available)." msgstr "" -#: ../../library/shutil.rst:765 +#: ../../library/shutil.rst:766 msgid "*tar*: uncompressed tar file." msgstr "" -#: ../../library/shutil.rst:770 +#: ../../library/shutil.rst:771 msgid "" "You can register new formats or provide your own unpacker for any existing " "formats, by using :func:`register_unpack_format`." msgstr "" -#: ../../library/shutil.rst:777 +#: ../../library/shutil.rst:778 msgid "Archiving example" msgstr "" -#: ../../library/shutil.rst:779 +#: ../../library/shutil.rst:780 msgid "" "In this example, we create a gzip'ed tar-file archive containing all files " "found in the :file:`.ssh` directory of the user::" msgstr "" -#: ../../library/shutil.rst:782 +#: ../../library/shutil.rst:783 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1085,11 +1086,11 @@ msgid "" "'/Users/tarek/myarchive.tar.gz'" msgstr "" -#: ../../library/shutil.rst:789 +#: ../../library/shutil.rst:790 msgid "The resulting archive contains:" msgstr "" -#: ../../library/shutil.rst:791 +#: ../../library/shutil.rst:792 msgid "" "$ tar -tzvf /Users/tarek/myarchive.tar.gz\n" "drwx------ tarek/staff 0 2010-02-01 16:23:40 ./\n" @@ -1111,18 +1112,18 @@ msgstr "" "-rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub\n" "-rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts" -#: ../../library/shutil.rst:807 +#: ../../library/shutil.rst:808 msgid "Archiving example with *base_dir*" msgstr "" -#: ../../library/shutil.rst:809 +#: ../../library/shutil.rst:810 msgid "" "In this example, similar to the `one above `_, we " "show how to use :func:`make_archive`, but this time with the usage of " "*base_dir*. We now have the following directory structure:" msgstr "" -#: ../../library/shutil.rst:813 +#: ../../library/shutil.rst:814 msgid "" "$ tree tmp\n" "tmp\n" @@ -1140,13 +1141,13 @@ msgstr "" " └── please_add.txt\n" " └── do_not_add.txt" -#: ../../library/shutil.rst:823 +#: ../../library/shutil.rst:824 msgid "" "In the final archive, :file:`please_add.txt` should be included, but :file:" "`do_not_add.txt` should not. Therefore we use the following::" msgstr "" -#: ../../library/shutil.rst:826 +#: ../../library/shutil.rst:827 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1170,11 +1171,11 @@ msgstr "" "... )\n" "'/Users/tarek/my_archive.tar'" -#: ../../library/shutil.rst:837 +#: ../../library/shutil.rst:838 msgid "Listing the files in the resulting archive gives us:" msgstr "" -#: ../../library/shutil.rst:839 +#: ../../library/shutil.rst:840 msgid "" "$ python -m tarfile -l /Users/tarek/myarchive.tar\n" "structure/content/\n" @@ -1184,29 +1185,29 @@ msgstr "" "structure/content/\n" "structure/content/please_add.txt" -#: ../../library/shutil.rst:847 +#: ../../library/shutil.rst:848 msgid "Querying the size of the output terminal" msgstr "" -#: ../../library/shutil.rst:851 +#: ../../library/shutil.rst:852 msgid "Get the size of the terminal window." msgstr "" -#: ../../library/shutil.rst:853 +#: ../../library/shutil.rst:854 msgid "" "For each of the two dimensions, the environment variable, ``COLUMNS`` and " "``LINES`` respectively, is checked. If the variable is defined and the value " "is a positive integer, it is used." msgstr "" -#: ../../library/shutil.rst:857 +#: ../../library/shutil.rst:858 msgid "" "When ``COLUMNS`` or ``LINES`` is not defined, which is the common case, the " "terminal connected to :data:`sys.__stdout__` is queried by invoking :func:" "`os.get_terminal_size`." msgstr "" -#: ../../library/shutil.rst:861 +#: ../../library/shutil.rst:862 msgid "" "If the terminal size cannot be successfully queried, either because the " "system doesn't support querying, or because we are not connected to a " @@ -1215,17 +1216,17 @@ msgid "" "emulators." msgstr "" -#: ../../library/shutil.rst:867 +#: ../../library/shutil.rst:868 msgid "The value returned is a named tuple of type :class:`os.terminal_size`." msgstr "" -#: ../../library/shutil.rst:869 +#: ../../library/shutil.rst:870 msgid "" "See also: The Single UNIX Specification, Version 2, `Other Environment " "Variables`_." msgstr "" -#: ../../library/shutil.rst:874 +#: ../../library/shutil.rst:875 msgid "" "The ``fallback`` values are also used if :func:`os.get_terminal_size` " "returns zeroes." diff --git a/library/signal.po b/library/signal.po index 12239bc8b0..f177d710de 100644 --- a/library/signal.po +++ b/library/signal.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -469,8 +469,10 @@ msgid "See the :manpage:`pidfd_send_signal(2)` man page for more information." msgstr "更多資訊請見 :manpage:`pidfd_send_signal(2)` 手冊頁。" #: ../../library/signal.rst:414 -msgid ":ref:`Availability `: Linux >= 5.1" -msgstr ":ref:`適用 `:Linux 5.1 以上" +msgid "" +":ref:`Availability `: Linux >= 5.1, Android >= :func:`build-" +"time ` API level 31" +msgstr "" #: ../../library/signal.rst:420 msgid "" @@ -950,3 +952,6 @@ msgid "" "serve_forever(httpd)\n" "print(\"Shutdown...\")" msgstr "" + +#~ msgid ":ref:`Availability `: Linux >= 5.1" +#~ msgstr ":ref:`適用 `:Linux 5.1 以上" diff --git a/library/stdtypes.po b/library/stdtypes.po index d677d5a401..6ba75aed17 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+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-" @@ -35,7 +35,7 @@ msgstr "以下章節描述了直譯器中内建的標準型別。" msgid "" "The principal built-in types are numerics, sequences, mappings, classes, " "instances and exceptions." -msgstr "主要內建型別為數字、序列、映射、class(類別)、實例和例外。" +msgstr "主要內建型別為數字、序列、對映、class(類別)、實例和例外。" #: ../../library/stdtypes.rst:18 msgid "" @@ -7894,76 +7894,36 @@ msgstr "" #: ../../library/stdtypes.rst:5491 msgid "" -"A dictionary or other mapping object used to store an object's (writable) " -"attributes." -msgstr "" - -#: ../../library/stdtypes.rst:5497 -msgid "The class to which a class instance belongs." -msgstr "" - -#: ../../library/stdtypes.rst:5502 -msgid "The tuple of base classes of a class object." -msgstr "" - -#: ../../library/stdtypes.rst:5507 -msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5513 +#: ../../library/stdtypes.rst:5497 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5521 -msgid "" -"The :ref:`type parameters ` of generic classes, functions, and :" -"ref:`type aliases `." +#: ../../library/stdtypes.rst:5505 +msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5529 +#: ../../library/stdtypes.rst:5510 msgid "" -"This attribute is a tuple of classes that are considered when looking for " -"base classes during method resolution." +"The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5535 +#: ../../library/stdtypes.rst:5515 msgid "" -"This method can be overridden by a metaclass to customize the method " -"resolution order for its instances. It is called at class instantiation, " -"and its result is stored in :attr:`~class.__mro__`." -msgstr "" - -#: ../../library/stdtypes.rst:5542 -msgid "" -"Each class keeps a list of weak references to its immediate subclasses. " -"This method returns a list of all those references still alive. The list is " -"in definition order. Example::" -msgstr "" - -#: ../../library/stdtypes.rst:5546 -msgid "" -">>> int.__subclasses__()\n" -"[, , , ]" -msgstr "" -">>> int.__subclasses__()\n" -"[, , , ]" - -#: ../../library/stdtypes.rst:5552 -msgid "" -"A tuple containing names of attributes of this class which are accessed " -"through ``self.X`` from any function in its body." +"The :ref:`type parameters ` of generic classes, functions, and :" +"ref:`type aliases `. For classes and functions that are not " +"generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:5560 +#: ../../library/stdtypes.rst:5525 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5562 +#: ../../library/stdtypes.rst:5527 msgid "" "CPython has a global limit for converting between :class:`int` and :class:" "`str` to mitigate denial of service attacks. This limit *only* applies to " @@ -7971,7 +7931,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5567 +#: ../../library/stdtypes.rst:5532 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -7981,24 +7941,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5574 +#: ../../library/stdtypes.rst:5539 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5576 +#: ../../library/stdtypes.rst:5541 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:5580 +#: ../../library/stdtypes.rst:5545 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5582 +#: ../../library/stdtypes.rst:5547 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8022,7 +7982,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:5602 +#: ../../library/stdtypes.rst:5567 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -8030,11 +7990,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5607 +#: ../../library/stdtypes.rst:5572 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5609 +#: ../../library/stdtypes.rst:5574 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8045,84 +8005,84 @@ msgid "" "..." msgstr "" -#: ../../library/stdtypes.rst:5622 +#: ../../library/stdtypes.rst:5587 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:5624 +#: ../../library/stdtypes.rst:5589 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5627 +#: ../../library/stdtypes.rst:5592 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:5628 +#: ../../library/stdtypes.rst:5593 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5629 +#: ../../library/stdtypes.rst:5594 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5630 +#: ../../library/stdtypes.rst:5595 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5631 +#: ../../library/stdtypes.rst:5596 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5634 +#: ../../library/stdtypes.rst:5599 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5636 +#: ../../library/stdtypes.rst:5601 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5637 +#: ../../library/stdtypes.rst:5602 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:5638 +#: ../../library/stdtypes.rst:5603 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:5639 +#: ../../library/stdtypes.rst:5604 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5640 +#: ../../library/stdtypes.rst:5605 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5641 +#: ../../library/stdtypes.rst:5606 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5644 +#: ../../library/stdtypes.rst:5609 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:5646 +#: ../../library/stdtypes.rst:5611 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:5649 +#: ../../library/stdtypes.rst:5614 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:5652 +#: ../../library/stdtypes.rst:5617 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8130,7 +8090,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:5654 +#: ../../library/stdtypes.rst:5619 msgid "" ":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" "`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " @@ -8139,38 +8099,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:5660 +#: ../../library/stdtypes.rst:5625 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5663 +#: ../../library/stdtypes.rst:5628 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:5667 +#: ../../library/stdtypes.rst:5632 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5669 +#: ../../library/stdtypes.rst:5634 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5671 +#: ../../library/stdtypes.rst:5636 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:5678 +#: ../../library/stdtypes.rst:5643 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -8182,7 +8142,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5687 +#: ../../library/stdtypes.rst:5652 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -8190,11 +8150,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5693 +#: ../../library/stdtypes.rst:5658 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:5695 +#: ../../library/stdtypes.rst:5660 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -8202,11 +8162,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5700 +#: ../../library/stdtypes.rst:5665 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5702 +#: ../../library/stdtypes.rst:5667 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -8219,38 +8179,38 @@ msgid "" "... sys.set_int_max_str_digits(lower_bound)" msgstr "" -#: ../../library/stdtypes.rst:5712 +#: ../../library/stdtypes.rst:5677 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5716 +#: ../../library/stdtypes.rst:5681 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:5717 +#: ../../library/stdtypes.rst:5682 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5720 +#: ../../library/stdtypes.rst:5685 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5723 +#: ../../library/stdtypes.rst:5688 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5725 +#: ../../library/stdtypes.rst:5690 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:5728 +#: ../../library/stdtypes.rst:5693 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -9002,3 +8962,12 @@ msgstr "..." #: ../../library/stdtypes.rst:5442 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" + +#~ msgid "" +#~ ">>> int.__subclasses__()\n" +#~ "[, , , ]" +#~ msgstr "" +#~ ">>> int.__subclasses__()\n" +#~ "[, , , ]" diff --git a/library/string.po b/library/string.po index acd1fea713..f35d8e3922 100644 --- a/library/string.po +++ b/library/string.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -884,36 +884,37 @@ msgstr "" #: ../../library/string.rst:577 msgid "" -"For :class:`float` this is the same as ``'g'``, except that when fixed-point " -"notation is used to format the result, it always includes at least one digit " -"past the decimal point. The precision used is as large as needed to " -"represent the given value faithfully." +"For :class:`float` this is like the ``'g'`` type, except that when fixed-" +"point notation is used to format the result, it always includes at least one " +"digit past the decimal point, and switches to the scientific notation when " +"``exp >= p - 1``. When the precision is not specified, the latter will be " +"as large as needed to represent the given value faithfully." msgstr "" -#: ../../library/string.rst:583 +#: ../../library/string.rst:585 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: ../../library/string.rst:587 +#: ../../library/string.rst:589 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:595 +#: ../../library/string.rst:597 msgid "Format examples" msgstr "格式範例" -#: ../../library/string.rst:597 +#: ../../library/string.rst:599 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "本節包含 :meth:`str.format` 語法以及與舊式 ``%`` 格式的比較。" -#: ../../library/string.rst:600 +#: ../../library/string.rst:602 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " @@ -922,17 +923,17 @@ msgstr "" "此語法在大多情況下與舊式的 ``%`` 格式類似,只是增加了 ``{}`` 和 ``:`` 來取代 " "``%``。例如,``'%03.2f'`` 可以改寫為 ``'{:03.2f}'``。" -#: ../../library/string.rst:604 +#: ../../library/string.rst:606 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "新的語法還支援新的選項,將在以下的範例中說明。" -#: ../../library/string.rst:607 +#: ../../library/string.rst:609 msgid "Accessing arguments by position::" msgstr "按位置存取引數: ::" -#: ../../library/string.rst:609 +#: ../../library/string.rst:611 msgid "" ">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" "'a, b, c'\n" @@ -947,11 +948,11 @@ msgid "" "'abracadabra'" msgstr "" -#: ../../library/string.rst:620 +#: ../../library/string.rst:622 msgid "Accessing arguments by name::" msgstr "按名稱存取引數: ::" -#: ../../library/string.rst:622 +#: ../../library/string.rst:624 msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" @@ -961,11 +962,11 @@ msgid "" "'Coordinates: 37.24N, -115.81W'" msgstr "" -#: ../../library/string.rst:628 +#: ../../library/string.rst:630 msgid "Accessing arguments' attributes::" msgstr "存取引數的屬性: ::" -#: ../../library/string.rst:630 +#: ../../library/string.rst:632 msgid "" ">>> c = 3-5j\n" ">>> ('The complex number {0} is formed from the real part {0.real} '\n" @@ -982,22 +983,22 @@ msgid "" "'Point(4, 2)'" msgstr "" -#: ../../library/string.rst:643 +#: ../../library/string.rst:645 msgid "Accessing arguments' items::" msgstr "存取引數的內容: ::" -#: ../../library/string.rst:645 +#: ../../library/string.rst:647 msgid "" ">>> coord = (3, 5)\n" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" "'X: 3; Y: 5'" msgstr "" -#: ../../library/string.rst:649 +#: ../../library/string.rst:651 msgid "Replacing ``%s`` and ``%r``::" msgstr "替換 ``%s`` 和 ``%r``: ::" -#: ../../library/string.rst:651 +#: ../../library/string.rst:653 msgid "" ">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " "'test2')\n" @@ -1007,11 +1008,11 @@ msgstr "" "'test2')\n" "\"repr() shows quotes: 'test1'; str() doesn't: test2\"" -#: ../../library/string.rst:654 +#: ../../library/string.rst:656 msgid "Aligning the text and specifying a width::" msgstr "對齊文字以及指定寬度: ::" -#: ../../library/string.rst:656 +#: ../../library/string.rst:658 msgid "" ">>> '{:<30}'.format('left aligned')\n" "'left aligned '\n" @@ -1023,11 +1024,11 @@ msgid "" "'***********centered***********'" msgstr "" -#: ../../library/string.rst:665 +#: ../../library/string.rst:667 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "替換 ``%+f``、``%-f`` 和 ``% f`` 以及指定正負號: ::" -#: ../../library/string.rst:667 +#: ../../library/string.rst:669 msgid "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" @@ -1038,12 +1039,12 @@ msgid "" "'3.140000; -3.140000'" msgstr "" -#: ../../library/string.rst:674 +#: ../../library/string.rst:676 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "替換 ``%x`` 和 ``%o`` 並將其值轉換為不同的進位制: ::" -#: ../../library/string.rst:676 +#: ../../library/string.rst:678 msgid "" ">>> # format also supports binary numbers\n" ">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" @@ -1053,11 +1054,11 @@ msgid "" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" msgstr "" -#: ../../library/string.rst:683 +#: ../../library/string.rst:685 msgid "Using the comma as a thousands separator::" msgstr "使用逗號作為千位分隔符: ::" -#: ../../library/string.rst:685 +#: ../../library/string.rst:687 msgid "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" @@ -1065,11 +1066,11 @@ msgstr "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" -#: ../../library/string.rst:688 +#: ../../library/string.rst:690 msgid "Expressing a percentage::" msgstr "表示為百分比: ::" -#: ../../library/string.rst:690 +#: ../../library/string.rst:692 msgid "" ">>> points = 19\n" ">>> total = 22\n" @@ -1081,11 +1082,11 @@ msgstr "" ">>> 'Correct answers: {:.2%}'.format(points/total)\n" "'Correct answers: 86.36%'" -#: ../../library/string.rst:695 +#: ../../library/string.rst:697 msgid "Using type-specific formatting::" msgstr "作為特定型別格式: ::" -#: ../../library/string.rst:697 +#: ../../library/string.rst:699 msgid "" ">>> import datetime\n" ">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" @@ -1097,11 +1098,11 @@ msgstr "" ">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" "'2010-07-04 12:15:58'" -#: ../../library/string.rst:702 +#: ../../library/string.rst:704 msgid "Nesting arguments and more complex examples::" msgstr "巢狀引數及更多複雜範例: ::" -#: ../../library/string.rst:704 +#: ../../library/string.rst:706 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1159,11 +1160,11 @@ msgstr "" " 10 A 12 1010\n" " 11 B 13 1011" -#: ../../library/string.rst:736 +#: ../../library/string.rst:738 msgid "Template strings" msgstr "模板字串" -#: ../../library/string.rst:738 +#: ../../library/string.rst:740 msgid "" "Template strings provide simpler string substitutions as described in :pep:" "`292`. A primary use case for template strings is for internationalization " @@ -1177,17 +1178,17 @@ msgstr "" "化工具更容易翻譯。基於模板字串建構的 i18n 函式庫範例,請參閱 `flufl.i18n " "`_ 套件。" -#: ../../library/string.rst:748 +#: ../../library/string.rst:750 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:750 +#: ../../library/string.rst:752 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:752 +#: ../../library/string.rst:754 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1197,30 +1198,30 @@ msgid "" "specification." msgstr "" -#: ../../library/string.rst:759 +#: ../../library/string.rst:761 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: ../../library/string.rst:763 +#: ../../library/string.rst:765 msgid "" "Any other appearance of ``$`` in the string will result in a :exc:" "`ValueError` being raised." msgstr "" -#: ../../library/string.rst:766 +#: ../../library/string.rst:768 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:772 +#: ../../library/string.rst:774 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:777 +#: ../../library/string.rst:779 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -1232,7 +1233,7 @@ msgstr "" "的字典型物件。或者如果關鍵字就是佔位符號時,你也可以改提供關鍵字引數。當 " "*mapping* 跟 *kwds* 同時給定並存在重複時,*kwds* 的佔位符號會被優先使用。" -#: ../../library/string.rst:786 +#: ../../library/string.rst:788 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -1245,7 +1246,7 @@ msgstr "" "與 :meth:`substitute` 不同的是,任何包含 ``$`` 的字句會直接回傳 ``$`` 而非引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:792 +#: ../../library/string.rst:794 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -1259,7 +1260,7 @@ msgstr "" "完全安全,因為它會默默忽略格式錯誤的模板,這些模板包含了多餘的左右定界符、不" "匹配的括號,或者不是有效的 Python 識別字的佔位符號。" -#: ../../library/string.rst:802 +#: ../../library/string.rst:804 msgid "" "Returns false if the template has invalid placeholders that will cause :meth:" "`substitute` to raise :exc:`ValueError`." @@ -1267,18 +1268,18 @@ msgstr "" "如果模板有將導致 :meth:`substitute` 引發 :exc:`ValueError` 的無效佔位符號,就" "會回傳 false。" -#: ../../library/string.rst:810 +#: ../../library/string.rst:812 msgid "" "Returns a list of the valid identifiers in the template, in the order they " "first appear, ignoring any invalid identifiers." msgstr "" "回傳模板中有效識別字的串列,按照它們首次出現的順序,並忽略任何無效的識別字。" -#: ../../library/string.rst:815 +#: ../../library/string.rst:817 msgid ":class:`Template` instances also provide one public data attribute:" msgstr ":class:`Template` 實例也提供一個公開的資料屬性:" -#: ../../library/string.rst:819 +#: ../../library/string.rst:821 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." @@ -1286,11 +1287,11 @@ msgstr "" "這是傳遞給建構函式 *template* 引數的物件。一般來說,你不應該改變它,但並沒有" "強制設定成唯讀。" -#: ../../library/string.rst:822 +#: ../../library/string.rst:824 msgid "Here is an example of how to use a Template::" msgstr "以下是如何使用 Template 的一個範例: ::" -#: ../../library/string.rst:824 +#: ../../library/string.rst:826 msgid "" ">>> from string import Template\n" ">>> s = Template('$who likes $what')\n" @@ -1324,7 +1325,7 @@ msgstr "" ">>> Template('$who likes $what').safe_substitute(d)\n" "'tim likes $what'" -#: ../../library/string.rst:840 +#: ../../library/string.rst:842 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1334,7 +1335,7 @@ msgstr "" "進階用法:你可以衍生 :class:`Template` 類別來自定義佔位符號語法、左右定界符字" "元,或者用於剖析模板字串的正規表示式。你可以透過覆寫這些類別屬性來達成:" -#: ../../library/string.rst:845 +#: ../../library/string.rst:847 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " @@ -1348,7 +1349,7 @@ msgstr "" "注意你不能在建立類別後修改左右定界符。(意即在子類別的命名空間中必須設置不同" "的左右定界符)" -#: ../../library/string.rst:852 +#: ../../library/string.rst:854 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1356,19 +1357,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:859 +#: ../../library/string.rst:861 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: ../../library/string.rst:863 +#: ../../library/string.rst:865 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:867 +#: ../../library/string.rst:869 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1377,7 +1378,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:875 +#: ../../library/string.rst:877 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1386,7 +1387,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:883 +#: ../../library/string.rst:885 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1395,13 +1396,13 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:889 +#: ../../library/string.rst:891 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "*escaped* -- 此群組與跳脫序列匹配,例如在預設模式下為 ``$$``。" -#: ../../library/string.rst:892 +#: ../../library/string.rst:894 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." @@ -1409,7 +1410,7 @@ msgstr "" "*named* -- 此群組與不帶大括號的佔位符號名稱匹配;它不應包含擷取群組中的左右定" "界符號。" -#: ../../library/string.rst:895 +#: ../../library/string.rst:897 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." @@ -1417,7 +1418,7 @@ msgstr "" "*braced* -- 此群組與大括號括起來的佔位符號名稱匹配;它不應在擷取群組中包含左" "右定界符或大括號。" -#: ../../library/string.rst:898 +#: ../../library/string.rst:900 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." @@ -1425,7 +1426,7 @@ msgstr "" "*invalid* -- 此群組與任何其他左右定界符模式(通常是單一左右定界符)匹配,且它" "應該出現在正規表示式的最後。" -#: ../../library/string.rst:901 +#: ../../library/string.rst:903 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." @@ -1433,11 +1434,11 @@ msgstr "" "當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引發 :exc:" "`ValueError`。" -#: ../../library/string.rst:906 +#: ../../library/string.rst:908 msgid "Helper functions" msgstr "輔助函式" -#: ../../library/string.rst:910 +#: ../../library/string.rst:912 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " "using :meth:`str.capitalize`, and join the capitalized words using :meth:" @@ -1518,10 +1519,10 @@ msgstr ", (逗號)" msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../library/string.rst:746 +#: ../../library/string.rst:748 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/string.rst:746 +#: ../../library/string.rst:748 msgid "in template strings" msgstr "於 template strings(模板字串)" diff --git a/library/test.po b/library/test.po index a3d5c4d723..e0fe8b9e31 100644 --- a/library/test.po +++ b/library/test.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1156,9 +1156,9 @@ msgstr "" #: ../../library/test.rst:948 msgid "" "The *extra* argument can be a set of names that wouldn't otherwise be " -"automatically detected as \"public\", like objects without a proper " -"``__module__`` attribute. If provided, it will be added to the automatically " -"detected ones." +"automatically detected as \"public\", like objects without a proper :attr:" +"`~definition.__module__` attribute. If provided, it will be added to the " +"automatically detected ones." msgstr "" #: ../../library/test.rst:952 diff --git a/library/tomllib.po b/library/tomllib.po index 438b4e5eb0..45bf2403d2 100644 --- a/library/tomllib.po +++ b/library/tomllib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2022-11-18 01:56+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,11 +27,10 @@ msgid "**Source code:** :source:`Lib/tomllib`" msgstr "**原始碼:**\\ :source:`Lib/tomllib`" #: ../../library/tomllib.rst:16 -#, fuzzy msgid "" -"This module provides an interface for parsing TOML (Tom's Obvious Minimal " -"Language, `https://toml.io `_). This module does not " -"support writing TOML." +"This module provides an interface for parsing TOML 1.0.0 (Tom's Obvious " +"Minimal Language, `https://toml.io `_). This module " +"does not support writing TOML." msgstr "" "此模組提供了剖析 TOML 1.0.0 (Tom's Obvious Minimal Language, `https://toml." "io `_) 的一個介面,此模組並不支援寫入 TOML。" diff --git a/library/types.po b/library/types.po index 6cae9bb452..cd7e8ca1ba 100644 --- a/library/types.po +++ b/library/types.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+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-" @@ -141,7 +141,8 @@ msgstr "" msgid "" "For classes that have an ``__orig_bases__`` attribute, this function returns " "the value of ``cls.__orig_bases__``. For classes without the " -"``__orig_bases__`` attribute, ``cls.__bases__`` is returned." +"``__orig_bases__`` attribute, :attr:`cls.__bases__ ` is " +"returned." msgstr "" #: ../../library/types.rst:97 @@ -510,7 +511,7 @@ msgid "" "In addition, when a class is defined with a :attr:`~object.__slots__` " "attribute, then for each slot, an instance of :class:`!MemberDescriptorType` " "will be added as an attribute on the class. This allows the slot to appear " -"in the class's :attr:`~object.__dict__`." +"in the class's :attr:`~type.__dict__`." msgstr "" #: ../../library/types.rst:399 diff --git a/library/typing.po b/library/typing.po index 60f44beffd..f9b1cfb9a4 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-30 09:19+0000\n" "PO-Revision-Date: 2024-07-11 11:12+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -387,8 +387,8 @@ msgstr "" "str]`` 象徵為一個函式,可以接受一個型別為 :class:`int` 的引數,並回傳一個 :" "class:`str`。" -#: ../../library/typing.rst:215 ../../library/typing.rst:3109 -#: ../../library/typing.rst:3287 +#: ../../library/typing.rst:215 ../../library/typing.rst:3128 +#: ../../library/typing.rst:3308 msgid "For example:" msgstr "舉例來說:" @@ -492,7 +492,7 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:285 ../../library/typing.rst:3777 +#: ../../library/typing.rst:285 ../../library/typing.rst:3798 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." @@ -1434,8 +1434,8 @@ msgstr "" #: ../../library/typing.rst:868 ../../library/typing.rst:986 #: ../../library/typing.rst:1043 ../../library/typing.rst:1209 #: ../../library/typing.rst:1270 ../../library/typing.rst:1312 -#: ../../library/typing.rst:1510 ../../library/typing.rst:1571 -#: ../../library/typing.rst:3046 ../../library/typing.rst:3272 +#: ../../library/typing.rst:1527 ../../library/typing.rst:1588 +#: ../../library/typing.rst:3065 ../../library/typing.rst:3293 msgid "For example::" msgstr "舉例來說: ::" @@ -1502,7 +1502,7 @@ msgstr "" "此。然而,若是一個型別僅為 ``str`` 的物件則不相容。一個字串若是透過組合多個 " "``LiteralString`` 型別的物件建立,則此字串也可以視為 ``LiteralString``。" -#: ../../library/typing.rst:912 ../../library/typing.rst:2142 +#: ../../library/typing.rst:912 ../../library/typing.rst:2159 msgid "Example:" msgstr "舉例來說: ::" @@ -1957,7 +1957,7 @@ msgid "" "sum_threadsafe([1.1, 2.2, 3.3])" msgstr "" -#: ../../library/typing.rst:1196 ../../library/typing.rst:2110 +#: ../../library/typing.rst:1196 ../../library/typing.rst:2127 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)" @@ -1967,7 +1967,7 @@ msgstr ":pep:`612` -- 參數技術規範變數" msgid ":class:`ParamSpec`" msgstr ":class:`ParamSpec`" -#: ../../library/typing.rst:1199 ../../library/typing.rst:2113 +#: ../../library/typing.rst:1199 ../../library/typing.rst:2130 msgid ":ref:`annotating-callables`" msgstr ":ref:`annotating-callables`" @@ -2066,7 +2066,7 @@ msgstr "" #: ../../library/typing.rst:1265 msgid "Special typing construct to indicate final names to type checkers." -msgstr "特殊型別建構,用來指出最終名稱給型別檢查器。" +msgstr "特殊型別建構,用來指出給型別檢查器的最終名稱。" #: ../../library/typing.rst:1267 msgid "" @@ -2088,7 +2088,7 @@ msgid "" " TIMEOUT = 1 # Error reported by type checker" msgstr "" -#: ../../library/typing.rst:1281 ../../library/typing.rst:3062 +#: ../../library/typing.rst:1281 ../../library/typing.rst:3081 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." @@ -2122,11 +2122,10 @@ msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" #: ../../library/typing.rst:1310 -#, fuzzy msgid "" "A special typing construct to mark an item of a :class:`TypedDict` as read-" "only." -msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是必須的。" +msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 的項目是唯讀的。" #: ../../library/typing.rst:1314 msgid "" @@ -2140,15 +2139,12 @@ msgid "" msgstr "" #: ../../library/typing.rst:1322 -#, fuzzy msgid "There is no runtime checking for this property." -msgstr "" -"這些屬性 (property) 不會在 runtime 時進行檢查。更多詳細資訊請看 :pep:`591`。" +msgstr "這些屬性 (property) 不會在 runtime 時進行檢查。" #: ../../library/typing.rst:1324 -#, fuzzy msgid "See :class:`TypedDict` and :pep:`705` for more details." -msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" +msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`705`。" #: ../../library/typing.rst:1330 msgid "Special typing form to add context-specific metadata to an annotation." @@ -2388,21 +2384,50 @@ msgstr "" ">>> X.__metadata__\n" "('very', 'important', 'metadata')" -#: ../../library/typing.rst:1463 -msgid ":pep:`593` - Flexible function and variable annotations" +#: ../../library/typing.rst:1461 +msgid "" +"At runtime, if you want to retrieve the original type wrapped by " +"``Annotated``, use the :attr:`!__origin__` attribute:" msgstr "" #: ../../library/typing.rst:1464 +msgid "" +">>> from typing import Annotated, get_origin\n" +">>> Password = Annotated[str, \"secret\"]\n" +">>> Password.__origin__\n" +"" +msgstr "" +">>> from typing import Annotated, get_origin\n" +">>> Password = Annotated[str, \"secret\"]\n" +">>> Password.__origin__\n" +"" + +#: ../../library/typing.rst:1471 +msgid "Note that using :func:`get_origin` will return ``Annotated`` itself:" +msgstr "" + +#: ../../library/typing.rst:1473 +msgid "" +">>> get_origin(Password)\n" +"typing.Annotated" +msgstr "" +">>> get_origin(Password)\n" +"typing.Annotated" + +#: ../../library/typing.rst:1480 +msgid ":pep:`593` - Flexible function and variable annotations" +msgstr "" + +#: ../../library/typing.rst:1481 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1471 ../../library/typing.rst:1555 -#, fuzzy +#: ../../library/typing.rst:1488 ../../library/typing.rst:1572 msgid "" "Special typing construct for marking user-defined type predicate functions." -msgstr "特殊型別建構,用來指出最終名稱給型別檢查器。" +msgstr "" -#: ../../library/typing.rst:1473 +#: ../../library/typing.rst:1490 msgid "" "``TypeIs`` can be used to annotate the return type of a user-defined type " "predicate function. ``TypeIs`` only accepts a single type argument. At " @@ -2410,7 +2435,7 @@ msgid "" "one positional argument." msgstr "" -#: ../../library/typing.rst:1478 +#: ../../library/typing.rst:1495 msgid "" "``TypeIs`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -2420,7 +2445,7 @@ msgid "" "predicate\"::" msgstr "" -#: ../../library/typing.rst:1484 +#: ../../library/typing.rst:1501 msgid "" "def is_str(val: str | float):\n" " # \"isinstance\" type predicate\n" @@ -2432,7 +2457,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1493 +#: ../../library/typing.rst:1510 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " "type predicate. Such a function should use ``TypeIs[...]`` or :data:" @@ -2443,29 +2468,29 @@ msgid "" "does not return ``True`` for all instances of the narrowed type." msgstr "" -#: ../../library/typing.rst:1501 +#: ../../library/typing.rst:1518 msgid "" "Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " "given function:" msgstr "" -#: ../../library/typing.rst:1504 ../../library/typing.rst:1565 +#: ../../library/typing.rst:1521 ../../library/typing.rst:1582 msgid "The return value is a boolean." msgstr "" -#: ../../library/typing.rst:1505 +#: ../../library/typing.rst:1522 msgid "" "If the return value is ``True``, the type of its argument is the " "intersection of the argument's original type and ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1507 +#: ../../library/typing.rst:1524 msgid "" "If the return value is ``False``, the type of its argument is narrowed to " "exclude ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1512 +#: ../../library/typing.rst:1529 msgid "" "from typing import assert_type, final, TypeIs\n" "\n" @@ -2489,7 +2514,7 @@ msgid "" " assert_type(arg, Unrelated)" msgstr "" -#: ../../library/typing.rst:1533 +#: ../../library/typing.rst:1550 msgid "" "The type inside ``TypeIs`` must be consistent with the type of the " "function's argument; if it is not, static type checkers will raise an " @@ -2498,27 +2523,27 @@ msgid "" "functions in a type-safe manner." msgstr "" -#: ../../library/typing.rst:1539 +#: ../../library/typing.rst:1556 msgid "" "If a ``TypeIs`` function is a class or instance method, then the type in " "``TypeIs`` maps to the type of the second parameter (after ``cls`` or " "``self``)." msgstr "" -#: ../../library/typing.rst:1543 +#: ../../library/typing.rst:1560 msgid "" "In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``, means that " "if ``foo(arg)`` returns ``True``, then ``arg`` is an instance of ``TypeB``, " "and if it returns ``False``, it is not an instance of ``TypeB``." msgstr "" -#: ../../library/typing.rst:1547 +#: ../../library/typing.rst:1564 msgid "" "``TypeIs`` also works with type variables. For more information, see :pep:" "`742` (Narrowing types with ``TypeIs``)." msgstr "" -#: ../../library/typing.rst:1557 +#: ../../library/typing.rst:1574 msgid "" "Type predicate functions are user-defined functions that return whether " "their argument is an instance of a particular type. ``TypeGuard`` works " @@ -2526,25 +2551,25 @@ msgid "" "checking behavior (see below)." msgstr "" -#: ../../library/typing.rst:1562 +#: ../../library/typing.rst:1579 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1566 +#: ../../library/typing.rst:1583 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1569 +#: ../../library/typing.rst:1586 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: ../../library/typing.rst:1573 +#: ../../library/typing.rst:1590 msgid "" "def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" " '''Determines whether all objects in the list are strings'''\n" @@ -2559,11 +2584,11 @@ msgid "" " print(\"Not a list of strings!\")" msgstr "" -#: ../../library/typing.rst:1585 +#: ../../library/typing.rst:1602 msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" msgstr "" -#: ../../library/typing.rst:1587 +#: ../../library/typing.rst:1604 msgid "" "``TypeIs`` requires the narrowed type to be a subtype of the input type, " "while ``TypeGuard`` does not. The main reason is to allow for things like " @@ -2571,7 +2596,7 @@ msgid "" "subtype of the former, since ``list`` is invariant." msgstr "" -#: ../../library/typing.rst:1591 +#: ../../library/typing.rst:1608 msgid "" "When a ``TypeGuard`` function returns ``True``, type checkers narrow the " "type of the variable to exactly the ``TypeGuard`` type. When a ``TypeIs`` " @@ -2580,7 +2605,7 @@ msgid "" "type. (Technically, this is known as an intersection type.)" msgstr "" -#: ../../library/typing.rst:1595 +#: ../../library/typing.rst:1612 msgid "" "When a ``TypeGuard`` function returns ``False``, type checkers cannot narrow " "the type of the variable at all. When a ``TypeIs`` function returns " @@ -2588,18 +2613,18 @@ msgid "" "``TypeIs`` type." msgstr "" -#: ../../library/typing.rst:1604 +#: ../../library/typing.rst:1621 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1606 +#: ../../library/typing.rst:1623 msgid "" "For example, using the unpack operator ``*`` on a :ref:`type variable tuple " "` is equivalent to using ``Unpack`` to mark the type variable " "tuple as having been unpacked::" msgstr "" -#: ../../library/typing.rst:1610 +#: ../../library/typing.rst:1627 msgid "" "Ts = TypeVarTuple('Ts')\n" "tup: tuple[*Ts]\n" @@ -2607,7 +2632,7 @@ msgid "" "tup: tuple[Unpack[Ts]]" msgstr "" -#: ../../library/typing.rst:1615 +#: ../../library/typing.rst:1632 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -2615,7 +2640,7 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1621 +#: ../../library/typing.rst:1638 msgid "" "# In older versions of Python, TypeVarTuple and Unpack\n" "# are located in the `typing_extensions` backports package.\n" @@ -2626,13 +2651,13 @@ msgid "" "tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" msgstr "" -#: ../../library/typing.rst:1629 +#: ../../library/typing.rst:1646 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" -#: ../../library/typing.rst:1632 +#: ../../library/typing.rst:1649 msgid "" "from typing import TypedDict, Unpack\n" "\n" @@ -2645,23 +2670,23 @@ msgid "" "def foo(**kwargs: Unpack[Movie]): ..." msgstr "" -#: ../../library/typing.rst:1642 +#: ../../library/typing.rst:1659 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" -#: ../../library/typing.rst:1647 +#: ../../library/typing.rst:1664 msgid "Building generic types and type aliases" msgstr "" -#: ../../library/typing.rst:1649 +#: ../../library/typing.rst:1666 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types and " "type aliases." msgstr "" -#: ../../library/typing.rst:1653 +#: ../../library/typing.rst:1670 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " @@ -2669,17 +2694,17 @@ msgid "" "syntax, as documented below." msgstr "" -#: ../../library/typing.rst:1660 +#: ../../library/typing.rst:1677 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1662 +#: ../../library/typing.rst:1679 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" -#: ../../library/typing.rst:1665 +#: ../../library/typing.rst:1682 msgid "" "class Mapping[KT, VT]:\n" " def __getitem__(self, key: KT) -> VT:\n" @@ -2687,17 +2712,17 @@ msgid "" " # Etc." msgstr "" -#: ../../library/typing.rst:1670 +#: ../../library/typing.rst:1687 msgid "" "Such a class implicitly inherits from ``Generic``. The runtime semantics of " "this syntax are discussed in the :ref:`Language Reference `." msgstr "" -#: ../../library/typing.rst:1674 +#: ../../library/typing.rst:1691 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1676 +#: ../../library/typing.rst:1693 msgid "" "def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" " try:\n" @@ -2711,20 +2736,20 @@ msgstr "" " except KeyError:\n" " return default" -#: ../../library/typing.rst:1682 +#: ../../library/typing.rst:1699 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -#: ../../library/typing.rst:1685 +#: ../../library/typing.rst:1702 msgid "" "For backwards compatibility, generic classes can also be declared by " "explicitly inheriting from ``Generic``. In this case, the type parameters " "must be declared separately::" msgstr "" -#: ../../library/typing.rst:1690 +#: ../../library/typing.rst:1707 msgid "" "KT = TypeVar('KT')\n" "VT = TypeVar('VT')\n" @@ -2742,18 +2767,18 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1702 +#: ../../library/typing.rst:1719 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1704 +#: ../../library/typing.rst:1721 msgid "" "The preferred way to construct a type variable is via the dedicated syntax " "for :ref:`generic functions `, :ref:`generic classes " "`, and :ref:`generic type aliases `::" msgstr "" -#: ../../library/typing.rst:1709 +#: ../../library/typing.rst:1726 msgid "" "class Sequence[T]: # T is a TypeVar\n" " ..." @@ -2761,12 +2786,12 @@ msgstr "" "class Sequence[T]: # T 是一個 TypeVar\n" " ..." -#: ../../library/typing.rst:1712 +#: ../../library/typing.rst:1729 msgid "" "This syntax can also be used to create bound and constrained type variables::" msgstr "" -#: ../../library/typing.rst:1715 +#: ../../library/typing.rst:1732 msgid "" "class StrSequence[S: str]: # S is a TypeVar bound to str\n" " ...\n" @@ -2777,20 +2802,20 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1722 +#: ../../library/typing.rst:1739 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" -#: ../../library/typing.rst:1724 +#: ../../library/typing.rst:1741 msgid "" "T = TypeVar('T') # Can be anything\n" "S = TypeVar('S', bound=str) # Can be any subtype of str\n" "A = TypeVar('A', str, bytes) # Must be exactly str or bytes" msgstr "" -#: ../../library/typing.rst:1728 +#: ../../library/typing.rst:1745 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -2798,7 +2823,7 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1734 +#: ../../library/typing.rst:1751 msgid "" "def repeat[T](x: T, n: int) -> Sequence[T]:\n" " \"\"\"Return a list containing n references to x.\"\"\"\n" @@ -2816,13 +2841,13 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:1749 +#: ../../library/typing.rst:1766 msgid "" "Note that type variables can be *bound*, *constrained*, or neither, but " "cannot be both bound *and* constrained." msgstr "" -#: ../../library/typing.rst:1752 +#: ../../library/typing.rst:1769 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -2832,14 +2857,14 @@ msgid "" "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" -#: ../../library/typing.rst:1760 +#: ../../library/typing.rst:1777 msgid "" "Bound type variables and constrained type variables have different semantics " "in several important ways. Using a *bound* type variable means that the " "``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1764 +#: ../../library/typing.rst:1781 msgid "" "x = print_capitalized('a string')\n" "reveal_type(x) # revealed type is str\n" @@ -2853,13 +2878,13 @@ msgid "" "z = print_capitalized(45) # error: int is not a subtype of str" msgstr "" -#: ../../library/typing.rst:1775 +#: ../../library/typing.rst:1792 msgid "" "Type variables can be bound to concrete types, abstract types (ABCs or " "protocols), and even unions of types::" msgstr "" -#: ../../library/typing.rst:1778 +#: ../../library/typing.rst:1795 msgid "" "# Can be anything with an __abs__ method\n" "def print_abs[T: SupportsAbs](arg: T) -> None:\n" @@ -2870,13 +2895,13 @@ msgid "" "V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" -#: ../../library/typing.rst:1787 +#: ../../library/typing.rst:1804 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" -#: ../../library/typing.rst:1790 +#: ../../library/typing.rst:1807 msgid "" "a = concatenate('one', 'two')\n" "reveal_type(a) # revealed type is str\n" @@ -2889,56 +2914,56 @@ msgid "" "or bytes in a function call, but not both" msgstr "" -#: ../../library/typing.rst:1798 +#: ../../library/typing.rst:1815 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "" -#: ../../library/typing.rst:1802 +#: ../../library/typing.rst:1819 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1806 +#: ../../library/typing.rst:1823 msgid "Whether the type var has been explicitly marked as covariant." msgstr "" -#: ../../library/typing.rst:1810 +#: ../../library/typing.rst:1827 msgid "Whether the type var has been explicitly marked as contravariant." msgstr "" -#: ../../library/typing.rst:1814 +#: ../../library/typing.rst:1831 msgid "" "Whether the type variable's variance should be inferred by type checkers." msgstr "" -#: ../../library/typing.rst:1820 +#: ../../library/typing.rst:1837 msgid "The bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1824 +#: ../../library/typing.rst:1841 msgid "" "For type variables created through :ref:`type parameter syntax `, the bound is evaluated only when the attribute is accessed, not " "when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1830 +#: ../../library/typing.rst:1847 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1834 +#: ../../library/typing.rst:1851 msgid "" "For type variables created through :ref:`type parameter syntax `, the constraints are evaluated only when the attribute is accessed, " "not when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1840 +#: ../../library/typing.rst:1857 msgid "" "The default value of the type variable, or :data:`typing.NoDefault` if it " "has no default." msgstr "" -#: ../../library/typing.rst:1847 +#: ../../library/typing.rst:1864 msgid "" "Return whether or not the type variable has a default value. This is " "equivalent to checking whether :attr:`__default__` is not the :data:`typing." @@ -2946,31 +2971,31 @@ msgid "" "`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:1856 +#: ../../library/typing.rst:1873 msgid "" "Type variables can now be declared using the :ref:`type parameter ` syntax introduced by :pep:`695`. The ``infer_variance`` parameter " "was added." msgstr "" -#: ../../library/typing.rst:1862 ../../library/typing.rst:2001 -#: ../../library/typing.rst:2103 +#: ../../library/typing.rst:1879 ../../library/typing.rst:2018 +#: ../../library/typing.rst:2120 msgid "Support for default values was added." msgstr "" -#: ../../library/typing.rst:1868 +#: ../../library/typing.rst:1885 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1871 +#: ../../library/typing.rst:1888 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" -#: ../../library/typing.rst:1874 +#: ../../library/typing.rst:1891 msgid "" "def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " "T]:\n" @@ -2980,11 +3005,11 @@ msgstr "" "T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1877 +#: ../../library/typing.rst:1894 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" msgstr "" -#: ../../library/typing.rst:1879 +#: ../../library/typing.rst:1896 msgid "" "T = TypeVar(\"T\")\n" "Ts = TypeVarTuple(\"Ts\")\n" @@ -2998,7 +3023,7 @@ msgstr "" "def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1885 +#: ../../library/typing.rst:1902 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -3006,7 +3031,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1890 +#: ../../library/typing.rst:1907 msgid "" "# T is bound to int, Ts is bound to ()\n" "# Return value is (1,), which has type tuple[int]\n" @@ -3026,7 +3051,7 @@ msgid "" "move_first_element_to_last(tup=())" msgstr "" -#: ../../library/typing.rst:1907 +#: ../../library/typing.rst:1924 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -3036,26 +3061,26 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:1915 +#: ../../library/typing.rst:1932 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:1918 +#: ../../library/typing.rst:1935 msgid "" "x: Ts # Not valid\n" "x: tuple[Ts] # Not valid\n" "x: tuple[*Ts] # The correct way to do it" msgstr "" -#: ../../library/typing.rst:1922 +#: ../../library/typing.rst:1939 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" -#: ../../library/typing.rst:1925 +#: ../../library/typing.rst:1942 msgid "" "class Array[*Shape]:\n" " def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" @@ -3067,12 +3092,12 @@ msgstr "" " def __abs__(self) -> \"Array[*Shape]\": ...\n" " def get_shape(self) -> tuple[*Shape]: ..." -#: ../../library/typing.rst:1930 +#: ../../library/typing.rst:1947 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:1932 +#: ../../library/typing.rst:1949 msgid "" "class Array[DType, *Shape]: # This is fine\n" " pass\n" @@ -3087,26 +3112,26 @@ msgid "" "int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" msgstr "" -#: ../../library/typing.rst:1946 +#: ../../library/typing.rst:1963 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" -#: ../../library/typing.rst:1949 +#: ../../library/typing.rst:1966 msgid "" "x: tuple[*Ts, *Ts] # Not valid\n" "class Array[*Shape, *Shape]: # Not valid\n" " pass" msgstr "" -#: ../../library/typing.rst:1953 +#: ../../library/typing.rst:1970 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:1956 +#: ../../library/typing.rst:1973 msgid "" "def call_soon[*Ts](\n" " callback: Callable[[*Ts], None],\n" @@ -3122,7 +3147,7 @@ msgstr "" " ...\n" " callback(*args)" -#: ../../library/typing.rst:1963 +#: ../../library/typing.rst:1980 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -3131,21 +3156,21 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:1970 +#: ../../library/typing.rst:1987 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:1974 +#: ../../library/typing.rst:1991 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:1978 +#: ../../library/typing.rst:1995 msgid "" "The default value of the type variable tuple, or :data:`typing.NoDefault` if " "it has no default." msgstr "" -#: ../../library/typing.rst:1985 +#: ../../library/typing.rst:2002 msgid "" "Return whether or not the type variable tuple has a default value. This is " "equivalent to checking whether :attr:`__default__` is not the :data:`typing." @@ -3153,39 +3178,39 @@ msgid "" "`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:1996 +#: ../../library/typing.rst:2013 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2005 +#: ../../library/typing.rst:2022 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -#: ../../library/typing.rst:2008 +#: ../../library/typing.rst:2025 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" -#: ../../library/typing.rst:2011 +#: ../../library/typing.rst:2028 msgid "type IntFunc[**P] = Callable[P, int]" msgstr "type IntFunc[**P] = Callable[P, int]" -#: ../../library/typing.rst:2013 +#: ../../library/typing.rst:2030 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" -#: ../../library/typing.rst:2016 +#: ../../library/typing.rst:2033 msgid "P = ParamSpec('P')" msgstr "P = ParamSpec('P')" -#: ../../library/typing.rst:2018 +#: ../../library/typing.rst:2035 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -3195,7 +3220,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:2025 +#: ../../library/typing.rst:2042 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -3203,7 +3228,7 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:2030 +#: ../../library/typing.rst:2047 msgid "" "from collections.abc import Callable\n" "import logging\n" @@ -3221,27 +3246,27 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:2045 +#: ../../library/typing.rst:2062 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with bound ``Callable[..., Any]``. However this " "causes two problems:" msgstr "" -#: ../../library/typing.rst:2049 +#: ../../library/typing.rst:2066 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: ../../library/typing.rst:2051 +#: ../../library/typing.rst:2068 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: ../../library/typing.rst:2058 +#: ../../library/typing.rst:2075 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -3254,17 +3279,17 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:2070 +#: ../../library/typing.rst:2087 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:2074 +#: ../../library/typing.rst:2091 msgid "" "The default value of the parameter specification, or :data:`typing." "NoDefault` if it has no default." msgstr "" -#: ../../library/typing.rst:2081 +#: ../../library/typing.rst:2098 msgid "" "Return whether or not the parameter specification has a default value. This " "is equivalent to checking whether :attr:`__default__` is not the :data:" @@ -3272,7 +3297,7 @@ msgid "" "the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2088 +#: ../../library/typing.rst:2105 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -3281,23 +3306,23 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:2098 +#: ../../library/typing.rst:2115 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2106 +#: ../../library/typing.rst:2123 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:2112 +#: ../../library/typing.rst:2129 msgid ":data:`Concatenate`" msgstr ":data:`Concatenate`" -#: ../../library/typing.rst:2118 +#: ../../library/typing.rst:2135 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -3305,13 +3330,13 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:2123 +#: ../../library/typing.rst:2140 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:2126 +#: ../../library/typing.rst:2143 msgid "" ">>> from typing import ParamSpec, get_origin\n" ">>> P = ParamSpec(\"P\")\n" @@ -3327,11 +3352,11 @@ msgstr "" ">>> get_origin(P.kwargs) is P\n" "True" -#: ../../library/typing.rst:2140 +#: ../../library/typing.rst:2157 msgid "The type of type aliases created through the :keyword:`type` statement." msgstr "" -#: ../../library/typing.rst:2144 +#: ../../library/typing.rst:2161 msgid "" ">>> type Alias = int\n" ">>> type(Alias)\n" @@ -3341,11 +3366,11 @@ msgstr "" ">>> type(Alias)\n" "" -#: ../../library/typing.rst:2154 +#: ../../library/typing.rst:2171 msgid "The name of the type alias:" msgstr "" -#: ../../library/typing.rst:2156 +#: ../../library/typing.rst:2173 msgid "" ">>> type Alias = int\n" ">>> Alias.__name__\n" @@ -3355,11 +3380,11 @@ msgstr "" ">>> Alias.__name__\n" "'Alias'" -#: ../../library/typing.rst:2164 +#: ../../library/typing.rst:2181 msgid "The module in which the type alias was defined::" msgstr "" -#: ../../library/typing.rst:2166 +#: ../../library/typing.rst:2183 msgid "" ">>> type Alias = int\n" ">>> Alias.__module__\n" @@ -3369,13 +3394,13 @@ msgstr "" ">>> Alias.__module__\n" "'__main__'" -#: ../../library/typing.rst:2172 +#: ../../library/typing.rst:2189 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" -#: ../../library/typing.rst:2175 +#: ../../library/typing.rst:2192 msgid "" ">>> type ListOrSet[T] = list[T] | set[T]\n" ">>> ListOrSet.__type_params__\n" @@ -3391,14 +3416,14 @@ msgstr "" ">>> NotGeneric.__type_params__\n" "()" -#: ../../library/typing.rst:2186 +#: ../../library/typing.rst:2203 msgid "" "The type alias's value. This is :ref:`lazily evaluated `, " "so names used in the definition of the alias are not resolved until the " "``__value__`` attribute is accessed:" msgstr "" -#: ../../library/typing.rst:2190 +#: ../../library/typing.rst:2207 msgid "" ">>> type Mutually = Recursive\n" ">>> type Recursive = Mutually\n" @@ -3422,27 +3447,27 @@ msgstr "" ">>> Recursive.__value__\n" "Mutually" -#: ../../library/typing.rst:2204 +#: ../../library/typing.rst:2221 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:2206 +#: ../../library/typing.rst:2223 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" -#: ../../library/typing.rst:2212 +#: ../../library/typing.rst:2229 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:2214 ../../library/typing.rst:2304 -#: ../../library/typing.rst:3343 +#: ../../library/typing.rst:2231 ../../library/typing.rst:2323 +#: ../../library/typing.rst:3364 msgid "Usage::" msgstr "" -#: ../../library/typing.rst:2216 +#: ../../library/typing.rst:2233 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3452,20 +3477,20 @@ msgstr "" " name: str\n" " id: int" -#: ../../library/typing.rst:2220 +#: ../../library/typing.rst:2237 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../library/typing.rst:2222 +#: ../../library/typing.rst:2239 msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" msgstr "Employee = collections.namedtuple('Employee', ['name', 'id'])" -#: ../../library/typing.rst:2224 +#: ../../library/typing.rst:2241 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:2226 +#: ../../library/typing.rst:2243 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3481,12 +3506,12 @@ msgstr "" "employee = Employee('Guido')\n" "assert employee.id == 3" -#: ../../library/typing.rst:2233 +#: ../../library/typing.rst:2250 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:2235 +#: ../../library/typing.rst:2252 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -3495,11 +3520,11 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:2241 +#: ../../library/typing.rst:2258 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:2243 +#: ../../library/typing.rst:2260 msgid "" "class Employee(NamedTuple):\n" " \"\"\"Represents an employee.\"\"\"\n" @@ -3510,11 +3535,11 @@ msgid "" " return f''" msgstr "" -#: ../../library/typing.rst:2251 +#: ../../library/typing.rst:2268 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:2253 +#: ../../library/typing.rst:2270 msgid "" "class Group[T](NamedTuple):\n" " key: T\n" @@ -3524,13 +3549,15 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2257 +#: ../../library/typing.rst:2274 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:2259 +#: ../../library/typing.rst:2276 msgid "" -"# For creating a generic NamedTuple on Python 3.11 or lower\n" +"# For creating a generic NamedTuple on Python 3.11\n" +"T = TypeVar(\"T\")\n" +"\n" "class Group(NamedTuple, Generic[T]):\n" " key: T\n" " group: list[T]\n" @@ -3539,38 +3566,38 @@ msgid "" "Employee = NamedTuple('Employee', [('name', str), ('id', int)])" msgstr "" -#: ../../library/typing.rst:2267 +#: ../../library/typing.rst:2286 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:2270 +#: ../../library/typing.rst:2289 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:2273 +#: ../../library/typing.rst:2292 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:2277 +#: ../../library/typing.rst:2296 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:2281 +#: ../../library/typing.rst:2300 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:2284 +#: ../../library/typing.rst:2303 msgid "" "The undocumented keyword argument syntax for creating NamedTuple classes " "(``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be disallowed " "in 3.15. Use the class-based syntax or the functional syntax instead." msgstr "" -#: ../../library/typing.rst:2289 +#: ../../library/typing.rst:2308 msgid "" "When using the functional syntax to create a NamedTuple class, failing to " "pass a value to the 'fields' parameter (``NT = NamedTuple(\"NT\")``) is " @@ -3580,48 +3607,48 @@ msgid "" "NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." msgstr "" -#: ../../library/typing.rst:2299 +#: ../../library/typing.rst:2318 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:2301 +#: ../../library/typing.rst:2320 msgid "" "A ``NewType`` is considered a distinct type by a typechecker. At runtime, " "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: ../../library/typing.rst:2306 +#: ../../library/typing.rst:2325 msgid "" "UserId = NewType('UserId', int) # Declare the NewType \"UserId\"\n" "first_user = UserId(1) # \"UserId\" returns the argument unchanged at " "runtime" msgstr "" -#: ../../library/typing.rst:2311 +#: ../../library/typing.rst:2330 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:2315 +#: ../../library/typing.rst:2334 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:2319 +#: ../../library/typing.rst:2338 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:2323 +#: ../../library/typing.rst:2342 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:2328 +#: ../../library/typing.rst:2347 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:2330 +#: ../../library/typing.rst:2349 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:2332 +#: ../../library/typing.rst:2351 msgid "" "class Proto(Protocol):\n" " def meth(self) -> int:\n" @@ -3631,13 +3658,13 @@ msgstr "" " def meth(self) -> int:\n" " ..." -#: ../../library/typing.rst:2336 +#: ../../library/typing.rst:2355 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:2339 +#: ../../library/typing.rst:2358 msgid "" "class C:\n" " def meth(self) -> int:\n" @@ -3649,7 +3676,7 @@ msgid "" "func(C()) # Passes static type check" msgstr "" -#: ../../library/typing.rst:2348 +#: ../../library/typing.rst:2367 msgid "" "See :pep:`544` for more details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " @@ -3657,11 +3684,11 @@ msgid "" "signatures." msgstr "" -#: ../../library/typing.rst:2353 +#: ../../library/typing.rst:2372 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:2355 +#: ../../library/typing.rst:2374 msgid "" "class GenProto[T](Protocol):\n" " def meth(self) -> T:\n" @@ -3671,13 +3698,13 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2359 +#: ../../library/typing.rst:2378 msgid "" "In code that needs to be compatible with Python 3.11 or older, generic " "Protocols can be written as follows::" msgstr "" -#: ../../library/typing.rst:2362 +#: ../../library/typing.rst:2381 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -3691,11 +3718,11 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2372 +#: ../../library/typing.rst:2391 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:2374 +#: ../../library/typing.rst:2393 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 " @@ -3704,7 +3731,7 @@ msgid "" "Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:2379 +#: ../../library/typing.rst:2398 msgid "" "@runtime_checkable\n" "class Closable(Protocol):\n" @@ -3732,7 +3759,7 @@ msgstr "" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" -#: ../../library/typing.rst:2394 +#: ../../library/typing.rst:2413 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " "methods or attributes, not their type signatures or types. For example, :" @@ -3743,7 +3770,7 @@ msgid "" "(instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:2405 +#: ../../library/typing.rst:2424 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -3751,7 +3778,7 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:2413 +#: ../../library/typing.rst:2432 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -3761,7 +3788,7 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" -#: ../../library/typing.rst:2422 +#: ../../library/typing.rst:2441 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " @@ -3770,13 +3797,13 @@ msgid "" "`\"What's new in Python 3.12\" ` for more details." msgstr "" -#: ../../library/typing.rst:2433 +#: ../../library/typing.rst:2452 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:2436 +#: ../../library/typing.rst:2455 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -3784,7 +3811,7 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:2442 +#: ../../library/typing.rst:2461 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3797,24 +3824,24 @@ msgid "" "assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" -#: ../../library/typing.rst:2452 +#: ../../library/typing.rst:2471 msgid "" "An alternative way to create a ``TypedDict`` is by using function-call " "syntax. The second argument must be a literal :class:`dict`::" msgstr "" -#: ../../library/typing.rst:2455 +#: ../../library/typing.rst:2474 msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" msgstr "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -#: ../../library/typing.rst:2457 +#: ../../library/typing.rst:2476 msgid "" "This functional syntax allows defining keys which are not valid :ref:" "`identifiers `, for example because they are keywords or " "contain hyphens::" msgstr "" -#: ../../library/typing.rst:2461 +#: ../../library/typing.rst:2480 msgid "" "# raises SyntaxError\n" "class Point2D(TypedDict):\n" @@ -3825,13 +3852,13 @@ msgid "" "Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})" msgstr "" -#: ../../library/typing.rst:2469 +#: ../../library/typing.rst:2488 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" -#: ../../library/typing.rst:2472 +#: ../../library/typing.rst:2491 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3843,19 +3870,19 @@ msgid "" "NotRequired[str]})" msgstr "" -#: ../../library/typing.rst:2480 +#: ../../library/typing.rst:2499 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2483 +#: ../../library/typing.rst:2502 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2486 +#: ../../library/typing.rst:2505 msgid "" "class Point2D(TypedDict, total=False):\n" " x: int\n" @@ -3865,7 +3892,7 @@ msgid "" "Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" msgstr "" -#: ../../library/typing.rst:2493 +#: ../../library/typing.rst:2512 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -3873,13 +3900,13 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2498 +#: ../../library/typing.rst:2517 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2501 +#: ../../library/typing.rst:2520 msgid "" "class Point2D(TypedDict, total=False):\n" " x: Required[int]\n" @@ -3894,13 +3921,13 @@ msgid "" "}, total=False)" msgstr "" -#: ../../library/typing.rst:2513 +#: ../../library/typing.rst:2532 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:2517 +#: ../../library/typing.rst:2536 msgid "" "class Point3D(Point2D):\n" " z: int" @@ -3908,13 +3935,13 @@ msgstr "" "class Point3D(Point2D):\n" " z: int" -#: ../../library/typing.rst:2520 +#: ../../library/typing.rst:2539 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2523 +#: ../../library/typing.rst:2542 msgid "" "class Point3D(TypedDict):\n" " x: int\n" @@ -3926,13 +3953,13 @@ msgstr "" " y: int\n" " z: int" -#: ../../library/typing.rst:2528 +#: ../../library/typing.rst:2547 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2531 +#: ../../library/typing.rst:2550 msgid "" "class X(TypedDict):\n" " x: int\n" @@ -3947,11 +3974,11 @@ msgid "" "class XZ(X, Z): pass # raises TypeError" msgstr "" -#: ../../library/typing.rst:2543 +#: ../../library/typing.rst:2562 msgid "A ``TypedDict`` can be generic::" msgstr "" -#: ../../library/typing.rst:2545 +#: ../../library/typing.rst:2564 msgid "" "class Group[T](TypedDict):\n" " key: T\n" @@ -3961,13 +3988,13 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2549 +#: ../../library/typing.rst:2568 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" -#: ../../library/typing.rst:2552 +#: ../../library/typing.rst:2571 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -3981,19 +4008,19 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2560 +#: ../../library/typing.rst:2579 msgid "" "A ``TypedDict`` can be introspected via annotations dicts (see :ref:" "`annotations-howto` for more information on annotations best practices), :" "attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:2566 +#: ../../library/typing.rst:2585 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2569 +#: ../../library/typing.rst:2588 msgid "" ">>> from typing import TypedDict\n" ">>> class Point2D(TypedDict): pass\n" @@ -4017,7 +4044,7 @@ msgstr "" ">>> Point3D.__total__\n" "True" -#: ../../library/typing.rst:2582 +#: ../../library/typing.rst:2601 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " @@ -4028,21 +4055,21 @@ msgid "" "introspection." msgstr "" -#: ../../library/typing.rst:2595 +#: ../../library/typing.rst:2614 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2598 +#: ../../library/typing.rst:2617 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" -#: ../../library/typing.rst:2601 +#: ../../library/typing.rst:2620 msgid "" "For backwards compatibility with Python 3.10 and below, it is also possible " "to use inheritance to declare both required and non-required keys in the " @@ -4051,7 +4078,7 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2608 +#: ../../library/typing.rst:2627 msgid "" ">>> class Point2D(TypedDict, total=False):\n" "... x: int\n" @@ -4077,7 +4104,7 @@ msgstr "" ">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" "True" -#: ../../library/typing.rst:2626 +#: ../../library/typing.rst:2645 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -4086,48 +4113,48 @@ msgid "" "attributes may be incorrect." msgstr "" -#: ../../library/typing.rst:2632 +#: ../../library/typing.rst:2651 msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" msgstr "" -#: ../../library/typing.rst:2636 +#: ../../library/typing.rst:2655 msgid "" "A :class:`frozenset` containing the names of all read-only keys. Keys are " "read-only if they carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2643 +#: ../../library/typing.rst:2662 msgid "" "A :class:`frozenset` containing the names of all mutable keys. Keys are " "mutable if they do not carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2648 +#: ../../library/typing.rst:2667 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:2652 +#: ../../library/typing.rst:2671 msgid "" "Added support for marking individual keys as :data:`Required` or :data:" "`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2656 +#: ../../library/typing.rst:2675 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2659 +#: ../../library/typing.rst:2678 msgid "" "Removed support for the keyword-argument method of creating ``TypedDict``\\ " "s." msgstr "" -#: ../../library/typing.rst:2662 +#: ../../library/typing.rst:2681 msgid "Support for the :data:`ReadOnly` qualifier was added." msgstr "" -#: ../../library/typing.rst:2665 +#: ../../library/typing.rst:2684 msgid "" "When using the functional syntax to create a TypedDict class, failing to " "pass a value to the 'fields' parameter (``TD = TypedDict(\"TD\")``) is " @@ -4137,106 +4164,106 @@ msgid "" "TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." msgstr "" -#: ../../library/typing.rst:2674 +#: ../../library/typing.rst:2693 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2676 +#: ../../library/typing.rst:2695 msgid "" "The following protocols are provided by the typing module. All are decorated " "with :func:`@runtime_checkable `." msgstr "" -#: ../../library/typing.rst:2681 +#: ../../library/typing.rst:2700 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2686 +#: ../../library/typing.rst:2705 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2690 +#: ../../library/typing.rst:2709 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2694 +#: ../../library/typing.rst:2713 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2698 +#: ../../library/typing.rst:2717 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2704 +#: ../../library/typing.rst:2723 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2708 +#: ../../library/typing.rst:2727 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2712 +#: ../../library/typing.rst:2731 msgid "ABCs for working with IO" msgstr "" -#: ../../library/typing.rst:2718 +#: ../../library/typing.rst:2737 msgid "" "Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " "by :func:`open`." msgstr "" -#: ../../library/typing.rst:2724 +#: ../../library/typing.rst:2743 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2728 +#: ../../library/typing.rst:2747 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2730 +#: ../../library/typing.rst:2749 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: ../../library/typing.rst:2737 +#: ../../library/typing.rst:2756 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2739 +#: ../../library/typing.rst:2758 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" -#: ../../library/typing.rst:2742 +#: ../../library/typing.rst:2761 msgid "" "When a static type checker encounters a call to ``assert_type()``, it emits " "an error if the value is not of the specified type::" msgstr "" -#: ../../library/typing.rst:2745 +#: ../../library/typing.rst:2764 msgid "" "def greet(name: str) -> None:\n" " assert_type(name, str) # OK, inferred type of `name` is `str`\n" " assert_type(name, int) # type checker error" msgstr "" -#: ../../library/typing.rst:2749 +#: ../../library/typing.rst:2768 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" -#: ../../library/typing.rst:2752 +#: ../../library/typing.rst:2771 msgid "" "def complex_function(arg: object):\n" " # Do some complex type-narrowing logic,\n" @@ -4246,16 +4273,16 @@ msgid "" " assert_type(arg, int)" msgstr "" -#: ../../library/typing.rst:2763 +#: ../../library/typing.rst:2782 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2765 +#: ../../library/typing.rst:2784 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:2767 +#: ../../library/typing.rst:2786 msgid "" "def int_or_str(arg: int | str) -> None:\n" " match arg:\n" @@ -4275,14 +4302,14 @@ msgstr "" " case _ as unreachable:\n" " assert_never(unreachable)" -#: ../../library/typing.rst:2776 +#: ../../library/typing.rst:2795 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" -#: ../../library/typing.rst:2781 +#: ../../library/typing.rst:2800 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -4292,47 +4319,47 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2789 +#: ../../library/typing.rst:2808 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2792 +#: ../../library/typing.rst:2811 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about " "exhaustiveness checking with static typing." msgstr "" -#: ../../library/typing.rst:2800 +#: ../../library/typing.rst:2819 msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -#: ../../library/typing.rst:2802 +#: ../../library/typing.rst:2821 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the inferred type of the argument. For example::" msgstr "" -#: ../../library/typing.rst:2805 +#: ../../library/typing.rst:2824 msgid "" "x: int = 1\n" "reveal_type(x) # Revealed type is \"builtins.int\"" msgstr "" -#: ../../library/typing.rst:2808 +#: ../../library/typing.rst:2827 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2811 +#: ../../library/typing.rst:2830 msgid "" "At runtime, this function prints the runtime type of its argument to :data:" "`sys.stderr` and returns the argument unchanged (allowing the call to be " "used within an expression)::" msgstr "" -#: ../../library/typing.rst:2815 +#: ../../library/typing.rst:2834 msgid "" "x = reveal_type(1) # prints \"Runtime type is int\"\n" "print(x) # prints \"1\"" @@ -4340,13 +4367,13 @@ msgstr "" "x = reveal_type(1) # 印出 \"Runtime type is int\"\n" "print(x) # 印出 \"1\"" -#: ../../library/typing.rst:2818 +#: ../../library/typing.rst:2837 msgid "" "Note that the runtime type may be different from (more or less specific " "than) the type statically inferred by a type checker." msgstr "" -#: ../../library/typing.rst:2821 +#: ../../library/typing.rst:2840 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " @@ -4354,13 +4381,13 @@ msgid "" "clearly." msgstr "" -#: ../../library/typing.rst:2832 +#: ../../library/typing.rst:2851 msgid "" "Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" -#: ../../library/typing.rst:2835 +#: ../../library/typing.rst:2854 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -4369,11 +4396,11 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:2842 +#: ../../library/typing.rst:2861 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:2844 +#: ../../library/typing.rst:2863 msgid "" "@dataclass_transform()\n" "def create_model[T](cls: type[T]) -> type[T]:\n" @@ -4395,11 +4422,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2856 +#: ../../library/typing.rst:2875 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:2858 +#: ../../library/typing.rst:2877 msgid "" "@dataclass_transform()\n" "class ModelBase: ...\n" @@ -4415,11 +4442,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2865 +#: ../../library/typing.rst:2884 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:2867 +#: ../../library/typing.rst:2886 msgid "" "@dataclass_transform()\n" "class ModelMeta(type): ...\n" @@ -4439,7 +4466,7 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2876 +#: ../../library/typing.rst:2895 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " "similarly to classes created with :func:`@dataclasses.dataclass None:\n" @@ -4645,24 +4672,24 @@ msgid "" " ... # actual implementation goes here" msgstr "" -#: ../../library/typing.rst:3004 +#: ../../library/typing.rst:3023 msgid "" "See :pep:`484` for more details and comparison with other typing semantics." msgstr "" -#: ../../library/typing.rst:3006 +#: ../../library/typing.rst:3025 msgid "" "Overloaded functions can now be introspected at runtime using :func:" "`get_overloads`." msgstr "" -#: ../../library/typing.rst:3013 +#: ../../library/typing.rst:3032 msgid "" "Return a sequence of :func:`@overload `-decorated definitions for " "*func*." msgstr "" -#: ../../library/typing.rst:3016 +#: ../../library/typing.rst:3035 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -4672,32 +4699,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:3023 +#: ../../library/typing.rst:3042 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:3031 +#: ../../library/typing.rst:3050 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:3033 +#: ../../library/typing.rst:3052 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:3040 +#: ../../library/typing.rst:3059 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:3042 +#: ../../library/typing.rst:3061 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" -#: ../../library/typing.rst:3048 +#: ../../library/typing.rst:3067 msgid "" "class Base:\n" " @final\n" @@ -4714,7 +4741,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:3067 +#: ../../library/typing.rst:3086 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -4724,11 +4751,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:3078 +#: ../../library/typing.rst:3097 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:3080 +#: ../../library/typing.rst:3099 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " @@ -4736,40 +4763,40 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:3086 +#: ../../library/typing.rst:3105 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:3090 +#: ../../library/typing.rst:3109 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:3092 +#: ../../library/typing.rst:3111 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:3095 +#: ../../library/typing.rst:3114 msgid "" "No type checker ever added support for ``@no_type_check_decorator``. It is " "therefore deprecated, and will be removed in Python 3.15." msgstr "" -#: ../../library/typing.rst:3101 +#: ../../library/typing.rst:3120 msgid "" "Decorator to indicate that a method in a subclass is intended to override a " "method or attribute in a superclass." msgstr "" -#: ../../library/typing.rst:3104 +#: ../../library/typing.rst:3123 msgid "" "Type checkers should emit an error if a method decorated with ``@override`` " "does not, in fact, override anything. This helps prevent bugs that may occur " "when a base class is changed without an equivalent change to a child class." msgstr "" -#: ../../library/typing.rst:3111 +#: ../../library/typing.rst:3130 msgid "" "class Base:\n" " def log_status(self) -> None:\n" @@ -4785,11 +4812,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:3126 +#: ../../library/typing.rst:3145 msgid "There is no runtime checking of this property." msgstr "" -#: ../../library/typing.rst:3128 +#: ../../library/typing.rst:3147 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -4799,22 +4826,22 @@ msgid "" "without raising an exception." msgstr "" -#: ../../library/typing.rst:3135 +#: ../../library/typing.rst:3154 msgid "See :pep:`698` for more details." msgstr "更多細節請見 :pep:`698`。" -#: ../../library/typing.rst:3142 +#: ../../library/typing.rst:3161 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:3144 +#: ../../library/typing.rst:3163 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: ../../library/typing.rst:3148 +#: ../../library/typing.rst:3167 msgid "" "@type_check_only\n" "class Response: # private or not available at runtime\n" @@ -4824,29 +4851,29 @@ msgid "" "def fetch_response() -> Response: ..." msgstr "" -#: ../../library/typing.rst:3155 +#: ../../library/typing.rst:3174 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:3159 +#: ../../library/typing.rst:3178 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:3163 +#: ../../library/typing.rst:3182 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:3166 +#: ../../library/typing.rst:3185 msgid "" "This is often the same as ``obj.__annotations__``, but this function makes " "the following changes to the annotations dictionary:" msgstr "" -#: ../../library/typing.rst:3169 +#: ../../library/typing.rst:3188 msgid "" "Forward references encoded as string literals or :class:`ForwardRef` objects " "are handled by evaluating them in *globalns*, *localns*, and (where " @@ -4855,40 +4882,40 @@ msgid "" "inferred from *obj*." msgstr "" -#: ../../library/typing.rst:3174 +#: ../../library/typing.rst:3193 msgid "``None`` is replaced with :class:`types.NoneType`." msgstr "" -#: ../../library/typing.rst:3175 +#: ../../library/typing.rst:3194 msgid "" "If :func:`@no_type_check ` has been applied to *obj*, an " "empty dictionary is returned." msgstr "" -#: ../../library/typing.rst:3177 +#: ../../library/typing.rst:3196 msgid "" "If *obj* is a class ``C``, the function returns a dictionary that merges " "annotations from ``C``'s base classes with those on ``C`` directly. This is " -"done by traversing ``C.__mro__`` and iteratively combining " -"``__annotations__`` dictionaries. Annotations on classes appearing earlier " -"in the :term:`method resolution order` always take precedence over " +"done by traversing :attr:`C.__mro__ ` and iteratively " +"combining ``__annotations__`` dictionaries. Annotations on classes appearing " +"earlier in the :term:`method resolution order` always take precedence over " "annotations on classes appearing later in the method resolution order." msgstr "" -#: ../../library/typing.rst:3183 +#: ../../library/typing.rst:3203 msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]`` " "with ``T``, unless *include_extras* is set to ``True`` (see :class:" "`Annotated` for more information)." msgstr "" -#: ../../library/typing.rst:3187 +#: ../../library/typing.rst:3207 msgid "" "See also :func:`inspect.get_annotations`, a lower-level function that " "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:3192 +#: ../../library/typing.rst:3212 msgid "" "If any forward references in the annotations of *obj* are not resolvable or " "are not valid Python code, this function will raise an exception such as :" @@ -4897,7 +4924,7 @@ msgid "" "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:3198 +#: ../../library/typing.rst:3218 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." @@ -4905,20 +4932,20 @@ msgstr "" "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" "`Annotated` 的文件。" -#: ../../library/typing.rst:3202 +#: ../../library/typing.rst:3222 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:3209 +#: ../../library/typing.rst:3229 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3212 +#: ../../library/typing.rst:3232 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " "it will be normalized to the original class. If ``X`` is an instance of :" @@ -4926,15 +4953,16 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3218 ../../library/typing.rst:3241 +#: ../../library/typing.rst:3238 ../../library/typing.rst:3262 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3220 +#: ../../library/typing.rst:3240 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" "assert get_origin(Union[int, str]) is Union\n" +"assert get_origin(Annotated[str, \"metadata\"]) is Annotated\n" "P = ParamSpec('P')\n" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" @@ -4942,17 +4970,18 @@ msgstr "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" "assert get_origin(Union[int, str]) is Union\n" +"assert get_origin(Annotated[str, \"metadata\"]) is Annotated\n" "P = ParamSpec('P')\n" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3233 +#: ../../library/typing.rst:3254 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: ../../library/typing.rst:3236 +#: ../../library/typing.rst:3257 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -4960,7 +4989,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3243 +#: ../../library/typing.rst:3264 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -4970,11 +4999,11 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3253 +#: ../../library/typing.rst:3274 msgid "Return the set of members defined in a :class:`Protocol`." msgstr "" -#: ../../library/typing.rst:3255 +#: ../../library/typing.rst:3276 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -4984,16 +5013,15 @@ msgid "" "True" msgstr "" -#: ../../library/typing.rst:3264 +#: ../../library/typing.rst:3285 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." msgstr "" -#: ../../library/typing.rst:3270 -#, fuzzy +#: ../../library/typing.rst:3291 msgid "Determine if a type is a :class:`Protocol`." -msgstr "棄用 :class:`tuple` 的別名。" +msgstr "確定一個型別是否 :class:`Protocol`。" -#: ../../library/typing.rst:3274 +#: ../../library/typing.rst:3295 msgid "" "class P(Protocol):\n" " def a(self) -> str: ...\n" @@ -5003,11 +5031,11 @@ msgid "" "is_protocol(int) # => False" msgstr "" -#: ../../library/typing.rst:3285 +#: ../../library/typing.rst:3306 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3289 +#: ../../library/typing.rst:3310 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5021,32 +5049,32 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3306 +#: ../../library/typing.rst:3327 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3308 +#: ../../library/typing.rst:3329 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. ``ForwardRef`` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3313 +#: ../../library/typing.rst:3334 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:3321 +#: ../../library/typing.rst:3342 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" -#: ../../library/typing.rst:3324 +#: ../../library/typing.rst:3345 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5056,17 +5084,17 @@ msgid "" "True" msgstr "" -#: ../../library/typing.rst:3336 +#: ../../library/typing.rst:3357 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3340 +#: ../../library/typing.rst:3361 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It is ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3345 +#: ../../library/typing.rst:3366 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -5080,7 +5108,7 @@ msgstr "" "def fun(arg: 'expensive_mod.SomeType') -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3351 +#: ../../library/typing.rst:3372 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -5088,7 +5116,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:3358 +#: ../../library/typing.rst:3379 msgid "" "If ``from __future__ import annotations`` is used, annotations are not " "evaluated at function definition time. Instead, they are stored as strings " @@ -5096,11 +5124,11 @@ msgid "" "annotation (see :pep:`563`)." msgstr "" -#: ../../library/typing.rst:3370 +#: ../../library/typing.rst:3391 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3372 +#: ../../library/typing.rst:3393 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the typing module in " @@ -5109,7 +5137,7 @@ msgid "" "existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3379 +#: ../../library/typing.rst:3400 msgid "" "The redundant types are deprecated as of Python 3.9. However, while the " "aliases may be removed at some point, removal of these aliases is not " @@ -5117,7 +5145,7 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3384 +#: ../../library/typing.rst:3405 msgid "" "If at some point it is decided to remove these deprecated aliases, a " "deprecation warning will be issued by the interpreter for at least two " @@ -5125,38 +5153,38 @@ msgid "" "typing module without deprecation warnings until at least Python 3.14." msgstr "" -#: ../../library/typing.rst:3389 +#: ../../library/typing.rst:3410 msgid "" "Type checkers are encouraged to flag uses of the deprecated types if the " "program they are checking targets a minimum Python version of 3.9 or newer." msgstr "" -#: ../../library/typing.rst:3395 +#: ../../library/typing.rst:3416 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3399 +#: ../../library/typing.rst:3420 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3401 +#: ../../library/typing.rst:3422 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Mapping` rather than to " "use :class:`dict` or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:3405 +#: ../../library/typing.rst:3426 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3411 +#: ../../library/typing.rst:3432 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3413 +#: ../../library/typing.rst:3434 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Sequence` or :class:" @@ -5164,136 +5192,136 @@ msgid "" "typing.List`." msgstr "" -#: ../../library/typing.rst:3418 +#: ../../library/typing.rst:3439 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3424 +#: ../../library/typing.rst:3445 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3426 +#: ../../library/typing.rst:3447 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`collections.abc.Set` rather than to use :" "class:`set` or :class:`typing.Set`." msgstr "" -#: ../../library/typing.rst:3430 +#: ../../library/typing.rst:3451 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3436 +#: ../../library/typing.rst:3457 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3438 +#: ../../library/typing.rst:3459 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3445 +#: ../../library/typing.rst:3466 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3447 +#: ../../library/typing.rst:3468 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3450 +#: ../../library/typing.rst:3471 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3456 +#: ../../library/typing.rst:3477 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3458 +#: ../../library/typing.rst:3479 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3463 +#: ../../library/typing.rst:3484 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3470 +#: ../../library/typing.rst:3491 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3474 +#: ../../library/typing.rst:3495 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3478 +#: ../../library/typing.rst:3499 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3484 +#: ../../library/typing.rst:3505 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3488 +#: ../../library/typing.rst:3509 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3494 +#: ../../library/typing.rst:3515 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3498 +#: ../../library/typing.rst:3519 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3504 +#: ../../library/typing.rst:3525 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3508 +#: ../../library/typing.rst:3529 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3514 +#: ../../library/typing.rst:3535 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3518 +#: ../../library/typing.rst:3539 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3525 +#: ../../library/typing.rst:3546 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3530 +#: ../../library/typing.rst:3551 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3533 +#: ../../library/typing.rst:3554 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -5301,343 +5329,343 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3538 +#: ../../library/typing.rst:3559 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3544 +#: ../../library/typing.rst:3565 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3546 +#: ../../library/typing.rst:3567 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: ../../library/typing.rst:3550 +#: ../../library/typing.rst:3571 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:3553 +#: ../../library/typing.rst:3574 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" msgstr "" -#: ../../library/typing.rst:3558 +#: ../../library/typing.rst:3579 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: ../../library/typing.rst:3568 +#: ../../library/typing.rst:3589 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3572 +#: ../../library/typing.rst:3593 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3574 +#: ../../library/typing.rst:3595 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3580 +#: ../../library/typing.rst:3601 msgid "" "This type represents the types :class:`bytes`, :class:`bytearray`, and :" "class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:3583 +#: ../../library/typing.rst:3604 msgid "" "Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray " "| memoryview``." msgstr "" -#: ../../library/typing.rst:3588 +#: ../../library/typing.rst:3609 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3592 +#: ../../library/typing.rst:3613 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3598 +#: ../../library/typing.rst:3619 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3600 +#: ../../library/typing.rst:3621 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3606 +#: ../../library/typing.rst:3627 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3608 +#: ../../library/typing.rst:3629 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3614 +#: ../../library/typing.rst:3635 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3616 +#: ../../library/typing.rst:3637 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3622 +#: ../../library/typing.rst:3643 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3624 +#: ../../library/typing.rst:3645 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3630 +#: ../../library/typing.rst:3651 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3632 +#: ../../library/typing.rst:3653 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3638 +#: ../../library/typing.rst:3659 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3640 +#: ../../library/typing.rst:3661 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3647 +#: ../../library/typing.rst:3668 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3649 +#: ../../library/typing.rst:3670 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3656 +#: ../../library/typing.rst:3677 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3658 +#: ../../library/typing.rst:3679 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3664 +#: ../../library/typing.rst:3685 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3666 +#: ../../library/typing.rst:3687 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3672 +#: ../../library/typing.rst:3693 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3674 +#: ../../library/typing.rst:3695 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3681 +#: ../../library/typing.rst:3702 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3685 +#: ../../library/typing.rst:3706 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3687 +#: ../../library/typing.rst:3708 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Coroutine` and ``typing.Coroutine`` in type annotations." msgstr "" -#: ../../library/typing.rst:3693 +#: ../../library/typing.rst:3714 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3699 +#: ../../library/typing.rst:3720 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3701 +#: ../../library/typing.rst:3722 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` in type " "annotations." msgstr "" -#: ../../library/typing.rst:3707 +#: ../../library/typing.rst:3728 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3712 +#: ../../library/typing.rst:3733 msgid "The ``SendType`` parameter now has a default." msgstr "" -#: ../../library/typing.rst:3717 +#: ../../library/typing.rst:3738 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3721 +#: ../../library/typing.rst:3742 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3727 +#: ../../library/typing.rst:3748 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3731 +#: ../../library/typing.rst:3752 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3737 +#: ../../library/typing.rst:3758 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3741 +#: ../../library/typing.rst:3762 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3748 +#: ../../library/typing.rst:3769 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3752 +#: ../../library/typing.rst:3773 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3754 +#: ../../library/typing.rst:3775 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3760 +#: ../../library/typing.rst:3781 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3762 +#: ../../library/typing.rst:3783 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3768 +#: ../../library/typing.rst:3789 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:3770 +#: ../../library/typing.rst:3791 msgid "" "See :ref:`annotating-callables` for details on how to use :class:" "`collections.abc.Callable` and ``typing.Callable`` in type annotations." msgstr "" -#: ../../library/typing.rst:3773 +#: ../../library/typing.rst:3794 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3783 +#: ../../library/typing.rst:3804 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:3785 +#: ../../library/typing.rst:3806 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Generator` and ``typing.Generator`` in type annotations." msgstr "" -#: ../../library/typing.rst:3789 +#: ../../library/typing.rst:3810 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3793 +#: ../../library/typing.rst:3814 msgid "Default values for the send and return types were added." msgstr "" -#: ../../library/typing.rst:3798 +#: ../../library/typing.rst:3819 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:3800 +#: ../../library/typing.rst:3821 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:3805 +#: ../../library/typing.rst:3826 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:3807 +#: ../../library/typing.rst:3828 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3813 +#: ../../library/typing.rst:3834 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:3815 +#: ../../library/typing.rst:3836 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:3821 +#: ../../library/typing.rst:3842 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:3825 +#: ../../library/typing.rst:3846 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:3827 +#: ../../library/typing.rst:3848 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__enter__` method. The optional second type parameter, " @@ -5645,21 +5673,21 @@ msgid "" "returned by the :meth:`~object.__exit__` method." msgstr "" -#: ../../library/typing.rst:3834 +#: ../../library/typing.rst:3855 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3839 +#: ../../library/typing.rst:3860 msgid "Added the optional second type parameter, ``ExitT_co``." msgstr "" -#: ../../library/typing.rst:3844 +#: ../../library/typing.rst:3865 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:3846 +#: ../../library/typing.rst:3867 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__aenter__` method. The optional second type parameter, " @@ -5667,21 +5695,21 @@ msgid "" "returned by the :meth:`~object.__aexit__` method." msgstr "" -#: ../../library/typing.rst:3853 +#: ../../library/typing.rst:3874 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3858 +#: ../../library/typing.rst:3879 msgid "Added the optional second type parameter, ``AExitT_co``." msgstr "" -#: ../../library/typing.rst:3862 +#: ../../library/typing.rst:3883 msgid "Deprecation Timeline of Major Features" msgstr "" -#: ../../library/typing.rst:3864 +#: ../../library/typing.rst:3885 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -5689,111 +5717,111 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:3871 +#: ../../library/typing.rst:3892 msgid "Feature" msgstr "" -#: ../../library/typing.rst:3872 +#: ../../library/typing.rst:3893 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:3873 +#: ../../library/typing.rst:3894 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:3874 +#: ../../library/typing.rst:3895 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:3875 +#: ../../library/typing.rst:3896 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:3876 ../../library/typing.rst:3880 +#: ../../library/typing.rst:3897 ../../library/typing.rst:3901 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:3877 +#: ../../library/typing.rst:3898 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:3878 +#: ../../library/typing.rst:3899 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:3879 +#: ../../library/typing.rst:3900 msgid ":class:`typing.ByteString`" msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:3881 +#: ../../library/typing.rst:3902 msgid "3.14" msgstr "3.14" -#: ../../library/typing.rst:3882 +#: ../../library/typing.rst:3903 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:3883 +#: ../../library/typing.rst:3904 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:3884 +#: ../../library/typing.rst:3905 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:3885 ../../library/typing.rst:3889 -#: ../../library/typing.rst:3893 +#: ../../library/typing.rst:3906 ../../library/typing.rst:3910 +#: ../../library/typing.rst:3914 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:3886 +#: ../../library/typing.rst:3907 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:3887 +#: ../../library/typing.rst:3908 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:3888 ../../library/typing.rst:3892 +#: ../../library/typing.rst:3909 ../../library/typing.rst:3913 msgid "3.12" msgstr "3.12" -#: ../../library/typing.rst:3890 +#: ../../library/typing.rst:3911 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:3891 +#: ../../library/typing.rst:3912 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:3894 +#: ../../library/typing.rst:3915 msgid ":pep:`695`" msgstr ":pep:`695`" -#: ../../library/typing.rst:3895 +#: ../../library/typing.rst:3916 msgid ":func:`@typing.no_type_check_decorator `" msgstr "" -#: ../../library/typing.rst:3896 ../../library/typing.rst:3900 +#: ../../library/typing.rst:3917 ../../library/typing.rst:3921 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:3897 +#: ../../library/typing.rst:3918 msgid "3.15" msgstr "3.15" -#: ../../library/typing.rst:3898 +#: ../../library/typing.rst:3919 msgid ":gh:`106309`" msgstr ":gh:`106309`" -#: ../../library/typing.rst:3899 +#: ../../library/typing.rst:3920 msgid ":data:`typing.AnyStr`" msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:3901 +#: ../../library/typing.rst:3922 msgid "3.18" msgstr "3.18" -#: ../../library/typing.rst:3902 +#: ../../library/typing.rst:3923 msgid ":gh:`105578`" msgstr ":gh:`105578`" diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 46210eedbc..c4159ff0b8 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-02-19 21:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -304,11 +304,11 @@ msgstr "" #: ../../library/unittest.mock.rst:241 msgid "" -"If *spec* is an object (rather than a list of strings) then :attr:`~instance." +"If *spec* is an object (rather than a list of strings) then :attr:`~object." "__class__` returns the class of the spec object. This allows mocks to pass :" "func:`isinstance` tests." msgstr "" -"如果 *spec* 是一個物件(而不是一個字串的串列),那麼 :attr:`~instance." +"如果 *spec* 是一個物件(而不是一個字串的串列),那麼 :attr:`~object." "__class__` 會回傳 spec 物件的類別。這允許 mocks 通過 :func:`isinstance` 測" "試。" @@ -1147,9 +1147,8 @@ msgid "" msgstr "" #: ../../library/unittest.mock.rst:1133 -#, fuzzy msgid "Waits until the mock is called." -msgstr "斷言 mock 從未被呼叫。" +msgstr "等待直到 mock 被呼叫。" #: ../../library/unittest.mock.rst:1135 msgid "" @@ -1159,9 +1158,8 @@ msgid "" msgstr "" #: ../../library/unittest.mock.rst:1147 -#, fuzzy msgid "Waits until the mock is called with the specified arguments." -msgstr "斷言 mock 已經被使用指定的引數呼叫。" +msgstr "等到直到 mock 被以特定引數呼叫。" #: ../../library/unittest.mock.rst:1149 msgid "" diff --git a/library/venv.po b/library/venv.po index 2318e51ea4..ab4f0f4050 100644 --- a/library/venv.po +++ b/library/venv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-30 09:19+0000\n" "PO-Revision-Date: 2023-07-09 15:09+0800\n" "Last-Translator: Po-Chuan Chen \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -59,8 +59,8 @@ msgstr "" #: ../../library/venv.rst:40 msgid "" -"Contained in a directory, conventionally either named ``venv`` or ``.venv`` " -"in the project directory, or under a container directory for lots of virtual " +"Contained in a directory, conventionally named ``.venv`` or ``venv`` in the " +"project directory, or under a container directory for lots of virtual " "environments, such as ``~/.virtualenvs``." msgstr "" @@ -71,7 +71,7 @@ msgstr "" #: ../../library/venv.rst:46 msgid "" "Considered as disposable -- it should be simple to delete and recreate it " -"from scratch. You don't place any project code in the environment" +"from scratch. You don't place any project code in the environment." msgstr "" #: ../../library/venv.rst:49 @@ -107,118 +107,102 @@ msgstr "" msgid "Creating virtual environments" msgstr "建立虛擬環境" -#: ../../using/venv-create.inc:1 +#: ../../library/venv.rst:64 msgid "" -"Creation of :ref:`virtual environments ` is done by executing the " -"command ``venv``::" -msgstr "建立\\ :ref:`虛擬環境 `\\ 的方法是透過執行指令 ``venv``:" +":ref:`Virtual environments ` are created by executing the ``venv`` " +"module:" +msgstr ":ref:`虛擬環境 `\\ 是透過執行 ``venv`` 模組來建立:" -#: ../../using/venv-create.inc:4 +#: ../../library/venv.rst:67 msgid "python -m venv /path/to/new/virtual/environment" msgstr "python -m venv /path/to/new/virtual/environment" -#: ../../using/venv-create.inc:6 +#: ../../library/venv.rst:71 msgid "" -"Running this command creates the target directory (creating any parent " -"directories that don't exist already) and places a ``pyvenv.cfg`` file in it " -"with a ``home`` key pointing to the Python installation from which the " -"command was run (a common name for the target directory is ``.venv``). It " -"also creates a ``bin`` (or ``Scripts`` on Windows) subdirectory containing a " -"copy/symlink of the Python binary/binaries (as appropriate for the platform " -"or arguments used at environment creation time). It also creates an " -"(initially empty) ``lib/pythonX.Y/site-packages`` subdirectory (on Windows, " -"this is ``Lib\\site-packages``). If an existing directory is specified, it " -"will be re-used." +"This creates the target directory (including parent directories as needed) " +"and places a :file:`pyvenv.cfg` file in it with a ``home`` key pointing to " +"the Python installation from which the command was run. It also creates a :" +"file:`bin` (or :file:`Scripts` on Windows) subdirectory containing a copy or " +"symlink of the Python executable (as appropriate for the platform or " +"arguments used at environment creation time). It also creates a :file:`lib/" +"pythonX.Y/site-packages` subdirectory (on Windows, this is :file:`Lib\\site-" +"packages`). If an existing directory is specified, it will be re-used." msgstr "" "執行此命令會建立目標目錄(同時也會建立任何還不存在的父目錄)並在目錄中放置一" -"個名為 ``pyvenv.cfg`` 的檔案,其中包含一個指向執行該命令的 Python 安裝路徑的 " -"``home`` 鍵(目標目錄的常見名稱為 ``.venv``)。同時,它會建立一個 ``bin`` " -"(在 Windows 上為 ``Scripts``)子目錄,其中包含一個 Python 二進位檔案的副本/" -"符號連結(根據建立環境時使用的平台或引數而定)。此外,它還會建立一個(最初為" -"空的) ``lib/pythonX.Y/site-packages`` 子目錄(在 Windows 上為 ``Lib\\site-" -"packages``)。如果指定的目錄已存在,則將重新使用該目錄。" +"個名為 :file:`pyvenv.cfg` 的檔案,其中包含一個指向執行該命令的 Python 安裝路" +"徑的 ``home`` 鍵。它同時會建立一個 :file:`bin` (在 Windows 上為 :file:" +"`Scripts`)子目錄,其中包含一個 Python 二進位檔案的副本/符號連結(根據建立環" +"境時使用的平台或引數而定)。此外,它還會建立一個 :file:`lib/pythonX.Y/site-" +"packages` 子目錄(在 Windows 上為 :file:`Lib\\site-packages`)。如果指定的目" +"錄已存在,則將重新使用該目錄。" -#: ../../using/venv-create.inc:17 +#: ../../library/venv.rst:81 msgid "" "The use of ``venv`` is now recommended for creating virtual environments." msgstr "目前建議使用 ``venv`` 來建立虛擬環境。" -#: ../../using/venv-create.inc:20 +#: ../../library/venv.rst:84 msgid "" -"``pyvenv`` was the recommended tool for creating virtual environments for " -"Python 3.3 and 3.4, and is :ref:`deprecated in Python 3.6 `." +":program:`pyvenv` was the recommended tool for creating virtual environments " +"for Python 3.3 and 3.4, and replaced in 3.5 by executing ``venv`` directly." msgstr "" -"``pyvenv`` 是在 Python 3.3 和 3.4 中建立虛擬環境的推薦工具,但在 Python 3.6 " -"中已被\\ :ref:`棄用 `。" +":program:`pyvenv` 是在 Python 3.3 和 3.4 中建立虛擬環境的推薦工具,但在 " +"Python 3.5 中已被直接執行 ``venv`` 所取代。" -#: ../../using/venv-create.inc:27 -msgid "On Windows, invoke the ``venv`` command as follows::" +#: ../../library/venv.rst:90 +msgid "On Windows, invoke the ``venv`` command as follows:" msgstr "在 Windows 上,執行以下命令以使用 ``venv``:" -#: ../../using/venv-create.inc:29 -msgid "c:\\>Python35\\python -m venv c:\\path\\to\\myenv" -msgstr "c:\\>Python35\\python -m venv c:\\path\\to\\myenv" - -#: ../../using/venv-create.inc:31 -msgid "" -"Alternatively, if you configured the ``PATH`` and ``PATHEXT`` variables for " -"your :ref:`Python installation `::" -msgstr "" -"或者,如你已經為你的 :ref:`Python 安裝 `\\ 配置了 ``PATH`` " -"和 ``PATHEXT`` 變數,則可以執行以下命令:" - -#: ../../using/venv-create.inc:34 -msgid "c:\\>python -m venv c:\\path\\to\\myenv" -msgstr "c:\\>python -m venv c:\\path\\to\\myenv" +#: ../../library/venv.rst:92 +msgid "PS> python -m venv C:\\path\\to\\new\\virtual\\environment" +msgstr "PS> python -m venv C:\\path\\to\\new\\virtual\\environment" -#: ../../using/venv-create.inc:36 +#: ../../library/venv.rst:96 msgid "The command, if run with ``-h``, will show the available options::" msgstr "如果使用 ``-h`` 選項執行該命令,將會顯示可用的選項:" -#: ../../using/venv-create.inc:38 -#, fuzzy +#: ../../library/venv.rst:98 msgid "" "usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]\n" " [--upgrade] [--without-pip] [--prompt PROMPT] [--upgrade-deps]\n" -" [--without-scm-ignore-file]\n" +" [--without-scm-ignore-files]\n" " ENV_DIR [ENV_DIR ...]\n" "\n" "Creates virtual Python environments in one or more target directories.\n" "\n" "positional arguments:\n" -"ENV_DIR A directory to create the environment in.\n" +" ENV_DIR A directory to create the environment in.\n" "\n" "options:\n" -"-h, --help show this help message and exit\n" -"--system-site-packages\n" +" -h, --help show this help message and exit\n" +" --system-site-packages\n" " Give the virtual environment access to the system\n" " site-packages dir.\n" -"--symlinks Try to use symlinks rather than copies, when\n" +" --symlinks Try to use symlinks rather than copies, when\n" " symlinks are not the default for the platform.\n" -"--copies Try to use copies rather than symlinks, even when\n" +" --copies Try to use copies rather than symlinks, even when\n" " symlinks are the default for the platform.\n" -"--clear Delete the contents of the environment directory if\n" -" it already exists, before environment creation.\n" -"--upgrade Upgrade the environment directory to use this\n" -" version of Python, assuming Python has been " -"upgraded\n" -" in-place.\n" -"--without-pip Skips installing or upgrading pip in the virtual\n" +" --clear Delete the contents of the environment directory\n" +" if it already exists, before environment creation.\n" +" --upgrade Upgrade the environment directory to use this\n" +" version of Python, assuming Python has been\n" +" upgraded in-place.\n" +" --without-pip Skips installing or upgrading pip in the virtual\n" " environment (pip is bootstrapped by default)\n" -"--prompt PROMPT Provides an alternative prompt prefix for this\n" +" --prompt PROMPT Provides an alternative prompt prefix for this\n" " environment.\n" -"--upgrade-deps Upgrade core dependencies (pip) to the latest\n" +" --upgrade-deps Upgrade core dependencies (pip) to the latest\n" " version in PyPI\n" -"--without-scm-ignore-file\n" -" Skips adding the default SCM ignore file to the\n" -" environment directory (the default is a .gitignore\n" -" file).\n" +" --without-scm-ignore-files\n" +" Skips adding SCM ignore files to the environment\n" +" directory (Git is supported by default).\n" "\n" "Once an environment has been created, you may wish to activate it, e.g. by\n" "sourcing an activate script in its bin directory." msgstr "" "usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]\n" " [--upgrade] [--without-pip] [--prompt PROMPT] [--upgrade-deps]\n" +" [--without-scm-ignore-files]\n" " ENV_DIR [ENV_DIR ...]\n" "\n" "Creates virtual Python environments in one or more target directories.\n" @@ -226,65 +210,67 @@ msgstr "" "positional arguments:\n" " ENV_DIR A directory to create the environment in.\n" "\n" -"optional arguments:\n" +"options:\n" " -h, --help show this help message and exit\n" " --system-site-packages\n" " Give the virtual environment access to the system\n" " site-packages dir.\n" -" --symlinks Try to use symlinks rather than copies, when " -"symlinks\n" -" are not the default for the platform.\n" +" --symlinks Try to use symlinks rather than copies, when\n" +" symlinks are not the default for the platform.\n" " --copies Try to use copies rather than symlinks, even when\n" " symlinks are the default for the platform.\n" -" --clear Delete the contents of the environment directory if " -"it\n" -" already exists, before environment creation.\n" -" --upgrade Upgrade the environment directory to use this " -"version\n" -" of Python, assuming Python has been upgraded in-" -"place.\n" +" --clear Delete the contents of the environment directory\n" +" if it already exists, before environment creation.\n" +" --upgrade Upgrade the environment directory to use this\n" +" version of Python, assuming Python has been\n" +" upgraded in-place.\n" " --without-pip Skips installing or upgrading pip in the virtual\n" " environment (pip is bootstrapped by default)\n" " --prompt PROMPT Provides an alternative prompt prefix for this\n" " environment.\n" -" --upgrade-deps Upgrade core dependencies (pip) to the\n" -" latest version in PyPI\n" +" --upgrade-deps Upgrade core dependencies (pip) to the latest\n" +" version in PyPI\n" +" --without-scm-ignore-files\n" +" Skips adding SCM ignore files to the environment\n" +" directory (Git is supported by default).\n" "\n" "Once an environment has been created, you may wish to activate it, e.g. by\n" "sourcing an activate script in its bin directory." -#: ../../using/venv-create.inc:78 +#: ../../library/venv.rst:136 msgid "" -"``--without-scm-ignore-file`` was added along with creating an ignore file " -"for ``git`` by default." -msgstr "" +"Installs pip by default, added the ``--without-pip`` and ``--copies`` " +"options." +msgstr "預設會安裝 pip,並新增了 ``--without-pip`` 和 ``--copies`` 選項" -#: ../../library/venv.rst:323 ../../using/venv-create.inc:83 -msgid "``setuptools`` is no longer a core venv dependency." +#: ../../library/venv.rst:140 +msgid "" +"In earlier versions, if the target directory already existed, an error was " +"raised, unless the ``--clear`` or ``--upgrade`` option was provided." msgstr "" +"在較早的版本中,如果目標目錄已存在,除非提供了 ``--clear`` 或 ``--upgrade`` " +"選項,否則會引發錯誤。" -#: ../../using/venv-create.inc:85 +#: ../../library/venv.rst:144 msgid "" "Add ``--upgrade-deps`` option to upgrade pip + setuptools to the latest on " -"PyPI" +"PyPI." msgstr "" "新增 ``--upgrade-deps`` 選項以將 pip 和 setuptools 升級至 PyPI 上的最新版本" -#: ../../using/venv-create.inc:88 -msgid "" -"Installs pip by default, added the ``--without-pip`` and ``--copies`` " -"options" -msgstr "預設情況下安裝 pip,並新增了 ``--without-pip`` 和 ``--copies`` 選項" +#: ../../library/venv.rst:149 +msgid "``setuptools`` is no longer a core venv dependency." +msgstr "" -#: ../../using/venv-create.inc:92 -msgid "" -"In earlier versions, if the target directory already existed, an error was " -"raised, unless the ``--clear`` or ``--upgrade`` option was provided." +#: ../../library/venv.rst:153 +msgid "Added the ``--without-scm-ignore-files`` option." +msgstr "新增 ``--without-scm-ignore-files`` 選項" + +#: ../../library/venv.rst:154 +msgid "``venv`` now creates a :file:`.gitignore` file for Git by default." msgstr "" -"在較早的版本中,如果目標目錄已存在,除非提供了 ``--clear`` 或 ``--upgrade`` " -"選項,否則會引發錯誤。" -#: ../../using/venv-create.inc:97 +#: ../../library/venv.rst:158 msgid "" "While symlinks are supported on Windows, they are not recommended. Of " "particular note is that double-clicking ``python.exe`` in File Explorer will " @@ -293,7 +279,7 @@ msgstr "" "雖然在 Windows 上支援符號連結,但並不建議使用。特別需要注意的是,在檔案總管中" "按兩下 ``python.exe`` 會急切地解析符號連結並忽略虛擬環境。" -#: ../../using/venv-create.inc:102 +#: ../../library/venv.rst:163 msgid "" "On Microsoft Windows, it may be required to enable the ``Activate.ps1`` " "script by setting the execution policy for the user. You can do this by " @@ -302,12 +288,13 @@ msgstr "" "在 Microsoft Windows 上,可能需要通過設置使用者的執行策略來啟用 ``Activate." "ps1`` 腳本。你可以發出以下 PowerShell 命令來執行此操作:" -#: ../../using/venv-create.inc:106 +#: ../../library/venv.rst:167 msgid "" "PS C:\\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser" msgstr "" +"PS C:\\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser" -#: ../../using/venv-create.inc:108 +#: ../../library/venv.rst:171 msgid "" "See `About Execution Policies `_ for more information." @@ -315,17 +302,17 @@ msgstr "" "有關更多資訊,請參閱\\ `關於執行策略 `_。" -#: ../../using/venv-create.inc:112 +#: ../../library/venv.rst:175 msgid "" -"The created ``pyvenv.cfg`` file also includes the ``include-system-site-" +"The created :file:`pyvenv.cfg` file also includes the ``include-system-site-" "packages`` key, set to ``true`` if ``venv`` is run with the ``--system-site-" "packages`` option, ``false`` otherwise." msgstr "" -"被建立的 ``pyvenv.cfg`` 檔案還包括了 ``include-system-site-packages`` 的鍵," -"如果使用 ``venv`` 執行時帶有 ``--system-site-packages`` 選項,則設置為 " +"被建立的 :file:`pyvenv.cfg` 檔案還包括了 ``include-system-site-packages`` 的" +"鍵,如果使用 ``venv`` 執行時帶有 ``--system-site-packages`` 選項,則設置為 " "``true``,否則設置為 ``false``。" -#: ../../using/venv-create.inc:116 +#: ../../library/venv.rst:179 msgid "" "Unless the ``--without-pip`` option is given, :mod:`ensurepip` will be " "invoked to bootstrap ``pip`` into the virtual environment." @@ -333,7 +320,7 @@ msgstr "" "除非 ``--without-pip`` 選項被提供,否則將調用 :mod:`ensurepip` 來啟動 " "``pip`` 到虛擬環境中。" -#: ../../using/venv-create.inc:119 +#: ../../library/venv.rst:182 msgid "" "Multiple paths can be given to ``venv``, in which case an identical virtual " "environment will be created, according to the given options, at each " @@ -342,11 +329,11 @@ msgstr "" "可以向 ``venv`` 提供多個路徑,這樣每個提供的路徑都將根據給定的選項建立一個相" "同的虛擬環境。" -#: ../../library/venv.rst:69 +#: ../../library/venv.rst:189 msgid "How venvs work" msgstr "虛擬環境如何運作" -#: ../../library/venv.rst:71 +#: ../../library/venv.rst:191 msgid "" "When a Python interpreter is running from a virtual environment, :data:`sys." "prefix` and :data:`sys.exec_prefix` point to the directories of the virtual " @@ -360,7 +347,7 @@ msgstr "" "base_exec_prefix` 會指向建立虛擬環境的基礎 Python 的目錄。檢查 ``sys.prefix !" "= sys.base_prefix`` 就可以確定目前的直譯器是否跑在虛擬環境中。" -#: ../../library/venv.rst:80 +#: ../../library/venv.rst:200 msgid "" "A virtual environment may be \"activated\" using a script in its binary " "directory (``bin`` on POSIX; ``Scripts`` on Windows). This will prepend that " @@ -376,81 +363,81 @@ msgstr "" "用完整的路徑。啟動腳本的方式因平台而異(:samp:`{}` 需要替換成包含虛擬環" "境的目錄路徑)" -#: ../../library/venv.rst:90 +#: ../../library/venv.rst:210 msgid "Platform" msgstr "平台" -#: ../../library/venv.rst:90 +#: ../../library/venv.rst:210 msgid "Shell" msgstr "Shell" -#: ../../library/venv.rst:90 +#: ../../library/venv.rst:210 msgid "Command to activate virtual environment" msgstr "啟動虛擬環境的指令" -#: ../../library/venv.rst:92 +#: ../../library/venv.rst:212 msgid "POSIX" msgstr "POSIX" -#: ../../library/venv.rst:92 +#: ../../library/venv.rst:212 msgid "bash/zsh" msgstr "bash/zsh" -#: ../../library/venv.rst:92 +#: ../../library/venv.rst:212 msgid ":samp:`$ source {}/bin/activate`" msgstr ":samp:`$ source {}/bin/activate`" -#: ../../library/venv.rst:94 +#: ../../library/venv.rst:214 msgid "fish" msgstr "fish" -#: ../../library/venv.rst:94 +#: ../../library/venv.rst:214 msgid ":samp:`$ source {}/bin/activate.fish`" msgstr ":samp:`$ source {}/bin/activate.fish`" -#: ../../library/venv.rst:96 +#: ../../library/venv.rst:216 msgid "csh/tcsh" msgstr "csh/tcsh" -#: ../../library/venv.rst:96 +#: ../../library/venv.rst:216 msgid ":samp:`$ source {}/bin/activate.csh`" msgstr ":samp:`$ source {}/bin/activate.csh`" -#: ../../library/venv.rst:98 ../../library/venv.rst:102 +#: ../../library/venv.rst:218 ../../library/venv.rst:222 msgid "PowerShell" msgstr "PowerShell" -#: ../../library/venv.rst:98 +#: ../../library/venv.rst:218 msgid ":samp:`$ {}/bin/Activate.ps1`" msgstr ":samp:`$ {}/bin/Activate.ps1`" -#: ../../library/venv.rst:100 +#: ../../library/venv.rst:220 msgid "Windows" msgstr "Windows" -#: ../../library/venv.rst:100 +#: ../../library/venv.rst:220 msgid "cmd.exe" msgstr "cmd.exe" -#: ../../library/venv.rst:100 +#: ../../library/venv.rst:220 msgid ":samp:`C:\\\\> {}\\\\Scripts\\\\activate.bat`" msgstr ":samp:`C:\\\\> {}\\\\Scripts\\\\activate.bat`" -#: ../../library/venv.rst:102 +#: ../../library/venv.rst:222 msgid ":samp:`PS C:\\\\> {}\\\\Scripts\\\\Activate.ps1`" msgstr ":samp:`PS C:\\\\> {}\\\\Scripts\\\\Activate.ps1`" -#: ../../library/venv.rst:105 +#: ../../library/venv.rst:225 msgid ":program:`fish` and :program:`csh` activation scripts." msgstr ":program:`fish` 和 :program:`csh` 啟動腳本。" -#: ../../library/venv.rst:108 +#: ../../library/venv.rst:228 msgid "" "PowerShell activation scripts installed under POSIX for PowerShell Core " "support." msgstr "PowerShell 的啟動腳本安裝在 POSIX 上支援 PowerShell Core。" -#: ../../library/venv.rst:112 +#: ../../library/venv.rst:232 msgid "" "You don't specifically *need* to activate a virtual environment, as you can " "just specify the full path to that environment's Python interpreter when " @@ -461,25 +448,25 @@ msgstr "" "整路徑。此外,所有安裝在環境裡的腳本都應該都可以在未啟用虛擬環境的情況下運" "行。" -#: ../../library/venv.rst:118 +#: ../../library/venv.rst:238 msgid "" "In order to achieve this, scripts installed into virtual environments have a " -"\"shebang\" line which points to the environment's Python interpreter, i.e. :" -"samp:`#!/{}/bin/python`. This means that the script will run " -"with that interpreter regardless of the value of :envvar:`PATH`. On Windows, " +"\"shebang\" line which points to the environment's Python interpreter, :samp:" +"`#!/{}/bin/python`. This means that the script will run with " +"that interpreter regardless of the value of :envvar:`PATH`. On Windows, " "\"shebang\" line processing is supported if you have the :ref:`launcher` " "installed. Thus, double-clicking an installed script in a Windows Explorer " "window should run it with the correct interpreter without the environment " "needing to be activated or on the :envvar:`PATH`." msgstr "" "為了實現這一點,安裝在虛擬環境中的腳本會有一個 \"shebang\" 列,此列指向該環境" -"的 Python 直譯器,例如: :samp:`#!/{}/bin/python`。這代表無論 :" -"envvar:`PATH` 的值為何,該腳本都會在直譯器上運行。在 Windows 上,如果你安裝" -"了 :ref:`launcher`,則支援 \"shebang\" 列處理。因此,在 Windows 檔案總管" -"(Windows Explorer)中雙擊已安裝的腳本,應該可以在沒有啟用環境或將其加入 :" -"envvar:`PATH` 的情況下正確地運行。" +"的 Python 直譯器 :samp:`#!/{}/bin/python`。這代表無論 :envvar:" +"`PATH` 的值為何,該腳本都會在直譯器上運行。在 Windows 上,如果你安裝了 :ref:" +"`launcher`,則支援 \"shebang\" 列處理。因此,在 Windows 檔案總管(Windows " +"Explorer)中雙擊已安裝的腳本,應該可以在沒有啟用環境或將其加入 :envvar:" +"`PATH` 的情況下正確地運行。" -#: ../../library/venv.rst:127 +#: ../../library/venv.rst:247 msgid "" "When a virtual environment has been activated, the :envvar:`!VIRTUAL_ENV` " "environment variable is set to the path of the environment. Since explicitly " @@ -491,7 +478,7 @@ msgstr "" "於不需要明確啟用虛擬環境才能使用它。因此,無法依賴 :envvar:`!VIRTUAL_ENV` 來" "判斷是否正在使用虛擬環境。" -#: ../../library/venv.rst:133 +#: ../../library/venv.rst:253 msgid "" "Because scripts installed in environments should not expect the environment " "to be activated, their shebang lines contain the absolute paths to their " @@ -514,7 +501,7 @@ msgstr "" "位置重新建立它,並刪除舊位置的環境。如果你移動環境是因為移動了其父目錄,你應" "該在新位置重新建立環境。否則,安裝在該環境中的軟體可能無法正常運作。" -#: ../../library/venv.rst:147 +#: ../../library/venv.rst:267 msgid "" "You can deactivate a virtual environment by typing ``deactivate`` in your " "shell. The exact mechanism is platform-specific and is an internal " @@ -523,11 +510,11 @@ msgstr "" "你可以在 shell 輸入 ``deactivate`` 來關閉虛擬環境。具體的使用方式因平台而異," "是內部實作的細節(通常會使用腳本或是 shell 函式)" -#: ../../library/venv.rst:155 +#: ../../library/venv.rst:275 msgid "API" msgstr "API" -#: ../../library/venv.rst:159 +#: ../../library/venv.rst:279 msgid "" "The high-level method described above makes use of a simple API which " "provides mechanisms for third-party virtual environment creators to " @@ -537,108 +524,98 @@ msgstr "" "上述提到的高階 method(方法)透過簡單的 API 使用, 為第三方虛擬環境建立者提供" "可以依據他們需求來建立環境的客製化機制: :class:`EnvBuilder` class。" -#: ../../library/venv.rst:168 +#: ../../library/venv.rst:288 msgid "" "The :class:`EnvBuilder` class accepts the following keyword arguments on " "instantiation:" msgstr "進行實例化時,class :class:`EnvBuilder` 接受下列的關鍵字引數:" -#: ../../library/venv.rst:171 +#: ../../library/venv.rst:291 msgid "" -"``system_site_packages`` -- a Boolean value indicating that the system " -"Python site-packages should be available to the environment (defaults to " -"``False``)." +"*system_site_packages* -- a boolean value indicating that the system Python " +"site-packages should be available to the environment (defaults to ``False``)." msgstr "" -"``system_site_packages`` -- 為一個 Boolean (布林值),並表明系統的 Python " +"*system_site_packages* -- 為一個 boolean (布林值),並表明系統的 Python " "site-packages 是否可以在環境中可用(預設為 ``False`` )。" -#: ../../library/venv.rst:174 +#: ../../library/venv.rst:294 msgid "" -"``clear`` -- a Boolean value which, if true, will delete the contents of any " +"*clear* -- a boolean value which, if true, will delete the contents of any " "existing target directory, before creating the environment." msgstr "" -"``clear`` -- 為一個 Boolean,如果為 true,則在建立環境之前,刪除目標目錄內所" -"有存在的內容。" +"*clear* -- 為一個 boolean,如果為 true,則在建立環境之前,刪除目標目錄內所有" +"存在的內容。" -#: ../../library/venv.rst:177 +#: ../../library/venv.rst:297 msgid "" -"``symlinks`` -- a Boolean value indicating whether to attempt to symlink the " +"*symlinks* -- a boolean value indicating whether to attempt to symlink the " "Python binary rather than copying." msgstr "" -"``symlinks`` -- 為一個 Boolean,並表明是否嘗試與 Python 二進位檔案建立符號連" -"結而不是複製該檔案。" +"*symlinks* -- 為一個 boolean,並表明是否嘗試與 Python 二進位檔案建立符號連結" +"而不是複製該檔案。" -#: ../../library/venv.rst:180 +#: ../../library/venv.rst:300 msgid "" -"``upgrade`` -- a Boolean value which, if true, will upgrade an existing " +"*upgrade* -- a boolean value which, if true, will upgrade an existing " "environment with the running Python - for use when that Python has been " "upgraded in-place (defaults to ``False``)." msgstr "" -"``upgrade`` -- 為一個 Boolean,若為 true,則會在執行 Python 時為現有的環境進" -"行升級。目的是讓 Python 可以升級到位(預設為 ``False``)。" +"*upgrade* -- 為一個 boolean,若為 true,則會在執行 Python 時為現有的環境進行" +"升級。目的是讓 Python 可以升級到位(預設為 ``False``)。" -#: ../../library/venv.rst:184 +#: ../../library/venv.rst:304 msgid "" -"``with_pip`` -- a Boolean value which, if true, ensures pip is installed in " +"*with_pip* -- a boolean value which, if true, ensures pip is installed in " "the virtual environment. This uses :mod:`ensurepip` with the ``--default-" "pip`` option." msgstr "" -"``with_pip`` -- 為一個 Boolean,若為 true,則確保 pip 有安裝至虛擬環境之中。" -"當有 ``--default-pip`` 的選項時,會使用 :mod:`ensurepip`。" +"*with_pip* -- 為一個 boolean,若為 true,則確保 pip 有安裝至虛擬環境之中。當" +"有 ``--default-pip`` 的選項時,會使用 :mod:`ensurepip`。" -#: ../../library/venv.rst:188 +#: ../../library/venv.rst:308 msgid "" -"``prompt`` -- a String to be used after virtual environment is activated " +"*prompt* -- a string to be used after virtual environment is activated " "(defaults to ``None`` which means directory name of the environment would be " "used). If the special string ``\".\"`` is provided, the basename of the " "current directory is used as the prompt." msgstr "" -"``prompt`` -- 為一個 String(字串),該字串會在虛擬環境啟動時被使用。(預設" -"為 ``None``,代表該環境的目錄名稱會被使用)倘若出現特殊字串 ``\".\"`` ,則當" -"前目錄的 basename 會做為提示路徑使用。" +"*prompt* -- 為一個 String(字串),該字串會在虛擬環境啟動時被使用。(預設為 " +"``None``,代表該環境的目錄名稱會被使用)倘若出現特殊字串 ``\".\"`` ,則當前目" +"錄的 basename 會做為提示路徑使用。" -#: ../../library/venv.rst:193 -msgid "``upgrade_deps`` -- Update the base venv modules to the latest on PyPI" -msgstr "``upgrade_deps`` -- 更新基礎 venv 模組至 PyPI 的最新版本" +#: ../../library/venv.rst:313 +msgid "*upgrade_deps* -- Update the base venv modules to the latest on PyPI" +msgstr "*upgrade_deps* -- 更新基礎 venv 模組至 PyPI 的最新版本" -#: ../../library/venv.rst:195 +#: ../../library/venv.rst:315 msgid "" -"``scm_ignore_files`` -- Create ignore files based for the specified source " +"*scm_ignore_files* -- Create ignore files based for the specified source " "control managers (SCM) in the iterable. Support is defined by having a " "method named ``create_{scm}_ignore_file``. The only value supported by " "default is ``\"git\"`` via :meth:`create_git_ignore_file`." msgstr "" -#: ../../library/venv.rst:201 ../../library/venv.rst:389 +#: ../../library/venv.rst:321 msgid "Added the ``with_pip`` parameter" msgstr "新增 ``with_pip`` 參數" -#: ../../library/venv.rst:204 ../../library/venv.rst:392 +#: ../../library/venv.rst:324 msgid "Added the ``prompt`` parameter" msgstr "新增 ``prompt`` 參數" -#: ../../library/venv.rst:207 ../../library/venv.rst:395 +#: ../../library/venv.rst:327 msgid "Added the ``upgrade_deps`` parameter" msgstr "新增 ``upgrade_deps`` 參數" -#: ../../library/venv.rst:210 ../../library/venv.rst:398 -#, fuzzy +#: ../../library/venv.rst:330 msgid "Added the ``scm_ignore_files`` parameter" -msgstr "新增 ``upgrade_deps`` 參數" +msgstr "新增 ``scm_ignore_files`` 參數" -#: ../../library/venv.rst:213 -msgid "" -"Creators of third-party virtual environment tools will be free to use the " -"provided :class:`EnvBuilder` class as a base class." +#: ../../library/venv.rst:333 +msgid ":class:`EnvBuilder` may be used as a base class." msgstr "" -"第三方虛擬環境工具的建立者可以自由地使用 :class:`EnvBuilder` class 作為 base " -"class(基底類別)使用." - -#: ../../library/venv.rst:216 -msgid "The returned env-builder is an object which has a method, ``create``:" -msgstr "回傳的 env-builder 為一個物件,且帶有一個 method ``create``:" -#: ../../library/venv.rst:220 +#: ../../library/venv.rst:337 msgid "" "Create a virtual environment by specifying the target directory (absolute or " "relative to the current directory) which is to contain the virtual " @@ -649,7 +626,7 @@ msgstr "" "目錄),也就是在該目錄中容納虛擬環境。``create`` method 將會在指定的目錄下建" "立環境,或是觸發適當的例外。" -#: ../../library/venv.rst:226 +#: ../../library/venv.rst:343 msgid "" "The ``create`` method of the :class:`EnvBuilder` class illustrates the hooks " "available for subclass customization::" @@ -657,7 +634,7 @@ msgstr "" ":class:`EnvBuilder` class 的 ``create`` method 會闡述可用的 Hooks 以客製化 " "subclass (子類別)::" -#: ../../library/venv.rst:229 +#: ../../library/venv.rst:346 msgid "" "def create(self, env_dir):\n" " \"\"\"\n" @@ -672,7 +649,7 @@ msgid "" " self.post_setup(context)" msgstr "" -#: ../../library/venv.rst:241 +#: ../../library/venv.rst:358 msgid "" "Each of the methods :meth:`ensure_directories`, :meth:" "`create_configuration`, :meth:`setup_python`, :meth:`setup_scripts` and :" @@ -681,7 +658,7 @@ msgstr "" "每個 methods :meth:`ensure_directories`、:meth:`create_configuration`、:meth:" "`setup_python`、:meth:`setup_scripts` 及 :meth:`post_setup` 都可以被覆寫。" -#: ../../library/venv.rst:247 +#: ../../library/venv.rst:364 msgid "" "Creates the environment directory and all necessary subdirectories that " "don't already exist, and returns a context object. This context object is " @@ -695,7 +672,7 @@ msgstr "" "class:`EnvBuilder` 已被建立且帶有 ``clear=True`` 的引數,該環境目錄下的內容將" "被清空,以及所有必要的子目錄將被重新建立。" -#: ../../library/venv.rst:254 +#: ../../library/venv.rst:371 msgid "" "The returned context object is a :class:`types.SimpleNamespace` with the " "following attributes:" @@ -703,81 +680,81 @@ msgstr "" "回傳的情境物件(context object)其型別會是 :class:`types.SimpleNamespace`,並" "包含以下屬性:" -#: ../../library/venv.rst:257 +#: ../../library/venv.rst:374 msgid "" "``env_dir`` - The location of the virtual environment. Used for " "``__VENV_DIR__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:260 +#: ../../library/venv.rst:377 msgid "" "``env_name`` - The name of the virtual environment. Used for " "``__VENV_NAME__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:263 +#: ../../library/venv.rst:380 msgid "" "``prompt`` - The prompt to be used by the activation scripts. Used for " "``__VENV_PROMPT__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:266 +#: ../../library/venv.rst:383 msgid "" "``executable`` - The underlying Python executable used by the virtual " "environment. This takes into account the case where a virtual environment is " "created from another virtual environment." msgstr "" -#: ../../library/venv.rst:270 +#: ../../library/venv.rst:387 msgid "``inc_path`` - The include path for the virtual environment." msgstr "" -#: ../../library/venv.rst:272 +#: ../../library/venv.rst:389 msgid "``lib_path`` - The purelib path for the virtual environment." msgstr "" -#: ../../library/venv.rst:274 +#: ../../library/venv.rst:391 msgid "``bin_path`` - The script path for the virtual environment." -msgstr "" +msgstr "``bin_path`` - 虛擬環境的腳本路徑。" -#: ../../library/venv.rst:276 +#: ../../library/venv.rst:393 msgid "" "``bin_name`` - The name of the script path relative to the virtual " "environment location. Used for ``__VENV_BIN_NAME__`` in activation scripts " "(see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:280 +#: ../../library/venv.rst:397 msgid "" "``env_exe`` - The name of the Python interpreter in the virtual environment. " "Used for ``__VENV_PYTHON__`` in activation scripts (see :meth:" "`install_scripts`)." msgstr "" -#: ../../library/venv.rst:284 +#: ../../library/venv.rst:401 msgid "" "``env_exec_cmd`` - The name of the Python interpreter, taking into account " "filesystem redirections. This can be used to run Python in the virtual " "environment." msgstr "" -#: ../../library/venv.rst:289 +#: ../../library/venv.rst:406 msgid "" "The *venv* :ref:`sysconfig installation scheme ` is used " "to construct the paths of the created directories." msgstr "" -#: ../../library/venv.rst:294 +#: ../../library/venv.rst:411 msgid "" "The attribute ``lib_path`` was added to the context, and the context object " "was documented." msgstr "" -#: ../../library/venv.rst:300 +#: ../../library/venv.rst:417 msgid "Creates the ``pyvenv.cfg`` configuration file in the environment." -msgstr "" +msgstr "在環境中建立 ``pyvenv.cfg`` 設定檔。" -#: ../../library/venv.rst:304 +#: ../../library/venv.rst:421 msgid "" "Creates a copy or symlink to the Python executable in the environment. On " "POSIX systems, if a specific executable ``python3.x`` was used, symlinks to " @@ -785,120 +762,140 @@ msgid "" "unless files with those names already exist." msgstr "" -#: ../../library/venv.rst:311 +#: ../../library/venv.rst:428 msgid "" "Installs activation scripts appropriate to the platform into the virtual " "environment." msgstr "" -#: ../../library/venv.rst:316 +#: ../../library/venv.rst:433 msgid "" -"Upgrades the core venv dependency packages (currently ``pip``) in the " +"Upgrades the core venv dependency packages (currently :pypi:`pip`) in the " "environment. This is done by shelling out to the ``pip`` executable in the " "environment." msgstr "" -#: ../../library/venv.rst:327 +#: ../../library/venv.rst:440 +msgid ":pypi:`setuptools` is no longer a core venv dependency." +msgstr ":pypi:`setuptools` 不再是核心 venv 的依賴。" + +#: ../../library/venv.rst:444 msgid "" "A placeholder method which can be overridden in third party implementations " "to pre-install packages in the virtual environment or perform other post-" "creation steps." msgstr "" -#: ../../library/venv.rst:331 -msgid "" -"Windows now uses redirector scripts for ``python[w].exe`` instead of copying " -"the actual binaries. In 3.7.2 only :meth:`setup_python` does nothing unless " -"running from a build in the source tree." -msgstr "" - -#: ../../library/venv.rst:336 +#: ../../library/venv.rst:450 msgid "" -"Windows copies the redirector scripts as part of :meth:`setup_python` " -"instead of :meth:`setup_scripts`. This was not the case in 3.7.2. When using " -"symlinks, the original executables will be linked." -msgstr "" - -#: ../../library/venv.rst:341 -msgid "" -"In addition, :class:`EnvBuilder` provides this utility method that can be " -"called from :meth:`setup_scripts` or :meth:`post_setup` in subclasses to " -"assist in installing custom scripts into the virtual environment." +"This method can be called from :meth:`setup_scripts` or :meth:`post_setup` " +"in subclasses to assist in installing custom scripts into the virtual " +"environment." msgstr "" -#: ../../library/venv.rst:347 +#: ../../library/venv.rst:454 msgid "" "*path* is the path to a directory that should contain subdirectories " -"\"common\", \"posix\", \"nt\", each containing scripts destined for the bin " -"directory in the environment. The contents of \"common\" and the directory " -"corresponding to :data:`os.name` are copied after some text replacement of " -"placeholders:" +"``common``, ``posix``, ``nt``; each containing scripts destined for the " +"``bin`` directory in the environment. The contents of ``common`` and the " +"directory corresponding to :data:`os.name` are copied after some text " +"replacement of placeholders:" msgstr "" -#: ../../library/venv.rst:353 +#: ../../library/venv.rst:460 msgid "" "``__VENV_DIR__`` is replaced with the absolute path of the environment " "directory." msgstr "" -#: ../../library/venv.rst:356 +#: ../../library/venv.rst:463 msgid "" "``__VENV_NAME__`` is replaced with the environment name (final path segment " "of environment directory)." msgstr "" -#: ../../library/venv.rst:359 +#: ../../library/venv.rst:466 msgid "" "``__VENV_PROMPT__`` is replaced with the prompt (the environment name " "surrounded by parentheses and with a following space)" msgstr "" -#: ../../library/venv.rst:362 +#: ../../library/venv.rst:469 msgid "" "``__VENV_BIN_NAME__`` is replaced with the name of the bin directory (either " "``bin`` or ``Scripts``)." msgstr "" -#: ../../library/venv.rst:365 +#: ../../library/venv.rst:472 msgid "" "``__VENV_PYTHON__`` is replaced with the absolute path of the environment's " "executable." msgstr "" -#: ../../library/venv.rst:368 +#: ../../library/venv.rst:475 msgid "" "The directories are allowed to exist (for when an existing environment is " "being upgraded)." msgstr "" -#: ../../library/venv.rst:373 +#: ../../library/venv.rst:480 msgid "" "Creates a ``.gitignore`` file within the virtual environment that causes the " -"entire directory to be ignored by the ``git`` source control manager." +"entire directory to be ignored by the Git source control manager." +msgstr "" + +#: ../../library/venv.rst:485 +msgid "" +"Windows now uses redirector scripts for ``python[w].exe`` instead of copying " +"the actual binaries. In 3.7.2 only :meth:`setup_python` does nothing unless " +"running from a build in the source tree." msgstr "" -#: ../../library/venv.rst:378 +#: ../../library/venv.rst:490 +msgid "" +"Windows copies the redirector scripts as part of :meth:`setup_python` " +"instead of :meth:`setup_scripts`. This was not the case in 3.7.2. When using " +"symlinks, the original executables will be linked." +msgstr "" + +#: ../../library/venv.rst:495 msgid "There is also a module-level convenience function:" msgstr "" -#: ../../library/venv.rst:384 +#: ../../library/venv.rst:501 msgid "" "Create an :class:`EnvBuilder` with the given keyword arguments, and call " "its :meth:`~EnvBuilder.create` method with the *env_dir* argument." msgstr "" -#: ../../library/venv.rst:402 +#: ../../library/venv.rst:506 +msgid "Added the *with_pip* parameter" +msgstr "新增 *with_pip* 參數" + +#: ../../library/venv.rst:509 +msgid "Added the *prompt* parameter" +msgstr "新增 *prompt* 參數" + +#: ../../library/venv.rst:512 +msgid "Added the *upgrade_deps* parameter" +msgstr "新增 *upgrade_deps* 參數" + +#: ../../library/venv.rst:515 +msgid "Added the *scm_ignore_files* parameter" +msgstr "新增 *scm_ignore_files* 參數" + +#: ../../library/venv.rst:519 msgid "An example of extending ``EnvBuilder``" -msgstr "" +msgstr "一個擴展 ``EnvBuilder`` 的範例" -#: ../../library/venv.rst:404 +#: ../../library/venv.rst:521 msgid "" "The following script shows how to extend :class:`EnvBuilder` by implementing " "a subclass which installs setuptools and pip into a created virtual " "environment::" msgstr "" -#: ../../library/venv.rst:407 +#: ../../library/venv.rst:524 msgid "" "import os\n" "import os.path\n" @@ -1114,7 +1111,7 @@ msgid "" " sys.exit(rc)" msgstr "" -#: ../../library/venv.rst:615 +#: ../../library/venv.rst:732 msgid "" "This script is also available for download `online `_." @@ -1127,13 +1124,3 @@ msgstr "Environments (環境)" #: ../../library/venv.rst:14 msgid "virtual" msgstr "virtual (虛擬)" - -#, fuzzy -#~ msgid "" -#~ "This module does not work or is not available on WebAssembly platforms, " -#~ "or on iOS. See :ref:`wasm-availability` for more information on WASM " -#~ "availability; see :ref:`iOS-availability` for more information on iOS " -#~ "availability." -#~ msgstr "" -#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" -#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/warnings.po b/library/warnings.po index 702e2744ea..14bf51843b 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -912,7 +912,13 @@ msgid "" "context." msgstr "" -#: ../../library/warnings.rst:600 +#: ../../library/warnings.rst:598 +msgid "" +"See :ref:`warning-filter` for the meaning of the *category* and *lineno* " +"parameters." +msgstr "" + +#: ../../library/warnings.rst:603 msgid "" "The :class:`catch_warnings` manager works by replacing and then later " "restoring the module's :func:`showwarning` function and internal list of " @@ -920,7 +926,7 @@ msgid "" "state and therefore is not thread-safe." msgstr "" -#: ../../library/warnings.rst:608 +#: ../../library/warnings.rst:611 msgid "Added the *action*, *category*, *lineno*, and *append* parameters." msgstr "新增 *action*、*category*、*lineno* 和 *append* 參數。" diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 442b455961..db077dfd9a 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -610,8 +610,8 @@ msgid "" msgstr "" #: ../../reference/compound_stmts.rst:526 -#: ../../reference/compound_stmts.rst:1541 -#: ../../reference/compound_stmts.rst:1582 +#: ../../reference/compound_stmts.rst:1547 +#: ../../reference/compound_stmts.rst:1588 msgid "The following code::" msgstr "" @@ -625,7 +625,7 @@ msgstr "" #: ../../reference/compound_stmts.rst:531 #: ../../reference/compound_stmts.rst:556 -#: ../../reference/compound_stmts.rst:1587 +#: ../../reference/compound_stmts.rst:1593 msgid "is semantically equivalent to::" msgstr "" @@ -1543,7 +1543,7 @@ msgid ":class:`int`" msgstr ":class:`int`" #: ../../reference/compound_stmts.rst:1160 -#: ../../reference/compound_stmts.rst:1872 +#: ../../reference/compound_stmts.rst:1878 msgid ":class:`list`" msgstr ":class:`list`" @@ -1556,7 +1556,7 @@ msgid ":class:`str`" msgstr ":class:`str`" #: ../../reference/compound_stmts.rst:1163 -#: ../../reference/compound_stmts.rst:1875 +#: ../../reference/compound_stmts.rst:1881 msgid ":class:`tuple`" msgstr ":class:`tuple`" @@ -1606,7 +1606,7 @@ msgid "" "ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1227 +#: ../../reference/compound_stmts.rst:1228 msgid "" "A function definition is an executable statement. Its execution binds the " "function name in the current local namespace to a function object (a wrapper " @@ -1615,13 +1615,13 @@ msgid "" "used when the function is called." msgstr "" -#: ../../reference/compound_stmts.rst:1233 +#: ../../reference/compound_stmts.rst:1234 msgid "" "The function definition does not execute the function body; this gets " "executed only when the function is called. [#]_" msgstr "" -#: ../../reference/compound_stmts.rst:1239 +#: ../../reference/compound_stmts.rst:1240 msgid "" "A function definition may be wrapped by one or more :term:`decorator` " "expressions. Decorator expressions are evaluated when the function is " @@ -1632,7 +1632,7 @@ msgid "" "example, the following code ::" msgstr "" -#: ../../reference/compound_stmts.rst:1246 +#: ../../reference/compound_stmts.rst:1247 msgid "" "@f1(arg)\n" "@f2\n" @@ -1642,12 +1642,12 @@ msgstr "" "@f2\n" "def func(): pass" -#: ../../reference/compound_stmts.rst:1250 -#: ../../reference/compound_stmts.rst:1440 +#: ../../reference/compound_stmts.rst:1251 +#: ../../reference/compound_stmts.rst:1446 msgid "is roughly equivalent to ::" msgstr "大致等價於: ::" -#: ../../reference/compound_stmts.rst:1252 +#: ../../reference/compound_stmts.rst:1253 msgid "" "def func(): pass\n" "func = f1(arg)(f2(func))" @@ -1655,20 +1655,20 @@ msgstr "" "def func(): pass\n" "func = f1(arg)(f2(func))" -#: ../../reference/compound_stmts.rst:1255 +#: ../../reference/compound_stmts.rst:1256 msgid "" "except that the original function is not temporarily bound to the name " "``func``." msgstr "" -#: ../../reference/compound_stmts.rst:1257 +#: ../../reference/compound_stmts.rst:1258 msgid "" "Functions may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1262 +#: ../../reference/compound_stmts.rst:1263 msgid "" "A list of :ref:`type parameters ` may be given in square " "brackets between the function's name and the opening parenthesis for its " @@ -1678,12 +1678,12 @@ msgid "" "functions` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1269 -#: ../../reference/compound_stmts.rst:1459 +#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1465 msgid "Type parameter lists are new in Python 3.12." msgstr "" -#: ../../reference/compound_stmts.rst:1277 +#: ../../reference/compound_stmts.rst:1278 msgid "" "When one or more :term:`parameters ` have the form *parameter* " "``=`` *expression*, the function is said to have \"default parameter values." @@ -1694,7 +1694,7 @@ msgid "" "syntactic restriction that is not expressed by the grammar." msgstr "" -#: ../../reference/compound_stmts.rst:1285 +#: ../../reference/compound_stmts.rst:1286 msgid "" "**Default parameter values are evaluated from left to right when the " "function definition is executed.** This means that the expression is " @@ -1707,7 +1707,7 @@ msgid "" "the default, and explicitly test for it in the body of the function, e.g.::" msgstr "" -#: ../../reference/compound_stmts.rst:1295 +#: ../../reference/compound_stmts.rst:1296 msgid "" "def whats_on_the_telly(penguin=None):\n" " if penguin is None:\n" @@ -1716,7 +1716,7 @@ msgid "" " return penguin" msgstr "" -#: ../../reference/compound_stmts.rst:1306 +#: ../../reference/compound_stmts.rst:1307 msgid "" "Function call semantics are described in more detail in section :ref:" "`calls`. A function call always assigns values to all parameters mentioned " @@ -1732,31 +1732,39 @@ msgid "" "positional arguments." msgstr "" -#: ../../reference/compound_stmts.rst:1318 +#: ../../reference/compound_stmts.rst:1319 msgid "" "The ``/`` function parameter syntax may be used to indicate positional-only " "parameters. See :pep:`570` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1327 +#: ../../reference/compound_stmts.rst:1328 msgid "" "Parameters may have an :term:`annotation ` of the form " "\"``: expression``\" following the parameter name. Any parameter may have " -"an annotation, even those of the form ``*identifier`` or ``**identifier``. " -"Functions may have \"return\" annotation of the form \"``-> expression``\" " -"after the parameter list. These annotations can be any valid Python " -"expression. The presence of annotations does not change the semantics of a " -"function. The annotation values are available as values of a dictionary " -"keyed by the parameters' names in the :attr:`__annotations__` attribute of " -"the function object. If the ``annotations`` import from :mod:`__future__` " -"is used, annotations are preserved as strings at runtime which enables " -"postponed evaluation. Otherwise, they are evaluated when the function " -"definition is executed. In this case annotations may be evaluated in a " -"different order than they appear in the source code." +"an annotation, even those of the form ``*identifier`` or ``**identifier``. " +"(As a special case, parameters of the form ``*identifier`` may have an " +"annotation \"``: *expression``\".) Functions may have \"return\" annotation " +"of the form \"``-> expression``\" after the parameter list. These " +"annotations can be any valid Python expression. The presence of annotations " +"does not change the semantics of a function. The annotation values are " +"available as values of a dictionary keyed by the parameters' names in the :" +"attr:`__annotations__` attribute of the function object. If the " +"``annotations`` import from :mod:`__future__` is used, annotations are " +"preserved as strings at runtime which enables postponed evaluation. " +"Otherwise, they are evaluated when the function definition is executed. In " +"this case annotations may be evaluated in a different order than they appear " +"in the source code." msgstr "" #: ../../reference/compound_stmts.rst:1342 msgid "" +"Parameters of the form \"``*identifier``\" may have an annotation \"``: " +"*expression``\". See :pep:`646`." +msgstr "" + +#: ../../reference/compound_stmts.rst:1348 +msgid "" "It is also possible to create anonymous functions (functions not bound to a " "name), for immediate use in expressions. This uses lambda expressions, " "described in section :ref:`lambda`. Note that the lambda expression is " @@ -1767,7 +1775,7 @@ msgid "" "execution of multiple statements and annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1350 +#: ../../reference/compound_stmts.rst:1356 msgid "" "**Programmer's note:** Functions are first-class objects. A \"``def``\" " "statement executed inside a function definition defines a local function " @@ -1776,61 +1784,61 @@ msgid "" "See section :ref:`naming` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1358 +#: ../../reference/compound_stmts.rst:1364 msgid ":pep:`3107` - Function Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1359 +#: ../../reference/compound_stmts.rst:1365 msgid "The original specification for function annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1361 +#: ../../reference/compound_stmts.rst:1367 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/compound_stmts.rst:1362 +#: ../../reference/compound_stmts.rst:1368 msgid "Definition of a standard meaning for annotations: type hints." msgstr "" -#: ../../reference/compound_stmts.rst:1364 +#: ../../reference/compound_stmts.rst:1370 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1365 +#: ../../reference/compound_stmts.rst:1371 msgid "" "Ability to type hint variable declarations, including class variables and " "instance variables." msgstr "" -#: ../../reference/compound_stmts.rst:1368 +#: ../../reference/compound_stmts.rst:1374 msgid ":pep:`563` - Postponed Evaluation of Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1369 +#: ../../reference/compound_stmts.rst:1375 msgid "" "Support for forward references within annotations by preserving annotations " "in a string form at runtime instead of eager evaluation." msgstr "" -#: ../../reference/compound_stmts.rst:1372 +#: ../../reference/compound_stmts.rst:1378 msgid ":pep:`318` - Decorators for Functions and Methods" msgstr "" -#: ../../reference/compound_stmts.rst:1373 +#: ../../reference/compound_stmts.rst:1379 msgid "" "Function and method decorators were introduced. Class decorators were " "introduced in :pep:`3129`." msgstr "" -#: ../../reference/compound_stmts.rst:1379 +#: ../../reference/compound_stmts.rst:1385 msgid "Class definitions" msgstr "類別定義" -#: ../../reference/compound_stmts.rst:1394 +#: ../../reference/compound_stmts.rst:1400 msgid "A class definition defines a class object (see section :ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1401 +#: ../../reference/compound_stmts.rst:1407 msgid "" "A class definition is an executable statement. The inheritance list usually " "gives a list of base classes (see :ref:`metaclasses` for more advanced " @@ -1839,7 +1847,7 @@ msgid "" "default, from the base class :class:`object`; hence, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1407 +#: ../../reference/compound_stmts.rst:1413 msgid "" "class Foo:\n" " pass" @@ -1847,11 +1855,11 @@ msgstr "" "class Foo:\n" " pass" -#: ../../reference/compound_stmts.rst:1410 +#: ../../reference/compound_stmts.rst:1416 msgid "is equivalent to ::" msgstr "" -#: ../../reference/compound_stmts.rst:1412 +#: ../../reference/compound_stmts.rst:1418 msgid "" "class Foo(object):\n" " pass" @@ -1859,7 +1867,7 @@ msgstr "" "class Foo(object):\n" " pass" -#: ../../reference/compound_stmts.rst:1415 +#: ../../reference/compound_stmts.rst:1421 msgid "" "The class's suite is then executed in a new execution frame (see :ref:" "`naming`), using a newly created local namespace and the original global " @@ -1871,25 +1879,25 @@ msgid "" "original local namespace." msgstr "" -#: ../../reference/compound_stmts.rst:1424 +#: ../../reference/compound_stmts.rst:1430 msgid "" "The order in which attributes are defined in the class body is preserved in " -"the new class's ``__dict__``. Note that this is reliable only right after " -"the class is created and only for classes that were defined using the " -"definition syntax." +"the new class's :attr:`~type.__dict__`. Note that this is reliable only " +"right after the class is created and only for classes that were defined " +"using the definition syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1429 +#: ../../reference/compound_stmts.rst:1435 msgid "" "Class creation can be customized heavily using :ref:`metaclasses " "`." msgstr "" -#: ../../reference/compound_stmts.rst:1434 +#: ../../reference/compound_stmts.rst:1440 msgid "Classes can also be decorated: just like when decorating functions, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1436 +#: ../../reference/compound_stmts.rst:1442 msgid "" "@f1(arg)\n" "@f2\n" @@ -1899,7 +1907,7 @@ msgstr "" "@f2\n" "class Foo: pass" -#: ../../reference/compound_stmts.rst:1442 +#: ../../reference/compound_stmts.rst:1448 msgid "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" @@ -1907,29 +1915,29 @@ msgstr "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" -#: ../../reference/compound_stmts.rst:1445 +#: ../../reference/compound_stmts.rst:1451 msgid "" "The evaluation rules for the decorator expressions are the same as for " "function decorators. The result is then bound to the class name." msgstr "" -#: ../../reference/compound_stmts.rst:1448 +#: ../../reference/compound_stmts.rst:1454 msgid "" "Classes may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1453 +#: ../../reference/compound_stmts.rst:1459 msgid "" "A list of :ref:`type parameters ` may be given in square " "brackets immediately after the class's name. This indicates to static type " "checkers that the class is generic. At runtime, the type parameters can be " -"retrieved from the class's ``__type_params__`` attribute. See :ref:`generic-" -"classes` for more." +"retrieved from the class's :attr:`~type.__type_params__` attribute. See :ref:" +"`generic-classes` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1462 +#: ../../reference/compound_stmts.rst:1468 msgid "" "**Programmer's note:** Variables defined in the class definition are class " "attributes; they are shared by instances. Instance attributes can be set in " @@ -1942,35 +1950,35 @@ msgid "" "implementation details." msgstr "" -#: ../../reference/compound_stmts.rst:1474 +#: ../../reference/compound_stmts.rst:1480 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/compound_stmts.rst:1475 +#: ../../reference/compound_stmts.rst:1481 msgid "" "The proposal that changed the declaration of metaclasses to the current " "syntax, and the semantics for how classes with metaclasses are constructed." msgstr "" -#: ../../reference/compound_stmts.rst:1479 +#: ../../reference/compound_stmts.rst:1485 msgid ":pep:`3129` - Class Decorators" msgstr ":pep:`3129` - 類別裝飾器" -#: ../../reference/compound_stmts.rst:1480 +#: ../../reference/compound_stmts.rst:1486 msgid "" "The proposal that added class decorators. Function and method decorators " "were introduced in :pep:`318`." msgstr "" -#: ../../reference/compound_stmts.rst:1487 +#: ../../reference/compound_stmts.rst:1493 msgid "Coroutines" msgstr "協程" -#: ../../reference/compound_stmts.rst:1495 +#: ../../reference/compound_stmts.rst:1501 msgid "Coroutine function definition" msgstr "協程函式定義" -#: ../../reference/compound_stmts.rst:1505 +#: ../../reference/compound_stmts.rst:1511 msgid "" "Execution of Python coroutines can be suspended and resumed at many points " "(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` " @@ -1978,23 +1986,23 @@ msgid "" "function." msgstr "" -#: ../../reference/compound_stmts.rst:1509 +#: ../../reference/compound_stmts.rst:1515 msgid "" "Functions defined with ``async def`` syntax are always coroutine functions, " "even if they do not contain ``await`` or ``async`` keywords." msgstr "" -#: ../../reference/compound_stmts.rst:1512 +#: ../../reference/compound_stmts.rst:1518 msgid "" "It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1515 +#: ../../reference/compound_stmts.rst:1521 msgid "An example of a coroutine function::" msgstr "一個協程函式範例: ::" -#: ../../reference/compound_stmts.rst:1517 +#: ../../reference/compound_stmts.rst:1523 msgid "" "async def func(param1, param2):\n" " do_stuff()\n" @@ -2004,30 +2012,30 @@ msgstr "" " do_stuff()\n" " await some_coroutine()" -#: ../../reference/compound_stmts.rst:1521 +#: ../../reference/compound_stmts.rst:1527 msgid "" "``await`` and ``async`` are now keywords; previously they were only treated " "as such inside the body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1529 +#: ../../reference/compound_stmts.rst:1535 msgid "The :keyword:`!async for` statement" msgstr ":keyword:`!async for` 陳述式" -#: ../../reference/compound_stmts.rst:1534 +#: ../../reference/compound_stmts.rst:1540 msgid "" "An :term:`asynchronous iterable` provides an ``__aiter__`` method that " "directly returns an :term:`asynchronous iterator`, which can call " "asynchronous code in its ``__anext__`` method." msgstr "" -#: ../../reference/compound_stmts.rst:1538 +#: ../../reference/compound_stmts.rst:1544 msgid "" "The ``async for`` statement allows convenient iteration over asynchronous " "iterables." msgstr "" -#: ../../reference/compound_stmts.rst:1543 +#: ../../reference/compound_stmts.rst:1549 msgid "" "async for TARGET in ITER:\n" " SUITE\n" @@ -2039,11 +2047,11 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1548 +#: ../../reference/compound_stmts.rst:1554 msgid "Is semantically equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1550 +#: ../../reference/compound_stmts.rst:1556 msgid "" "iter = (ITER)\n" "iter = type(iter).__aiter__(iter)\n" @@ -2073,28 +2081,28 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1564 +#: ../../reference/compound_stmts.rst:1570 msgid "" "See also :meth:`~object.__aiter__` and :meth:`~object.__anext__` for details." msgstr "更多細節請見 :meth:`~object.__aiter__` 與 :meth:`~object.__anext__`。" -#: ../../reference/compound_stmts.rst:1566 +#: ../../reference/compound_stmts.rst:1572 msgid "" "It is a :exc:`SyntaxError` to use an ``async for`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1574 +#: ../../reference/compound_stmts.rst:1580 msgid "The :keyword:`!async with` statement" msgstr ":keyword:`!async with` 陳述式" -#: ../../reference/compound_stmts.rst:1579 +#: ../../reference/compound_stmts.rst:1585 msgid "" "An :term:`asynchronous context manager` is a :term:`context manager` that is " "able to suspend execution in its *enter* and *exit* methods." msgstr "" -#: ../../reference/compound_stmts.rst:1584 +#: ../../reference/compound_stmts.rst:1590 msgid "" "async with EXPRESSION as TARGET:\n" " SUITE" @@ -2102,7 +2110,7 @@ msgstr "" "async with EXPRESSION as TARGET:\n" " SUITE" -#: ../../reference/compound_stmts.rst:1589 +#: ../../reference/compound_stmts.rst:1595 msgid "" "manager = (EXPRESSION)\n" "aenter = type(manager).__aenter__\n" @@ -2138,44 +2146,44 @@ msgstr "" " if not hit_except:\n" " await aexit(manager, None, None, None)" -#: ../../reference/compound_stmts.rst:1606 +#: ../../reference/compound_stmts.rst:1612 msgid "" "See also :meth:`~object.__aenter__` and :meth:`~object.__aexit__` for " "details." msgstr "更多細節請見 :meth:`~object.__aenter__` 與 :meth:`~object.__aexit__`。" -#: ../../reference/compound_stmts.rst:1608 +#: ../../reference/compound_stmts.rst:1614 msgid "" "It is a :exc:`SyntaxError` to use an ``async with`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1613 +#: ../../reference/compound_stmts.rst:1619 msgid ":pep:`492` - Coroutines with async and await syntax" msgstr "" -#: ../../reference/compound_stmts.rst:1614 +#: ../../reference/compound_stmts.rst:1620 msgid "" "The proposal that made coroutines a proper standalone concept in Python, and " "added supporting syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1620 +#: ../../reference/compound_stmts.rst:1626 msgid "Type parameter lists" msgstr "" -#: ../../reference/compound_stmts.rst:1624 +#: ../../reference/compound_stmts.rst:1630 msgid "Support for default values was added (see :pep:`696`)." msgstr "" -#: ../../reference/compound_stmts.rst:1637 +#: ../../reference/compound_stmts.rst:1643 msgid "" ":ref:`Functions ` (including :ref:`coroutines `), :ref:" "`classes ` and :ref:`type aliases ` may contain a type " "parameter list::" msgstr "" -#: ../../reference/compound_stmts.rst:1641 +#: ../../reference/compound_stmts.rst:1647 msgid "" "def max[T](args: list[T]) -> T:\n" " ...\n" @@ -2207,7 +2215,7 @@ msgstr "" "\n" "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1656 +#: ../../reference/compound_stmts.rst:1662 msgid "" "Semantically, this indicates that the function, class, or type alias is " "generic over a type variable. This information is primarily used by static " @@ -2215,7 +2223,7 @@ msgid "" "generic counterparts." msgstr "" -#: ../../reference/compound_stmts.rst:1661 +#: ../../reference/compound_stmts.rst:1667 msgid "" "Type parameters are declared in square brackets (``[]``) immediately after " "the name of the function, class, or type alias. The type parameters are " @@ -2227,36 +2235,36 @@ msgid "" "wraps the creation of the generic object." msgstr "" -#: ../../reference/compound_stmts.rst:1670 +#: ../../reference/compound_stmts.rst:1676 msgid "" -"Generic functions, classes, and type aliases have a :attr:`!__type_params__` " -"attribute listing their type parameters." +"Generic functions, classes, and type aliases have a :attr:`~definition." +"__type_params__` attribute listing their type parameters." msgstr "" -#: ../../reference/compound_stmts.rst:1673 +#: ../../reference/compound_stmts.rst:1679 msgid "Type parameters come in three kinds:" msgstr "" -#: ../../reference/compound_stmts.rst:1675 +#: ../../reference/compound_stmts.rst:1681 msgid "" ":data:`typing.TypeVar`, introduced by a plain name (e.g., ``T``). " "Semantically, this represents a single type to a type checker." msgstr "" -#: ../../reference/compound_stmts.rst:1677 +#: ../../reference/compound_stmts.rst:1683 msgid "" ":data:`typing.TypeVarTuple`, introduced by a name prefixed with a single " "asterisk (e.g., ``*Ts``). Semantically, this stands for a tuple of any " "number of types." msgstr "" -#: ../../reference/compound_stmts.rst:1680 +#: ../../reference/compound_stmts.rst:1686 msgid "" ":data:`typing.ParamSpec`, introduced by a name prefixed with two asterisks " "(e.g., ``**P``). Semantically, this stands for the parameters of a callable." msgstr "" -#: ../../reference/compound_stmts.rst:1683 +#: ../../reference/compound_stmts.rst:1689 msgid "" ":data:`typing.TypeVar` declarations can define *bounds* and *constraints* " "with a colon (``:``) followed by an expression. A single expression after " @@ -2268,7 +2276,7 @@ msgid "" "variables can only take on one of the types in the list of constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1692 +#: ../../reference/compound_stmts.rst:1698 msgid "" "For :data:`!typing.TypeVar`\\ s declared using the type parameter list " "syntax, the bound and constraints are not evaluated when the generic object " @@ -2278,13 +2286,13 @@ msgid "" "`." msgstr "" -#: ../../reference/compound_stmts.rst:1698 +#: ../../reference/compound_stmts.rst:1704 msgid "" ":data:`typing.TypeVarTuple`\\ s and :data:`typing.ParamSpec`\\ s cannot have " "bounds or constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1701 +#: ../../reference/compound_stmts.rst:1707 msgid "" "All three flavors of type parameters can also have a *default value*, which " "is used when the type parameter is not explicitly provided. This is added by " @@ -2297,13 +2305,13 @@ msgid "" "attribute is set to the special sentinel object :data:`typing.NoDefault`." msgstr "" -#: ../../reference/compound_stmts.rst:1711 +#: ../../reference/compound_stmts.rst:1717 msgid "" "The following example indicates the full set of allowed type parameter " "declarations::" msgstr "" -#: ../../reference/compound_stmts.rst:1713 +#: ../../reference/compound_stmts.rst:1719 msgid "" "def overly_generic[\n" " SimpleTypeVar,\n" @@ -2335,24 +2343,24 @@ msgstr "" " *e: SimpleTypeVarTuple,\n" "): ..." -#: ../../reference/compound_stmts.rst:1731 +#: ../../reference/compound_stmts.rst:1737 msgid "Generic functions" msgstr "" -#: ../../reference/compound_stmts.rst:1733 +#: ../../reference/compound_stmts.rst:1739 msgid "Generic functions are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1735 +#: ../../reference/compound_stmts.rst:1741 msgid "def func[T](arg: T): ..." msgstr "def func[T](arg: T): ..." -#: ../../reference/compound_stmts.rst:1737 -#: ../../reference/compound_stmts.rst:1797 +#: ../../reference/compound_stmts.rst:1743 +#: ../../reference/compound_stmts.rst:1803 msgid "This syntax is equivalent to::" msgstr "語法大致等價於: ::" -#: ../../reference/compound_stmts.rst:1739 +#: ../../reference/compound_stmts.rst:1745 msgid "" "annotation-def TYPE_PARAMS_OF_func():\n" " T = typing.TypeVar(\"T\")\n" @@ -2368,7 +2376,7 @@ msgstr "" " return func\n" "func = TYPE_PARAMS_OF_func()" -#: ../../reference/compound_stmts.rst:1746 +#: ../../reference/compound_stmts.rst:1752 msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope `, which is not actually bound to any name at runtime. (One other " @@ -2377,20 +2385,20 @@ msgid "" "data:`typing.TypeVar` directly.)" msgstr "" -#: ../../reference/compound_stmts.rst:1752 +#: ../../reference/compound_stmts.rst:1758 msgid "" "The annotations of generic functions are evaluated within the annotation " "scope used for declaring the type parameters, but the function's defaults " "and decorators are not." msgstr "" -#: ../../reference/compound_stmts.rst:1756 +#: ../../reference/compound_stmts.rst:1762 msgid "" "The following example illustrates the scoping rules for these cases, as well " "as for additional flavors of type parameters::" msgstr "" -#: ../../reference/compound_stmts.rst:1759 +#: ../../reference/compound_stmts.rst:1765 msgid "" "@decorator\n" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" @@ -2400,13 +2408,13 @@ msgstr "" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" " ..." -#: ../../reference/compound_stmts.rst:1763 +#: ../../reference/compound_stmts.rst:1769 msgid "" "Except for the :ref:`lazy evaluation ` of the :class:" "`~typing.TypeVar` bound, this is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1766 +#: ../../reference/compound_stmts.rst:1772 msgid "" "DEFAULT_OF_arg = some_default\n" "\n" @@ -2428,25 +2436,25 @@ msgid "" "func = decorator(TYPE_PARAMS_OF_func())" msgstr "" -#: ../../reference/compound_stmts.rst:1785 +#: ../../reference/compound_stmts.rst:1791 msgid "" "The capitalized names like ``DEFAULT_OF_arg`` are not actually bound at " "runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1791 +#: ../../reference/compound_stmts.rst:1797 msgid "Generic classes" msgstr "" -#: ../../reference/compound_stmts.rst:1793 +#: ../../reference/compound_stmts.rst:1799 msgid "Generic classes are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1795 +#: ../../reference/compound_stmts.rst:1801 msgid "class Bag[T]: ..." msgstr "class Bag[T]: ..." -#: ../../reference/compound_stmts.rst:1799 +#: ../../reference/compound_stmts.rst:1805 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2464,14 +2472,14 @@ msgstr "" " return Bag\n" "Bag = TYPE_PARAMS_OF_Bag()" -#: ../../reference/compound_stmts.rst:1807 +#: ../../reference/compound_stmts.rst:1813 msgid "" "Here again ``annotation-def`` (not a real keyword) indicates an :ref:" "`annotation scope `, and the name ``TYPE_PARAMS_OF_Bag`` " "is not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1811 +#: ../../reference/compound_stmts.rst:1817 msgid "" "Generic classes implicitly inherit from :data:`typing.Generic`. The base " "classes and keyword arguments of generic classes are evaluated within the " @@ -2479,7 +2487,7 @@ msgid "" "that scope. This is illustrated by this example::" msgstr "" -#: ../../reference/compound_stmts.rst:1817 +#: ../../reference/compound_stmts.rst:1823 msgid "" "@decorator\n" "class Bag(Base[T], arg=T): ..." @@ -2487,11 +2495,11 @@ msgstr "" "@decorator\n" "class Bag(Base[T], arg=T): ..." -#: ../../reference/compound_stmts.rst:1820 +#: ../../reference/compound_stmts.rst:1826 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../reference/compound_stmts.rst:1822 +#: ../../reference/compound_stmts.rst:1828 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2509,27 +2517,27 @@ msgstr "" " return Bag\n" "Bag = decorator(TYPE_PARAMS_OF_Bag())" -#: ../../reference/compound_stmts.rst:1833 +#: ../../reference/compound_stmts.rst:1839 msgid "Generic type aliases" msgstr "" -#: ../../reference/compound_stmts.rst:1835 +#: ../../reference/compound_stmts.rst:1841 msgid "" "The :keyword:`type` statement can also be used to create a generic type " "alias::" msgstr "" -#: ../../reference/compound_stmts.rst:1837 +#: ../../reference/compound_stmts.rst:1843 msgid "type ListOrSet[T] = list[T] | set[T]" msgstr "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1839 +#: ../../reference/compound_stmts.rst:1845 msgid "" "Except for the :ref:`lazy evaluation ` of the value, this " "is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1842 +#: ../../reference/compound_stmts.rst:1848 msgid "" "annotation-def TYPE_PARAMS_OF_ListOrSet():\n" " T = typing.TypeVar(\"T\")\n" @@ -2542,109 +2550,109 @@ msgid "" "ListOrSet = TYPE_PARAMS_OF_ListOrSet()" msgstr "" -#: ../../reference/compound_stmts.rst:1851 +#: ../../reference/compound_stmts.rst:1857 msgid "" "Here, ``annotation-def`` (not a real keyword) indicates an :ref:`annotation " "scope `. The capitalized names like " "``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1856 +#: ../../reference/compound_stmts.rst:1862 msgid "Footnotes" msgstr "註解" -#: ../../reference/compound_stmts.rst:1857 +#: ../../reference/compound_stmts.rst:1863 msgid "" "The exception is propagated to the invocation stack unless there is a :" "keyword:`finally` clause which happens to raise another exception. That new " "exception causes the old one to be lost." msgstr "" -#: ../../reference/compound_stmts.rst:1861 +#: ../../reference/compound_stmts.rst:1867 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1863 +#: ../../reference/compound_stmts.rst:1869 msgid "a class that inherits from :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1864 +#: ../../reference/compound_stmts.rst:1870 msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1865 +#: ../../reference/compound_stmts.rst:1871 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1866 -#: ../../reference/compound_stmts.rst:1885 +#: ../../reference/compound_stmts.rst:1872 +#: ../../reference/compound_stmts.rst:1891 msgid "a class that inherits from any of the above" msgstr "" -#: ../../reference/compound_stmts.rst:1868 +#: ../../reference/compound_stmts.rst:1874 msgid "The following standard library classes are sequences:" msgstr "" -#: ../../reference/compound_stmts.rst:1870 +#: ../../reference/compound_stmts.rst:1876 msgid ":class:`array.array`" msgstr ":class:`array.array`" -#: ../../reference/compound_stmts.rst:1871 +#: ../../reference/compound_stmts.rst:1877 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../reference/compound_stmts.rst:1873 +#: ../../reference/compound_stmts.rst:1879 msgid ":class:`memoryview`" msgstr ":class:`memoryview`" -#: ../../reference/compound_stmts.rst:1874 +#: ../../reference/compound_stmts.rst:1880 msgid ":class:`range`" msgstr ":class:`range`" -#: ../../reference/compound_stmts.rst:1877 +#: ../../reference/compound_stmts.rst:1883 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1880 +#: ../../reference/compound_stmts.rst:1886 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1882 +#: ../../reference/compound_stmts.rst:1888 msgid "a class that inherits from :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1883 +#: ../../reference/compound_stmts.rst:1889 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1884 +#: ../../reference/compound_stmts.rst:1890 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1887 +#: ../../reference/compound_stmts.rst:1893 msgid "" "The standard library classes :class:`dict` and :class:`types." "MappingProxyType` are mappings." msgstr "" -#: ../../reference/compound_stmts.rst:1890 +#: ../../reference/compound_stmts.rst:1896 msgid "" "A string literal appearing as the first statement in the function body is " "transformed into the function's :attr:`~function.__doc__` attribute and " "therefore the function's :term:`docstring`." msgstr "" -#: ../../reference/compound_stmts.rst:1894 +#: ../../reference/compound_stmts.rst:1900 msgid "" "A string literal appearing as the first statement in the class body is " -"transformed into the namespace's ``__doc__`` item and therefore the class's :" -"term:`docstring`." +"transformed into the namespace's :attr:`~type.__doc__` item and therefore " +"the class's :term:`docstring`." msgstr "" #: ../../reference/compound_stmts.rst:7 @@ -2662,10 +2670,10 @@ msgstr "compound(複合)" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 -#: ../../reference/compound_stmts.rst:1491 -#: ../../reference/compound_stmts.rst:1525 -#: ../../reference/compound_stmts.rst:1570 +#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1497 +#: ../../reference/compound_stmts.rst:1531 +#: ../../reference/compound_stmts.rst:1576 msgid "statement" msgstr "statement(陳述式)" @@ -2713,7 +2721,7 @@ msgstr "if" #: ../../reference/compound_stmts.rst:408 #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 -#: ../../reference/compound_stmts.rst:1501 +#: ../../reference/compound_stmts.rst:1507 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2727,8 +2735,8 @@ msgstr "elif" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1322 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1323 +#: ../../reference/compound_stmts.rst:1387 msgid ": (colon)" msgstr ": (冒號)" @@ -2738,7 +2746,7 @@ msgstr ": (冒號)" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "compound statement" msgstr "compound statement(複合陳述式)" @@ -2784,7 +2792,7 @@ msgstr "list(串列)" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:298 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "object" msgstr "object(物件)" @@ -2855,7 +2863,7 @@ msgstr "with statement(with 陳述式)" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid ", (comma)" msgstr ", (逗號)" @@ -2896,15 +2904,15 @@ msgid "AS pattern, OR pattern, capture pattern, wildcard pattern" msgstr "" #: ../../reference/compound_stmts.rst:1186 -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "parameter" msgstr "parameter(參數)" #: ../../reference/compound_stmts.rst:1186 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1236 -#: ../../reference/compound_stmts.rst:1272 -#: ../../reference/compound_stmts.rst:1301 +#: ../../reference/compound_stmts.rst:1237 +#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1302 msgid "function definition" msgstr "function definition(函式定義)" @@ -2913,22 +2921,22 @@ msgid "def" msgstr "def" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1322 +#: ../../reference/compound_stmts.rst:1323 msgid "function" msgstr "function (函式)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "definition" msgstr "definition(定義)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "name" msgstr "name(名稱)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "binding" msgstr "binding(綁定)" @@ -2937,7 +2945,7 @@ msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "() (parentheses)" msgstr "() (圓括號)" @@ -2945,108 +2953,108 @@ msgstr "() (圓括號)" msgid "parameter list" msgstr "parameter list(參數列表)" -#: ../../reference/compound_stmts.rst:1236 -#: ../../reference/compound_stmts.rst:1431 +#: ../../reference/compound_stmts.rst:1237 +#: ../../reference/compound_stmts.rst:1437 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "default" msgstr "default(預設)" -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "value" msgstr "value(值)" -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "argument" msgstr "argument(引數)" -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/compound_stmts.rst:1301 +#: ../../reference/compound_stmts.rst:1302 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/compound_stmts.rst:1301 +#: ../../reference/compound_stmts.rst:1302 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/compound_stmts.rst:1301 +#: ../../reference/compound_stmts.rst:1302 msgid "**" msgstr "**" -#: ../../reference/compound_stmts.rst:1322 +#: ../../reference/compound_stmts.rst:1323 msgid "annotations" msgstr "annotations(註釋)" -#: ../../reference/compound_stmts.rst:1322 +#: ../../reference/compound_stmts.rst:1323 msgid "->" msgstr "->" -#: ../../reference/compound_stmts.rst:1322 +#: ../../reference/compound_stmts.rst:1323 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../reference/compound_stmts.rst:1340 +#: ../../reference/compound_stmts.rst:1346 msgid "lambda" msgstr "lambda" -#: ../../reference/compound_stmts.rst:1340 +#: ../../reference/compound_stmts.rst:1346 msgid "expression" msgstr "expression(運算式)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "class" msgstr "class(類別)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "execution" msgstr "execution(執行)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "frame" msgstr "frame" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "inheritance" msgstr "inheritance(繼承)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../reference/compound_stmts.rst:1381 -#: ../../reference/compound_stmts.rst:1431 +#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1437 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "expression list" msgstr "expression list(表達式列表)" -#: ../../reference/compound_stmts.rst:1491 +#: ../../reference/compound_stmts.rst:1497 msgid "async def" msgstr "async def" -#: ../../reference/compound_stmts.rst:1501 +#: ../../reference/compound_stmts.rst:1507 msgid "async" msgstr "async" -#: ../../reference/compound_stmts.rst:1501 +#: ../../reference/compound_stmts.rst:1507 msgid "await" msgstr "await" -#: ../../reference/compound_stmts.rst:1525 +#: ../../reference/compound_stmts.rst:1531 msgid "async for" msgstr "async for" -#: ../../reference/compound_stmts.rst:1570 +#: ../../reference/compound_stmts.rst:1576 msgid "async with" msgstr "async with" -#: ../../reference/compound_stmts.rst:1627 +#: ../../reference/compound_stmts.rst:1633 msgid "type parameters" msgstr "type parameter(型別參數)" diff --git a/reference/datamodel.po b/reference/datamodel.po index 0d583e4d37..4a7709654d 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-27 00:03+0000\n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" "PO-Revision-Date: 2024-09-24 19:03+0900\n" "Last-Translator: Kisaragi Hiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -668,16 +668,18 @@ msgid "" "containing the same number of items as the function's formal parameter list." msgstr "" -#: ../../reference/datamodel.rst:545 ../../reference/datamodel.rst:1133 -#: ../../reference/datamodel.rst:1330 +#: ../../reference/datamodel.rst:545 ../../reference/datamodel.rst:1206 +#: ../../reference/datamodel.rst:1403 msgid "Special read-only attributes" msgstr "特殊唯讀屬性" #: ../../reference/datamodel.rst:555 ../../reference/datamodel.rst:589 +#: ../../reference/datamodel.rst:981 msgid "Attribute" msgstr "屬性" #: ../../reference/datamodel.rst:556 ../../reference/datamodel.rst:590 +#: ../../reference/datamodel.rst:982 msgid "Meaning" msgstr "含義" @@ -700,7 +702,7 @@ msgid "" "the value of the cell, as well as set the value." msgstr "" -#: ../../reference/datamodel.rst:571 ../../reference/datamodel.rst:1372 +#: ../../reference/datamodel.rst:571 ../../reference/datamodel.rst:1445 msgid "Special writable attributes" msgstr "特殊可寫屬性" @@ -709,49 +711,47 @@ msgid "Most of these attributes check the type of the assigned value:" msgstr "" #: ../../reference/datamodel.rst:593 -msgid "" -"The function's documentation string, or ``None`` if unavailable. Not " -"inherited by subclasses." -msgstr "" +msgid "The function's documentation string, or ``None`` if unavailable." +msgstr "函式的文件字串,若不可用則為 ``None``。" -#: ../../reference/datamodel.rst:597 +#: ../../reference/datamodel.rst:596 msgid "" "The function's name. See also: :attr:`__name__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:601 +#: ../../reference/datamodel.rst:600 msgid "" "The function's :term:`qualified name`. See also: :attr:`__qualname__ " "attributes `." msgstr "" -#: ../../reference/datamodel.rst:607 +#: ../../reference/datamodel.rst:606 msgid "" "The name of the module the function was defined in, or ``None`` if " "unavailable." msgstr "" -#: ../../reference/datamodel.rst:611 +#: ../../reference/datamodel.rst:610 msgid "" "A :class:`tuple` containing default :term:`parameter` values for those " "parameters that have defaults, or ``None`` if no parameters have a default " "value." msgstr "" -#: ../../reference/datamodel.rst:616 +#: ../../reference/datamodel.rst:615 msgid "" "The :ref:`code object ` representing the compiled function " "body." msgstr "代表編譯函式主體的\\ :ref:`程式碼物件 `。" -#: ../../reference/datamodel.rst:620 +#: ../../reference/datamodel.rst:619 msgid "" "The namespace supporting arbitrary function attributes. See also: :attr:" "`__dict__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:624 +#: ../../reference/datamodel.rst:623 msgid "" "A :class:`dictionary ` containing annotations of :term:`parameters " "`. The keys of the dictionary are the parameter names, and " @@ -759,88 +759,88 @@ msgid "" "`annotations-howto`." msgstr "" -#: ../../reference/datamodel.rst:631 +#: ../../reference/datamodel.rst:630 msgid "" "A :class:`dictionary ` containing defaults for keyword-only :term:" "`parameters `." msgstr "" -#: ../../reference/datamodel.rst:635 +#: ../../reference/datamodel.rst:634 msgid "" "A :class:`tuple` containing the :ref:`type parameters ` of a :" "ref:`generic function `." msgstr "" -#: ../../reference/datamodel.rst:640 +#: ../../reference/datamodel.rst:639 msgid "" "Function objects also support getting and setting arbitrary attributes, " "which can be used, for example, to attach metadata to functions. Regular " "attribute dot-notation is used to get and set such attributes." msgstr "" -#: ../../reference/datamodel.rst:646 +#: ../../reference/datamodel.rst:645 msgid "" "CPython's current implementation only supports function attributes on user-" "defined functions. Function attributes on :ref:`built-in functions ` may be supported in the future." msgstr "" -#: ../../reference/datamodel.rst:651 +#: ../../reference/datamodel.rst:650 msgid "" "Additional information about a function's definition can be retrieved from " "its :ref:`code object ` (accessible via the :attr:`~function." "__code__` attribute)." msgstr "" -#: ../../reference/datamodel.rst:659 +#: ../../reference/datamodel.rst:658 msgid "Instance methods" msgstr "" -#: ../../reference/datamodel.rst:666 +#: ../../reference/datamodel.rst:665 msgid "" "An instance method object combines a class, a class instance and any " "callable object (normally a user-defined function)." msgstr "" -#: ../../reference/datamodel.rst:676 ../../reference/datamodel.rst:1468 +#: ../../reference/datamodel.rst:675 ../../reference/datamodel.rst:1541 msgid "Special read-only attributes:" msgstr "特殊唯讀屬性:" -#: ../../reference/datamodel.rst:681 +#: ../../reference/datamodel.rst:680 msgid "" "Refers to the class instance object to which the method is :ref:`bound " "`" msgstr "" -#: ../../reference/datamodel.rst:685 +#: ../../reference/datamodel.rst:684 msgid "Refers to the original :ref:`function object `" msgstr "" -#: ../../reference/datamodel.rst:688 +#: ../../reference/datamodel.rst:687 msgid "" "The method's documentation (same as :attr:`method.__func__.__doc__ `). A :class:`string ` if the original function had a " "docstring, else ``None``." msgstr "" -#: ../../reference/datamodel.rst:694 +#: ../../reference/datamodel.rst:693 msgid "" "The name of the method (same as :attr:`method.__func__.__name__ `)" msgstr "" -#: ../../reference/datamodel.rst:698 +#: ../../reference/datamodel.rst:697 msgid "" "The name of the module the method was defined in, or ``None`` if unavailable." msgstr "" -#: ../../reference/datamodel.rst:701 +#: ../../reference/datamodel.rst:700 msgid "" "Methods also support accessing (but not setting) the arbitrary function " "attributes on the underlying :ref:`function object `." msgstr "" -#: ../../reference/datamodel.rst:704 +#: ../../reference/datamodel.rst:703 msgid "" "User-defined method objects may be created when getting an attribute of a " "class (perhaps via an instance of that class), if that attribute is a user-" @@ -848,7 +848,7 @@ msgid "" "`classmethod` object." msgstr "" -#: ../../reference/datamodel.rst:711 +#: ../../reference/datamodel.rst:710 msgid "" "When an instance method object is created by retrieving a user-defined :ref:" "`function object ` from a class via one of its " @@ -857,7 +857,7 @@ msgid "" "__func__` attribute is the original function object." msgstr "" -#: ../../reference/datamodel.rst:717 +#: ../../reference/datamodel.rst:716 msgid "" "When an instance method object is created by retrieving a :class:" "`classmethod` object from a class or instance, its :attr:`~method.__self__` " @@ -865,7 +865,7 @@ msgid "" "the function object underlying the class method." msgstr "" -#: ../../reference/datamodel.rst:722 +#: ../../reference/datamodel.rst:721 msgid "" "When an instance method object is called, the underlying function (:attr:" "`~method.__func__`) is called, inserting the class instance (:attr:`~method." @@ -875,7 +875,7 @@ msgid "" "f(x, 1)``." msgstr "" -#: ../../reference/datamodel.rst:729 +#: ../../reference/datamodel.rst:728 msgid "" "When an instance method object is derived from a :class:`classmethod` " "object, the \"class instance\" stored in :attr:`~method.__self__` will " @@ -884,18 +884,18 @@ msgid "" "function." msgstr "" -#: ../../reference/datamodel.rst:734 +#: ../../reference/datamodel.rst:733 msgid "" "It is important to note that user-defined functions which are attributes of " "a class instance are not converted to bound methods; this *only* happens " "when the function is an attribute of the class." msgstr "" -#: ../../reference/datamodel.rst:741 +#: ../../reference/datamodel.rst:740 msgid "Generator functions" msgstr "Generator(產生器)函式" -#: ../../reference/datamodel.rst:747 +#: ../../reference/datamodel.rst:746 msgid "" "A function or method which uses the :keyword:`yield` statement (see section :" "ref:`yield`) is called a :dfn:`generator function`. Such a function, when " @@ -908,11 +908,11 @@ msgid "" "values to be returned." msgstr "" -#: ../../reference/datamodel.rst:759 +#: ../../reference/datamodel.rst:758 msgid "Coroutine functions" msgstr "Coroutine(協程)函式" -#: ../../reference/datamodel.rst:764 +#: ../../reference/datamodel.rst:763 msgid "" "A function or method which is defined using :keyword:`async def` is called " "a :dfn:`coroutine function`. Such a function, when called, returns a :term:" @@ -921,11 +921,11 @@ msgid "" "ref:`coroutine-objects` section." msgstr "" -#: ../../reference/datamodel.rst:772 +#: ../../reference/datamodel.rst:771 msgid "Asynchronous generator functions" msgstr "" -#: ../../reference/datamodel.rst:778 +#: ../../reference/datamodel.rst:777 msgid "" "A function or method which is defined using :keyword:`async def` and which " "uses the :keyword:`yield` statement is called a :dfn:`asynchronous generator " @@ -934,7 +934,7 @@ msgid "" "execute the body of the function." msgstr "" -#: ../../reference/datamodel.rst:784 +#: ../../reference/datamodel.rst:783 msgid "" "Calling the asynchronous iterator's :meth:`aiterator.__anext__ ` method will return an :term:`awaitable` which when awaited will " @@ -945,11 +945,11 @@ msgid "" "yielded." msgstr "" -#: ../../reference/datamodel.rst:797 +#: ../../reference/datamodel.rst:796 msgid "Built-in functions" msgstr "內建函式" -#: ../../reference/datamodel.rst:804 +#: ../../reference/datamodel.rst:803 msgid "" "A built-in function object is a wrapper around a C function. Examples of " "built-in functions are :func:`len` and :func:`math.sin` (:mod:`math` is a " @@ -960,7 +960,7 @@ msgstr "" "func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數數量" "與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" -#: ../../reference/datamodel.rst:809 +#: ../../reference/datamodel.rst:808 msgid "" ":attr:`!__doc__` is the function's documentation string, or ``None`` if " "unavailable. See :attr:`function.__doc__`." @@ -968,26 +968,26 @@ msgstr "" ":attr:`!__doc__` 是函式的文件字串,若不可用則為 ``None``。請見 :attr:" "`function.__doc__`。" -#: ../../reference/datamodel.rst:811 +#: ../../reference/datamodel.rst:810 msgid "" ":attr:`!__name__` is the function's name. See :attr:`function.__name__`." msgstr ":attr:`!__name__` 是函式的名稱。請見 :attr:`function.__name__`。" -#: ../../reference/datamodel.rst:812 +#: ../../reference/datamodel.rst:811 msgid ":attr:`!__self__` is set to ``None`` (but see the next item)." msgstr "" -#: ../../reference/datamodel.rst:813 +#: ../../reference/datamodel.rst:812 msgid "" ":attr:`!__module__` is the name of the module the function was defined in or " "``None`` if unavailable. See :attr:`function.__module__`." msgstr "" -#: ../../reference/datamodel.rst:821 +#: ../../reference/datamodel.rst:820 msgid "Built-in methods" msgstr "" -#: ../../reference/datamodel.rst:828 +#: ../../reference/datamodel.rst:827 msgid "" "This is really a different disguise of a built-in function, this time " "containing an object passed to the C function as an implicit extra " @@ -1058,7 +1058,7 @@ msgstr ":attr:`__name__`" msgid "The module's name." msgstr "" -#: ../../reference/datamodel.rst:888 ../../reference/datamodel.rst:988 +#: ../../reference/datamodel.rst:888 msgid ":attr:`__doc__`" msgstr ":attr:`__doc__`" @@ -1079,7 +1079,7 @@ msgid "" "library, it's the pathname of the shared library file." msgstr "" -#: ../../reference/datamodel.rst:901 ../../reference/datamodel.rst:991 +#: ../../reference/datamodel.rst:901 msgid ":attr:`__annotations__`" msgstr ":attr:`__annotations__`" @@ -1104,11 +1104,11 @@ msgid "" "module around while using its dictionary directly." msgstr "" -#: ../../reference/datamodel.rst:921 +#: ../../reference/datamodel.rst:923 msgid "Custom classes" msgstr "" -#: ../../reference/datamodel.rst:923 +#: ../../reference/datamodel.rst:925 msgid "" "Custom class types are typically created by class definitions (see section :" "ref:`class`). A class has a namespace implemented by a dictionary object. " @@ -1123,7 +1123,7 @@ msgid "" "found at :ref:`python_2.3_mro`." msgstr "" -#: ../../reference/datamodel.rst:944 +#: ../../reference/datamodel.rst:946 msgid "" "When a class attribute reference (for class :class:`!C`, say) would yield a " "class method object, it is transformed into an instance method object whose :" @@ -1134,102 +1134,135 @@ msgid "" "contained in its :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:955 +#: ../../reference/datamodel.rst:957 msgid "" "Class attribute assignments update the class's dictionary, never the " "dictionary of a base class." msgstr "" -#: ../../reference/datamodel.rst:960 +#: ../../reference/datamodel.rst:962 msgid "" "A class object can be called (see above) to yield a class instance (see " "below)." msgstr "" -#: ../../reference/datamodel.rst:973 -msgid "Special attributes:" -msgstr "特殊屬性:" - -#: ../../reference/datamodel.rst:975 -msgid ":attr:`~definition.__name__`" -msgstr ":attr:`~definition.__name__`" +#: ../../reference/datamodel.rst:965 ../../reference/datamodel.rst:1112 +msgid "Special attributes" +msgstr "特殊屬性" -#: ../../reference/datamodel.rst:976 -msgid "The class name." +#: ../../reference/datamodel.rst:985 +msgid "" +"The class's name. See also: :attr:`__name__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:978 -msgid ":attr:`__module__`" -msgstr ":attr:`__module__`" +#: ../../reference/datamodel.rst:989 +msgid "" +"The class's :term:`qualified name`. See also: :attr:`__qualname__ attributes " +"`." +msgstr "" -#: ../../reference/datamodel.rst:979 +#: ../../reference/datamodel.rst:993 msgid "The name of the module in which the class was defined." msgstr "" -#: ../../reference/datamodel.rst:981 -msgid ":attr:`~object.__dict__`" -msgstr ":attr:`~object.__dict__`" +#: ../../reference/datamodel.rst:996 +msgid "" +"A :class:`mapping proxy ` providing a read-only view " +"of the class's namespace. See also: :attr:`__dict__ attributes `." +msgstr "" -#: ../../reference/datamodel.rst:982 -msgid "The dictionary containing the class's namespace." +#: ../../reference/datamodel.rst:1001 +msgid "" +"A :class:`tuple` containing the class's bases. In most cases, for a class " +"defined as ``class X(A, B, C)``, ``X.__bases__`` will be exactly equal to " +"``(A, B, C)``." msgstr "" -#: ../../reference/datamodel.rst:984 -msgid ":attr:`~class.__bases__`" -msgstr ":attr:`~class.__bases__`" +#: ../../reference/datamodel.rst:1006 +msgid "" +"The class's documentation string, or ``None`` if undefined. Not inherited by " +"subclasses." +msgstr "" -#: ../../reference/datamodel.rst:985 +#: ../../reference/datamodel.rst:1010 msgid "" -"A tuple containing the base classes, in the order of their occurrence in the " -"base class list." +"A dictionary containing :term:`variable annotations ` " +"collected during class body execution. For best practices on working with :" +"attr:`!__annotations__`, please see :ref:`annotations-howto`." msgstr "" -#: ../../reference/datamodel.rst:989 -msgid "The class's documentation string, or ``None`` if undefined." +#: ../../reference/datamodel.rst:1017 +msgid "" +"Accessing the :attr:`!__annotations__` attribute of a class object directly " +"may yield incorrect results in the presence of metaclasses. In addition, the " +"attribute may not exist for some classes. Use :func:`inspect." +"get_annotations` to retrieve class annotations safely." msgstr "" -#: ../../reference/datamodel.rst:992 +#: ../../reference/datamodel.rst:1024 msgid "" -"A dictionary containing :term:`variable annotations ` " -"collected during class body execution. For best practices on working with :" -"attr:`__annotations__`, please see :ref:`annotations-howto`." +"A :class:`tuple` containing the :ref:`type parameters ` of a :" +"ref:`generic class `." +msgstr "" + +#: ../../reference/datamodel.rst:1030 +msgid "" +"A :class:`tuple` containing names of attributes of this class which are " +"assigned through ``self.X`` from any function in its body." msgstr "" -#: ../../reference/datamodel.rst:998 -msgid ":attr:`__type_params__`" -msgstr ":attr:`__type_params__`" +#: ../../reference/datamodel.rst:1036 +msgid "" +"The line number of the first line of the class definition, including " +"decorators. Setting the :attr:`__module__` attribute removes the :attr:`!" +"__firstlineno__` item from the type's dictionary." +msgstr "" -#: ../../reference/datamodel.rst:999 +#: ../../reference/datamodel.rst:1044 msgid "" -"A tuple containing the :ref:`type parameters ` of a :ref:" -"`generic class `." +"The :class:`tuple` of classes that are considered when looking for base " +"classes during method resolution." msgstr "" -#: ../../reference/datamodel.rst:1002 -msgid ":attr:`~class.__static_attributes__`" -msgstr ":attr:`~class.__static_attributes__`" +#: ../../reference/datamodel.rst:1049 +msgid "Special methods" +msgstr "特殊方法" -#: ../../reference/datamodel.rst:1003 +#: ../../reference/datamodel.rst:1051 msgid "" -"A tuple containing names of attributes of this class which are assigned " -"through ``self.X`` from any function in its body." +"In addition to the special attributes described above, all Python classes " +"also have the following two methods available:" msgstr "" -#: ../../reference/datamodel.rst:1006 -msgid ":attr:`__firstlineno__`" -msgstr ":attr:`__firstlineno__`" +#: ../../reference/datamodel.rst:1056 +msgid "" +"This method can be overridden by a metaclass to customize the method " +"resolution order for its instances. It is called at class instantiation, " +"and its result is stored in :attr:`~type.__mro__`." +msgstr "" -#: ../../reference/datamodel.rst:1007 +#: ../../reference/datamodel.rst:1062 msgid "" -"The line number of the first line of the class definition, including " -"decorators." +"Each class keeps a list of weak references to its immediate subclasses. This " +"method returns a list of all those references still alive. The list is in " +"definition order. Example:" +msgstr "" + +#: ../../reference/datamodel.rst:1066 +msgid "" +">>> class A: pass\n" +">>> class B(A): pass\n" +">>> A.__subclasses__()\n" +"[]" msgstr "" -#: ../../reference/datamodel.rst:1011 +#: ../../reference/datamodel.rst:1074 msgid "Class instances" msgstr "" -#: ../../reference/datamodel.rst:1019 +#: ../../reference/datamodel.rst:1082 msgid "" "A class instance is created by calling a class object (see above). A class " "instance has a namespace implemented as a dictionary which is the first " @@ -1246,7 +1279,7 @@ msgid "" "__getattr__` method, that is called to satisfy the lookup." msgstr "" -#: ../../reference/datamodel.rst:1035 +#: ../../reference/datamodel.rst:1098 msgid "" "Attribute assignments and deletions update the instance's dictionary, never " "a class's dictionary. If the class has a :meth:`~object.__setattr__` or :" @@ -1254,23 +1287,28 @@ msgid "" "instance dictionary directly." msgstr "" -#: ../../reference/datamodel.rst:1045 +#: ../../reference/datamodel.rst:1108 msgid "" "Class instances can pretend to be numbers, sequences, or mappings if they " "have methods with certain special names. See section :ref:`specialnames`." msgstr "" -#: ../../reference/datamodel.rst:1052 +#: ../../reference/datamodel.rst:1120 +msgid "The class to which a class instance belongs." +msgstr "" + +#: ../../reference/datamodel.rst:1124 msgid "" -"Special attributes: :attr:`~object.__dict__` is the attribute dictionary; :" -"attr:`~instance.__class__` is the instance's class." +"A dictionary or other mapping object used to store an object's (writable) " +"attributes. Not all instances have a :attr:`!__dict__` attribute; see the " +"section on :ref:`slots` for more details." msgstr "" -#: ../../reference/datamodel.rst:1057 +#: ../../reference/datamodel.rst:1130 msgid "I/O objects (also known as file objects)" msgstr "" -#: ../../reference/datamodel.rst:1072 +#: ../../reference/datamodel.rst:1145 msgid "" "A :term:`file object` represents an open file. Various shortcuts are " "available to create file objects: the :func:`open` built-in function, and " @@ -1279,7 +1317,7 @@ msgid "" "methods provided by extension modules)." msgstr "" -#: ../../reference/datamodel.rst:1078 +#: ../../reference/datamodel.rst:1151 msgid "" "The objects ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` are initialized " "to file objects corresponding to the interpreter's standard input, output " @@ -1287,22 +1325,22 @@ msgid "" "interface defined by the :class:`io.TextIOBase` abstract class." msgstr "" -#: ../../reference/datamodel.rst:1086 +#: ../../reference/datamodel.rst:1159 msgid "Internal types" msgstr "" -#: ../../reference/datamodel.rst:1092 +#: ../../reference/datamodel.rst:1165 msgid "" "A few types used internally by the interpreter are exposed to the user. " "Their definitions may change with future versions of the interpreter, but " "they are mentioned here for completeness." msgstr "" -#: ../../reference/datamodel.rst:1100 +#: ../../reference/datamodel.rst:1173 msgid "Code objects" msgstr "" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1177 msgid "" "Code objects represent *byte-compiled* executable Python code, or :term:" "`bytecode`. The difference between a code object and a function object is " @@ -1314,103 +1352,103 @@ msgid "" "no references (directly or indirectly) to mutable objects." msgstr "" -#: ../../reference/datamodel.rst:1138 +#: ../../reference/datamodel.rst:1211 msgid "The function name" msgstr "函式名稱" -#: ../../reference/datamodel.rst:1141 +#: ../../reference/datamodel.rst:1214 msgid "The fully qualified function name" msgstr "" -#: ../../reference/datamodel.rst:1146 +#: ../../reference/datamodel.rst:1219 msgid "" "The total number of positional :term:`parameters ` (including " "positional-only parameters and parameters with default values) that the " "function has" msgstr "" -#: ../../reference/datamodel.rst:1151 +#: ../../reference/datamodel.rst:1224 msgid "" "The number of positional-only :term:`parameters ` (including " "arguments with default values) that the function has" msgstr "" -#: ../../reference/datamodel.rst:1155 +#: ../../reference/datamodel.rst:1228 msgid "" "The number of keyword-only :term:`parameters ` (including " "arguments with default values) that the function has" msgstr "" -#: ../../reference/datamodel.rst:1159 +#: ../../reference/datamodel.rst:1232 msgid "" "The number of :ref:`local variables ` used by the function " "(including parameters)" msgstr "" -#: ../../reference/datamodel.rst:1163 +#: ../../reference/datamodel.rst:1236 msgid "" "A :class:`tuple` containing the names of the local variables in the function " "(starting with the parameter names)" msgstr "" -#: ../../reference/datamodel.rst:1167 +#: ../../reference/datamodel.rst:1240 msgid "" "A :class:`tuple` containing the names of :ref:`local variables ` " "that are referenced by nested functions inside the function" msgstr "" -#: ../../reference/datamodel.rst:1171 +#: ../../reference/datamodel.rst:1244 msgid "A :class:`tuple` containing the names of free variables in the function" msgstr "" -#: ../../reference/datamodel.rst:1174 +#: ../../reference/datamodel.rst:1247 msgid "" "A string representing the sequence of :term:`bytecode` instructions in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1178 +#: ../../reference/datamodel.rst:1251 msgid "" "A :class:`tuple` containing the literals used by the :term:`bytecode` in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1182 +#: ../../reference/datamodel.rst:1255 msgid "" "A :class:`tuple` containing the names used by the :term:`bytecode` in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1259 msgid "The name of the file from which the code was compiled" msgstr "" -#: ../../reference/datamodel.rst:1189 +#: ../../reference/datamodel.rst:1262 msgid "The line number of the first line of the function" msgstr "" -#: ../../reference/datamodel.rst:1192 +#: ../../reference/datamodel.rst:1265 msgid "" "A string encoding the mapping from :term:`bytecode` offsets to line numbers. " "For details, see the source code of the interpreter." msgstr "" -#: ../../reference/datamodel.rst:1195 +#: ../../reference/datamodel.rst:1268 msgid "" "This attribute of code objects is deprecated, and may be removed in Python " "3.14." msgstr "" -#: ../../reference/datamodel.rst:1200 +#: ../../reference/datamodel.rst:1273 msgid "The required stack size of the code object" msgstr "" -#: ../../reference/datamodel.rst:1203 +#: ../../reference/datamodel.rst:1276 msgid "" "An :class:`integer ` encoding a number of flags for the interpreter." msgstr "" -#: ../../reference/datamodel.rst:1208 +#: ../../reference/datamodel.rst:1281 msgid "" "The following flag bits are defined for :attr:`~codeobject.co_flags`: bit " "``0x04`` is set if the function uses the ``*arguments`` syntax to accept an " @@ -1421,7 +1459,7 @@ msgid "" "might be present." msgstr "" -#: ../../reference/datamodel.rst:1216 +#: ../../reference/datamodel.rst:1289 msgid "" "Future feature declarations (``from __future__ import division``) also use " "bits in :attr:`~codeobject.co_flags` to indicate whether a code object was " @@ -1430,29 +1468,29 @@ msgid "" "``0x1000`` were used in earlier versions of Python." msgstr "" -#: ../../reference/datamodel.rst:1222 +#: ../../reference/datamodel.rst:1295 msgid "" "Other bits in :attr:`~codeobject.co_flags` are reserved for internal use." msgstr "" -#: ../../reference/datamodel.rst:1226 +#: ../../reference/datamodel.rst:1299 msgid "" "If a code object represents a function, the first item in :attr:`~codeobject." "co_consts` is the documentation string of the function, or ``None`` if " "undefined." msgstr "" -#: ../../reference/datamodel.rst:1231 +#: ../../reference/datamodel.rst:1304 msgid "Methods on code objects" msgstr "用於程式碼物件的方法" -#: ../../reference/datamodel.rst:1235 +#: ../../reference/datamodel.rst:1308 msgid "" "Returns an iterable over the source code positions of each :term:`bytecode` " "instruction in the code object." msgstr "" -#: ../../reference/datamodel.rst:1238 +#: ../../reference/datamodel.rst:1311 msgid "" "The iterator returns :class:`tuple`\\s containing the ``(start_line, " "end_line, start_column, end_column)``. The *i-th* tuple corresponds to the " @@ -1460,37 +1498,37 @@ msgid "" "information is 0-indexed utf-8 byte offsets on the given source line." msgstr "" -#: ../../reference/datamodel.rst:1244 +#: ../../reference/datamodel.rst:1317 msgid "" "This positional information can be missing. A non-exhaustive lists of cases " "where this may happen:" msgstr "" -#: ../../reference/datamodel.rst:1247 +#: ../../reference/datamodel.rst:1320 msgid "Running the interpreter with :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1248 +#: ../../reference/datamodel.rst:1321 msgid "" "Loading a pyc file compiled while using :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1249 +#: ../../reference/datamodel.rst:1322 msgid "Position tuples corresponding to artificial instructions." msgstr "" -#: ../../reference/datamodel.rst:1250 +#: ../../reference/datamodel.rst:1323 msgid "" "Line and column numbers that can't be represented due to implementation " "specific limitations." msgstr "" -#: ../../reference/datamodel.rst:1253 +#: ../../reference/datamodel.rst:1326 msgid "" "When this occurs, some or all of the tuple elements can be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:1259 +#: ../../reference/datamodel.rst:1332 msgid "" "This feature requires storing column positions in code objects which may " "result in a small increase of disk usage of compiled Python files or " @@ -1500,100 +1538,100 @@ msgid "" "environment variable can be used." msgstr "" -#: ../../reference/datamodel.rst:1268 +#: ../../reference/datamodel.rst:1341 msgid "" "Returns an iterator that yields information about successive ranges of :term:" "`bytecode`\\s. Each item yielded is a ``(start, end, lineno)`` :class:" "`tuple`:" msgstr "" -#: ../../reference/datamodel.rst:1272 +#: ../../reference/datamodel.rst:1345 msgid "" "``start`` (an :class:`int`) represents the offset (inclusive) of the start " "of the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1274 +#: ../../reference/datamodel.rst:1347 msgid "" "``end`` (an :class:`int`) represents the offset (exclusive) of the end of " "the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1276 +#: ../../reference/datamodel.rst:1349 msgid "" "``lineno`` is an :class:`int` representing the line number of the :term:" "`bytecode` range, or ``None`` if the bytecodes in the given range have no " "line number" msgstr "" -#: ../../reference/datamodel.rst:1280 +#: ../../reference/datamodel.rst:1353 msgid "The items yielded will have the following properties:" msgstr "" -#: ../../reference/datamodel.rst:1282 +#: ../../reference/datamodel.rst:1355 msgid "The first range yielded will have a ``start`` of 0." msgstr "" -#: ../../reference/datamodel.rst:1283 +#: ../../reference/datamodel.rst:1356 msgid "" "The ``(start, end)`` ranges will be non-decreasing and consecutive. That is, " "for any pair of :class:`tuple`\\s, the ``start`` of the second will be equal " "to the ``end`` of the first." msgstr "" -#: ../../reference/datamodel.rst:1286 +#: ../../reference/datamodel.rst:1359 msgid "No range will be backwards: ``end >= start`` for all triples." msgstr "" -#: ../../reference/datamodel.rst:1287 +#: ../../reference/datamodel.rst:1360 msgid "" "The last :class:`tuple` yielded will have ``end`` equal to the size of the :" "term:`bytecode`." msgstr "" -#: ../../reference/datamodel.rst:1290 +#: ../../reference/datamodel.rst:1363 msgid "" "Zero-width ranges, where ``start == end``, are allowed. Zero-width ranges " "are used for lines that are present in the source code, but have been " "eliminated by the :term:`bytecode` compiler." msgstr "" -#: ../../reference/datamodel.rst:1298 +#: ../../reference/datamodel.rst:1371 msgid ":pep:`626` - Precise line numbers for debugging and other tools." msgstr "" -#: ../../reference/datamodel.rst:1299 +#: ../../reference/datamodel.rst:1372 msgid "The PEP that introduced the :meth:`!co_lines` method." msgstr "" -#: ../../reference/datamodel.rst:1303 +#: ../../reference/datamodel.rst:1376 msgid "" "Return a copy of the code object with new values for the specified fields." msgstr "" -#: ../../reference/datamodel.rst:1305 +#: ../../reference/datamodel.rst:1378 msgid "" "Code objects are also supported by the generic function :func:`copy.replace`." msgstr "" -#: ../../reference/datamodel.rst:1313 +#: ../../reference/datamodel.rst:1386 msgid "Frame objects" msgstr "" -#: ../../reference/datamodel.rst:1317 +#: ../../reference/datamodel.rst:1390 msgid "" "Frame objects represent execution frames. They may occur in :ref:`traceback " "objects `, and are also passed to registered trace " "functions." msgstr "" -#: ../../reference/datamodel.rst:1335 +#: ../../reference/datamodel.rst:1408 msgid "" "Points to the previous stack frame (towards the caller), or ``None`` if this " "is the bottom stack frame" msgstr "" -#: ../../reference/datamodel.rst:1339 +#: ../../reference/datamodel.rst:1412 msgid "" "The :ref:`code object ` being executed in this frame. " "Accessing this attribute raises an :ref:`auditing event ` ``object." @@ -1603,55 +1641,55 @@ msgstr "" "這個屬性會引發一個附帶引數 ``obj`` 與 ``\"f_code\"`` 的\\ :ref:`稽核事件 " "` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1344 +#: ../../reference/datamodel.rst:1417 msgid "" "The mapping used by the frame to look up :ref:`local variables `. If " "the frame refers to an :term:`optimized scope`, this may return a write-" "through proxy object." msgstr "" -#: ../../reference/datamodel.rst:1349 +#: ../../reference/datamodel.rst:1422 msgid "Return a proxy for optimized scopes." msgstr "" -#: ../../reference/datamodel.rst:1353 +#: ../../reference/datamodel.rst:1426 msgid "" "The dictionary used by the frame to look up :ref:`global variables `" msgstr "" -#: ../../reference/datamodel.rst:1357 +#: ../../reference/datamodel.rst:1430 msgid "" "The dictionary used by the frame to look up :ref:`built-in (intrinsic) names " "`" msgstr "" -#: ../../reference/datamodel.rst:1361 +#: ../../reference/datamodel.rst:1434 msgid "" "The \"precise instruction\" of the frame object (this is an index into the :" "term:`bytecode` string of the :ref:`code object `)" msgstr "" -#: ../../reference/datamodel.rst:1377 +#: ../../reference/datamodel.rst:1450 msgid "" "If not ``None``, this is a function called for various events during code " "execution (this is used by debuggers). Normally an event is triggered for " "each new source line (see :attr:`~frame.f_trace_lines`)." msgstr "" -#: ../../reference/datamodel.rst:1382 +#: ../../reference/datamodel.rst:1455 msgid "" "Set this attribute to :const:`False` to disable triggering a tracing event " "for each source line." msgstr "" -#: ../../reference/datamodel.rst:1386 +#: ../../reference/datamodel.rst:1459 msgid "" "Set this attribute to :const:`True` to allow per-opcode events to be " "requested. Note that this may lead to undefined interpreter behaviour if " "exceptions raised by the trace function escape to the function being traced." msgstr "" -#: ../../reference/datamodel.rst:1392 +#: ../../reference/datamodel.rst:1465 msgid "" "The current line number of the frame -- writing to this from within a trace " "function jumps to the given line (only for the bottom-most frame). A " @@ -1659,15 +1697,15 @@ msgid "" "this attribute." msgstr "" -#: ../../reference/datamodel.rst:1398 +#: ../../reference/datamodel.rst:1471 msgid "Frame object methods" msgstr "" -#: ../../reference/datamodel.rst:1400 +#: ../../reference/datamodel.rst:1473 msgid "Frame objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1477 msgid "" "This method clears all references to :ref:`local variables ` held by " "the frame. Also, if the frame belonged to a :term:`generator`, the " @@ -1676,34 +1714,34 @@ msgid "" "and storing its :ref:`traceback ` for later use)." msgstr "" -#: ../../reference/datamodel.rst:1410 +#: ../../reference/datamodel.rst:1483 msgid "" ":exc:`RuntimeError` is raised if the frame is currently executing or " "suspended." msgstr "" -#: ../../reference/datamodel.rst:1415 +#: ../../reference/datamodel.rst:1488 msgid "" "Attempting to clear a suspended frame raises :exc:`RuntimeError` (as has " "always been the case for executing frames)." msgstr "" -#: ../../reference/datamodel.rst:1423 +#: ../../reference/datamodel.rst:1496 msgid "Traceback objects" msgstr "" -#: ../../reference/datamodel.rst:1436 +#: ../../reference/datamodel.rst:1509 msgid "" "Traceback objects represent the stack trace of an :ref:`exception `. A traceback object is implicitly created when an exception occurs, " "and may also be explicitly created by calling :class:`types.TracebackType`." msgstr "" -#: ../../reference/datamodel.rst:1441 +#: ../../reference/datamodel.rst:1514 msgid "Traceback objects can now be explicitly instantiated from Python code." msgstr "" -#: ../../reference/datamodel.rst:1444 +#: ../../reference/datamodel.rst:1517 msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " @@ -1714,7 +1752,7 @@ msgid "" "the caught exception." msgstr "" -#: ../../reference/datamodel.rst:1453 +#: ../../reference/datamodel.rst:1526 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " @@ -1722,19 +1760,19 @@ msgid "" "last_traceback`." msgstr "" -#: ../../reference/datamodel.rst:1458 +#: ../../reference/datamodel.rst:1531 msgid "" "For explicitly created tracebacks, it is up to the creator of the traceback " "to determine how the :attr:`~traceback.tb_next` attributes should be linked " "to form a full stack trace." msgstr "" -#: ../../reference/datamodel.rst:1473 +#: ../../reference/datamodel.rst:1546 msgid "" "Points to the execution :ref:`frame ` of the current level." msgstr "" -#: ../../reference/datamodel.rst:1476 +#: ../../reference/datamodel.rst:1549 msgid "" "Accessing this attribute raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." @@ -1742,15 +1780,15 @@ msgstr "" "存取此屬性會引發一個附帶引數 ``obj`` 與 ``\"tb_frame\"`` 的\\ :ref:`稽核事件 " "` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1481 +#: ../../reference/datamodel.rst:1554 msgid "Gives the line number where the exception occurred" msgstr "" -#: ../../reference/datamodel.rst:1484 +#: ../../reference/datamodel.rst:1557 msgid "Indicates the \"precise instruction\"." msgstr "" -#: ../../reference/datamodel.rst:1486 +#: ../../reference/datamodel.rst:1559 msgid "" "The line number and last instruction in the traceback may differ from the " "line number of its :ref:`frame object ` if the exception " @@ -1758,39 +1796,39 @@ msgid "" "with a :keyword:`finally` clause." msgstr "" -#: ../../reference/datamodel.rst:1497 +#: ../../reference/datamodel.rst:1570 msgid "" "The special writable attribute :attr:`!tb_next` is the next level in the " "stack trace (towards the frame where the exception occurred), or ``None`` if " "there is no next level." msgstr "" -#: ../../reference/datamodel.rst:1501 +#: ../../reference/datamodel.rst:1574 msgid "This attribute is now writable" msgstr "" -#: ../../reference/datamodel.rst:1506 +#: ../../reference/datamodel.rst:1579 msgid "Slice objects" msgstr "" -#: ../../reference/datamodel.rst:1510 +#: ../../reference/datamodel.rst:1583 msgid "" "Slice objects are used to represent slices for :meth:`~object.__getitem__` " "methods. They are also created by the built-in :func:`slice` function." msgstr "" -#: ../../reference/datamodel.rst:1519 +#: ../../reference/datamodel.rst:1592 msgid "" "Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" "`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " "each is ``None`` if omitted. These attributes can have any type." msgstr "" -#: ../../reference/datamodel.rst:1523 +#: ../../reference/datamodel.rst:1596 msgid "Slice objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1527 +#: ../../reference/datamodel.rst:1600 msgid "" "This method takes a single integer argument *length* and computes " "information about the slice that the slice object would describe if applied " @@ -1800,11 +1838,11 @@ msgid "" "a manner consistent with regular slices." msgstr "" -#: ../../reference/datamodel.rst:1536 +#: ../../reference/datamodel.rst:1609 msgid "Static method objects" msgstr "" -#: ../../reference/datamodel.rst:1538 +#: ../../reference/datamodel.rst:1611 msgid "" "Static method objects provide a way of defeating the transformation of " "function objects to method objects described above. A static method object " @@ -1815,11 +1853,11 @@ msgid "" "method objects are created by the built-in :func:`staticmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1548 +#: ../../reference/datamodel.rst:1621 msgid "Class method objects" msgstr "" -#: ../../reference/datamodel.rst:1550 +#: ../../reference/datamodel.rst:1623 msgid "" "A class method object, like a static method object, is a wrapper around " "another object that alters the way in which that object is retrieved from " @@ -1829,11 +1867,11 @@ msgid "" "`classmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1560 +#: ../../reference/datamodel.rst:1633 msgid "Special method names" msgstr "" -#: ../../reference/datamodel.rst:1566 +#: ../../reference/datamodel.rst:1639 msgid "" "A class can implement certain operations that are invoked by special syntax " "(such as arithmetic operations or subscripting and slicing) by defining " @@ -1847,7 +1885,7 @@ msgid "" "`TypeError`)." msgstr "" -#: ../../reference/datamodel.rst:1577 +#: ../../reference/datamodel.rst:1650 msgid "" "Setting a special method to ``None`` indicates that the corresponding " "operation is not available. For example, if a class sets :meth:`~object." @@ -1856,7 +1894,7 @@ msgid "" "`~object.__getitem__`). [#]_" msgstr "" -#: ../../reference/datamodel.rst:1583 +#: ../../reference/datamodel.rst:1656 msgid "" "When implementing a class that emulates any built-in type, it is important " "that the emulation only be implemented to the degree that it makes sense for " @@ -1866,11 +1904,11 @@ msgid "" "the W3C's Document Object Model.)" msgstr "" -#: ../../reference/datamodel.rst:1594 +#: ../../reference/datamodel.rst:1667 msgid "Basic customization" msgstr "" -#: ../../reference/datamodel.rst:1600 +#: ../../reference/datamodel.rst:1673 msgid "" "Called to create a new instance of class *cls*. :meth:`__new__` is a static " "method (special-cased so you need not declare it as such) that takes the " @@ -1880,7 +1918,7 @@ msgid "" "new object instance (usually an instance of *cls*)." msgstr "" -#: ../../reference/datamodel.rst:1607 +#: ../../reference/datamodel.rst:1680 msgid "" "Typical implementations create a new instance of the class by invoking the " "superclass's :meth:`__new__` method using ``super().__new__(cls[, ...])`` " @@ -1888,7 +1926,7 @@ msgid "" "necessary before returning it." msgstr "" -#: ../../reference/datamodel.rst:1612 +#: ../../reference/datamodel.rst:1685 msgid "" "If :meth:`__new__` is invoked during object construction and it returns an " "instance of *cls*, then the new instance’s :meth:`__init__` method will be " @@ -1897,13 +1935,13 @@ msgid "" "constructor." msgstr "" -#: ../../reference/datamodel.rst:1617 +#: ../../reference/datamodel.rst:1690 msgid "" "If :meth:`__new__` does not return an instance of *cls*, then the new " "instance's :meth:`__init__` method will not be invoked." msgstr "" -#: ../../reference/datamodel.rst:1620 +#: ../../reference/datamodel.rst:1693 msgid "" ":meth:`__new__` is intended mainly to allow subclasses of immutable types " "(like int, str, or tuple) to customize instance creation. It is also " @@ -1911,7 +1949,7 @@ msgid "" "creation." msgstr "" -#: ../../reference/datamodel.rst:1629 +#: ../../reference/datamodel.rst:1702 msgid "" "Called after the instance has been created (by :meth:`__new__`), but before " "it is returned to the caller. The arguments are those passed to the class " @@ -1921,7 +1959,7 @@ msgid "" "example: ``super().__init__([args...])``." msgstr "" -#: ../../reference/datamodel.rst:1636 +#: ../../reference/datamodel.rst:1709 msgid "" "Because :meth:`__new__` and :meth:`__init__` work together in constructing " "objects (:meth:`__new__` to create it, and :meth:`__init__` to customize " @@ -1929,7 +1967,7 @@ msgid "" "will cause a :exc:`TypeError` to be raised at runtime." msgstr "" -#: ../../reference/datamodel.rst:1649 +#: ../../reference/datamodel.rst:1722 msgid "" "Called when the instance is about to be destroyed. This is also called a " "finalizer or (improperly) a destructor. If a base class has a :meth:" @@ -1938,7 +1976,7 @@ msgid "" "instance." msgstr "" -#: ../../reference/datamodel.rst:1655 +#: ../../reference/datamodel.rst:1728 msgid "" "It is possible (though not recommended!) for the :meth:`__del__` method to " "postpone destruction of the instance by creating a new reference to it. " @@ -1948,7 +1986,7 @@ msgid "" "it once." msgstr "" -#: ../../reference/datamodel.rst:1662 +#: ../../reference/datamodel.rst:1735 msgid "" "It is not guaranteed that :meth:`__del__` methods are called for objects " "that still exist when the interpreter exits. :class:`weakref.finalize` " @@ -1956,14 +1994,14 @@ msgid "" "when an object is garbage collected." msgstr "" -#: ../../reference/datamodel.rst:1669 +#: ../../reference/datamodel.rst:1742 msgid "" "``del x`` doesn't directly call ``x.__del__()`` --- the former decrements " "the reference count for ``x`` by one, and the latter is only called when " "``x``'s reference count reaches zero." msgstr "" -#: ../../reference/datamodel.rst:1674 +#: ../../reference/datamodel.rst:1747 msgid "" "It is possible for a reference cycle to prevent the reference count of an " "object from going to zero. In this case, the cycle will be later detected " @@ -1974,18 +2012,18 @@ msgid "" "caught in the traceback." msgstr "" -#: ../../reference/datamodel.rst:1684 +#: ../../reference/datamodel.rst:1757 msgid "Documentation for the :mod:`gc` module." msgstr "" -#: ../../reference/datamodel.rst:1688 +#: ../../reference/datamodel.rst:1761 msgid "" "Due to the precarious circumstances under which :meth:`__del__` methods are " "invoked, exceptions that occur during their execution are ignored, and a " "warning is printed to ``sys.stderr`` instead. In particular:" msgstr "" -#: ../../reference/datamodel.rst:1692 +#: ../../reference/datamodel.rst:1765 msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " @@ -1994,7 +2032,7 @@ msgid "" "`__del__`." msgstr "" -#: ../../reference/datamodel.rst:1698 +#: ../../reference/datamodel.rst:1771 msgid "" ":meth:`__del__` can be executed during interpreter shutdown. As a " "consequence, the global variables it needs to access (including other " @@ -2005,7 +2043,7 @@ msgid "" "still available at the time when the :meth:`__del__` method is called." msgstr "" -#: ../../reference/datamodel.rst:1713 +#: ../../reference/datamodel.rst:1786 msgid "" "Called by the :func:`repr` built-in function to compute the \"official\" " "string representation of an object. If at all possible, this should look " @@ -2017,13 +2055,13 @@ msgid "" "an \"informal\" string representation of instances of that class is required." msgstr "" -#: ../../reference/datamodel.rst:1722 +#: ../../reference/datamodel.rst:1795 msgid "" "This is typically used for debugging, so it is important that the " "representation is information-rich and unambiguous." msgstr "" -#: ../../reference/datamodel.rst:1733 +#: ../../reference/datamodel.rst:1806 msgid "" "Called by :func:`str(object) ` and the built-in functions :func:" "`format` and :func:`print` to compute the \"informal\" or nicely printable " @@ -2031,26 +2069,26 @@ msgid "" "` object." msgstr "" -#: ../../reference/datamodel.rst:1738 +#: ../../reference/datamodel.rst:1811 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" -#: ../../reference/datamodel.rst:1742 +#: ../../reference/datamodel.rst:1815 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -#: ../../reference/datamodel.rst:1752 +#: ../../reference/datamodel.rst:1825 msgid "" "Called by :ref:`bytes ` to compute a byte-string representation " "of an object. This should return a :class:`bytes` object." msgstr "" -#: ../../reference/datamodel.rst:1763 +#: ../../reference/datamodel.rst:1836 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals ` and the :meth:`str.format` " @@ -2062,28 +2100,28 @@ msgid "" "formatting option syntax." msgstr "" -#: ../../reference/datamodel.rst:1773 +#: ../../reference/datamodel.rst:1846 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" -#: ../../reference/datamodel.rst:1775 +#: ../../reference/datamodel.rst:1848 msgid "The return value must be a string object." msgstr "" -#: ../../reference/datamodel.rst:1777 +#: ../../reference/datamodel.rst:1850 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -#: ../../reference/datamodel.rst:1781 +#: ../../reference/datamodel.rst:1854 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" -#: ../../reference/datamodel.rst:1797 +#: ../../reference/datamodel.rst:1870 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " "between operator symbols and method names is as follows: ``x.__hash__``." msgstr "" -#: ../../reference/datamodel.rst:1889 +#: ../../reference/datamodel.rst:1962 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " @@ -2217,7 +2255,7 @@ msgid "" "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" -#: ../../reference/datamodel.rst:1898 +#: ../../reference/datamodel.rst:1971 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are " "\"salted\" with an unpredictable random value. Although they remain " @@ -2225,7 +2263,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../reference/datamodel.rst:1903 +#: ../../reference/datamodel.rst:1976 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully chosen inputs that exploit the worst case performance of a dict " @@ -2233,22 +2271,22 @@ msgid "" "advisories/ocert-2011-003.html for details." msgstr "" -#: ../../reference/datamodel.rst:1908 +#: ../../reference/datamodel.rst:1981 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" -#: ../../reference/datamodel.rst:1912 +#: ../../reference/datamodel.rst:1985 msgid "See also :envvar:`PYTHONHASHSEED`." msgstr "另請參閱 :envvar:`PYTHONHASHSEED`。" -#: ../../reference/datamodel.rst:1914 +#: ../../reference/datamodel.rst:1987 msgid "Hash randomization is enabled by default." msgstr "" -#: ../../reference/datamodel.rst:1922 +#: ../../reference/datamodel.rst:1995 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " @@ -2257,18 +2295,18 @@ msgid "" "meth:`!__len__` nor :meth:`!__bool__`, all its instances are considered true." msgstr "" -#: ../../reference/datamodel.rst:1933 +#: ../../reference/datamodel.rst:2006 msgid "Customizing attribute access" msgstr "" -#: ../../reference/datamodel.rst:1935 +#: ../../reference/datamodel.rst:2008 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" -#: ../../reference/datamodel.rst:1943 +#: ../../reference/datamodel.rst:2016 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " @@ -2278,7 +2316,7 @@ msgid "" "attribute value or raise an :exc:`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:1950 +#: ../../reference/datamodel.rst:2023 msgid "" "Note that if the attribute is found through the normal mechanism, :meth:" "`__getattr__` is not called. (This is an intentional asymmetry between :" @@ -2291,7 +2329,7 @@ msgid "" "actually get total control over attribute access." msgstr "" -#: ../../reference/datamodel.rst:1963 +#: ../../reference/datamodel.rst:2036 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -2303,64 +2341,64 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" -#: ../../reference/datamodel.rst:1974 +#: ../../reference/datamodel.rst:2047 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or :ref:`built-in " "functions `. See :ref:`special-lookup`." msgstr "" -#: ../../reference/datamodel.rst:1979 ../../reference/datamodel.rst:1981 +#: ../../reference/datamodel.rst:2052 ../../reference/datamodel.rst:2054 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:1988 +#: ../../reference/datamodel.rst:2061 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" -#: ../../reference/datamodel.rst:1992 +#: ../../reference/datamodel.rst:2065 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " "call the base class method with the same name, for example, ``object." "__setattr__(self, name, value)``." msgstr "" -#: ../../reference/datamodel.rst:1996 ../../reference/datamodel.rst:1998 +#: ../../reference/datamodel.rst:2069 ../../reference/datamodel.rst:2071 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -#: ../../reference/datamodel.rst:2005 +#: ../../reference/datamodel.rst:2078 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" -#: ../../reference/datamodel.rst:2008 ../../reference/datamodel.rst:2010 +#: ../../reference/datamodel.rst:2081 ../../reference/datamodel.rst:2083 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2017 +#: ../../reference/datamodel.rst:2090 msgid "" "Called when :func:`dir` is called on the object. An iterable must be " "returned. :func:`dir` converts the returned iterable to a list and sorts it." msgstr "" -#: ../../reference/datamodel.rst:2022 +#: ../../reference/datamodel.rst:2095 msgid "Customizing module attribute access" msgstr "" -#: ../../reference/datamodel.rst:2029 +#: ../../reference/datamodel.rst:2102 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " @@ -2372,21 +2410,21 @@ msgid "" "with the attribute name and the result is returned." msgstr "" -#: ../../reference/datamodel.rst:2038 +#: ../../reference/datamodel.rst:2111 msgid "" "The ``__dir__`` function should accept no arguments, and return an iterable " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" -#: ../../reference/datamodel.rst:2042 +#: ../../reference/datamodel.rst:2115 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" -#: ../../reference/datamodel.rst:2046 +#: ../../reference/datamodel.rst:2119 msgid "" "import sys\n" "from types import ModuleType\n" @@ -2414,7 +2452,7 @@ msgstr "" "\n" "sys.modules[__name__].__class__ = VerboseModule" -#: ../../reference/datamodel.rst:2060 +#: ../../reference/datamodel.rst:2133 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " @@ -2422,27 +2460,27 @@ msgid "" "module's globals dictionary) is unaffected." msgstr "" -#: ../../reference/datamodel.rst:2065 +#: ../../reference/datamodel.rst:2138 msgid "``__class__`` module attribute is now writable." msgstr "" -#: ../../reference/datamodel.rst:2068 +#: ../../reference/datamodel.rst:2141 msgid "``__getattr__`` and ``__dir__`` module attributes." msgstr "" -#: ../../reference/datamodel.rst:2073 +#: ../../reference/datamodel.rst:2146 msgid ":pep:`562` - Module __getattr__ and __dir__" msgstr ":pep:`562` - 模組 __getattr__ 和 __dir__" -#: ../../reference/datamodel.rst:2074 +#: ../../reference/datamodel.rst:2147 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." msgstr "" -#: ../../reference/datamodel.rst:2080 +#: ../../reference/datamodel.rst:2153 msgid "Implementing Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2082 +#: ../../reference/datamodel.rst:2155 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " @@ -2452,7 +2490,7 @@ msgid "" "the owner class' :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:2092 +#: ../../reference/datamodel.rst:2165 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2461,13 +2499,13 @@ msgid "" "accessed through the *owner*." msgstr "" -#: ../../reference/datamodel.rst:2098 +#: ../../reference/datamodel.rst:2171 msgid "" "This method should return the computed attribute value or raise an :exc:" "`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:2101 +#: ../../reference/datamodel.rst:2174 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2477,31 +2515,31 @@ msgid "" "not." msgstr "" -#: ../../reference/datamodel.rst:2110 +#: ../../reference/datamodel.rst:2183 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" -#: ../../reference/datamodel.rst:2113 +#: ../../reference/datamodel.rst:2186 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" -#: ../../reference/datamodel.rst:2119 +#: ../../reference/datamodel.rst:2192 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" -#: ../../reference/datamodel.rst:2121 +#: ../../reference/datamodel.rst:2194 msgid "" "Instances of descriptors may also have the :attr:`!__objclass__` attribute " "present:" msgstr "" -#: ../../reference/datamodel.rst:2126 +#: ../../reference/datamodel.rst:2199 msgid "" "The attribute :attr:`!__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2512,11 +2550,11 @@ msgid "" "are implemented in C)." msgstr "" -#: ../../reference/datamodel.rst:2137 +#: ../../reference/datamodel.rst:2210 msgid "Invoking Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2139 +#: ../../reference/datamodel.rst:2212 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " @@ -2525,7 +2563,7 @@ msgid "" "is said to be a descriptor." msgstr "" -#: ../../reference/datamodel.rst:2145 +#: ../../reference/datamodel.rst:2218 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -2533,7 +2571,7 @@ msgid "" "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" -#: ../../reference/datamodel.rst:2150 +#: ../../reference/datamodel.rst:2223 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " @@ -2541,54 +2579,54 @@ msgid "" "depends on which descriptor methods were defined and how they were called." msgstr "" -#: ../../reference/datamodel.rst:2155 +#: ../../reference/datamodel.rst:2228 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" -#: ../../reference/datamodel.rst:2158 +#: ../../reference/datamodel.rst:2231 msgid "Direct Call" msgstr "" -#: ../../reference/datamodel.rst:2159 +#: ../../reference/datamodel.rst:2232 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" -#: ../../reference/datamodel.rst:2162 +#: ../../reference/datamodel.rst:2235 msgid "Instance Binding" msgstr "" -#: ../../reference/datamodel.rst:2163 +#: ../../reference/datamodel.rst:2236 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -#: ../../reference/datamodel.rst:2166 +#: ../../reference/datamodel.rst:2239 msgid "Class Binding" msgstr "" -#: ../../reference/datamodel.rst:2167 +#: ../../reference/datamodel.rst:2240 msgid "" "If binding to a class, ``A.x`` is transformed into the call: ``A." "__dict__['x'].__get__(None, A)``." msgstr "" -#: ../../reference/datamodel.rst:2170 +#: ../../reference/datamodel.rst:2243 msgid "Super Binding" msgstr "" -#: ../../reference/datamodel.rst:2171 +#: ../../reference/datamodel.rst:2244 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " "for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." "__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." msgstr "" -#: ../../reference/datamodel.rst:2208 +#: ../../reference/datamodel.rst:2281 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " @@ -2606,7 +2644,7 @@ msgid "" "instances." msgstr "" -#: ../../reference/datamodel.rst:2223 +#: ../../reference/datamodel.rst:2296 msgid "" "Python methods (including those decorated with :func:`@staticmethod " "` and :func:`@classmethod `) are implemented as " @@ -2615,30 +2653,30 @@ msgid "" "from other instances of the same class." msgstr "" -#: ../../reference/datamodel.rst:2229 +#: ../../reference/datamodel.rst:2302 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" -#: ../../reference/datamodel.rst:2236 +#: ../../reference/datamodel.rst:2309 msgid "__slots__" msgstr "__slots__" -#: ../../reference/datamodel.rst:2238 +#: ../../reference/datamodel.rst:2311 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " "and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " "explicitly declared in *__slots__* or available in a parent.)" msgstr "" -#: ../../reference/datamodel.rst:2242 +#: ../../reference/datamodel.rst:2315 msgid "" "The space saved over using :attr:`~object.__dict__` can be significant. " "Attribute lookup speed can be significantly improved as well." msgstr "" -#: ../../reference/datamodel.rst:2247 +#: ../../reference/datamodel.rst:2320 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " @@ -2646,18 +2684,18 @@ msgid "" "`~object.__dict__` and *__weakref__* for each instance." msgstr "" -#: ../../reference/datamodel.rst:2256 +#: ../../reference/datamodel.rst:2329 msgid "Notes on using *__slots__*:" msgstr "" -#: ../../reference/datamodel.rst:2258 +#: ../../reference/datamodel.rst:2331 msgid "" "When inheriting from a class without *__slots__*, the :attr:`~object." "__dict__` and *__weakref__* attribute of the instances will always be " "accessible." msgstr "" -#: ../../reference/datamodel.rst:2262 +#: ../../reference/datamodel.rst:2335 msgid "" "Without a :attr:`~object.__dict__` variable, instances cannot be assigned " "new variables not listed in the *__slots__* definition. Attempts to assign " @@ -2666,7 +2704,7 @@ msgid "" "sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2269 +#: ../../reference/datamodel.rst:2342 msgid "" "Without a *__weakref__* variable for each instance, classes defining " "*__slots__* do not support :mod:`weak references ` to its " @@ -2674,7 +2712,7 @@ msgid "" "to the sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2275 +#: ../../reference/datamodel.rst:2348 msgid "" "*__slots__* are implemented at the class level by creating :ref:`descriptors " "` for each variable name. As a result, class attributes cannot " @@ -2682,16 +2720,16 @@ msgid "" "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" -#: ../../reference/datamodel.rst:2281 +#: ../../reference/datamodel.rst:2354 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " -"However, child subclasses will get a :attr:`~object.__dict__` and " -"*__weakref__* unless they also define *__slots__* (which should only contain " -"names of any *additional* slots)." +"However, instances of a child subclass will get a :attr:`~object.__dict__` " +"and *__weakref__* unless the subclass also defines *__slots__* (which should " +"only contain names of any *additional* slots)." msgstr "" -#: ../../reference/datamodel.rst:2287 +#: ../../reference/datamodel.rst:2360 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -2700,7 +2738,7 @@ msgid "" "prevent this." msgstr "" -#: ../../reference/datamodel.rst:2292 +#: ../../reference/datamodel.rst:2365 msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " @@ -2708,11 +2746,11 @@ msgid "" "`tuple`." msgstr "" -#: ../../reference/datamodel.rst:2297 +#: ../../reference/datamodel.rst:2370 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2299 +#: ../../reference/datamodel.rst:2372 msgid "" "If a :class:`dictionary ` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " @@ -2720,13 +2758,13 @@ msgid "" "func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" -#: ../../reference/datamodel.rst:2304 +#: ../../reference/datamodel.rst:2377 msgid "" -":attr:`~instance.__class__` assignment works only if both classes have the " +":attr:`~object.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2307 +#: ../../reference/datamodel.rst:2380 msgid "" ":ref:`Multiple inheritance ` with multiple slotted parent " "classes can be used, but only one parent is allowed to have attributes " @@ -2734,18 +2772,18 @@ msgid "" "raise :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2313 +#: ../../reference/datamodel.rst:2386 msgid "" "If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " "created for each of the iterator's values. However, the *__slots__* " "attribute will be an empty iterator." msgstr "" -#: ../../reference/datamodel.rst:2321 +#: ../../reference/datamodel.rst:2394 msgid "Customizing class creation" msgstr "" -#: ../../reference/datamodel.rst:2323 +#: ../../reference/datamodel.rst:2396 msgid "" "Whenever a class inherits from another class, :meth:`~object." "__init_subclass__` is called on the parent class. This way, it is possible " @@ -2755,14 +2793,14 @@ msgid "" "future subclasses of the class defining the method." msgstr "" -#: ../../reference/datamodel.rst:2332 +#: ../../reference/datamodel.rst:2405 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" -#: ../../reference/datamodel.rst:2336 +#: ../../reference/datamodel.rst:2409 msgid "" "Keyword arguments which are given to a new class are passed to the parent " "class's ``__init_subclass__``. For compatibility with other classes using " @@ -2770,7 +2808,7 @@ msgid "" "pass the others over to the base class, as in::" msgstr "" -#: ../../reference/datamodel.rst:2342 +#: ../../reference/datamodel.rst:2415 msgid "" "class Philosopher:\n" " def __init_subclass__(cls, /, default_name, **kwargs):\n" @@ -2788,13 +2826,13 @@ msgstr "" "class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" " pass" -#: ../../reference/datamodel.rst:2350 +#: ../../reference/datamodel.rst:2423 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" -#: ../../reference/datamodel.rst:2355 +#: ../../reference/datamodel.rst:2428 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " @@ -2802,19 +2840,19 @@ msgid "" "``type(cls)``." msgstr "" -#: ../../reference/datamodel.rst:2363 +#: ../../reference/datamodel.rst:2436 msgid "" "When a class is created, :meth:`type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:2368 +#: ../../reference/datamodel.rst:2441 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -#: ../../reference/datamodel.rst:2371 +#: ../../reference/datamodel.rst:2444 msgid "" "class A:\n" " x = C() # Automatically calls: x.__set_name__(A, 'x')" @@ -2822,14 +2860,14 @@ msgstr "" "class A:\n" " x = C() # 自動呼叫:x.__set_name__(A, 'x')" -#: ../../reference/datamodel.rst:2374 +#: ../../reference/datamodel.rst:2447 msgid "" "If the class variable is assigned after the class is created, :meth:" "`__set_name__` will not be called automatically. If needed, :meth:" "`__set_name__` can be called directly::" msgstr "" -#: ../../reference/datamodel.rst:2378 +#: ../../reference/datamodel.rst:2451 msgid "" "class A:\n" " pass\n" @@ -2839,22 +2877,22 @@ msgid "" "c.__set_name__(A, 'x') # Manually invoke the hook" msgstr "" -#: ../../reference/datamodel.rst:2385 +#: ../../reference/datamodel.rst:2458 msgid "See :ref:`class-object-creation` for more details." msgstr "更多細節請見 :ref:`class-object-creation`。" -#: ../../reference/datamodel.rst:2393 +#: ../../reference/datamodel.rst:2466 msgid "Metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2400 +#: ../../reference/datamodel.rst:2473 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" -#: ../../reference/datamodel.rst:2404 +#: ../../reference/datamodel.rst:2477 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " @@ -2862,7 +2900,7 @@ msgid "" "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" -#: ../../reference/datamodel.rst:2409 +#: ../../reference/datamodel.rst:2482 msgid "" "class Meta(type):\n" " pass\n" @@ -2882,41 +2920,41 @@ msgstr "" "class MySubclass(MyClass):\n" " pass" -#: ../../reference/datamodel.rst:2418 +#: ../../reference/datamodel.rst:2491 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" -#: ../../reference/datamodel.rst:2421 +#: ../../reference/datamodel.rst:2494 msgid "When a class definition is executed, the following steps occur:" msgstr "" -#: ../../reference/datamodel.rst:2423 +#: ../../reference/datamodel.rst:2496 msgid "MRO entries are resolved;" msgstr "" -#: ../../reference/datamodel.rst:2424 +#: ../../reference/datamodel.rst:2497 msgid "the appropriate metaclass is determined;" msgstr "" -#: ../../reference/datamodel.rst:2425 +#: ../../reference/datamodel.rst:2498 msgid "the class namespace is prepared;" msgstr "" -#: ../../reference/datamodel.rst:2426 +#: ../../reference/datamodel.rst:2499 msgid "the class body is executed;" msgstr "" -#: ../../reference/datamodel.rst:2427 +#: ../../reference/datamodel.rst:2500 msgid "the class object is created." msgstr "" -#: ../../reference/datamodel.rst:2431 +#: ../../reference/datamodel.rst:2504 msgid "Resolving MRO entries" msgstr "" -#: ../../reference/datamodel.rst:2435 +#: ../../reference/datamodel.rst:2508 msgid "" "If a base that appears in a class definition is not an instance of :class:" "`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " @@ -2928,59 +2966,59 @@ msgid "" "is ignored." msgstr "" -#: ../../reference/datamodel.rst:2446 +#: ../../reference/datamodel.rst:2519 msgid ":func:`types.resolve_bases`" msgstr ":func:`types.resolve_bases`" -#: ../../reference/datamodel.rst:2447 +#: ../../reference/datamodel.rst:2520 msgid "Dynamically resolve bases that are not instances of :class:`type`." msgstr "" -#: ../../reference/datamodel.rst:2449 +#: ../../reference/datamodel.rst:2522 msgid ":func:`types.get_original_bases`" msgstr ":func:`types.get_original_bases`" -#: ../../reference/datamodel.rst:2450 +#: ../../reference/datamodel.rst:2523 msgid "" "Retrieve a class's \"original bases\" prior to modifications by :meth:" "`~object.__mro_entries__`." msgstr "" -#: ../../reference/datamodel.rst:2453 +#: ../../reference/datamodel.rst:2526 msgid ":pep:`560`" msgstr ":pep:`560`" -#: ../../reference/datamodel.rst:2454 +#: ../../reference/datamodel.rst:2527 msgid "Core support for typing module and generic types." msgstr "" -#: ../../reference/datamodel.rst:2458 +#: ../../reference/datamodel.rst:2531 msgid "Determining the appropriate metaclass" msgstr "" -#: ../../reference/datamodel.rst:2462 +#: ../../reference/datamodel.rst:2535 msgid "" "The appropriate metaclass for a class definition is determined as follows:" msgstr "" -#: ../../reference/datamodel.rst:2464 +#: ../../reference/datamodel.rst:2537 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" -#: ../../reference/datamodel.rst:2465 +#: ../../reference/datamodel.rst:2538 msgid "" "if an explicit metaclass is given and it is *not* an instance of :func:" "`type`, then it is used directly as the metaclass;" msgstr "" -#: ../../reference/datamodel.rst:2467 +#: ../../reference/datamodel.rst:2540 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" -#: ../../reference/datamodel.rst:2470 +#: ../../reference/datamodel.rst:2543 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -2989,11 +3027,11 @@ msgid "" "that criterion, then the class definition will fail with ``TypeError``." msgstr "" -#: ../../reference/datamodel.rst:2480 +#: ../../reference/datamodel.rst:2553 msgid "Preparing the class namespace" msgstr "" -#: ../../reference/datamodel.rst:2485 +#: ../../reference/datamodel.rst:2558 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -3005,25 +3043,25 @@ msgid "" "copied into a new ``dict``." msgstr "" -#: ../../reference/datamodel.rst:2494 +#: ../../reference/datamodel.rst:2567 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" -#: ../../reference/datamodel.rst:2499 +#: ../../reference/datamodel.rst:2572 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/datamodel.rst:2500 +#: ../../reference/datamodel.rst:2573 msgid "Introduced the ``__prepare__`` namespace hook" msgstr "" -#: ../../reference/datamodel.rst:2504 +#: ../../reference/datamodel.rst:2577 msgid "Executing the class body" msgstr "" -#: ../../reference/datamodel.rst:2509 +#: ../../reference/datamodel.rst:2582 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -3032,7 +3070,7 @@ msgid "" "inside a function." msgstr "" -#: ../../reference/datamodel.rst:2515 +#: ../../reference/datamodel.rst:2588 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -3041,11 +3079,11 @@ msgid "" "reference described in the next section." msgstr "" -#: ../../reference/datamodel.rst:2524 +#: ../../reference/datamodel.rst:2597 msgid "Creating the class object" msgstr "" -#: ../../reference/datamodel.rst:2531 +#: ../../reference/datamodel.rst:2604 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " @@ -3053,7 +3091,7 @@ msgid "" "to ``__prepare__``)." msgstr "" -#: ../../reference/datamodel.rst:2536 +#: ../../reference/datamodel.rst:2609 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " @@ -3064,7 +3102,7 @@ msgid "" "is identified based on the first argument passed to the method." msgstr "" -#: ../../reference/datamodel.rst:2546 +#: ../../reference/datamodel.rst:2619 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -3073,59 +3111,59 @@ msgid "" "in Python 3.8." msgstr "" -#: ../../reference/datamodel.rst:2552 +#: ../../reference/datamodel.rst:2625 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" -#: ../../reference/datamodel.rst:2556 +#: ../../reference/datamodel.rst:2629 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -#: ../../reference/datamodel.rst:2558 +#: ../../reference/datamodel.rst:2631 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -#: ../../reference/datamodel.rst:2560 +#: ../../reference/datamodel.rst:2633 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -#: ../../reference/datamodel.rst:2563 +#: ../../reference/datamodel.rst:2636 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" -#: ../../reference/datamodel.rst:2567 +#: ../../reference/datamodel.rst:2640 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " "object is discarded. The new copy is wrapped in a read-only proxy, which " -"becomes the :attr:`~object.__dict__` attribute of the class object." +"becomes the :attr:`~type.__dict__` attribute of the class object." msgstr "" -#: ../../reference/datamodel.rst:2574 +#: ../../reference/datamodel.rst:2647 msgid ":pep:`3135` - New super" msgstr "" -#: ../../reference/datamodel.rst:2575 +#: ../../reference/datamodel.rst:2648 msgid "Describes the implicit ``__class__`` closure reference" msgstr "" -#: ../../reference/datamodel.rst:2579 +#: ../../reference/datamodel.rst:2652 msgid "Uses for metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2581 +#: ../../reference/datamodel.rst:2654 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " @@ -3133,17 +3171,17 @@ msgid "" "locking/synchronization." msgstr "" -#: ../../reference/datamodel.rst:2588 +#: ../../reference/datamodel.rst:2661 msgid "Customizing instance and subclass checks" msgstr "" -#: ../../reference/datamodel.rst:2590 +#: ../../reference/datamodel.rst:2663 msgid "" "The following methods are used to override the default behavior of the :func:" "`isinstance` and :func:`issubclass` built-in functions." msgstr "" -#: ../../reference/datamodel.rst:2593 +#: ../../reference/datamodel.rst:2666 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " @@ -3151,21 +3189,21 @@ msgid "" "other ABCs." msgstr "" -#: ../../reference/datamodel.rst:2600 +#: ../../reference/datamodel.rst:2673 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2607 +#: ../../reference/datamodel.rst:2680 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2612 +#: ../../reference/datamodel.rst:2685 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " @@ -3173,24 +3211,24 @@ msgid "" "only in this case the instance is itself a class." msgstr "" -#: ../../reference/datamodel.rst:2619 +#: ../../reference/datamodel.rst:2692 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: ../../reference/datamodel.rst:2620 +#: ../../reference/datamodel.rst:2693 msgid "" "Includes the specification for customizing :func:`isinstance` and :func:" -"`issubclass` behavior through :meth:`~class.__instancecheck__` and :meth:" -"`~class.__subclasscheck__`, with motivation for this functionality in the " +"`issubclass` behavior through :meth:`~type.__instancecheck__` and :meth:" +"`~type.__subclasscheck__`, with motivation for this functionality in the " "context of adding Abstract Base Classes (see the :mod:`abc` module) to the " "language." msgstr "" -#: ../../reference/datamodel.rst:2628 +#: ../../reference/datamodel.rst:2701 msgid "Emulating generic types" msgstr "" -#: ../../reference/datamodel.rst:2630 +#: ../../reference/datamodel.rst:2703 msgid "" "When using :term:`type annotations`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " @@ -3198,65 +3236,65 @@ msgid "" "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2637 +#: ../../reference/datamodel.rst:2710 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/datamodel.rst:2638 +#: ../../reference/datamodel.rst:2711 msgid "Introducing Python's framework for type annotations" msgstr "" -#: ../../reference/datamodel.rst:2640 +#: ../../reference/datamodel.rst:2713 msgid ":ref:`Generic Alias Types`" msgstr ":ref:`泛型別名型別 `" -#: ../../reference/datamodel.rst:2641 +#: ../../reference/datamodel.rst:2714 msgid "Documentation for objects representing parameterized generic classes" msgstr "" -#: ../../reference/datamodel.rst:2643 +#: ../../reference/datamodel.rst:2716 msgid "" ":ref:`Generics`, :ref:`user-defined generics` and :" "class:`typing.Generic`" msgstr "" -#: ../../reference/datamodel.rst:2644 +#: ../../reference/datamodel.rst:2717 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../reference/datamodel.rst:2647 +#: ../../reference/datamodel.rst:2720 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2652 +#: ../../reference/datamodel.rst:2725 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2655 +#: ../../reference/datamodel.rst:2728 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " "method. As such, there is no need for it to be decorated with :func:" "`@classmethod` when it is defined." msgstr "" -#: ../../reference/datamodel.rst:2661 +#: ../../reference/datamodel.rst:2734 msgid "The purpose of *__class_getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2663 +#: ../../reference/datamodel.rst:2736 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints` to these classes." msgstr "" -#: ../../reference/datamodel.rst:2667 +#: ../../reference/datamodel.rst:2740 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " @@ -3265,7 +3303,7 @@ msgid "" "own implementation of ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:2746 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " @@ -3273,11 +3311,11 @@ msgid "" "purposes other than type hinting is discouraged." msgstr "" -#: ../../reference/datamodel.rst:2683 +#: ../../reference/datamodel.rst:2756 msgid "*__class_getitem__* versus *__getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2685 +#: ../../reference/datamodel.rst:2758 msgid "" "Usually, the :ref:`subscription` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -3287,14 +3325,14 @@ msgid "" "genericalias>` object if it is properly defined." msgstr "" -#: ../../reference/datamodel.rst:2692 +#: ../../reference/datamodel.rst:2765 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " "follows something like the following process to decide whether :meth:" "`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" msgstr "" -#: ../../reference/datamodel.rst:2697 +#: ../../reference/datamodel.rst:2770 msgid "" "from inspect import isclass\n" "\n" @@ -3320,7 +3358,7 @@ msgid "" " )" msgstr "" -#: ../../reference/datamodel.rst:2720 +#: ../../reference/datamodel.rst:2793 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " @@ -3330,7 +3368,7 @@ msgid "" "__class_getitem__` being called::" msgstr "" -#: ../../reference/datamodel.rst:2727 +#: ../../reference/datamodel.rst:2800 msgid "" ">>> # list has class \"type\" as its metaclass, like most classes:\n" ">>> type(list)\n" @@ -3345,14 +3383,14 @@ msgid "" "" msgstr "" -#: ../../reference/datamodel.rst:2739 +#: ../../reference/datamodel.rst:2812 msgid "" "However, if a class has a custom metaclass that defines :meth:`~object." "__getitem__`, subscribing the class may result in different behaviour. An " "example of this can be found in the :mod:`enum` module::" msgstr "" -#: ../../reference/datamodel.rst:2743 +#: ../../reference/datamodel.rst:2816 msgid "" ">>> from enum import Enum\n" ">>> class Menu(Enum):\n" @@ -3372,33 +3410,33 @@ msgid "" "" msgstr "" -#: ../../reference/datamodel.rst:2762 +#: ../../reference/datamodel.rst:2835 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:2763 +#: ../../reference/datamodel.rst:2836 msgid "" "Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" "`subscription` results in ``__class_getitem__()`` being " "called instead of :meth:`~object.__getitem__`" msgstr "" -#: ../../reference/datamodel.rst:2771 +#: ../../reference/datamodel.rst:2844 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:2778 +#: ../../reference/datamodel.rst:2851 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " "arg1, ...)``." msgstr "" -#: ../../reference/datamodel.rst:2785 +#: ../../reference/datamodel.rst:2858 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:2787 +#: ../../reference/datamodel.rst:2860 msgid "" "The following methods can be defined to implement container objects. " "Containers usually are :term:`sequences ` (such as :class:`lists " @@ -3434,7 +3472,7 @@ msgid "" "should iterate through the values." msgstr "" -#: ../../reference/datamodel.rst:2828 +#: ../../reference/datamodel.rst:2901 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -3442,7 +3480,7 @@ msgid "" "returns zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:2835 +#: ../../reference/datamodel.rst:2908 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " "length is larger than :data:`!sys.maxsize` some features (such as :func:" @@ -3451,7 +3489,7 @@ msgid "" "`~object.__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:2844 +#: ../../reference/datamodel.rst:2917 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " @@ -3461,28 +3499,28 @@ msgid "" "never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:2858 +#: ../../reference/datamodel.rst:2931 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:2860 +#: ../../reference/datamodel.rst:2933 msgid "a[1:2] = b" msgstr "a[1:2] = b" -#: ../../reference/datamodel.rst:2862 +#: ../../reference/datamodel.rst:2935 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:2864 +#: ../../reference/datamodel.rst:2937 msgid "a[slice(1, 2, None)] = b" msgstr "a[slice(1, 2, None)] = b" -#: ../../reference/datamodel.rst:2866 +#: ../../reference/datamodel.rst:2939 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:2871 +#: ../../reference/datamodel.rst:2944 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " "the accepted keys should be integers. Optionally, they may support :class:" @@ -3494,20 +3532,20 @@ msgid "" "`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:2883 +#: ../../reference/datamodel.rst:2956 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" -#: ../../reference/datamodel.rst:2888 +#: ../../reference/datamodel.rst:2961 msgid "" "When :ref:`subscripting` a *class*, the special class method :" "meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " "See :ref:`classgetitem-versus-getitem` for more details." msgstr "" -#: ../../reference/datamodel.rst:2896 +#: ../../reference/datamodel.rst:2969 msgid "" "Called to implement assignment to ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3516,7 +3554,7 @@ msgid "" "for improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2905 +#: ../../reference/datamodel.rst:2978 msgid "" "Called to implement deletion of ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3525,13 +3563,13 @@ msgid "" "values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2914 +#: ../../reference/datamodel.rst:2987 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:2920 +#: ../../reference/datamodel.rst:2993 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -3539,14 +3577,14 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:2928 +#: ../../reference/datamodel.rst:3001 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:2932 +#: ../../reference/datamodel.rst:3005 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " "built-in will fall back to using the sequence protocol (:meth:`__len__` and :" @@ -3555,7 +3593,7 @@ msgid "" "more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:2939 +#: ../../reference/datamodel.rst:3012 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -3563,14 +3601,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:2946 +#: ../../reference/datamodel.rst:3019 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:2950 +#: ../../reference/datamodel.rst:3023 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -3578,11 +3616,11 @@ msgid "" "reference `." msgstr "" -#: ../../reference/datamodel.rst:2959 +#: ../../reference/datamodel.rst:3032 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:2961 +#: ../../reference/datamodel.rst:3034 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -3590,7 +3628,7 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:2987 +#: ../../reference/datamodel.rst:3060 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3604,13 +3642,13 @@ msgid "" "function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:2998 +#: ../../reference/datamodel.rst:3071 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3021 +#: ../../reference/datamodel.rst:3094 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3623,13 +3661,13 @@ msgid "" "`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3033 +#: ../../reference/datamodel.rst:3106 msgid "" "Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " "coercion rules would become too complicated)." msgstr "" -#: ../../reference/datamodel.rst:3038 +#: ../../reference/datamodel.rst:3111 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -3638,7 +3676,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:3059 +#: ../../reference/datamodel.rst:3132 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -3656,19 +3694,19 @@ msgid "" "data model." msgstr "" -#: ../../reference/datamodel.rst:3082 +#: ../../reference/datamodel.rst:3155 msgid "" "Called to implement the unary arithmetic operations (``-``, ``+``, :func:" "`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:3095 +#: ../../reference/datamodel.rst:3168 msgid "" "Called to implement the built-in functions :func:`complex`, :func:`int` and :" "func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:3102 +#: ../../reference/datamodel.rst:3175 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -3677,14 +3715,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:3108 +#: ../../reference/datamodel.rst:3181 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:3120 +#: ../../reference/datamodel.rst:3193 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -3693,21 +3731,21 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:3126 +#: ../../reference/datamodel.rst:3199 msgid "" "The built-in function :func:`int` falls back to :meth:`__trunc__` if " "neither :meth:`__int__` nor :meth:`__index__` is defined." msgstr "" -#: ../../reference/datamodel.rst:3129 +#: ../../reference/datamodel.rst:3202 msgid "The delegation of :func:`int` to :meth:`__trunc__` is deprecated." msgstr "" -#: ../../reference/datamodel.rst:3136 +#: ../../reference/datamodel.rst:3209 msgid "With Statement Context Managers" msgstr "With 陳述式的情境管理器" -#: ../../reference/datamodel.rst:3138 +#: ../../reference/datamodel.rst:3211 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -3717,32 +3755,32 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:3149 +#: ../../reference/datamodel.rst:3222 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:3152 +#: ../../reference/datamodel.rst:3225 msgid "" "For more information on context managers, see :ref:`typecontextmanager`." msgstr "" -#: ../../reference/datamodel.rst:3157 +#: ../../reference/datamodel.rst:3230 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:3164 +#: ../../reference/datamodel.rst:3237 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:3168 +#: ../../reference/datamodel.rst:3241 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -3750,27 +3788,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:3172 +#: ../../reference/datamodel.rst:3245 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:3178 +#: ../../reference/datamodel.rst:3251 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../reference/datamodel.rst:3179 +#: ../../reference/datamodel.rst:3252 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3186 +#: ../../reference/datamodel.rst:3259 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:3188 +#: ../../reference/datamodel.rst:3261 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -3778,7 +3816,7 @@ msgid "" "pattern, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:3195 +#: ../../reference/datamodel.rst:3268 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -3787,7 +3825,7 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:3201 +#: ../../reference/datamodel.rst:3274 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " @@ -3797,19 +3835,19 @@ msgid "" "exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:3211 +#: ../../reference/datamodel.rst:3284 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:3212 +#: ../../reference/datamodel.rst:3285 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:3218 +#: ../../reference/datamodel.rst:3291 msgid "Emulating buffer types" msgstr "" -#: ../../reference/datamodel.rst:3220 +#: ../../reference/datamodel.rst:3293 msgid "" "The :ref:`buffer protocol ` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " @@ -3817,13 +3855,13 @@ msgid "" "and third-party libraries may define additional buffer types." msgstr "" -#: ../../reference/datamodel.rst:3225 +#: ../../reference/datamodel.rst:3298 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" -#: ../../reference/datamodel.rst:3230 +#: ../../reference/datamodel.rst:3303 msgid "" "Called when a buffer is requested from *self* (for example, by the :class:" "`memoryview` constructor). The *flags* argument is an integer representing " @@ -3833,7 +3871,7 @@ msgid "" "`memoryview` object." msgstr "" -#: ../../reference/datamodel.rst:3239 +#: ../../reference/datamodel.rst:3312 msgid "" "Called when a buffer is no longer needed. The *buffer* argument is a :class:" "`memoryview` object that was previously returned by :meth:`~object." @@ -3842,28 +3880,28 @@ msgid "" "to perform any cleanup are not required to implement this method." msgstr "" -#: ../../reference/datamodel.rst:3250 +#: ../../reference/datamodel.rst:3323 msgid ":pep:`688` - Making the buffer protocol accessible in Python" msgstr "" -#: ../../reference/datamodel.rst:3251 +#: ../../reference/datamodel.rst:3324 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3253 +#: ../../reference/datamodel.rst:3326 msgid ":class:`collections.abc.Buffer`" msgstr ":class:`collections.abc.Buffer`" -#: ../../reference/datamodel.rst:3254 +#: ../../reference/datamodel.rst:3327 msgid "ABC for buffer types." msgstr "" -#: ../../reference/datamodel.rst:3259 +#: ../../reference/datamodel.rst:3332 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:3261 +#: ../../reference/datamodel.rst:3334 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -3871,7 +3909,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:3266 +#: ../../reference/datamodel.rst:3339 msgid "" ">>> class C:\n" "... pass\n" @@ -3893,7 +3931,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: object of type 'C' has no len()" -#: ../../reference/datamodel.rst:3276 +#: ../../reference/datamodel.rst:3349 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -3902,7 +3940,7 @@ msgid "" "invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:3283 +#: ../../reference/datamodel.rst:3356 msgid "" ">>> 1 .__hash__() == hash(1)\n" "True\n" @@ -3918,14 +3956,14 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: descriptor '__hash__' of 'int' object needs an argument" -#: ../../reference/datamodel.rst:3290 +#: ../../reference/datamodel.rst:3363 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:3294 +#: ../../reference/datamodel.rst:3367 msgid "" ">>> type(1).__hash__(1) == hash(1)\n" "True\n" @@ -3937,14 +3975,14 @@ msgstr "" ">>> type(int).__hash__(int) == hash(int)\n" "True" -#: ../../reference/datamodel.rst:3299 +#: ../../reference/datamodel.rst:3372 msgid "" "In addition to bypassing any instance attributes in the interest of " "correctness, implicit special method lookup generally also bypasses the :" "meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:3303 +#: ../../reference/datamodel.rst:3376 msgid "" ">>> class Meta(type):\n" "... def __getattribute__(*args):\n" @@ -3969,7 +4007,7 @@ msgid "" "10" msgstr "" -#: ../../reference/datamodel.rst:3325 +#: ../../reference/datamodel.rst:3398 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -3978,36 +4016,36 @@ msgid "" "consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:3336 +#: ../../reference/datamodel.rst:3409 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:3340 +#: ../../reference/datamodel.rst:3413 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:3342 +#: ../../reference/datamodel.rst:3415 msgid "" "An :term:`awaitable` object generally implements an :meth:`~object." "__await__` method. :term:`Coroutine objects ` returned from :" "keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:3348 +#: ../../reference/datamodel.rst:3421 msgid "" "The :term:`generator iterator` objects returned from generators decorated " "with :func:`types.coroutine` are also awaitable, but they do not implement :" "meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:3354 +#: ../../reference/datamodel.rst:3427 msgid "" "Must return an :term:`iterator`. Should be used to implement :term:" "`awaitable` objects. For instance, :class:`asyncio.Future` implements this " "method to be compatible with the :keyword:`await` expression." msgstr "" -#: ../../reference/datamodel.rst:3360 +#: ../../reference/datamodel.rst:3433 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " @@ -4015,15 +4053,15 @@ msgid "" "g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" -#: ../../reference/datamodel.rst:3368 +#: ../../reference/datamodel.rst:3441 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:3374 +#: ../../reference/datamodel.rst:3447 msgid "Coroutine Objects" msgstr "" -#: ../../reference/datamodel.rst:3376 +#: ../../reference/datamodel.rst:3449 msgid "" ":term:`Coroutine objects ` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " @@ -4034,18 +4072,18 @@ msgid "" "should not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" -#: ../../reference/datamodel.rst:3384 +#: ../../reference/datamodel.rst:3457 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:3388 +#: ../../reference/datamodel.rst:3461 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:3394 +#: ../../reference/datamodel.rst:3467 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " "is equivalent to advancing the iterator returned by :meth:`~object." @@ -4056,7 +4094,7 @@ msgid "" "value, described above." msgstr "" -#: ../../reference/datamodel.rst:3405 +#: ../../reference/datamodel.rst:3478 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " @@ -4067,13 +4105,13 @@ msgid "" "not caught in the coroutine, it propagates back to the caller." msgstr "" -#: ../../reference/datamodel.rst:3416 +#: ../../reference/datamodel.rst:3489 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: ../../reference/datamodel.rst:3421 +#: ../../reference/datamodel.rst:3494 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -4083,42 +4121,42 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:3429 +#: ../../reference/datamodel.rst:3502 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:3435 +#: ../../reference/datamodel.rst:3508 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:3437 +#: ../../reference/datamodel.rst:3510 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:3440 +#: ../../reference/datamodel.rst:3513 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:3444 +#: ../../reference/datamodel.rst:3517 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:3448 +#: ../../reference/datamodel.rst:3521 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:3451 +#: ../../reference/datamodel.rst:3524 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:3453 +#: ../../reference/datamodel.rst:3526 msgid "" "class Reader:\n" " async def readline(self):\n" @@ -4146,53 +4184,53 @@ msgstr "" " raise StopAsyncIteration\n" " return val" -#: ../../reference/datamodel.rst:3468 +#: ../../reference/datamodel.rst:3541 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator `." msgstr "" -#: ../../reference/datamodel.rst:3473 +#: ../../reference/datamodel.rst:3546 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " "asynchronous iterator object. Returning anything else will result in a :exc:" "`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:3481 +#: ../../reference/datamodel.rst:3554 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3483 +#: ../../reference/datamodel.rst:3556 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3486 +#: ../../reference/datamodel.rst:3559 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3490 +#: ../../reference/datamodel.rst:3563 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3495 +#: ../../reference/datamodel.rst:3568 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3498 +#: ../../reference/datamodel.rst:3571 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:3500 +#: ../../reference/datamodel.rst:3573 msgid "" "class AsyncContextManager:\n" " async def __aenter__(self):\n" @@ -4208,18 +4246,18 @@ msgstr "" " async def __aexit__(self, exc_type, exc, tb):\n" " await log('exiting context')" -#: ../../reference/datamodel.rst:3511 +#: ../../reference/datamodel.rst:3584 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:3512 +#: ../../reference/datamodel.rst:3585 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:3516 +#: ../../reference/datamodel.rst:3589 msgid "" "The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." "__reversed__`, :meth:`~object.__contains__`, :meth:`~object." @@ -4228,7 +4266,7 @@ msgid "" "by relying on the behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3523 +#: ../../reference/datamodel.rst:3596 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " @@ -4236,7 +4274,7 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3529 +#: ../../reference/datamodel.rst:3602 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method -- such as :meth:`~object.__add__` -- fails then the overall " @@ -4253,13 +4291,13 @@ msgstr "" #: ../../reference/datamodel.rst:427 ../../reference/datamodel.rst:447 #: ../../reference/datamodel.rst:455 ../../reference/datamodel.rst:466 #: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:519 -#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:661 -#: ../../reference/datamodel.rst:799 ../../reference/datamodel.rst:823 -#: ../../reference/datamodel.rst:856 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:1013 ../../reference/datamodel.rst:1040 -#: ../../reference/datamodel.rst:1102 ../../reference/datamodel.rst:1206 -#: ../../reference/datamodel.rst:1315 ../../reference/datamodel.rst:1425 -#: ../../reference/datamodel.rst:1839 ../../reference/datamodel.rst:2854 +#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:660 +#: ../../reference/datamodel.rst:798 ../../reference/datamodel.rst:822 +#: ../../reference/datamodel.rst:856 ../../reference/datamodel.rst:937 +#: ../../reference/datamodel.rst:1076 ../../reference/datamodel.rst:1103 +#: ../../reference/datamodel.rst:1175 ../../reference/datamodel.rst:1279 +#: ../../reference/datamodel.rst:1388 ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1912 ../../reference/datamodel.rst:2927 msgid "object" msgstr "object(物件)" @@ -4269,14 +4307,14 @@ msgstr "data(資料)" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:296 #: ../../reference/datamodel.rst:343 ../../reference/datamodel.rst:427 -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:799 -#: ../../reference/datamodel.rst:1059 ../../reference/datamodel.rst:1508 -#: ../../reference/datamodel.rst:1750 ../../reference/datamodel.rst:1755 -#: ../../reference/datamodel.rst:1839 ../../reference/datamodel.rst:2395 -#: ../../reference/datamodel.rst:2824 ../../reference/datamodel.rst:2982 -#: ../../reference/datamodel.rst:3017 ../../reference/datamodel.rst:3031 -#: ../../reference/datamodel.rst:3080 ../../reference/datamodel.rst:3090 -#: ../../reference/datamodel.rst:3118 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:798 +#: ../../reference/datamodel.rst:1132 ../../reference/datamodel.rst:1581 +#: ../../reference/datamodel.rst:1823 ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:1912 ../../reference/datamodel.rst:2468 +#: ../../reference/datamodel.rst:2897 ../../reference/datamodel.rst:3055 +#: ../../reference/datamodel.rst:3090 ../../reference/datamodel.rst:3104 +#: ../../reference/datamodel.rst:3153 ../../reference/datamodel.rst:3163 +#: ../../reference/datamodel.rst:3191 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -4285,7 +4323,7 @@ msgid "id" msgstr "id" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:126 -#: ../../reference/datamodel.rst:2395 +#: ../../reference/datamodel.rst:2468 msgid "type" msgstr "type(型別)" @@ -4321,7 +4359,7 @@ msgstr "reference counting(參照計數)" msgid "unreachable object" msgstr "unreachable object(不可達物件)" -#: ../../reference/datamodel.rst:95 ../../reference/datamodel.rst:935 +#: ../../reference/datamodel.rst:95 ../../reference/datamodel.rst:937 msgid "container" msgstr "container(容器)" @@ -4336,23 +4374,23 @@ msgstr "extension(擴充)" #: ../../reference/datamodel.rst:126 ../../reference/datamodel.rst:400 #: ../../reference/datamodel.rst:401 ../../reference/datamodel.rst:502 #: ../../reference/datamodel.rst:856 ../../reference/datamodel.rst:876 -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "module" msgstr "module(模組)" #: ../../reference/datamodel.rst:126 ../../reference/datamodel.rst:265 -#: ../../reference/datamodel.rst:799 +#: ../../reference/datamodel.rst:798 msgid "C" msgstr "C" #: ../../reference/datamodel.rst:126 ../../reference/datamodel.rst:265 -#: ../../reference/datamodel.rst:799 +#: ../../reference/datamodel.rst:798 msgid "language" msgstr "language(語言)" -#: ../../reference/datamodel.rst:139 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:953 ../../reference/datamodel.rst:1013 -#: ../../reference/datamodel.rst:1033 +#: ../../reference/datamodel.rst:139 ../../reference/datamodel.rst:937 +#: ../../reference/datamodel.rst:955 ../../reference/datamodel.rst:1076 +#: ../../reference/datamodel.rst:1096 msgid "attribute" msgstr "attribute(屬性)" @@ -4372,7 +4410,7 @@ msgstr "..." msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" -#: ../../reference/datamodel.rst:196 ../../reference/datamodel.rst:1040 +#: ../../reference/datamodel.rst:196 ../../reference/datamodel.rst:1103 msgid "numeric" msgstr "numeric(數值)" @@ -4409,16 +4447,16 @@ msgstr "number(數字)" msgid "Java" msgstr "Java" -#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3163 msgid "complex" msgstr "complex(複數)" #: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:427 -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:2824 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:2897 msgid "len" msgstr "len" -#: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:1040 +#: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:1103 msgid "sequence" msgstr "sequence(序列)" @@ -4447,8 +4485,8 @@ msgstr "immutable sequence(不可變序列)" msgid "immutable" msgstr "immutable(不可變)" -#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1725 -#: ../../reference/datamodel.rst:1755 +#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1798 +#: ../../reference/datamodel.rst:1828 msgid "string" msgstr "string(字串)" @@ -4484,7 +4522,7 @@ msgstr "singleton(單例)" msgid "empty" msgstr "empty(空的)" -#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:1750 +#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:1823 msgid "bytes" msgstr "bytes(位元組)" @@ -4500,14 +4538,14 @@ msgstr "mutable sequence(可變序列)" msgid "mutable" msgstr "mutable(可變的)" -#: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:953 -#: ../../reference/datamodel.rst:1033 +#: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:955 +#: ../../reference/datamodel.rst:1096 msgid "assignment" msgstr "assignment(賦值)" #: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:856 -#: ../../reference/datamodel.rst:1462 ../../reference/datamodel.rst:1644 -#: ../../reference/datamodel.rst:3145 +#: ../../reference/datamodel.rst:1535 ../../reference/datamodel.rst:1717 +#: ../../reference/datamodel.rst:3218 msgid "statement" msgstr "statement(陳述式)" @@ -4539,12 +4577,12 @@ msgstr "set(集合)" msgid "frozenset" msgstr "frozenset(凍結集合)" -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:1040 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:1103 msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:1839 +#: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:937 +#: ../../reference/datamodel.rst:1912 msgid "dictionary" msgstr "dictionary(字典)" @@ -4561,13 +4599,13 @@ msgid "callable" msgstr "callable(可呼叫物件)" #: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:534 -#: ../../reference/datamodel.rst:743 ../../reference/datamodel.rst:761 -#: ../../reference/datamodel.rst:774 ../../reference/datamodel.rst:799 +#: ../../reference/datamodel.rst:742 ../../reference/datamodel.rst:760 +#: ../../reference/datamodel.rst:773 ../../reference/datamodel.rst:798 msgid "function" msgstr "function (函式)" -#: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:958 ../../reference/datamodel.rst:2776 +#: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:937 +#: ../../reference/datamodel.rst:960 ../../reference/datamodel.rst:2849 msgid "call" msgstr "call(呼叫)" @@ -4579,7 +4617,7 @@ msgstr "invocation(調用)" msgid "argument" msgstr "argument(引數)" -#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:661 +#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:660 msgid "user-defined" msgstr "user-defined(使用者定義)" @@ -4639,59 +4677,59 @@ msgstr "__kwdefaults__ (函式屬性)" msgid "__type_params__ (function attribute)" msgstr "__type_params__ (函式屬性)" -#: ../../reference/datamodel.rst:661 ../../reference/datamodel.rst:823 +#: ../../reference/datamodel.rst:660 ../../reference/datamodel.rst:822 msgid "method" msgstr "method(方法)" -#: ../../reference/datamodel.rst:661 +#: ../../reference/datamodel.rst:660 msgid "user-defined method" msgstr "user-defined method(使用者定義方法)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__func__ (method attribute)" msgstr "__func__ (方法屬性)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__self__ (method attribute)" msgstr "__self__ (方法屬性)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__doc__ (method attribute)" msgstr "__doc__ (方法屬性)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__name__ (method attribute)" msgstr "__name__ (方法屬性)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__module__ (method attribute)" msgstr "__module__ (方法屬性)" -#: ../../reference/datamodel.rst:743 ../../reference/datamodel.rst:1206 +#: ../../reference/datamodel.rst:742 ../../reference/datamodel.rst:1279 msgid "generator" msgstr "generator(產生器)" -#: ../../reference/datamodel.rst:743 +#: ../../reference/datamodel.rst:742 msgid "iterator" msgstr "itorator(疊代器)" -#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3332 +#: ../../reference/datamodel.rst:760 ../../reference/datamodel.rst:3405 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../reference/datamodel.rst:774 +#: ../../reference/datamodel.rst:773 msgid "asynchronous generator" msgstr "asynchronous generator(非同步產生器)" -#: ../../reference/datamodel.rst:774 +#: ../../reference/datamodel.rst:773 msgid "asynchronous iterator" msgstr "asynchronous iterator(非同步疊代器)" -#: ../../reference/datamodel.rst:823 +#: ../../reference/datamodel.rst:822 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/datamodel.rst:823 +#: ../../reference/datamodel.rst:822 msgid "built-in" msgstr "built-in(內建)" @@ -4719,489 +4757,508 @@ msgstr "__annotations__ (模組屬性)" msgid "__dict__ (module attribute)" msgstr "__dict__ (模組屬性)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:953 -#: ../../reference/datamodel.rst:1013 ../../reference/datamodel.rst:1627 -#: ../../reference/datamodel.rst:2506 +#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:955 +#: ../../reference/datamodel.rst:1076 ../../reference/datamodel.rst:1700 +#: ../../reference/datamodel.rst:2579 msgid "class" msgstr "class(類別)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:1013 -#: ../../reference/datamodel.rst:1033 +#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:1076 +#: ../../reference/datamodel.rst:1096 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:1013 -#: ../../reference/datamodel.rst:2776 +#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:1076 +#: ../../reference/datamodel.rst:2849 msgid "instance" msgstr "instance(實例)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:958 +#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:960 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__name__ (class attribute)" msgstr "__name__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__module__ (class attribute)" msgstr "__module__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__dict__ (class attribute)" msgstr "__dict__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__bases__ (class attribute)" msgstr "__bases__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__doc__ (class attribute)" msgstr "__doc__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__annotations__ (class attribute)" msgstr "__annotations__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__type_params__ (class attribute)" msgstr "__type_params__ (類別屬性)" -#: ../../reference/datamodel.rst:962 -#, fuzzy +#: ../../reference/datamodel.rst:967 msgid "__static_attributes__ (class attribute)" -msgstr "__annotations__ (類別屬性)" +msgstr "__static_attributes__ (類別屬性)" -#: ../../reference/datamodel.rst:962 -#, fuzzy +#: ../../reference/datamodel.rst:967 msgid "__firstlineno__ (class attribute)" -msgstr "__name__ (類別屬性)" +msgstr "__firstlineno__ (類別屬性)" -#: ../../reference/datamodel.rst:1048 +#: ../../reference/datamodel.rst:1114 msgid "__dict__ (instance attribute)" msgstr "__dict__ (實例屬性)" -#: ../../reference/datamodel.rst:1048 +#: ../../reference/datamodel.rst:1114 msgid "__class__ (instance attribute)" msgstr "__class__ (實例屬性)" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "open" msgstr "open" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "io" msgstr "io" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "popen() (in module os)" msgstr "popen() (於 os 模組中)" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "makefile() (socket method)" msgstr "makefile() (socket 方法)" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "sys.stdin" msgstr "sys.stdin" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "sys.stdout" msgstr "sys.stdout" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "sys.stderr" msgstr "sys.stderr" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "stdio" msgstr "stdio" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "stdin (in module sys)" msgstr "stdin (sys 模組中)" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "stdout (in module sys)" msgstr "stdout (sys 模組中)" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "stderr (in module sys)" msgstr "stderr (sys 模組中)" -#: ../../reference/datamodel.rst:1088 +#: ../../reference/datamodel.rst:1161 msgid "internal type" msgstr "internal type(內部型別)" -#: ../../reference/datamodel.rst:1088 +#: ../../reference/datamodel.rst:1161 msgid "types, internal" msgstr "types(型別), internal(內部)" -#: ../../reference/datamodel.rst:1102 +#: ../../reference/datamodel.rst:1175 msgid "bytecode" msgstr "bytecode(位元組碼)" -#: ../../reference/datamodel.rst:1102 +#: ../../reference/datamodel.rst:1175 msgid "code" msgstr "code(程式碼)" -#: ../../reference/datamodel.rst:1102 +#: ../../reference/datamodel.rst:1175 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_argcount (code object attribute)" msgstr "co_argcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_posonlyargcount (code object attribute)" msgstr "co_posonlyargcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_kwonlyargcount (code object attribute)" msgstr "co_kwonlyargcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_code (code object attribute)" msgstr "co_code (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_consts (code object attribute)" msgstr "co_consts (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_filename (code object attribute)" msgstr "co_filename (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_firstlineno (code object attribute)" msgstr "co_firstlineno (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_flags (code object attribute)" msgstr "co_flags (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_lnotab (code object attribute)" msgstr "co_lnotab (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_name (code object attribute)" msgstr "co_name (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_names (code object attribute)" msgstr "co_names (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_nlocals (code object attribute)" msgstr "co_nlocals (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_stacksize (code object attribute)" msgstr "co_stacksize (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_varnames (code object attribute)" msgstr "co_varnames (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_cellvars (code object attribute)" msgstr "co_cellvars (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_freevars (code object attribute)" msgstr "co_freevars (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_qualname (code object attribute)" msgstr "co_qualname (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1224 +#: ../../reference/datamodel.rst:1297 msgid "documentation string" msgstr "documentation string(文件字串)" -#: ../../reference/datamodel.rst:1315 +#: ../../reference/datamodel.rst:1388 msgid "frame" msgstr "frame" -#: ../../reference/datamodel.rst:1321 +#: ../../reference/datamodel.rst:1394 msgid "f_back (frame attribute)" msgstr "f_back (frame 屬性)" -#: ../../reference/datamodel.rst:1321 +#: ../../reference/datamodel.rst:1394 msgid "f_code (frame attribute)" msgstr "f_code (frame 屬性)" -#: ../../reference/datamodel.rst:1321 +#: ../../reference/datamodel.rst:1394 msgid "f_globals (frame attribute)" msgstr "f_globals (frame 屬性)" -#: ../../reference/datamodel.rst:1321 +#: ../../reference/datamodel.rst:1394 msgid "f_locals (frame attribute)" msgstr "f_locals (frame 屬性)" -#: ../../reference/datamodel.rst:1321 +#: ../../reference/datamodel.rst:1394 msgid "f_lasti (frame attribute)" msgstr "f_lasti (frame 屬性)" -#: ../../reference/datamodel.rst:1321 +#: ../../reference/datamodel.rst:1394 msgid "f_builtins (frame attribute)" msgstr "f_builtins (frame 屬性)" -#: ../../reference/datamodel.rst:1365 +#: ../../reference/datamodel.rst:1438 msgid "f_trace (frame attribute)" msgstr "f_trace (frame 屬性)" -#: ../../reference/datamodel.rst:1365 +#: ../../reference/datamodel.rst:1438 msgid "f_trace_lines (frame attribute)" msgstr "f_trace_lines (frame 屬性)" -#: ../../reference/datamodel.rst:1365 +#: ../../reference/datamodel.rst:1438 msgid "f_trace_opcodes (frame attribute)" msgstr "f_trace_opcodes (frame 屬性)" -#: ../../reference/datamodel.rst:1365 +#: ../../reference/datamodel.rst:1438 msgid "f_lineno (frame attribute)" msgstr "f_lineno (frame 屬性)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "traceback" msgstr "traceback" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "stack" msgstr "stack(堆疊)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "trace" msgstr "trace(追蹤)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "exception" msgstr "exception(例外)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "handler" msgstr "handler(處理器)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "execution" msgstr "execution(執行)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "exc_info (in module sys)" msgstr "exc_info (sys 模組中)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "last_traceback (in module sys)" msgstr "last_traceback (sys 模組中)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "sys.exc_info" msgstr "sys.exc_info" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "sys.exception" msgstr "sys.exception" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "sys.last_traceback" msgstr "sys.last_traceback" -#: ../../reference/datamodel.rst:1462 +#: ../../reference/datamodel.rst:1535 msgid "tb_frame (traceback attribute)" msgstr "tb_frame (traceback 屬性)" -#: ../../reference/datamodel.rst:1462 +#: ../../reference/datamodel.rst:1535 msgid "tb_lineno (traceback attribute)" msgstr "tb_lineno (traceback 屬性)" -#: ../../reference/datamodel.rst:1462 +#: ../../reference/datamodel.rst:1535 msgid "tb_lasti (traceback attribute)" msgstr "tb_lasti (traceback 屬性)" -#: ../../reference/datamodel.rst:1462 +#: ../../reference/datamodel.rst:1535 msgid "try" msgstr "try" -#: ../../reference/datamodel.rst:1492 +#: ../../reference/datamodel.rst:1565 msgid "tb_next (traceback attribute)" msgstr "tb_next (traceback 屬性)" -#: ../../reference/datamodel.rst:1508 ../../reference/datamodel.rst:2854 +#: ../../reference/datamodel.rst:1581 ../../reference/datamodel.rst:2927 msgid "slice" msgstr "slice(切片)" -#: ../../reference/datamodel.rst:1514 +#: ../../reference/datamodel.rst:1587 msgid "start (slice object attribute)" msgstr "start (slice 物件屬性)" -#: ../../reference/datamodel.rst:1514 +#: ../../reference/datamodel.rst:1587 msgid "stop (slice object attribute)" msgstr "stop (slice 物件屬性)" -#: ../../reference/datamodel.rst:1514 +#: ../../reference/datamodel.rst:1587 msgid "step (slice object attribute)" msgstr "step (slice 物件屬性)" -#: ../../reference/datamodel.rst:1562 +#: ../../reference/datamodel.rst:1635 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/datamodel.rst:1562 +#: ../../reference/datamodel.rst:1635 msgid "overloading" msgstr "overloading(多載)" -#: ../../reference/datamodel.rst:1562 +#: ../../reference/datamodel.rst:1635 msgid "__getitem__() (mapping object method)" msgstr "__getitem__() (對映物件方法)" -#: ../../reference/datamodel.rst:1598 +#: ../../reference/datamodel.rst:1671 msgid "subclassing" msgstr "subclassing(子類別化)" -#: ../../reference/datamodel.rst:1598 +#: ../../reference/datamodel.rst:1671 msgid "immutable types" msgstr "immutable types(不可變型別)" -#: ../../reference/datamodel.rst:1627 +#: ../../reference/datamodel.rst:1700 msgid "constructor" msgstr "constructor(建構函式)" -#: ../../reference/datamodel.rst:1644 +#: ../../reference/datamodel.rst:1717 msgid "destructor" msgstr "destructor(解構函式)" -#: ../../reference/datamodel.rst:1644 +#: ../../reference/datamodel.rst:1717 msgid "finalizer" msgstr "finalizer(終結函式)" -#: ../../reference/datamodel.rst:1644 +#: ../../reference/datamodel.rst:1717 msgid "del" msgstr "del" -#: ../../reference/datamodel.rst:1708 +#: ../../reference/datamodel.rst:1781 msgid "repr() (built-in function)" msgstr "repr() (內建函式)" -#: ../../reference/datamodel.rst:1708 +#: ../../reference/datamodel.rst:1781 msgid "__repr__() (object method)" msgstr "__repr__() (物件方法)" -#: ../../reference/datamodel.rst:1725 +#: ../../reference/datamodel.rst:1798 msgid "__str__() (object method)" msgstr "__str__() (物件方法)" -#: ../../reference/datamodel.rst:1725 +#: ../../reference/datamodel.rst:1798 msgid "format() (built-in function)" msgstr "format() (內建函式)" -#: ../../reference/datamodel.rst:1725 +#: ../../reference/datamodel.rst:1798 msgid "print() (built-in function)" msgstr "print() (內建函式)" -#: ../../reference/datamodel.rst:1755 +#: ../../reference/datamodel.rst:1828 msgid "__format__() (object method)" msgstr "__format__() (物件方法)" -#: ../../reference/datamodel.rst:1755 +#: ../../reference/datamodel.rst:1828 msgid "conversion" msgstr "conversion" -#: ../../reference/datamodel.rst:1755 +#: ../../reference/datamodel.rst:1828 msgid "print" msgstr "print" -#: ../../reference/datamodel.rst:1794 +#: ../../reference/datamodel.rst:1867 msgid "comparisons" msgstr "comparison(比較)" -#: ../../reference/datamodel.rst:1839 +#: ../../reference/datamodel.rst:1912 msgid "hash" msgstr "hash(雜湊)" -#: ../../reference/datamodel.rst:1920 +#: ../../reference/datamodel.rst:1993 msgid "__len__() (mapping object method)" msgstr "__len__() (對映物件方法)" -#: ../../reference/datamodel.rst:2024 +#: ../../reference/datamodel.rst:2097 msgid "__getattr__ (module attribute)" msgstr "__getattr__ (模組屬性)" -#: ../../reference/datamodel.rst:2024 +#: ../../reference/datamodel.rst:2097 msgid "__dir__ (module attribute)" msgstr "__dir__ (模組屬性)" -#: ../../reference/datamodel.rst:2024 +#: ../../reference/datamodel.rst:2097 msgid "__class__ (module attribute)" msgstr "__class__ (模組屬性)" -#: ../../reference/datamodel.rst:2395 +#: ../../reference/datamodel.rst:2468 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../reference/datamodel.rst:2395 +#: ../../reference/datamodel.rst:2468 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/datamodel.rst:2395 +#: ../../reference/datamodel.rst:2468 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/datamodel.rst:2459 +#: ../../reference/datamodel.rst:2532 msgid "metaclass hint" msgstr "metaclass hint(元類別提示)" -#: ../../reference/datamodel.rst:2482 +#: ../../reference/datamodel.rst:2555 msgid "__prepare__ (metaclass method)" msgstr "__prepare__ (元類別方法)" -#: ../../reference/datamodel.rst:2506 +#: ../../reference/datamodel.rst:2579 msgid "body" msgstr "body" -#: ../../reference/datamodel.rst:2526 +#: ../../reference/datamodel.rst:2599 msgid "__class__ (method cell)" msgstr "__class__ (方法 cell)" -#: ../../reference/datamodel.rst:2526 +#: ../../reference/datamodel.rst:2599 msgid "__classcell__ (class namespace entry)" msgstr "__classcell__ (類別命名空間項目)" -#: ../../reference/datamodel.rst:2824 +#: ../../reference/datamodel.rst:2897 msgid "__bool__() (object method)" msgstr "__bool__() (物件方法)" -#: ../../reference/datamodel.rst:2982 ../../reference/datamodel.rst:3017 +#: ../../reference/datamodel.rst:3055 ../../reference/datamodel.rst:3090 msgid "divmod" msgstr "divmod" -#: ../../reference/datamodel.rst:2982 ../../reference/datamodel.rst:3017 -#: ../../reference/datamodel.rst:3031 +#: ../../reference/datamodel.rst:3055 ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:3104 msgid "pow" msgstr "pow" -#: ../../reference/datamodel.rst:3080 +#: ../../reference/datamodel.rst:3153 msgid "abs" msgstr "abs" -#: ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:3163 msgid "int" msgstr "int" -#: ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:3163 msgid "float" msgstr "float" -#: ../../reference/datamodel.rst:3118 +#: ../../reference/datamodel.rst:3191 msgid "round" msgstr "round" -#: ../../reference/datamodel.rst:3145 +#: ../../reference/datamodel.rst:3218 msgid "with" msgstr "with" -#: ../../reference/datamodel.rst:3145 +#: ../../reference/datamodel.rst:3218 msgid "context manager" msgstr "context manager(情境管理器)" + +#~ msgid ":attr:`~definition.__name__`" +#~ msgstr ":attr:`~definition.__name__`" + +#~ msgid ":attr:`__module__`" +#~ msgstr ":attr:`__module__`" + +#~ msgid ":attr:`~object.__dict__`" +#~ msgstr ":attr:`~object.__dict__`" + +#~ msgid ":attr:`~class.__bases__`" +#~ msgstr ":attr:`~class.__bases__`" + +#~ msgid ":attr:`__type_params__`" +#~ msgstr ":attr:`__type_params__`" + +#~ msgid ":attr:`~class.__static_attributes__`" +#~ msgstr ":attr:`~class.__static_attributes__`" + +#~ msgid ":attr:`__firstlineno__`" +#~ msgstr ":attr:`__firstlineno__`" diff --git a/reference/executionmodel.po b/reference/executionmodel.po index 63aff5c713..4dabdcd7f3 100644 --- a/reference/executionmodel.po +++ b/reference/executionmodel.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -347,9 +347,9 @@ msgstr "" #: ../../reference/executionmodel.rst:227 msgid "" "While annotation scopes have an internal name, that name is not reflected in " -"the :term:`__qualname__ ` of objects defined within the " -"scope. Instead, the :attr:`!__qualname__` of such objects is as if the " -"object were defined in the enclosing scope." +"the :term:`qualified name` of objects defined within the scope. Instead, " +"the :attr:`~definition.__qualname__` of such objects is as if the object " +"were defined in the enclosing scope." msgstr "" #: ../../reference/executionmodel.rst:232 diff --git a/reference/expressions.po b/reference/expressions.po index 366629e070..959ecdaa17 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -138,8 +138,8 @@ msgstr "" #: ../../reference/expressions.rst:107 msgid "" -"The ``__name__`` attribute of nested functions, classes, and type aliases is " -"however not mangled." +"The :attr:`~definition.__name__` attribute of nested functions, classes, and " +"type aliases is however not mangled." msgstr "" #: ../../reference/expressions.rst:110 @@ -541,9 +541,9 @@ msgid "" "function. The execution starts when one of the generator's methods is " "called. At that time, the execution proceeds to the first yield expression, " "where it is suspended again, returning the value of :token:`~python-grammar:" -"expression_list` to the generator's caller, or ``None`` if :token:`~python-" -"grammar:expression_list` is omitted. By suspended, we mean that all local " -"state is retained, including the current bindings of local variables, the " +"yield_list` to the generator's caller, or ``None`` if :token:`~python-" +"grammar:yield_list` is omitted. By suspended, we mean that all local state " +"is retained, including the current bindings of local variables, the " "instruction pointer, the internal evaluation stack, and the state of any " "exception handling. When the execution is resumed by calling one of the " "generator's methods, the function can proceed exactly as if the yield " @@ -667,7 +667,7 @@ msgid "" "meth:`~generator.__next__` method, the current yield expression always " "evaluates to :const:`None`. The execution then continues to the next yield " "expression, where the generator is suspended again, and the value of the :" -"token:`~python-grammar:expression_list` is returned to :meth:`__next__`'s " +"token:`~python-grammar:yield_list` is returned to :meth:`__next__`'s " "caller. If the generator exits without yielding another value, a :exc:" "`StopIteration` exception is raised." msgstr "" @@ -811,17 +811,16 @@ msgid "" "`awaitable` object, and the execution starts when this object is awaited on. " "At that time, the execution proceeds to the first yield expression, where it " "is suspended again, returning the value of :token:`~python-grammar:" -"expression_list` to the awaiting coroutine. As with a generator, suspension " -"means that all local state is retained, including the current bindings of " -"local variables, the instruction pointer, the internal evaluation stack, and " -"the state of any exception handling. When the execution is resumed by " -"awaiting on the next object returned by the asynchronous generator's " -"methods, the function can proceed exactly as if the yield expression were " -"just another external call. The value of the yield expression after resuming " -"depends on the method which resumed the execution. If :meth:`~agen." -"__anext__` is used then the result is :const:`None`. Otherwise, if :meth:" -"`~agen.asend` is used, then the result will be the value passed in to that " -"method." +"yield_list` to the awaiting coroutine. As with a generator, suspension means " +"that all local state is retained, including the current bindings of local " +"variables, the instruction pointer, the internal evaluation stack, and the " +"state of any exception handling. When the execution is resumed by awaiting " +"on the next object returned by the asynchronous generator's methods, the " +"function can proceed exactly as if the yield expression were just another " +"external call. The value of the yield expression after resuming depends on " +"the method which resumed the execution. If :meth:`~agen.__anext__` is used " +"then the result is :const:`None`. Otherwise, if :meth:`~agen.asend` is used, " +"then the result will be the value passed in to that method." msgstr "" #: ../../reference/expressions.rst:710 @@ -886,7 +885,7 @@ msgid "" "asynchronous generator function is resumed with an :meth:`~agen.__anext__` " "method, the current yield expression always evaluates to :const:`None` in " "the returned awaitable, which when run will continue to the next yield " -"expression. The value of the :token:`~python-grammar:expression_list` of the " +"expression. The value of the :token:`~python-grammar:yield_list` of the " "yield expression is the value of the :exc:`StopIteration` exception raised " "by the completing coroutine. If the asynchronous generator exits without " "yielding another value, the awaitable instead raises a :exc:" @@ -1013,18 +1012,23 @@ msgstr "" #: ../../reference/expressions.rst:907 msgid "" -"If the expression list contains at least one comma, it will evaluate to a :" -"class:`tuple` containing the items of the expression list. Otherwise, the " +"If the expression list contains at least one comma, or if any of the " +"expressions are starred, the expression list will evaluate to a :class:" +"`tuple` containing the items of the expression list. Otherwise, the " "expression list will evaluate to the value of the list's sole member." msgstr "" -#: ../../reference/expressions.rst:911 +#: ../../reference/expressions.rst:912 +msgid "Expressions in an expression list may be starred. See :pep:`646`." +msgstr "" + +#: ../../reference/expressions.rst:915 msgid "" "For built-in objects, there are two types of objects that support " "subscription via :meth:`~object.__getitem__`:" msgstr "" -#: ../../reference/expressions.rst:914 +#: ../../reference/expressions.rst:918 msgid "" "Mappings. If the primary is a :term:`mapping`, the expression list must " "evaluate to an object whose value is one of the keys of the mapping, and the " @@ -1032,7 +1036,7 @@ msgid "" "An example of a builtin mapping class is the :class:`dict` class." msgstr "" -#: ../../reference/expressions.rst:918 +#: ../../reference/expressions.rst:922 msgid "" "Sequences. If the primary is a :term:`sequence`, the expression list must " "evaluate to an :class:`int` or a :class:`slice` (as discussed in the " @@ -1040,7 +1044,7 @@ msgid "" "`str`, :class:`list` and :class:`tuple` classes." msgstr "" -#: ../../reference/expressions.rst:923 +#: ../../reference/expressions.rst:927 msgid "" "The formal syntax makes no special provision for negative indices in :term:" "`sequences `. However, built-in sequences all provide a :meth:" @@ -1054,25 +1058,25 @@ msgid "" "explicitly add that support." msgstr "" -#: ../../reference/expressions.rst:937 +#: ../../reference/expressions.rst:941 msgid "" "A :class:`string ` is a special kind of sequence whose items are " "*characters*. A character is not a separate data type but a string of " "exactly one character." msgstr "" -#: ../../reference/expressions.rst:945 +#: ../../reference/expressions.rst:949 msgid "Slicings" msgstr "" -#: ../../reference/expressions.rst:959 +#: ../../reference/expressions.rst:963 msgid "" "A slicing selects a range of items in a sequence object (e.g., a string, " "tuple or list). Slicings may be used as expressions or as targets in " "assignment or :keyword:`del` statements. The syntax for a slicing:" msgstr "" -#: ../../reference/expressions.rst:972 +#: ../../reference/expressions.rst:976 msgid "" "There is ambiguity in the formal syntax here: anything that looks like an " "expression list also looks like a slice list, so any subscription can be " @@ -1082,7 +1086,7 @@ msgid "" "the case if the slice list contains no proper slice)." msgstr "" -#: ../../reference/expressions.rst:984 +#: ../../reference/expressions.rst:988 msgid "" "The semantics for a slicing are as follows. The primary is indexed (using " "the same :meth:`~object.__getitem__` method as normal subscription) with a " @@ -1097,23 +1101,23 @@ msgid "" "missing expressions." msgstr "" -#: ../../reference/expressions.rst:1008 +#: ../../reference/expressions.rst:1012 msgid "Calls" msgstr "" -#: ../../reference/expressions.rst:1010 +#: ../../reference/expressions.rst:1014 msgid "" "A call calls a callable object (e.g., a :term:`function`) with a possibly " "empty series of :term:`arguments `:" msgstr "" -#: ../../reference/expressions.rst:1027 +#: ../../reference/expressions.rst:1031 msgid "" "An optional trailing comma may be present after the positional and keyword " "arguments but does not affect the semantics." msgstr "" -#: ../../reference/expressions.rst:1033 +#: ../../reference/expressions.rst:1037 msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -1123,7 +1127,7 @@ msgid "" "formal :term:`parameter` lists." msgstr "" -#: ../../reference/expressions.rst:1041 +#: ../../reference/expressions.rst:1045 msgid "" "If keyword arguments are present, they are first converted to positional " "arguments, as follows. First, a list of unfilled slots is created for the " @@ -1144,7 +1148,7 @@ msgid "" "filled slots is used as the argument list for the call." msgstr "" -#: ../../reference/expressions.rst:1061 +#: ../../reference/expressions.rst:1065 msgid "" "An implementation may provide built-in functions whose positional parameters " "do not have names, even if they are 'named' for the purpose of " @@ -1153,7 +1157,7 @@ msgid "" "`PyArg_ParseTuple` to parse their arguments." msgstr "" -#: ../../reference/expressions.rst:1067 +#: ../../reference/expressions.rst:1071 msgid "" "If there are more positional arguments than there are formal parameter " "slots, a :exc:`TypeError` exception is raised, unless a formal parameter " @@ -1162,7 +1166,7 @@ msgid "" "empty tuple if there were no excess positional arguments)." msgstr "" -#: ../../reference/expressions.rst:1073 +#: ../../reference/expressions.rst:1077 msgid "" "If any keyword argument does not correspond to a formal parameter name, a :" "exc:`TypeError` exception is raised, unless a formal parameter using the " @@ -1172,7 +1176,7 @@ msgid "" "(new) empty dictionary if there were no excess keyword arguments." msgstr "" -#: ../../reference/expressions.rst:1084 +#: ../../reference/expressions.rst:1088 msgid "" "If the syntax ``*expression`` appears in the function call, ``expression`` " "must evaluate to an :term:`iterable`. Elements from these iterables are " @@ -1182,14 +1186,14 @@ msgid "" "*y1*, ..., *yM*, *x3*, *x4*." msgstr "" -#: ../../reference/expressions.rst:1091 +#: ../../reference/expressions.rst:1095 msgid "" "A consequence of this is that although the ``*expression`` syntax may appear " "*after* explicit keyword arguments, it is processed *before* the keyword " "arguments (and any ``**expression`` arguments -- see below). So::" msgstr "" -#: ../../reference/expressions.rst:1095 +#: ../../reference/expressions.rst:1099 msgid "" ">>> def f(a, b):\n" "... print(a, b)\n" @@ -1215,13 +1219,13 @@ msgstr "" ">>> f(1, *(2,))\n" "1 2" -#: ../../reference/expressions.rst:1107 +#: ../../reference/expressions.rst:1111 msgid "" "It is unusual for both keyword arguments and the ``*expression`` syntax to " "be used in the same call, so in practice this confusion does not often arise." msgstr "" -#: ../../reference/expressions.rst:1113 +#: ../../reference/expressions.rst:1117 msgid "" "If the syntax ``**expression`` appears in the function call, ``expression`` " "must evaluate to a :term:`mapping`, the contents of which are treated as " @@ -1230,7 +1234,7 @@ msgid "" "a :exc:`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1119 +#: ../../reference/expressions.rst:1123 msgid "" "When ``**expression`` is used, each key in this mapping must be a string. " "Each value from the mapping is assigned to the first formal parameter " @@ -1242,35 +1246,35 @@ msgid "" "is raised." msgstr "" -#: ../../reference/expressions.rst:1129 +#: ../../reference/expressions.rst:1133 msgid "" "Formal parameters using the syntax ``*identifier`` or ``**identifier`` " "cannot be used as positional argument slots or as keyword argument names." msgstr "" -#: ../../reference/expressions.rst:1132 +#: ../../reference/expressions.rst:1136 msgid "" "Function calls accept any number of ``*`` and ``**`` unpackings, positional " "arguments may follow iterable unpackings (``*``), and keyword arguments may " "follow dictionary unpackings (``**``). Originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1138 +#: ../../reference/expressions.rst:1142 msgid "" "A call always returns some value, possibly ``None``, unless it raises an " "exception. How this value is computed depends on the type of the callable " "object." msgstr "" -#: ../../reference/expressions.rst:1142 +#: ../../reference/expressions.rst:1146 msgid "If it is---" msgstr "" -#: ../../reference/expressions.rst:1144 +#: ../../reference/expressions.rst:1148 msgid "a user-defined function:" msgstr "" -#: ../../reference/expressions.rst:1151 +#: ../../reference/expressions.rst:1155 msgid "" "The code block for the function is executed, passing it the argument list. " "The first thing the code block will do is bind the formal parameters to the " @@ -1279,73 +1283,73 @@ msgid "" "value of the function call." msgstr "" -#: ../../reference/expressions.rst:1157 +#: ../../reference/expressions.rst:1161 msgid "a built-in function or method:" msgstr "" -#: ../../reference/expressions.rst:1168 +#: ../../reference/expressions.rst:1172 msgid "" "The result is up to the interpreter; see :ref:`built-in-funcs` for the " "descriptions of built-in functions and methods." msgstr "" -#: ../../reference/expressions.rst:1171 +#: ../../reference/expressions.rst:1175 msgid "a class object:" msgstr "" -#: ../../reference/expressions.rst:1176 +#: ../../reference/expressions.rst:1180 msgid "A new instance of that class is returned." msgstr "" -#: ../../reference/expressions.rst:1178 +#: ../../reference/expressions.rst:1182 msgid "a class instance method:" msgstr "" -#: ../../reference/expressions.rst:1184 +#: ../../reference/expressions.rst:1188 msgid "" "The corresponding user-defined function is called, with an argument list " "that is one longer than the argument list of the call: the instance becomes " "the first argument." msgstr "" -#: ../../reference/expressions.rst:1188 +#: ../../reference/expressions.rst:1192 msgid "a class instance:" msgstr "" -#: ../../reference/expressions.rst:1193 +#: ../../reference/expressions.rst:1197 msgid "" "The class must define a :meth:`~object.__call__` method; the effect is then " "the same as if that method was called." msgstr "" -#: ../../reference/expressions.rst:1201 ../../reference/expressions.rst:1994 +#: ../../reference/expressions.rst:1205 ../../reference/expressions.rst:2004 msgid "Await expression" msgstr "" -#: ../../reference/expressions.rst:1203 +#: ../../reference/expressions.rst:1207 msgid "" "Suspend the execution of :term:`coroutine` on an :term:`awaitable` object. " "Can only be used inside a :term:`coroutine function`." msgstr "" -#: ../../reference/expressions.rst:1215 +#: ../../reference/expressions.rst:1219 msgid "The power operator" msgstr "" -#: ../../reference/expressions.rst:1221 +#: ../../reference/expressions.rst:1225 msgid "" "The power operator binds more tightly than unary operators on its left; it " "binds less tightly than unary operators on its right. The syntax is:" msgstr "" -#: ../../reference/expressions.rst:1227 +#: ../../reference/expressions.rst:1231 msgid "" "Thus, in an unparenthesized sequence of power and unary operators, the " "operators are evaluated from right to left (this does not constrain the " "evaluation order for the operands): ``-1**2`` results in ``-1``." msgstr "" -#: ../../reference/expressions.rst:1231 +#: ../../reference/expressions.rst:1235 msgid "" "The power operator has the same semantics as the built-in :func:`pow` " "function, when called with two arguments: it yields its left argument raised " @@ -1353,7 +1357,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" -#: ../../reference/expressions.rst:1236 +#: ../../reference/expressions.rst:1240 msgid "" "For int operands, the result has the same type as the operands unless the " "second argument is negative; in that case, all arguments are converted to " @@ -1361,41 +1365,41 @@ msgid "" "``100``, but ``10**-2`` returns ``0.01``." msgstr "" -#: ../../reference/expressions.rst:1241 +#: ../../reference/expressions.rst:1245 msgid "" "Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. " "Raising a negative number to a fractional power results in a :class:" "`complex` number. (In earlier versions it raised a :exc:`ValueError`.)" msgstr "" -#: ../../reference/expressions.rst:1245 +#: ../../reference/expressions.rst:1249 msgid "" "This operation can be customized using the special :meth:`~object.__pow__` " "and :meth:`~object.__rpow__` methods." msgstr "" -#: ../../reference/expressions.rst:1251 +#: ../../reference/expressions.rst:1255 msgid "Unary arithmetic and bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1257 +#: ../../reference/expressions.rst:1261 msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "" -#: ../../reference/expressions.rst:1268 +#: ../../reference/expressions.rst:1272 msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`~object.__neg__` " "special method." msgstr "" -#: ../../reference/expressions.rst:1276 +#: ../../reference/expressions.rst:1280 msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`~object.__pos__` special method." msgstr "" -#: ../../reference/expressions.rst:1283 +#: ../../reference/expressions.rst:1287 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " @@ -1403,17 +1407,17 @@ msgid "" "meth:`~object.__invert__` special method." msgstr "" -#: ../../reference/expressions.rst:1292 +#: ../../reference/expressions.rst:1296 msgid "" "In all three cases, if the argument does not have the proper type, a :exc:" "`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1299 +#: ../../reference/expressions.rst:1303 msgid "Binary arithmetic operations" msgstr "" -#: ../../reference/expressions.rst:1303 +#: ../../reference/expressions.rst:1307 msgid "" "The binary arithmetic operations have the conventional priority levels. " "Note that some of these operations also apply to certain non-numeric types. " @@ -1421,7 +1425,7 @@ msgid "" "multiplicative operators and one for additive operators:" msgstr "" -#: ../../reference/expressions.rst:1318 +#: ../../reference/expressions.rst:1322 msgid "" "The ``*`` (multiplication) operator yields the product of its arguments. " "The arguments must either both be numbers, or one argument must be an " @@ -1431,25 +1435,25 @@ msgid "" "an empty sequence." msgstr "" -#: ../../reference/expressions.rst:1324 +#: ../../reference/expressions.rst:1328 msgid "" "This operation can be customized using the special :meth:`~object.__mul__` " "and :meth:`~object.__rmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1331 +#: ../../reference/expressions.rst:1335 msgid "" "The ``@`` (at) operator is intended to be used for matrix multiplication. " "No builtin Python types implement this operator." msgstr "" -#: ../../reference/expressions.rst:1334 +#: ../../reference/expressions.rst:1338 msgid "" "This operation can be customized using the special :meth:`~object." "__matmul__` and :meth:`~object.__rmatmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1345 +#: ../../reference/expressions.rst:1349 msgid "" "The ``/`` (division) and ``//`` (floor division) operators yield the " "quotient of their arguments. The numeric arguments are first converted to a " @@ -1459,7 +1463,7 @@ msgid "" "the :exc:`ZeroDivisionError` exception." msgstr "" -#: ../../reference/expressions.rst:1352 +#: ../../reference/expressions.rst:1356 msgid "" "The division operation can be customized using the special :meth:`~object." "__truediv__` and :meth:`~object.__rtruediv__` methods. The floor division " @@ -1467,7 +1471,7 @@ msgid "" "and :meth:`~object.__rfloordiv__` methods." msgstr "" -#: ../../reference/expressions.rst:1361 +#: ../../reference/expressions.rst:1365 msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " @@ -1479,7 +1483,7 @@ msgid "" "absolute value of the second operand [#]_." msgstr "" -#: ../../reference/expressions.rst:1370 +#: ../../reference/expressions.rst:1374 msgid "" "The floor division and modulo operators are connected by the following " "identity: ``x == (x//y)*y + (x%y)``. Floor division and modulo are also " @@ -1487,7 +1491,7 @@ msgid "" "y, x%y)``. [#]_." msgstr "" -#: ../../reference/expressions.rst:1375 +#: ../../reference/expressions.rst:1379 msgid "" "In addition to performing the modulo operation on numbers, the ``%`` " "operator is also overloaded by string objects to perform old-style string " @@ -1496,20 +1500,20 @@ msgid "" "formatting`." msgstr "" -#: ../../reference/expressions.rst:1380 +#: ../../reference/expressions.rst:1384 msgid "" "The *modulo* operation can be customized using the special :meth:`~object." "__mod__` and :meth:`~object.__rmod__` methods." msgstr "" -#: ../../reference/expressions.rst:1383 +#: ../../reference/expressions.rst:1387 msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " "floating-point number using the :func:`abs` function if appropriate." msgstr "" -#: ../../reference/expressions.rst:1392 +#: ../../reference/expressions.rst:1396 msgid "" "The ``+`` (addition) operator yields the sum of its arguments. The " "arguments must either both be numbers or both be sequences of the same " @@ -1517,40 +1521,40 @@ msgid "" "then added together. In the latter case, the sequences are concatenated." msgstr "" -#: ../../reference/expressions.rst:1397 +#: ../../reference/expressions.rst:1401 msgid "" "This operation can be customized using the special :meth:`~object.__add__` " "and :meth:`~object.__radd__` methods." msgstr "" -#: ../../reference/expressions.rst:1405 +#: ../../reference/expressions.rst:1409 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " "The numeric arguments are first converted to a common type." msgstr "" -#: ../../reference/expressions.rst:1408 +#: ../../reference/expressions.rst:1412 msgid "" "This operation can be customized using the special :meth:`~object.__sub__` " "and :meth:`~object.__rsub__` methods." msgstr "" -#: ../../reference/expressions.rst:1415 +#: ../../reference/expressions.rst:1419 msgid "Shifting operations" msgstr "" -#: ../../reference/expressions.rst:1422 +#: ../../reference/expressions.rst:1426 msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "" -#: ../../reference/expressions.rst:1427 +#: ../../reference/expressions.rst:1431 msgid "" "These operators accept integers as arguments. They shift the first argument " "to the left or right by the number of bits given by the second argument." msgstr "" -#: ../../reference/expressions.rst:1430 +#: ../../reference/expressions.rst:1434 msgid "" "The left shift operation can be customized using the special :meth:`~object." "__lshift__` and :meth:`~object.__rlshift__` methods. The right shift " @@ -1558,46 +1562,46 @@ msgid "" "and :meth:`~object.__rrshift__` methods." msgstr "" -#: ../../reference/expressions.rst:1437 +#: ../../reference/expressions.rst:1441 msgid "" "A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A " "left shift by *n* bits is defined as multiplication with ``pow(2,n)``." msgstr "" -#: ../../reference/expressions.rst:1444 +#: ../../reference/expressions.rst:1448 msgid "Binary bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1448 +#: ../../reference/expressions.rst:1452 msgid "Each of the three bitwise operations has a different priority level:" msgstr "" -#: ../../reference/expressions.rst:1459 +#: ../../reference/expressions.rst:1463 msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " "integers or one of them must be a custom object overriding :meth:`~object." "__and__` or :meth:`~object.__rand__` special methods." msgstr "" -#: ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1472 msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " "which must be integers or one of them must be a custom object overriding :" "meth:`~object.__xor__` or :meth:`~object.__rxor__` special methods." msgstr "" -#: ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1481 msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " "must be integers or one of them must be a custom object overriding :meth:" "`~object.__or__` or :meth:`~object.__ror__` special methods." msgstr "" -#: ../../reference/expressions.rst:1485 +#: ../../reference/expressions.rst:1489 msgid "Comparisons" msgstr "" -#: ../../reference/expressions.rst:1497 +#: ../../reference/expressions.rst:1501 msgid "" "Unlike C, all comparison operations in Python have the same priority, which " "is lower than that of any arithmetic, shifting or bitwise operation. Also " @@ -1605,14 +1609,14 @@ msgid "" "conventional in mathematics:" msgstr "" -#: ../../reference/expressions.rst:1507 +#: ../../reference/expressions.rst:1511 msgid "" "Comparisons yield boolean values: ``True`` or ``False``. Custom :dfn:`rich " "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" -#: ../../reference/expressions.rst:1513 +#: ../../reference/expressions.rst:1517 msgid "" "Comparisons can be chained arbitrarily, e.g., ``x < y <= z`` is equivalent " "to ``x < y and y <= z``, except that ``y`` is evaluated only once (but in " @@ -1620,7 +1624,7 @@ msgid "" "false)." msgstr "" -#: ../../reference/expressions.rst:1517 +#: ../../reference/expressions.rst:1521 msgid "" "Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*, " "*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y opN " @@ -1628,24 +1632,24 @@ msgid "" "each expression is evaluated at most once." msgstr "" -#: ../../reference/expressions.rst:1522 +#: ../../reference/expressions.rst:1526 msgid "" "Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* " "and *c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not " "pretty)." msgstr "" -#: ../../reference/expressions.rst:1529 +#: ../../reference/expressions.rst:1533 msgid "Value comparisons" msgstr "" -#: ../../reference/expressions.rst:1531 +#: ../../reference/expressions.rst:1535 msgid "" "The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the " "values of two objects. The objects do not need to have the same type." msgstr "" -#: ../../reference/expressions.rst:1534 +#: ../../reference/expressions.rst:1538 msgid "" "Chapter :ref:`objects` states that objects have a value (in addition to type " "and identity). The value of an object is a rather abstract notion in " @@ -1657,7 +1661,7 @@ msgid "" "indirectly, by means of their comparison implementation." msgstr "" -#: ../../reference/expressions.rst:1543 +#: ../../reference/expressions.rst:1547 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -1665,7 +1669,7 @@ msgid "" "methods` like :meth:`~object.__lt__`, described in :ref:`customization`." msgstr "" -#: ../../reference/expressions.rst:1549 +#: ../../reference/expressions.rst:1553 msgid "" "The default behavior for equality comparison (``==`` and ``!=``) is based on " "the identity of the objects. Hence, equality comparison of instances with " @@ -1675,14 +1679,14 @@ msgid "" "``x is y`` implies ``x == y``)." msgstr "" -#: ../../reference/expressions.rst:1556 +#: ../../reference/expressions.rst:1560 msgid "" "A default order comparison (``<``, ``>``, ``<=``, and ``>=``) is not " "provided; an attempt raises :exc:`TypeError`. A motivation for this default " "behavior is the lack of a similar invariant as for equality." msgstr "" -#: ../../reference/expressions.rst:1560 +#: ../../reference/expressions.rst:1564 msgid "" "The behavior of the default equality comparison, that instances with " "different identities are always unequal, may be in contrast to what types " @@ -1691,13 +1695,13 @@ msgid "" "in fact, a number of built-in types have done that." msgstr "" -#: ../../reference/expressions.rst:1566 +#: ../../reference/expressions.rst:1570 msgid "" "The following list describes the comparison behavior of the most important " "built-in types." msgstr "" -#: ../../reference/expressions.rst:1569 +#: ../../reference/expressions.rst:1573 msgid "" "Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard " "library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can " @@ -1707,7 +1711,7 @@ msgid "" "of precision." msgstr "" -#: ../../reference/expressions.rst:1576 +#: ../../reference/expressions.rst:1580 msgid "" "The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are " "special. Any ordered comparison of a number to a not-a-number value is " @@ -1717,32 +1721,32 @@ msgid "" "is compliant with IEEE 754." msgstr "" -#: ../../reference/expressions.rst:1583 +#: ../../reference/expressions.rst:1587 msgid "" "``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" -#: ../../reference/expressions.rst:1587 +#: ../../reference/expressions.rst:1591 msgid "" "Binary sequences (instances of :class:`bytes` or :class:`bytearray`) can be " "compared within and across their types. They compare lexicographically " "using the numeric values of their elements." msgstr "" -#: ../../reference/expressions.rst:1591 +#: ../../reference/expressions.rst:1595 msgid "" "Strings (instances of :class:`str`) compare lexicographically using the " "numerical Unicode code points (the result of the built-in function :func:" "`ord`) of their characters. [#]_" msgstr "" -#: ../../reference/expressions.rst:1595 +#: ../../reference/expressions.rst:1599 msgid "Strings and binary sequences cannot be directly compared." msgstr "" -#: ../../reference/expressions.rst:1597 +#: ../../reference/expressions.rst:1601 msgid "" "Sequences (instances of :class:`tuple`, :class:`list`, or :class:`range`) " "can be compared only within each of their types, with the restriction that " @@ -1751,7 +1755,7 @@ msgid "" "raises :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1603 +#: ../../reference/expressions.rst:1607 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " @@ -1759,19 +1763,19 @@ msgid "" "objects to improve performance and to maintain their internal invariants." msgstr "" -#: ../../reference/expressions.rst:1608 +#: ../../reference/expressions.rst:1612 msgid "" "Lexicographical comparison between built-in collections works as follows:" msgstr "" -#: ../../reference/expressions.rst:1610 +#: ../../reference/expressions.rst:1614 msgid "" "For two collections to compare equal, they must be of the same type, have " "the same length, and each pair of corresponding elements must compare equal " "(for example, ``[1,2] == (1,2)`` is false because the type is not the same)." msgstr "" -#: ../../reference/expressions.rst:1615 +#: ../../reference/expressions.rst:1619 msgid "" "Collections that support order comparison are ordered the same as their " "first unequal elements (for example, ``[1,2,x] <= [1,2,y]`` has the same " @@ -1780,25 +1784,25 @@ msgid "" "true)." msgstr "" -#: ../../reference/expressions.rst:1621 +#: ../../reference/expressions.rst:1625 msgid "" "Mappings (instances of :class:`dict`) compare equal if and only if they have " "equal ``(key, value)`` pairs. Equality comparison of the keys and values " "enforces reflexivity." msgstr "" -#: ../../reference/expressions.rst:1625 +#: ../../reference/expressions.rst:1629 msgid "" "Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1627 +#: ../../reference/expressions.rst:1631 msgid "" "Sets (instances of :class:`set` or :class:`frozenset`) can be compared " "within and across their types." msgstr "" -#: ../../reference/expressions.rst:1630 +#: ../../reference/expressions.rst:1634 msgid "" "They define order comparison operators to mean subset and superset tests. " "Those relations do not define total orderings (for example, the two sets " @@ -1809,110 +1813,110 @@ msgid "" "sets as inputs)." msgstr "" -#: ../../reference/expressions.rst:1638 +#: ../../reference/expressions.rst:1642 msgid "Comparison of sets enforces reflexivity of its elements." msgstr "" -#: ../../reference/expressions.rst:1640 +#: ../../reference/expressions.rst:1644 msgid "" "Most other built-in types have no comparison methods implemented, so they " "inherit the default comparison behavior." msgstr "" -#: ../../reference/expressions.rst:1643 +#: ../../reference/expressions.rst:1647 msgid "" "User-defined classes that customize their comparison behavior should follow " "some consistency rules, if possible:" msgstr "" -#: ../../reference/expressions.rst:1646 +#: ../../reference/expressions.rst:1650 msgid "" "Equality comparison should be reflexive. In other words, identical objects " "should compare equal:" msgstr "" -#: ../../reference/expressions.rst:1649 +#: ../../reference/expressions.rst:1653 msgid "``x is y`` implies ``x == y``" msgstr "" -#: ../../reference/expressions.rst:1651 +#: ../../reference/expressions.rst:1655 msgid "" "Comparison should be symmetric. In other words, the following expressions " "should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1654 +#: ../../reference/expressions.rst:1658 msgid "``x == y`` and ``y == x``" msgstr "``x == y`` 和 ``y == x``" -#: ../../reference/expressions.rst:1656 +#: ../../reference/expressions.rst:1660 msgid "``x != y`` and ``y != x``" msgstr "``x != y`` 和 ``y != x``" -#: ../../reference/expressions.rst:1658 +#: ../../reference/expressions.rst:1662 msgid "``x < y`` and ``y > x``" msgstr "``x < y`` 和 ``y > x``" -#: ../../reference/expressions.rst:1660 +#: ../../reference/expressions.rst:1664 msgid "``x <= y`` and ``y >= x``" msgstr "``x <= y`` 和 ``y >= x``" -#: ../../reference/expressions.rst:1662 +#: ../../reference/expressions.rst:1666 msgid "" "Comparison should be transitive. The following (non-exhaustive) examples " "illustrate that:" msgstr "" -#: ../../reference/expressions.rst:1665 +#: ../../reference/expressions.rst:1669 msgid "``x > y and y > z`` implies ``x > z``" msgstr "``x > y and y > z`` 暗示了 ``x > z``" -#: ../../reference/expressions.rst:1667 +#: ../../reference/expressions.rst:1671 msgid "``x < y and y <= z`` implies ``x < z``" msgstr "``x < y and y <= z`` 暗示了 ``x < z``" -#: ../../reference/expressions.rst:1669 +#: ../../reference/expressions.rst:1673 msgid "" "Inverse comparison should result in the boolean negation. In other words, " "the following expressions should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1672 +#: ../../reference/expressions.rst:1676 msgid "``x == y`` and ``not x != y``" msgstr "``x == y`` 和 ``not x != y``" -#: ../../reference/expressions.rst:1674 +#: ../../reference/expressions.rst:1678 msgid "``x < y`` and ``not x >= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1676 +#: ../../reference/expressions.rst:1680 msgid "``x > y`` and ``not x <= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1678 +#: ../../reference/expressions.rst:1682 msgid "" "The last two expressions apply to totally ordered collections (e.g. to " "sequences, but not to sets or mappings). See also the :func:`~functools." "total_ordering` decorator." msgstr "" -#: ../../reference/expressions.rst:1682 +#: ../../reference/expressions.rst:1686 msgid "" "The :func:`hash` result should be consistent with equality. Objects that are " "equal should either have the same hash value, or be marked as unhashable." msgstr "" -#: ../../reference/expressions.rst:1686 +#: ../../reference/expressions.rst:1690 msgid "" "Python does not enforce these consistency rules. In fact, the not-a-number " "values are an example for not following these rules." msgstr "" -#: ../../reference/expressions.rst:1695 +#: ../../reference/expressions.rst:1699 msgid "Membership test operations" msgstr "" -#: ../../reference/expressions.rst:1697 +#: ../../reference/expressions.rst:1701 msgid "" "The operators :keyword:`in` and :keyword:`not in` test for membership. ``x " "in s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` " @@ -1923,7 +1927,7 @@ msgid "" "expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." msgstr "" -#: ../../reference/expressions.rst:1705 +#: ../../reference/expressions.rst:1709 msgid "" "For the string and bytes types, ``x in y`` is ``True`` if and only if *x* is " "a substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty " @@ -1931,14 +1935,14 @@ msgid "" "``\"\" in \"abc\"`` will return ``True``." msgstr "" -#: ../../reference/expressions.rst:1710 +#: ../../reference/expressions.rst:1714 msgid "" "For user-defined classes which define the :meth:`~object.__contains__` " "method, ``x in y`` returns ``True`` if ``y.__contains__(x)`` returns a true " "value, and ``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1714 +#: ../../reference/expressions.rst:1718 msgid "" "For user-defined classes which do not define :meth:`~object.__contains__` " "but do define :meth:`~object.__iter__`, ``x in y`` is ``True`` if some value " @@ -1947,7 +1951,7 @@ msgid "" "it is as if :keyword:`in` raised that exception." msgstr "" -#: ../../reference/expressions.rst:1720 +#: ../../reference/expressions.rst:1724 msgid "" "Lastly, the old-style iteration protocol is tried: if a class defines :meth:" "`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-" @@ -1956,17 +1960,17 @@ msgid "" "exception is raised, it is as if :keyword:`in` raised that exception)." msgstr "" -#: ../../reference/expressions.rst:1732 +#: ../../reference/expressions.rst:1736 msgid "" "The operator :keyword:`not in` is defined to have the inverse truth value " "of :keyword:`in`." msgstr "" -#: ../../reference/expressions.rst:1745 +#: ../../reference/expressions.rst:1749 msgid "Identity comparisons" msgstr "" -#: ../../reference/expressions.rst:1747 +#: ../../reference/expressions.rst:1751 msgid "" "The operators :keyword:`is` and :keyword:`is not` test for an object's " "identity: ``x is y`` is true if and only if *x* and *y* are the same " @@ -1974,11 +1978,11 @@ msgid "" "``x is not y`` yields the inverse truth value. [#]_" msgstr "" -#: ../../reference/expressions.rst:1759 +#: ../../reference/expressions.rst:1763 msgid "Boolean operations" msgstr "" -#: ../../reference/expressions.rst:1770 +#: ../../reference/expressions.rst:1774 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " @@ -1989,25 +1993,25 @@ msgid "" "__bool__` method." msgstr "" -#: ../../reference/expressions.rst:1779 +#: ../../reference/expressions.rst:1783 msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1784 +#: ../../reference/expressions.rst:1788 msgid "" "The expression ``x and y`` first evaluates *x*; if *x* is false, its value " "is returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1789 +#: ../../reference/expressions.rst:1793 msgid "" "The expression ``x or y`` first evaluates *x*; if *x* is true, its value is " "returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1792 +#: ../../reference/expressions.rst:1796 msgid "" "Note that neither :keyword:`and` nor :keyword:`or` restrict the value and " "type they return to ``False`` and ``True``, but rather return the last " @@ -2018,11 +2022,11 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: ../../reference/expressions.rst:1808 +#: ../../reference/expressions.rst:1813 msgid "Assignment expressions" msgstr "" -#: ../../reference/expressions.rst:1813 +#: ../../reference/expressions.rst:1818 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " "\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" @@ -2030,11 +2034,11 @@ msgid "" "`~python-grammar:expression`." msgstr "" -#: ../../reference/expressions.rst:1818 +#: ../../reference/expressions.rst:1823 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: ../../reference/expressions.rst:1820 +#: ../../reference/expressions.rst:1825 msgid "" "if matching := pattern.search(data):\n" " do_something(matching)" @@ -2042,11 +2046,11 @@ msgstr "" "if matching := pattern.search(data):\n" " do_something(matching)" -#: ../../reference/expressions.rst:1825 +#: ../../reference/expressions.rst:1830 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: ../../reference/expressions.rst:1827 +#: ../../reference/expressions.rst:1832 msgid "" "while chunk := file.read(9000):\n" " process(chunk)" @@ -2054,7 +2058,7 @@ msgstr "" "while chunk := file.read(9000):\n" " process(chunk)" -#: ../../reference/expressions.rst:1832 +#: ../../reference/expressions.rst:1837 msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -2064,36 +2068,36 @@ msgid "" "and ``while`` statements." msgstr "" -#: ../../reference/expressions.rst:1840 +#: ../../reference/expressions.rst:1845 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: ../../reference/expressions.rst:1847 +#: ../../reference/expressions.rst:1852 msgid "Conditional expressions" msgstr "" -#: ../../reference/expressions.rst:1859 +#: ../../reference/expressions.rst:1864 msgid "" "Conditional expressions (sometimes called a \"ternary operator\") have the " "lowest priority of all Python operations." msgstr "" -#: ../../reference/expressions.rst:1862 +#: ../../reference/expressions.rst:1867 msgid "" "The expression ``x if C else y`` first evaluates the condition, *C* rather " "than *x*. If *C* is true, *x* is evaluated and its value is returned; " "otherwise, *y* is evaluated and its value is returned." msgstr "" -#: ../../reference/expressions.rst:1866 +#: ../../reference/expressions.rst:1871 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: ../../reference/expressions.rst:1873 +#: ../../reference/expressions.rst:1878 msgid "Lambdas" msgstr "" -#: ../../reference/expressions.rst:1884 +#: ../../reference/expressions.rst:1889 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -2101,7 +2105,7 @@ msgid "" "defined with:" msgstr "" -#: ../../reference/expressions.rst:1888 +#: ../../reference/expressions.rst:1893 msgid "" "def (parameters):\n" " return expression" @@ -2109,25 +2113,25 @@ msgstr "" "def (parameters):\n" " return expression" -#: ../../reference/expressions.rst:1893 +#: ../../reference/expressions.rst:1898 msgid "" "See section :ref:`function` for the syntax of parameter lists. Note that " "functions created with lambda expressions cannot contain statements or " "annotations." msgstr "" -#: ../../reference/expressions.rst:1901 +#: ../../reference/expressions.rst:1906 msgid "Expression lists" msgstr "" -#: ../../reference/expressions.rst:1915 +#: ../../reference/expressions.rst:1922 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -#: ../../reference/expressions.rst:1924 +#: ../../reference/expressions.rst:1931 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -2135,12 +2139,16 @@ msgid "" "unpacking." msgstr "" -#: ../../reference/expressions.rst:1929 +#: ../../reference/expressions.rst:1936 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1934 +#: ../../reference/expressions.rst:1939 +msgid "Any item in an expression list may be starred. See :pep:`646`." +msgstr "" + +#: ../../reference/expressions.rst:1944 msgid "" "A trailing comma is required only to create a one-item tuple, such as ``1," "``; it is optional in all other cases. A single expression without a " @@ -2149,24 +2157,24 @@ msgid "" "``()``.)" msgstr "" -#: ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:1955 msgid "Evaluation order" msgstr "" -#: ../../reference/expressions.rst:1949 +#: ../../reference/expressions.rst:1959 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -#: ../../reference/expressions.rst:1952 +#: ../../reference/expressions.rst:1962 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: ../../reference/expressions.rst:1955 +#: ../../reference/expressions.rst:1965 msgid "" "expr1, expr2, expr3, expr4\n" "(expr1, expr2, expr3, expr4)\n" @@ -2182,11 +2190,11 @@ msgstr "" "expr1(expr2, expr3, *expr4, **expr5)\n" "expr3, expr4 = expr1, expr2" -#: ../../reference/expressions.rst:1966 +#: ../../reference/expressions.rst:1976 msgid "Operator precedence" msgstr "" -#: ../../reference/expressions.rst:1971 +#: ../../reference/expressions.rst:1981 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " @@ -2196,176 +2204,176 @@ msgid "" "group from right to left)." msgstr "" -#: ../../reference/expressions.rst:1977 +#: ../../reference/expressions.rst:1987 msgid "" "Note that comparisons, membership tests, and identity tests, all have the " "same precedence and have a left-to-right chaining feature as described in " "the :ref:`comparisons` section." msgstr "" -#: ../../reference/expressions.rst:1983 +#: ../../reference/expressions.rst:1993 msgid "Operator" msgstr "" -#: ../../reference/expressions.rst:1983 +#: ../../reference/expressions.rst:1993 msgid "Description" msgstr "描述" -#: ../../reference/expressions.rst:1985 +#: ../../reference/expressions.rst:1995 msgid "``(expressions...)``," msgstr "``(expressions...)``," -#: ../../reference/expressions.rst:1987 +#: ../../reference/expressions.rst:1997 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" -#: ../../reference/expressions.rst:1985 +#: ../../reference/expressions.rst:1995 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: ../../reference/expressions.rst:1991 +#: ../../reference/expressions.rst:2001 msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" msgstr "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" -#: ../../reference/expressions.rst:1991 +#: ../../reference/expressions.rst:2001 msgid "Subscription, slicing, call, attribute reference" msgstr "" -#: ../../reference/expressions.rst:1994 +#: ../../reference/expressions.rst:2004 msgid ":keyword:`await x `" msgstr ":keyword:`await x `" -#: ../../reference/expressions.rst:1996 +#: ../../reference/expressions.rst:2006 msgid "``**``" msgstr "``**``" -#: ../../reference/expressions.rst:1996 +#: ../../reference/expressions.rst:2006 msgid "Exponentiation [#]_" msgstr "" -#: ../../reference/expressions.rst:1998 +#: ../../reference/expressions.rst:2008 msgid "``+x``, ``-x``, ``~x``" msgstr "``+x``, ``-x``, ``~x``" -#: ../../reference/expressions.rst:1998 +#: ../../reference/expressions.rst:2008 msgid "Positive, negative, bitwise NOT" msgstr "" -#: ../../reference/expressions.rst:2000 +#: ../../reference/expressions.rst:2010 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "``*``, ``@``, ``/``, ``//``, ``%``" -#: ../../reference/expressions.rst:2000 +#: ../../reference/expressions.rst:2010 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: ../../reference/expressions.rst:2004 +#: ../../reference/expressions.rst:2014 msgid "``+``, ``-``" msgstr "``+``, ``-``" -#: ../../reference/expressions.rst:2004 +#: ../../reference/expressions.rst:2014 msgid "Addition and subtraction" msgstr "" -#: ../../reference/expressions.rst:2006 +#: ../../reference/expressions.rst:2016 msgid "``<<``, ``>>``" msgstr "``<<``, ``>>``" -#: ../../reference/expressions.rst:2006 +#: ../../reference/expressions.rst:2016 msgid "Shifts" msgstr "" -#: ../../reference/expressions.rst:2008 +#: ../../reference/expressions.rst:2018 msgid "``&``" msgstr "``&``" -#: ../../reference/expressions.rst:2008 +#: ../../reference/expressions.rst:2018 msgid "Bitwise AND" msgstr "" -#: ../../reference/expressions.rst:2010 +#: ../../reference/expressions.rst:2020 msgid "``^``" msgstr "``^``" -#: ../../reference/expressions.rst:2010 +#: ../../reference/expressions.rst:2020 msgid "Bitwise XOR" msgstr "" -#: ../../reference/expressions.rst:2012 +#: ../../reference/expressions.rst:2022 msgid "``|``" msgstr "``|``" -#: ../../reference/expressions.rst:2012 +#: ../../reference/expressions.rst:2022 msgid "Bitwise OR" msgstr "" -#: ../../reference/expressions.rst:2014 +#: ../../reference/expressions.rst:2024 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: ../../reference/expressions.rst:2014 +#: ../../reference/expressions.rst:2024 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: ../../reference/expressions.rst:2018 +#: ../../reference/expressions.rst:2028 msgid ":keyword:`not x `" msgstr ":keyword:`not x `" -#: ../../reference/expressions.rst:2018 +#: ../../reference/expressions.rst:2028 msgid "Boolean NOT" msgstr "" -#: ../../reference/expressions.rst:2020 +#: ../../reference/expressions.rst:2030 msgid ":keyword:`and`" msgstr ":keyword:`and`" -#: ../../reference/expressions.rst:2020 +#: ../../reference/expressions.rst:2030 msgid "Boolean AND" msgstr "" -#: ../../reference/expressions.rst:2022 +#: ../../reference/expressions.rst:2032 msgid ":keyword:`or`" msgstr ":keyword:`or`" -#: ../../reference/expressions.rst:2022 +#: ../../reference/expressions.rst:2032 msgid "Boolean OR" msgstr "" -#: ../../reference/expressions.rst:2024 +#: ../../reference/expressions.rst:2034 msgid ":keyword:`if ` -- :keyword:`!else`" msgstr ":keyword:`if ` -- :keyword:`!else`" -#: ../../reference/expressions.rst:2024 +#: ../../reference/expressions.rst:2034 msgid "Conditional expression" msgstr "" -#: ../../reference/expressions.rst:2026 +#: ../../reference/expressions.rst:2036 msgid ":keyword:`lambda`" msgstr ":keyword:`lambda`" -#: ../../reference/expressions.rst:2026 +#: ../../reference/expressions.rst:2036 msgid "Lambda expression" msgstr "" -#: ../../reference/expressions.rst:2028 +#: ../../reference/expressions.rst:2038 msgid "``:=``" msgstr "``:=``" -#: ../../reference/expressions.rst:2028 +#: ../../reference/expressions.rst:2038 msgid "Assignment expression" msgstr "" -#: ../../reference/expressions.rst:2033 +#: ../../reference/expressions.rst:2043 msgid "Footnotes" msgstr "註解" -#: ../../reference/expressions.rst:2034 +#: ../../reference/expressions.rst:2044 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2377,7 +2385,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: ../../reference/expressions.rst:2043 +#: ../../reference/expressions.rst:2053 msgid "" "If x is very close to an exact integer multiple of y, it's possible for ``x//" "y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such cases, " @@ -2385,7 +2393,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: ../../reference/expressions.rst:2048 +#: ../../reference/expressions.rst:2058 msgid "" "The Unicode standard distinguishes between :dfn:`code points` (e.g. U+0041) " "and :dfn:`abstract characters` (e.g. \"LATIN CAPITAL LETTER A\"). While most " @@ -2399,7 +2407,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../reference/expressions.rst:2059 +#: ../../reference/expressions.rst:2069 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2407,13 +2415,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: ../../reference/expressions.rst:2064 +#: ../../reference/expressions.rst:2074 msgid "" "To compare strings at the level of abstract characters (that is, in a way " "intuitive to humans), use :func:`unicodedata.normalize`." msgstr "" -#: ../../reference/expressions.rst:2067 +#: ../../reference/expressions.rst:2077 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2421,22 +2429,22 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: ../../reference/expressions.rst:2072 +#: ../../reference/expressions.rst:2082 msgid "" "The power operator ``**`` binds less tightly than an arithmetic or bitwise " "unary operator on its right, that is, ``2**-1`` is ``0.5``." msgstr "" -#: ../../reference/expressions.rst:2075 +#: ../../reference/expressions.rst:2085 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." msgstr "" #: ../../reference/expressions.rst:8 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1761 -#: ../../reference/expressions.rst:1849 ../../reference/expressions.rst:1875 -#: ../../reference/expressions.rst:1903 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1765 +#: ../../reference/expressions.rst:1805 ../../reference/expressions.rst:1854 +#: ../../reference/expressions.rst:1880 ../../reference/expressions.rst:1908 msgid "expression" msgstr "" @@ -2444,8 +2452,8 @@ msgstr "" msgid "BNF" msgstr "BNF" -#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1253 -#: ../../reference/expressions.rst:1301 +#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1257 +#: ../../reference/expressions.rst:1305 msgid "arithmetic" msgstr "" @@ -2468,8 +2476,8 @@ msgstr "" #: ../../reference/expressions.rst:74 ../../reference/expressions.rst:569 #: ../../reference/expressions.rst:624 ../../reference/expressions.rst:753 #: ../../reference/expressions.rst:805 ../../reference/expressions.rst:851 -#: ../../reference/expressions.rst:1290 ../../reference/expressions.rst:1339 -#: ../../reference/expressions.rst:1435 +#: ../../reference/expressions.rst:1294 ../../reference/expressions.rst:1343 +#: ../../reference/expressions.rst:1439 msgid "exception" msgstr "" @@ -2510,10 +2518,10 @@ msgstr "type(型別)" #: ../../reference/expressions.rst:372 ../../reference/expressions.rst:393 #: ../../reference/expressions.rst:557 ../../reference/expressions.rst:743 #: ../../reference/expressions.rst:851 ../../reference/expressions.rst:880 -#: ../../reference/expressions.rst:953 ../../reference/expressions.rst:997 -#: ../../reference/expressions.rst:1145 ../../reference/expressions.rst:1158 -#: ../../reference/expressions.rst:1172 ../../reference/expressions.rst:1179 -#: ../../reference/expressions.rst:1726 ../../reference/expressions.rst:1913 +#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1149 ../../reference/expressions.rst:1162 +#: ../../reference/expressions.rst:1176 ../../reference/expressions.rst:1183 +#: ../../reference/expressions.rst:1730 ../../reference/expressions.rst:1920 msgid "object" msgstr "object(物件)" @@ -2522,7 +2530,7 @@ msgid "parenthesized form" msgstr "" #: ../../reference/expressions.rst:162 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:997 +#: ../../reference/expressions.rst:1001 msgid "() (parentheses)" msgstr "() (圓括號)" @@ -2535,18 +2543,18 @@ msgid "empty" msgstr "" #: ../../reference/expressions.rst:175 ../../reference/expressions.rst:880 -#: ../../reference/expressions.rst:953 ../../reference/expressions.rst:1913 +#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1920 msgid "tuple" msgstr "" -#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1932 +#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1942 msgid "comma" msgstr "" #: ../../reference/expressions.rst:181 ../../reference/expressions.rst:275 #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 -#: ../../reference/expressions.rst:947 ../../reference/expressions.rst:997 -#: ../../reference/expressions.rst:1903 +#: ../../reference/expressions.rst:951 ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1908 msgid ", (comma)" msgstr ", (逗號)" @@ -2563,7 +2571,7 @@ msgstr "for" msgid "in comprehensions" msgstr "於 comprehensions(綜合運算)" -#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1849 +#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1854 msgid "if" msgstr "if" @@ -2571,13 +2579,13 @@ msgstr "if" msgid "async for" msgstr "async for" -#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1197 +#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1201 msgid "await" msgstr "await" #: ../../reference/expressions.rst:275 ../../reference/expressions.rst:851 -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:953 -#: ../../reference/expressions.rst:1903 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 +#: ../../reference/expressions.rst:1908 msgid "list" msgstr "list(串列)" @@ -2595,7 +2603,7 @@ msgid "list expression" msgstr "list expression(串列運算式)" #: ../../reference/expressions.rst:275 ../../reference/expressions.rst:301 -#: ../../reference/expressions.rst:1903 +#: ../../reference/expressions.rst:1908 msgid "expression list" msgstr "expression list(運算式串列)" @@ -2632,8 +2640,8 @@ msgstr "key/value pair(鍵/值對)" msgid "dictionary expression" msgstr "dictionary expression(字典運算式)" -#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:947 -#: ../../reference/expressions.rst:1875 +#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:951 +#: ../../reference/expressions.rst:1880 msgid ": (colon)" msgstr ": (冒號)" @@ -2645,13 +2653,13 @@ msgstr "於字典運算式" msgid "in dictionary displays" msgstr "於字典顯示" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1080 -#: ../../reference/expressions.rst:1920 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1084 +#: ../../reference/expressions.rst:1927 msgid "unpacking" msgstr "unpacking(解包)" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1110 -#: ../../reference/expressions.rst:1217 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1114 +#: ../../reference/expressions.rst:1221 msgid "**" msgstr "**" @@ -2668,7 +2676,7 @@ msgstr "generator(產生器)" msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1197 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1201 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2680,8 +2688,8 @@ msgstr "yield" msgid "from" msgstr "from" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1145 -#: ../../reference/expressions.rst:1158 ../../reference/expressions.rst:1875 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1149 +#: ../../reference/expressions.rst:1162 ../../reference/expressions.rst:1880 msgid "function" msgstr "function (函式)" @@ -2745,8 +2753,8 @@ msgstr "module(模組)" msgid "subscription" msgstr "subscription(下標)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:953 -#: ../../reference/expressions.rst:1726 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 +#: ../../reference/expressions.rst:1730 msgid "sequence" msgstr "sequence(序列)" @@ -2754,443 +2762,447 @@ msgstr "sequence(序列)" msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:933 -#: ../../reference/expressions.rst:953 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:937 +#: ../../reference/expressions.rst:957 msgid "string" msgstr "string(字串)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:933 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:937 msgid "item" msgstr "item(項目)" -#: ../../reference/expressions.rst:933 +#: ../../reference/expressions.rst:937 msgid "character" msgstr "character(字元)" -#: ../../reference/expressions.rst:947 +#: ../../reference/expressions.rst:951 msgid "slicing" msgstr "slicing(切片)" -#: ../../reference/expressions.rst:947 +#: ../../reference/expressions.rst:951 msgid "slice" msgstr "slice(切片)" -#: ../../reference/expressions.rst:979 +#: ../../reference/expressions.rst:983 msgid "start (slice object attribute)" msgstr "start(切片物件屬性)" -#: ../../reference/expressions.rst:979 +#: ../../reference/expressions.rst:983 msgid "stop (slice object attribute)" msgstr "stop(切片物件屬性)" -#: ../../reference/expressions.rst:979 +#: ../../reference/expressions.rst:983 msgid "step (slice object attribute)" msgstr "step(切片物件屬性)" -#: ../../reference/expressions.rst:997 +#: ../../reference/expressions.rst:1001 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../reference/expressions.rst:997 ../../reference/expressions.rst:1145 -#: ../../reference/expressions.rst:1158 ../../reference/expressions.rst:1172 -#: ../../reference/expressions.rst:1179 ../../reference/expressions.rst:1189 +#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1149 +#: ../../reference/expressions.rst:1162 ../../reference/expressions.rst:1176 +#: ../../reference/expressions.rst:1183 ../../reference/expressions.rst:1193 msgid "call" msgstr "call(呼叫)" -#: ../../reference/expressions.rst:997 +#: ../../reference/expressions.rst:1001 msgid "argument" msgstr "argument(引數)" -#: ../../reference/expressions.rst:997 ../../reference/expressions.rst:1030 +#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1034 msgid "call semantics" msgstr "call semantics(呼叫語意)" -#: ../../reference/expressions.rst:997 +#: ../../reference/expressions.rst:1001 msgid "argument list" msgstr "argument list(引數列表)" -#: ../../reference/expressions.rst:997 +#: ../../reference/expressions.rst:1001 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/expressions.rst:997 ../../reference/expressions.rst:1080 -#: ../../reference/expressions.rst:1110 +#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1084 +#: ../../reference/expressions.rst:1114 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../reference/expressions.rst:1030 +#: ../../reference/expressions.rst:1034 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/expressions.rst:1080 ../../reference/expressions.rst:1314 -#: ../../reference/expressions.rst:1920 +#: ../../reference/expressions.rst:1084 ../../reference/expressions.rst:1318 +#: ../../reference/expressions.rst:1927 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/expressions.rst:1145 +#: ../../reference/expressions.rst:1149 msgid "user-defined" msgstr "user-defined(使用者定義)" -#: ../../reference/expressions.rst:1145 +#: ../../reference/expressions.rst:1149 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/expressions.rst:1158 +#: ../../reference/expressions.rst:1162 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../reference/expressions.rst:1158 +#: ../../reference/expressions.rst:1162 msgid "method" msgstr "method(方法)" -#: ../../reference/expressions.rst:1158 +#: ../../reference/expressions.rst:1162 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/expressions.rst:1172 +#: ../../reference/expressions.rst:1176 msgid "class" msgstr "class(類別)" -#: ../../reference/expressions.rst:1172 +#: ../../reference/expressions.rst:1176 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/expressions.rst:1179 +#: ../../reference/expressions.rst:1183 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/expressions.rst:1179 ../../reference/expressions.rst:1189 +#: ../../reference/expressions.rst:1183 ../../reference/expressions.rst:1193 msgid "instance" msgstr "instance(實例)" -#: ../../reference/expressions.rst:1189 +#: ../../reference/expressions.rst:1193 msgid "__call__() (object method)" msgstr "__call__() (物件方法)" -#: ../../reference/expressions.rst:1217 +#: ../../reference/expressions.rst:1221 msgid "power" msgstr "power(次方)" -#: ../../reference/expressions.rst:1217 ../../reference/expressions.rst:1253 -#: ../../reference/expressions.rst:1301 ../../reference/expressions.rst:1417 -#: ../../reference/expressions.rst:1446 ../../reference/expressions.rst:1761 +#: ../../reference/expressions.rst:1221 ../../reference/expressions.rst:1257 +#: ../../reference/expressions.rst:1305 ../../reference/expressions.rst:1421 +#: ../../reference/expressions.rst:1450 ../../reference/expressions.rst:1765 msgid "operation" msgstr "operation(操作)" -#: ../../reference/expressions.rst:1217 ../../reference/expressions.rst:1262 -#: ../../reference/expressions.rst:1271 ../../reference/expressions.rst:1279 -#: ../../reference/expressions.rst:1314 ../../reference/expressions.rst:1327 -#: ../../reference/expressions.rst:1339 ../../reference/expressions.rst:1357 -#: ../../reference/expressions.rst:1387 ../../reference/expressions.rst:1400 -#: ../../reference/expressions.rst:1417 ../../reference/expressions.rst:1455 -#: ../../reference/expressions.rst:1463 ../../reference/expressions.rst:1472 -#: ../../reference/expressions.rst:1487 ../../reference/expressions.rst:1726 -#: ../../reference/expressions.rst:1735 ../../reference/expressions.rst:1777 -#: ../../reference/expressions.rst:1782 ../../reference/expressions.rst:1787 -#: ../../reference/expressions.rst:1849 ../../reference/expressions.rst:1968 +#: ../../reference/expressions.rst:1221 ../../reference/expressions.rst:1266 +#: ../../reference/expressions.rst:1275 ../../reference/expressions.rst:1283 +#: ../../reference/expressions.rst:1318 ../../reference/expressions.rst:1331 +#: ../../reference/expressions.rst:1343 ../../reference/expressions.rst:1361 +#: ../../reference/expressions.rst:1391 ../../reference/expressions.rst:1404 +#: ../../reference/expressions.rst:1421 ../../reference/expressions.rst:1459 +#: ../../reference/expressions.rst:1467 ../../reference/expressions.rst:1476 +#: ../../reference/expressions.rst:1491 ../../reference/expressions.rst:1730 +#: ../../reference/expressions.rst:1739 ../../reference/expressions.rst:1781 +#: ../../reference/expressions.rst:1786 ../../reference/expressions.rst:1791 +#: ../../reference/expressions.rst:1854 ../../reference/expressions.rst:1978 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/expressions.rst:1253 +#: ../../reference/expressions.rst:1257 msgid "unary" msgstr "unary(一元)" -#: ../../reference/expressions.rst:1253 ../../reference/expressions.rst:1446 -#: ../../reference/expressions.rst:1455 ../../reference/expressions.rst:1463 -#: ../../reference/expressions.rst:1472 +#: ../../reference/expressions.rst:1257 ../../reference/expressions.rst:1450 +#: ../../reference/expressions.rst:1459 ../../reference/expressions.rst:1467 +#: ../../reference/expressions.rst:1476 msgid "bitwise" msgstr "bitwise(位元)" -#: ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1266 msgid "negation" msgstr "negation(否定)" -#: ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1266 msgid "minus" msgstr "minus(減)" -#: ../../reference/expressions.rst:1262 ../../reference/expressions.rst:1400 +#: ../../reference/expressions.rst:1266 ../../reference/expressions.rst:1404 msgid "- (minus)" msgstr "- (減號)" -#: ../../reference/expressions.rst:1262 ../../reference/expressions.rst:1271 +#: ../../reference/expressions.rst:1266 ../../reference/expressions.rst:1275 msgid "unary operator" msgstr "unary operator(一元運算子)" -#: ../../reference/expressions.rst:1271 +#: ../../reference/expressions.rst:1275 msgid "plus" msgstr "plus(加)" -#: ../../reference/expressions.rst:1271 ../../reference/expressions.rst:1387 +#: ../../reference/expressions.rst:1275 ../../reference/expressions.rst:1391 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../reference/expressions.rst:1279 +#: ../../reference/expressions.rst:1283 msgid "inversion" msgstr "inversion(反轉)" -#: ../../reference/expressions.rst:1279 +#: ../../reference/expressions.rst:1283 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../reference/expressions.rst:1290 +#: ../../reference/expressions.rst:1294 msgid "TypeError" msgstr "TypeError" -#: ../../reference/expressions.rst:1301 ../../reference/expressions.rst:1446 +#: ../../reference/expressions.rst:1305 ../../reference/expressions.rst:1450 msgid "binary" msgstr "binary(二進位)" -#: ../../reference/expressions.rst:1314 +#: ../../reference/expressions.rst:1318 msgid "multiplication" msgstr "multiplication(乘)" -#: ../../reference/expressions.rst:1327 +#: ../../reference/expressions.rst:1331 msgid "matrix multiplication" msgstr "matrix multiplication(矩陣乘法)" -#: ../../reference/expressions.rst:1327 +#: ../../reference/expressions.rst:1331 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/expressions.rst:1339 +#: ../../reference/expressions.rst:1343 msgid "ZeroDivisionError" msgstr "ZeroDivisionError" -#: ../../reference/expressions.rst:1339 +#: ../../reference/expressions.rst:1343 msgid "division" msgstr "division(除)" -#: ../../reference/expressions.rst:1339 +#: ../../reference/expressions.rst:1343 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/expressions.rst:1339 +#: ../../reference/expressions.rst:1343 msgid "//" msgstr "//" -#: ../../reference/expressions.rst:1357 +#: ../../reference/expressions.rst:1361 msgid "modulo" msgstr "modulo(餘數)" -#: ../../reference/expressions.rst:1357 +#: ../../reference/expressions.rst:1361 msgid "% (percent)" msgstr "% (百分號)" -#: ../../reference/expressions.rst:1387 +#: ../../reference/expressions.rst:1391 msgid "addition" msgstr "addition(加)" -#: ../../reference/expressions.rst:1387 ../../reference/expressions.rst:1400 +#: ../../reference/expressions.rst:1391 ../../reference/expressions.rst:1404 msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../reference/expressions.rst:1400 +#: ../../reference/expressions.rst:1404 msgid "subtraction" msgstr "subtraction(減)" -#: ../../reference/expressions.rst:1417 +#: ../../reference/expressions.rst:1421 msgid "shifting" msgstr "shifting(移動)" -#: ../../reference/expressions.rst:1417 +#: ../../reference/expressions.rst:1421 msgid "<<" msgstr "<<" -#: ../../reference/expressions.rst:1417 +#: ../../reference/expressions.rst:1421 msgid ">>" msgstr ">>" -#: ../../reference/expressions.rst:1435 +#: ../../reference/expressions.rst:1439 msgid "ValueError" msgstr "ValueError" -#: ../../reference/expressions.rst:1455 ../../reference/expressions.rst:1782 +#: ../../reference/expressions.rst:1459 ../../reference/expressions.rst:1786 msgid "and" msgstr "and" -#: ../../reference/expressions.rst:1455 +#: ../../reference/expressions.rst:1459 msgid "& (ampersand)" msgstr "& (和號)" -#: ../../reference/expressions.rst:1463 +#: ../../reference/expressions.rst:1467 msgid "xor" msgstr "xor" -#: ../../reference/expressions.rst:1463 +#: ../../reference/expressions.rst:1467 msgid "exclusive" msgstr "exclusive(排外)" -#: ../../reference/expressions.rst:1463 ../../reference/expressions.rst:1472 -#: ../../reference/expressions.rst:1787 +#: ../../reference/expressions.rst:1467 ../../reference/expressions.rst:1476 +#: ../../reference/expressions.rst:1791 msgid "or" msgstr "or" -#: ../../reference/expressions.rst:1463 +#: ../../reference/expressions.rst:1467 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../reference/expressions.rst:1472 +#: ../../reference/expressions.rst:1476 msgid "inclusive" msgstr "inclusive(包含)" -#: ../../reference/expressions.rst:1472 +#: ../../reference/expressions.rst:1476 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "comparison" msgstr "comparison(比較)" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "C" msgstr "C" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "language" msgstr "language(語言)" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "< (less)" msgstr "< (小於)" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "> (greater)" msgstr "> (大於)" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "<=" msgstr "<=" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid ">=" msgstr ">=" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "==" msgstr "==" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "!=" msgstr "!=" -#: ../../reference/expressions.rst:1511 +#: ../../reference/expressions.rst:1515 msgid "chaining" msgstr "chaining(鏈接)" -#: ../../reference/expressions.rst:1511 +#: ../../reference/expressions.rst:1515 msgid "comparisons" msgstr "comparisons(比較)" -#: ../../reference/expressions.rst:1726 +#: ../../reference/expressions.rst:1730 msgid "in" msgstr "in" -#: ../../reference/expressions.rst:1726 +#: ../../reference/expressions.rst:1730 msgid "not in" msgstr "not in" -#: ../../reference/expressions.rst:1726 +#: ../../reference/expressions.rst:1730 msgid "membership" msgstr "membership(成員)" -#: ../../reference/expressions.rst:1726 ../../reference/expressions.rst:1735 +#: ../../reference/expressions.rst:1730 ../../reference/expressions.rst:1739 msgid "test" msgstr "test(測試)" -#: ../../reference/expressions.rst:1735 +#: ../../reference/expressions.rst:1739 msgid "is" msgstr "is" -#: ../../reference/expressions.rst:1735 +#: ../../reference/expressions.rst:1739 msgid "is not" msgstr "is not" -#: ../../reference/expressions.rst:1735 +#: ../../reference/expressions.rst:1739 msgid "identity" msgstr "identity" -#: ../../reference/expressions.rst:1761 +#: ../../reference/expressions.rst:1765 msgid "Conditional" msgstr "Conditional(條件式)" -#: ../../reference/expressions.rst:1761 +#: ../../reference/expressions.rst:1765 msgid "Boolean" msgstr "Boolean(布林)" -#: ../../reference/expressions.rst:1777 +#: ../../reference/expressions.rst:1781 msgid "not" msgstr "not" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1805 msgid ":= (colon equals)" msgstr ":= (冒號等於)" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1805 msgid "assignment expression" msgstr "assignment expression(賦值運算式)" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1805 msgid "walrus operator" msgstr "walrus operator(海象運算子)" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1805 msgid "named expression" msgstr "named expression(附名運算式)" -#: ../../reference/expressions.rst:1849 +#: ../../reference/expressions.rst:1805 +msgid "assignment" +msgstr "assignment(賦值)" + +#: ../../reference/expressions.rst:1854 msgid "conditional" msgstr "conditional(條件式)" -#: ../../reference/expressions.rst:1849 +#: ../../reference/expressions.rst:1854 msgid "ternary" msgstr "ternary(三元)" -#: ../../reference/expressions.rst:1849 +#: ../../reference/expressions.rst:1854 msgid "conditional expression" msgstr "conditional expression(條件運算式)" -#: ../../reference/expressions.rst:1849 +#: ../../reference/expressions.rst:1854 msgid "else" msgstr "else" -#: ../../reference/expressions.rst:1875 +#: ../../reference/expressions.rst:1880 msgid "lambda" msgstr "lambda" -#: ../../reference/expressions.rst:1875 +#: ../../reference/expressions.rst:1880 msgid "form" msgstr "form" -#: ../../reference/expressions.rst:1875 +#: ../../reference/expressions.rst:1880 msgid "anonymous" msgstr "anonymous(匿名)" -#: ../../reference/expressions.rst:1875 +#: ../../reference/expressions.rst:1880 msgid "lambda expression" msgstr "lambda expression(lambda 運算式)" -#: ../../reference/expressions.rst:1920 +#: ../../reference/expressions.rst:1927 msgid "iterable" msgstr "iterable(可疊代)" -#: ../../reference/expressions.rst:1920 +#: ../../reference/expressions.rst:1927 msgid "in expression lists" msgstr "於 expression list(運算式串列)" -#: ../../reference/expressions.rst:1932 +#: ../../reference/expressions.rst:1942 msgid "trailing" msgstr "trailing" -#: ../../reference/expressions.rst:1947 +#: ../../reference/expressions.rst:1957 msgid "evaluation" msgstr "evaluation" -#: ../../reference/expressions.rst:1947 +#: ../../reference/expressions.rst:1957 msgid "order" msgstr "order(順序)" -#: ../../reference/expressions.rst:1968 +#: ../../reference/expressions.rst:1978 msgid "precedence" msgstr "precedence(優先順序)" diff --git a/reference/import.po b/reference/import.po index 9a98a69bd1..4fb01ece71 100644 --- a/reference/import.po +++ b/reference/import.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -830,7 +830,13 @@ msgid "" "back to ``__package__``." msgstr "" -#: ../../reference/import.rst:602 +#: ../../reference/import.rst:599 +msgid "" +"``__package__`` will cease to be set or taken into consideration by the " +"import system or standard library." +msgstr "" + +#: ../../reference/import.rst:606 msgid "" "The ``__spec__`` attribute must be set to the module spec that was used when " "importing the module. Setting ``__spec__`` appropriately applies equally to :" @@ -839,18 +845,18 @@ msgid "" "cases `." msgstr "" -#: ../../reference/import.rst:608 +#: ../../reference/import.rst:612 msgid "" "When ``__spec__.parent`` is not set, ``__package__`` is used as a fallback." msgstr "" -#: ../../reference/import.rst:613 +#: ../../reference/import.rst:617 msgid "" "``__spec__.parent`` is used as a fallback when ``__package__`` is not " "defined." msgstr "" -#: ../../reference/import.rst:619 +#: ../../reference/import.rst:623 msgid "" "If the module is a package (either regular or namespace), the module " "object's ``__path__`` attribute must be set. The value must be iterable, " @@ -860,11 +866,11 @@ msgid "" "rules>`." msgstr "" -#: ../../reference/import.rst:626 +#: ../../reference/import.rst:630 msgid "Non-package modules should not have a ``__path__`` attribute." msgstr "" -#: ../../reference/import.rst:631 +#: ../../reference/import.rst:635 msgid "" "``__file__`` is optional (if set, value must be a string). It indicates the " "pathname of the file from which the module was loaded (if loaded from a " @@ -875,7 +881,7 @@ msgid "" "semantic meaning (e.g. a module loaded from a database)." msgstr "" -#: ../../reference/import.rst:640 +#: ../../reference/import.rst:644 msgid "" "If ``__file__`` is set then the ``__cached__`` attribute might also be set, " "which is the path to any compiled version of the code (e.g. byte-compiled " @@ -883,7 +889,7 @@ msgid "" "simply point to where the compiled file would exist (see :pep:`3147`)." msgstr "" -#: ../../reference/import.rst:646 +#: ../../reference/import.rst:650 msgid "" "Note that ``__cached__`` may be set even if ``__file__`` is not set. " "However, that scenario is quite atypical. Ultimately, the loader is what " @@ -893,22 +899,28 @@ msgid "" "be appropriate." msgstr "" -#: ../../reference/import.rst:653 +#: ../../reference/import.rst:657 msgid "" "It is **strongly** recommended that you rely on :attr:`__spec__` instead of " "``__cached__``." msgstr "" -#: ../../reference/import.rst:659 +#: ../../reference/import.rst:660 +msgid "" +"``__cached__`` will cease to be set or taken into consideration by the " +"import system or standard library." +msgstr "" + +#: ../../reference/import.rst:667 msgid "module.__path__" msgstr "module.__path__" -#: ../../reference/import.rst:661 +#: ../../reference/import.rst:669 msgid "" "By definition, if a module has a ``__path__`` attribute, it is a package." msgstr "" -#: ../../reference/import.rst:663 +#: ../../reference/import.rst:671 msgid "" "A package's ``__path__`` attribute is used during imports of its " "subpackages. Within the import machinery, it functions much the same as :" @@ -917,7 +929,7 @@ msgid "" "than :data:`sys.path`." msgstr "" -#: ../../reference/import.rst:669 +#: ../../reference/import.rst:677 msgid "" "``__path__`` must be an iterable of strings, but it may be empty. The same " "rules used for :data:`sys.path` also apply to a package's ``__path__``, and :" @@ -925,7 +937,7 @@ msgid "" "package's ``__path__``." msgstr "" -#: ../../reference/import.rst:674 +#: ../../reference/import.rst:682 msgid "" "A package's ``__init__.py`` file may set or alter the package's ``__path__`` " "attribute, and this was typically the way namespace packages were " @@ -935,18 +947,18 @@ msgid "" "``__path__`` correctly for the namespace package." msgstr "" -#: ../../reference/import.rst:682 +#: ../../reference/import.rst:690 msgid "Module reprs" msgstr "" -#: ../../reference/import.rst:684 +#: ../../reference/import.rst:692 msgid "" "By default, all modules have a usable repr, however depending on the " "attributes set above, and in the module's spec, you can more explicitly " "control the repr of module objects." msgstr "" -#: ../../reference/import.rst:688 +#: ../../reference/import.rst:696 msgid "" "If the module has a spec (``__spec__``), the import machinery will try to " "generate a repr from it. If that fails or there is no spec, the import " @@ -956,45 +968,45 @@ msgid "" "for whatever information is missing." msgstr "" -#: ../../reference/import.rst:695 +#: ../../reference/import.rst:703 msgid "Here are the exact rules used:" msgstr "" -#: ../../reference/import.rst:697 +#: ../../reference/import.rst:705 msgid "" "If the module has a ``__spec__`` attribute, the information in the spec is " "used to generate the repr. The \"name\", \"loader\", \"origin\", and " "\"has_location\" attributes are consulted." msgstr "" -#: ../../reference/import.rst:701 +#: ../../reference/import.rst:709 msgid "" "If the module has a ``__file__`` attribute, this is used as part of the " "module's repr." msgstr "" -#: ../../reference/import.rst:704 +#: ../../reference/import.rst:712 msgid "" "If the module has no ``__file__`` but does have a ``__loader__`` that is not " "``None``, then the loader's repr is used as part of the module's repr." msgstr "" -#: ../../reference/import.rst:707 +#: ../../reference/import.rst:715 msgid "Otherwise, just use the module's ``__name__`` in the repr." msgstr "" -#: ../../reference/import.rst:709 +#: ../../reference/import.rst:717 msgid "" "Use of :meth:`!module_repr`, having been deprecated since Python 3.4, was " "removed in Python 3.12 and is no longer called during the resolution of a " "module's repr." msgstr "" -#: ../../reference/import.rst:717 +#: ../../reference/import.rst:725 msgid "Cached bytecode invalidation" msgstr "" -#: ../../reference/import.rst:719 +#: ../../reference/import.rst:727 msgid "" "Before Python loads cached bytecode from a ``.pyc`` file, it checks whether " "the cache is up-to-date with the source ``.py`` file. By default, Python " @@ -1004,7 +1016,7 @@ msgid "" "source's metadata." msgstr "" -#: ../../reference/import.rst:726 +#: ../../reference/import.rst:734 msgid "" "Python also supports \"hash-based\" cache files, which store a hash of the " "source file's contents rather than its metadata. There are two variants of " @@ -1018,17 +1030,17 @@ msgid "" "option:`--check-hash-based-pycs` flag." msgstr "" -#: ../../reference/import.rst:737 +#: ../../reference/import.rst:745 msgid "" "Added hash-based ``.pyc`` files. Previously, Python only supported timestamp-" "based invalidation of bytecode caches." msgstr "" -#: ../../reference/import.rst:743 +#: ../../reference/import.rst:751 msgid "The Path Based Finder" msgstr "" -#: ../../reference/import.rst:748 +#: ../../reference/import.rst:756 msgid "" "As mentioned previously, Python comes with several default meta path " "finders. One of these, called the :term:`path based finder` (:class:" @@ -1037,14 +1049,14 @@ msgid "" "a location to search for modules." msgstr "" -#: ../../reference/import.rst:754 +#: ../../reference/import.rst:762 msgid "" "The path based finder itself doesn't know how to import anything. Instead, " "it traverses the individual path entries, associating each of them with a " "path entry finder that knows how to handle that particular kind of path." msgstr "" -#: ../../reference/import.rst:758 +#: ../../reference/import.rst:766 msgid "" "The default set of path entry finders implement all the semantics for " "finding modules on the file system, handling special file types such as " @@ -1055,14 +1067,14 @@ msgid "" "from zipfiles." msgstr "" -#: ../../reference/import.rst:765 +#: ../../reference/import.rst:773 msgid "" "Path entries need not be limited to file system locations. They can refer " "to URLs, database queries, or any other location that can be specified as a " "string." msgstr "" -#: ../../reference/import.rst:769 +#: ../../reference/import.rst:777 msgid "" "The path based finder provides additional hooks and protocols so that you " "can extend and customize the types of searchable path entries. For example, " @@ -1073,7 +1085,7 @@ msgid "" "from the web." msgstr "" -#: ../../reference/import.rst:777 +#: ../../reference/import.rst:785 msgid "" "A word of warning: this section and the previous both use the term *finder*, " "distinguishing between them by using the terms :term:`meta path finder` and :" @@ -1084,7 +1096,7 @@ msgid "" "process, as keyed off the :data:`sys.meta_path` traversal." msgstr "" -#: ../../reference/import.rst:785 +#: ../../reference/import.rst:793 msgid "" "By contrast, path entry finders are in a sense an implementation detail of " "the path based finder, and in fact, if the path based finder were to be " @@ -1092,11 +1104,11 @@ msgid "" "would be invoked." msgstr "" -#: ../../reference/import.rst:792 +#: ../../reference/import.rst:800 msgid "Path entry finders" msgstr "" -#: ../../reference/import.rst:800 +#: ../../reference/import.rst:808 msgid "" "The :term:`path based finder` is responsible for finding and loading Python " "modules and packages whose location is specified with a string :term:`path " @@ -1104,7 +1116,7 @@ msgid "" "not be limited to this." msgstr "" -#: ../../reference/import.rst:805 +#: ../../reference/import.rst:813 msgid "" "As a meta path finder, the :term:`path based finder` implements the :meth:" "`~importlib.abc.MetaPathFinder.find_spec` protocol previously described, " @@ -1112,7 +1124,7 @@ msgid "" "modules are found and loaded from the :term:`import path`." msgstr "" -#: ../../reference/import.rst:810 +#: ../../reference/import.rst:818 msgid "" "Three variables are used by the :term:`path based finder`, :data:`sys." "path`, :data:`sys.path_hooks` and :data:`sys.path_importer_cache`. The " @@ -1120,7 +1132,7 @@ msgid "" "additional ways that the import machinery can be customized." msgstr "" -#: ../../reference/import.rst:815 +#: ../../reference/import.rst:823 msgid "" ":data:`sys.path` contains a list of strings providing search locations for " "modules and packages. It is initialized from the :envvar:`PYTHONPATH` " @@ -1132,7 +1144,7 @@ msgid "" "other data types are ignored." msgstr "" -#: ../../reference/import.rst:824 +#: ../../reference/import.rst:832 msgid "" "The :term:`path based finder` is a :term:`meta path finder`, so the import " "machinery begins the :term:`import path` search by calling the path based " @@ -1144,7 +1156,7 @@ msgid "" "top level import and :data:`sys.path` is used." msgstr "" -#: ../../reference/import.rst:833 +#: ../../reference/import.rst:841 msgid "" "The path based finder iterates over every entry in the search path, and for " "each of these, looks for an appropriate :term:`path entry finder` (:class:" @@ -1160,7 +1172,7 @@ msgid "" "finder to perform the path entry search again." msgstr "" -#: ../../reference/import.rst:846 +#: ../../reference/import.rst:854 msgid "" "If the path entry is not present in the cache, the path based finder " "iterates over every callable in :data:`sys.path_hooks`. Each of the :term:" @@ -1176,7 +1188,7 @@ msgid "" "decode the argument, it should raise :exc:`ImportError`." msgstr "" -#: ../../reference/import.rst:860 +#: ../../reference/import.rst:868 msgid "" "If :data:`sys.path_hooks` iteration ends with no :term:`path entry finder` " "being returned, then the path based finder's :meth:`~importlib.machinery." @@ -1186,7 +1198,7 @@ msgid "" "could not find the module." msgstr "" -#: ../../reference/import.rst:867 +#: ../../reference/import.rst:875 msgid "" "If a :term:`path entry finder` *is* returned by one of the :term:`path entry " "hook` callables on :data:`sys.path_hooks`, then the following protocol is " @@ -1194,7 +1206,7 @@ msgid "" "the module." msgstr "" -#: ../../reference/import.rst:872 +#: ../../reference/import.rst:880 msgid "" "The current working directory -- denoted by an empty string -- is handled " "slightly differently from other entries on :data:`sys.path`. First, if the " @@ -1206,18 +1218,18 @@ msgid "" "and not the empty string." msgstr "" -#: ../../reference/import.rst:882 +#: ../../reference/import.rst:890 msgid "Path entry finder protocol" msgstr "" -#: ../../reference/import.rst:884 +#: ../../reference/import.rst:892 msgid "" "In order to support imports of modules and initialized packages and also to " "contribute portions to namespace packages, path entry finders must implement " "the :meth:`~importlib.abc.PathEntryFinder.find_spec` method." msgstr "" -#: ../../reference/import.rst:888 +#: ../../reference/import.rst:896 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` takes two arguments: the " "fully qualified name of the module being imported, and the (optional) target " @@ -1225,21 +1237,21 @@ msgid "" "spec will always have \"loader\" set (with one exception)." msgstr "" -#: ../../reference/import.rst:893 +#: ../../reference/import.rst:901 msgid "" "To indicate to the import machinery that the spec represents a namespace :" "term:`portion`, the path entry finder sets ``submodule_search_locations`` to " "a list containing the portion." msgstr "" -#: ../../reference/import.rst:897 +#: ../../reference/import.rst:905 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` replaced :meth:`!" "find_loader` and :meth:`!find_module`, both of which are now deprecated, but " "will be used if ``find_spec()`` is not defined." msgstr "" -#: ../../reference/import.rst:903 +#: ../../reference/import.rst:911 msgid "" "Older path entry finders may implement one of these two deprecated methods " "instead of ``find_spec()``. The methods are still respected for the sake of " @@ -1247,14 +1259,14 @@ msgid "" "path entry finder, the legacy methods are ignored." msgstr "" -#: ../../reference/import.rst:908 +#: ../../reference/import.rst:916 msgid "" ":meth:`!find_loader` takes one argument, the fully qualified name of the " "module being imported. ``find_loader()`` returns a 2-tuple where the first " "item is the loader and the second item is a namespace :term:`portion`." msgstr "" -#: ../../reference/import.rst:913 +#: ../../reference/import.rst:921 msgid "" "For backwards compatibility with other implementations of the import " "protocol, many path entry finders also support the same, traditional " @@ -1264,7 +1276,7 @@ msgid "" "initial call to the path hook)." msgstr "" -#: ../../reference/import.rst:920 +#: ../../reference/import.rst:928 msgid "" "The ``find_module()`` method on path entry finders is deprecated, as it does " "not allow the path entry finder to contribute portions to namespace " @@ -1273,28 +1285,28 @@ msgid "" "preference to ``find_module()``." msgstr "" -#: ../../reference/import.rst:926 +#: ../../reference/import.rst:934 msgid "" "Calls to :meth:`!find_module` and :meth:`!find_loader` by the import system " "will raise :exc:`ImportWarning`." msgstr "" -#: ../../reference/import.rst:931 +#: ../../reference/import.rst:939 msgid "``find_module()`` and ``find_loader()`` have been removed." msgstr "" -#: ../../reference/import.rst:936 +#: ../../reference/import.rst:944 msgid "Replacing the standard import system" msgstr "" -#: ../../reference/import.rst:938 +#: ../../reference/import.rst:946 msgid "" "The most reliable mechanism for replacing the entire import system is to " "delete the default contents of :data:`sys.meta_path`, replacing them " "entirely with a custom meta path hook." msgstr "" -#: ../../reference/import.rst:942 +#: ../../reference/import.rst:950 msgid "" "If it is acceptable to only alter the behaviour of import statements without " "affecting other APIs that access the import system, then replacing the " @@ -1303,7 +1315,7 @@ msgid "" "statements within that module." msgstr "" -#: ../../reference/import.rst:948 +#: ../../reference/import.rst:956 msgid "" "To selectively prevent the import of some modules from a hook early on the " "meta path (rather than disabling the standard import system entirely), it is " @@ -1313,11 +1325,11 @@ msgid "" "exception terminates it immediately." msgstr "" -#: ../../reference/import.rst:958 +#: ../../reference/import.rst:966 msgid "Package Relative Imports" msgstr "" -#: ../../reference/import.rst:960 +#: ../../reference/import.rst:968 msgid "" "Relative imports use leading dots. A single leading dot indicates a relative " "import, starting with the current package. Two or more leading dots indicate " @@ -1325,7 +1337,7 @@ msgid "" "after the first. For example, given the following package layout::" msgstr "" -#: ../../reference/import.rst:965 +#: ../../reference/import.rst:973 msgid "" "package/\n" " __init__.py\n" @@ -1349,13 +1361,13 @@ msgstr "" " moduleZ.py\n" " moduleA.py" -#: ../../reference/import.rst:976 +#: ../../reference/import.rst:984 msgid "" "In either ``subpackage1/moduleX.py`` or ``subpackage1/__init__.py``, the " "following are valid relative imports::" msgstr "" -#: ../../reference/import.rst:979 +#: ../../reference/import.rst:987 msgid "" "from .moduleY import spam\n" "from .moduleY import spam as ham\n" @@ -1371,28 +1383,28 @@ msgstr "" "from ..subpackage2.moduleZ import eggs\n" "from ..moduleA import foo" -#: ../../reference/import.rst:986 +#: ../../reference/import.rst:994 msgid "" "Absolute imports may use either the ``import <>`` or ``from <> import <>`` " "syntax, but relative imports may only use the second form; the reason for " "this is that::" msgstr "" -#: ../../reference/import.rst:990 +#: ../../reference/import.rst:998 msgid "import XXX.YYY.ZZZ" msgstr "import XXX.YYY.ZZZ" -#: ../../reference/import.rst:992 +#: ../../reference/import.rst:1000 msgid "" "should expose ``XXX.YYY.ZZZ`` as a usable expression, but .moduleY is not a " "valid expression." msgstr "" -#: ../../reference/import.rst:999 +#: ../../reference/import.rst:1007 msgid "Special considerations for __main__" msgstr "" -#: ../../reference/import.rst:1001 +#: ../../reference/import.rst:1009 msgid "" "The :mod:`__main__` module is a special case relative to Python's import " "system. As noted :ref:`elsewhere `, the ``__main__`` module is " @@ -1403,17 +1415,17 @@ msgid "" "interpreter is invoked." msgstr "" -#: ../../reference/import.rst:1012 +#: ../../reference/import.rst:1020 msgid "__main__.__spec__" msgstr "__main__.__spec__" -#: ../../reference/import.rst:1014 +#: ../../reference/import.rst:1022 msgid "" "Depending on how :mod:`__main__` is initialized, ``__main__.__spec__`` gets " "set appropriately or to ``None``." msgstr "" -#: ../../reference/import.rst:1017 +#: ../../reference/import.rst:1025 msgid "" "When Python is started with the :option:`-m` option, ``__spec__`` is set to " "the module spec of the corresponding module or package. ``__spec__`` is also " @@ -1421,30 +1433,30 @@ msgid "" "directory, zipfile or other :data:`sys.path` entry." msgstr "" -#: ../../reference/import.rst:1022 +#: ../../reference/import.rst:1030 msgid "" "In :ref:`the remaining cases ` ``__main__." "__spec__`` is set to ``None``, as the code used to populate the :mod:" "`__main__` does not correspond directly with an importable module:" msgstr "" -#: ../../reference/import.rst:1026 +#: ../../reference/import.rst:1034 msgid "interactive prompt" msgstr "" -#: ../../reference/import.rst:1027 +#: ../../reference/import.rst:1035 msgid ":option:`-c` option" msgstr ":option:`-c` 選項" -#: ../../reference/import.rst:1028 +#: ../../reference/import.rst:1036 msgid "running from stdin" msgstr "" -#: ../../reference/import.rst:1029 +#: ../../reference/import.rst:1037 msgid "running directly from a source or bytecode file" msgstr "" -#: ../../reference/import.rst:1031 +#: ../../reference/import.rst:1039 msgid "" "Note that ``__main__.__spec__`` is always ``None`` in the last case, *even " "if* the file could technically be imported directly as a module instead. Use " @@ -1452,7 +1464,7 @@ msgid "" "`__main__`." msgstr "" -#: ../../reference/import.rst:1036 +#: ../../reference/import.rst:1044 msgid "" "Note also that even when ``__main__`` corresponds with an importable module " "and ``__main__.__spec__`` is set accordingly, they're still considered " @@ -1461,11 +1473,11 @@ msgid "" "populate the ``__main__`` namespace, and not during normal import." msgstr "" -#: ../../reference/import.rst:1044 +#: ../../reference/import.rst:1052 msgid "References" msgstr "" -#: ../../reference/import.rst:1046 +#: ../../reference/import.rst:1054 msgid "" "The import machinery has evolved considerably since Python's early days. " "The original `specification for packages ` for " "Python 3.3. :pep:`420` also introduced the :meth:`!find_loader` protocol as " "an alternative to :meth:`!find_module`." msgstr "" -#: ../../reference/import.rst:1058 +#: ../../reference/import.rst:1066 msgid "" ":pep:`366` describes the addition of the ``__package__`` attribute for " "explicit relative imports in main modules." msgstr "" -#: ../../reference/import.rst:1061 +#: ../../reference/import.rst:1069 msgid "" ":pep:`328` introduced absolute and explicit relative imports and initially " "proposed ``__name__`` for semantics :pep:`366` would eventually specify for " "``__package__``." msgstr "" -#: ../../reference/import.rst:1065 +#: ../../reference/import.rst:1073 msgid ":pep:`338` defines executing modules as scripts." msgstr "" -#: ../../reference/import.rst:1067 +#: ../../reference/import.rst:1075 msgid "" ":pep:`451` adds the encapsulation of per-module import state in spec " "objects. It also off-loads most of the boilerplate responsibilities of " @@ -1512,15 +1524,15 @@ msgid "" "finders and loaders." msgstr "" -#: ../../reference/import.rst:1074 +#: ../../reference/import.rst:1082 msgid "Footnotes" msgstr "註解" -#: ../../reference/import.rst:1075 +#: ../../reference/import.rst:1083 msgid "See :class:`types.ModuleType`." msgstr "參閱 :class:`types.ModuleType`。" -#: ../../reference/import.rst:1077 +#: ../../reference/import.rst:1085 msgid "" "The importlib implementation avoids using the return value directly. " "Instead, it gets the module object by looking the module name up in :data:" @@ -1602,22 +1614,22 @@ msgstr "sys.meta_path" msgid "find_spec" msgstr "find_spec" -#: ../../reference/import.rst:745 +#: ../../reference/import.rst:753 msgid "path based finder" msgstr "path based finder(基於路徑的搜尋器)" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:802 msgid "sys.path" msgstr "sys.path" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:802 msgid "sys.path_hooks" msgstr "sys.path_hooks" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:802 msgid "sys.path_importer_cache" msgstr "sys.path_importer_cache" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:802 msgid "PYTHONPATH" msgstr "PYTHONPATH" diff --git a/sphinx.po b/sphinx.po index 5729a9b54b..f044d5a9c6 100644 --- a/sphinx.po +++ b/sphinx.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2023-03-15 10:19+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,15 +37,15 @@ msgstr "顯示原始碼" msgid "Download" msgstr "下載" -#: ../../tools/templates/download.html:14 -msgid "Download Python %(release)s Documentation" -msgstr "下載 Python %(release)s 說明文件" - #: ../../tools/templates/download.html:16 +msgid "Download Python %(dl_version)s Documentation" +msgstr "下載 Python %(dl_version)s 說明文件" + +#: ../../tools/templates/download.html:18 msgid "Last updated on: %(last_updated)s." msgstr "最後更新時間:%(last_updated)s。" -#: ../../tools/templates/download.html:18 +#: ../../tools/templates/download.html:20 msgid "" "To download an archive containing all the documents for this version of\n" "Python in one of various formats, follow one of links in this table." @@ -53,119 +53,119 @@ msgstr "" "要下載包含這個 Python 版本所有文件的歸檔,可以遵循這個表格中的其中一個連結," "以取得各種格式的文件。" -#: ../../tools/templates/download.html:23 +#: ../../tools/templates/download.html:25 msgid "Format" msgstr "格式" -#: ../../tools/templates/download.html:24 +#: ../../tools/templates/download.html:26 msgid "Packed as .zip" msgstr "打包成 .zip" -#: ../../tools/templates/download.html:25 +#: ../../tools/templates/download.html:27 msgid "Packed as .tar.bz2" msgstr "打包成 .tar.bz2" -#: ../../tools/templates/download.html:28 +#: ../../tools/templates/download.html:30 msgid "PDF" msgstr "PDF" -#: ../../tools/templates/download.html:29 +#: ../../tools/templates/download.html:31 msgid "" -"Download (ca. " -"%(download_size)s MiB)" +"Download " +"(ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " +"下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:30 +#: ../../tools/templates/download.html:32 msgid "" -"Download " -"(ca. %(download_size)s MiB)" +"Download (ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " -"%(download_size)s MiB)" +"下載 " +"(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:33 +#: ../../tools/templates/download.html:35 msgid "HTML" msgstr "HTML" -#: ../../tools/templates/download.html:34 +#: ../../tools/templates/download.html:36 msgid "" -"Download (ca. " -"%(download_size)s MiB)" +"Download " +"(ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " +"下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:35 +#: ../../tools/templates/download.html:37 msgid "" -"Download " +"Download " "(ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " -"%(download_size)s MiB)" +"下載 " +"(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:38 +#: ../../tools/templates/download.html:40 msgid "Plain text" msgstr "純文字" -#: ../../tools/templates/download.html:39 +#: ../../tools/templates/download.html:41 msgid "" -"Download (ca. " -"%(download_size)s MiB)" +"Download " +"(ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " +"下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:40 +#: ../../tools/templates/download.html:42 msgid "" -"Download " +"Download " "(ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " -"%(download_size)s MiB)" +"下載 " +"(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:43 +#: ../../tools/templates/download.html:45 msgid "Texinfo" msgstr "Texinfo" -#: ../../tools/templates/download.html:44 +#: ../../tools/templates/download.html:46 msgid "" -"Download (ca. " -"%(download_size)s MiB)" +"Download " +"(ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " +"下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:45 +#: ../../tools/templates/download.html:47 msgid "" -"Download " -"(ca. %(download_size)s MiB)" +"Download (ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " -"%(download_size)s MiB)" +"下載 " +"(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:48 +#: ../../tools/templates/download.html:50 msgid "EPUB" msgstr "EPUB" -#: ../../tools/templates/download.html:49 +#: ../../tools/templates/download.html:51 msgid "" -"Download (ca. " +"Download (ca. " "%(download_size)s MiB)" msgstr "" -"下載 (ca. " +"下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:54 +#: ../../tools/templates/download.html:56 msgid "These archives contain all the content in the documentation." msgstr "這些歸檔包含了說明文件中的所有內容。" -#: ../../tools/templates/download.html:57 +#: ../../tools/templates/download.html:59 msgid "Unpacking" msgstr "解壓縮" -#: ../../tools/templates/download.html:59 +#: ../../tools/templates/download.html:61 msgid "" "Unix users should download the .tar.bz2 archives; these are bzipped tar\n" "archives and can be handled in the usual way using tar and the bzip2\n" @@ -180,7 +180,7 @@ msgstr "" "net\">Info-ZIP 解壓縮程式來處理 ZIP 歸檔。.tar.bz2 歸檔提供最佳壓縮率和最" "快的下載時間。" -#: ../../tools/templates/download.html:65 +#: ../../tools/templates/download.html:67 msgid "" "Windows users can use the ZIP archives since those are customary on that\n" "platform. These are created on Unix using the Info-ZIP zip program." @@ -188,11 +188,11 @@ msgstr "" "Windows 使用者可以使用 ZIP 歸檔,因為這在該平台上是常見的。這些是在 Unix 上使" "用 Info-ZIP zip 程式建立的。" -#: ../../tools/templates/download.html:69 +#: ../../tools/templates/download.html:71 msgid "Problems" msgstr "問題" -#: ../../tools/templates/download.html:71 +#: ../../tools/templates/download.html:73 msgid "" "If you have comments or suggestions for the Python documentation, please " "send\n" diff --git a/tutorial/classes.po b/tutorial/classes.po index f102da185e..491479937b 100644 --- a/tutorial/classes.po +++ b/tutorial/classes.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+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-" @@ -156,7 +156,7 @@ msgid "" "may both define a function ``maximize`` without confusion --- users of the " "modules must prefix it with the module name." msgstr "" -"*命名空間*\\ 是從名稱到物件的映射。大部分的命名空間現在都是以 Python 的 " +"*命名空間*\\ 是從名稱到物件的對映。大部分的命名空間現在都是以 Python 的 " "dictionary 被實作,但通常不會以任何方式被察覺(除了性能),且它可能會在未來改" "變。命名空間的例子有:內建名稱的集合(包含如 :func:`abs` 的函式,和內建的例外" "名稱);模組中的全域 (global) 名稱;和在函式調用中的區域 (local) 名稱。某種意" @@ -533,13 +533,13 @@ msgid "" "then ``MyClass.i`` and ``MyClass.f`` are valid attribute references, " "returning an integer and a function object, respectively. Class attributes " "can also be assigned to, so you can change the value of ``MyClass.i`` by " -"assignment. :attr:`!__doc__` is also a valid attribute, returning the " +"assignment. :attr:`~type.__doc__` is also a valid attribute, returning the " "docstring belonging to the class: ``\"A simple example class\"``." msgstr "" "那麼 ``MyClass.i`` 和 ``MyClass.f`` 都是有效的屬性參照,會分別回傳一個整數和" "一個函式物件。Class 屬性也可以被指派 (assign),所以你可以透過賦值改變 " -"``MyClass.i`` 的值。:attr:`!__doc__` 也是一個有效的屬性,會回傳屬於該 class " -"的說明字串 (docstring):``\"A simple example class\"``。" +"``MyClass.i`` 的值。:attr:`~type.__doc__` 也是一個有效的屬性,會回傳屬於該 " +"class 的說明字串 (docstring):``\"A simple example class\"``。" #: ../../tutorial/classes.rst:282 msgid "" @@ -828,6 +828,22 @@ msgid "" ">>> d.tricks # unexpectedly shared by all dogs\n" "['roll over', 'play dead']" msgstr "" +"class Dog:\n" +"\n" +" tricks = [] # 誤用類別變數\n" +"\n" +" def __init__(self, name):\n" +" self.name = name\n" +"\n" +" def add_trick(self, trick):\n" +" self.tricks.append(trick)\n" +"\n" +">>> d = Dog('Fido')\n" +">>> e = Dog('Buddy')\n" +">>> d.add_trick('roll over')\n" +">>> e.add_trick('play dead')\n" +">>> d.tricks # 出乎意料地被所有 dog 共享\n" +"['roll over', 'play dead']" #: ../../tutorial/classes.rst:445 msgid "Correct design of the class should use an instance variable instead::" @@ -853,6 +869,23 @@ msgid "" ">>> e.tricks\n" "['play dead']" msgstr "" +"class Dog:\n" +"\n" +" def __init__(self, name):\n" +" self.name = name\n" +" self.tricks = [] # 為每一個 dog 建立空 list\n" +"\n" +" def add_trick(self, trick):\n" +" self.tricks.append(trick)\n" +"\n" +">>> d = Dog('Fido')\n" +">>> e = Dog('Buddy')\n" +">>> d.add_trick('roll over')\n" +">>> e.add_trick('play dead')\n" +">>> d.tricks\n" +"['roll over']\n" +">>> e.tricks\n" +"['play dead']" #: ../../tutorial/classes.rst:469 msgid "Random Remarks" @@ -970,6 +1003,17 @@ msgid "" "\n" " h = g" msgstr "" +"# 在類別以外定義的函式\n" +"def f1(self, x, y):\n" +" return min(x, x+y)\n" +"\n" +"class C:\n" +" f = f1\n" +"\n" +" def g(self):\n" +" return 'hello world'\n" +"\n" +" h = g" #: ../../tutorial/classes.rst:530 msgid "" @@ -1702,15 +1746,15 @@ msgstr "註解" msgid "" "Except for one thing. Module objects have a secret read-only attribute " "called :attr:`~object.__dict__` which returns the dictionary used to " -"implement the module's namespace; the name :attr:`~object.__dict__` is an " -"attribute but not a global name. Obviously, using this violates the " -"abstraction of namespace implementation, and should be restricted to things " -"like post-mortem debuggers." +"implement the module's namespace; the name ``__dict__`` is an attribute but " +"not a global name. Obviously, using this violates the abstraction of " +"namespace implementation, and should be restricted to things like post-" +"mortem debuggers." msgstr "" "有一個例外。模組物件有一個秘密的唯讀屬性,稱為 :attr:`~object.__dict__`,它回" -"傳用於實作模組命名空間的 dictionary;:attr:`~object.__dict__` 這個名稱是一個" -"屬性但不是全域名稱。顯然,使用此屬性將違反命名空間實作的抽象化,而應該僅限用" -"於事後除錯器 (post-mortem debugger) 之類的東西。" +"傳用於實作模組命名空間的 dictionary;``__dict__`` 這個名稱是一個屬性但不是全" +"域名稱。顯然,使用此屬性將違反命名空間實作的抽象化,而應該僅限用於事後除錯器 " +"(post-mortem debugger) 之類的東西。" #: ../../tutorial/classes.rst:343 msgid "object" @@ -1727,18 +1771,3 @@ msgstr "name(名稱)" #: ../../tutorial/classes.rst:679 msgid "mangling" msgstr "mangling(修飾)" - -#~ msgid "" -#~ "The other kind of instance attribute reference is a *method*. A method is " -#~ "a function that \"belongs to\" an object. (In Python, the term method is " -#~ "not unique to class instances: other object types can have methods as " -#~ "well. For example, list objects have methods called append, insert, " -#~ "remove, sort, and so on. However, in the following discussion, we'll use " -#~ "the term method exclusively to mean methods of class instance objects, " -#~ "unless explicitly stated otherwise.)" -#~ msgstr "" -#~ "實例的另一種屬性參照是 *method*。Method 是一個「屬於」物件的函式。(在 " -#~ "Python 中,術語 method 並不是 class 實例所獨有的:其他物件型別也可以有 " -#~ "method。例如,list 物件具有稱為 append、insert、remove、sort 等 method。但" -#~ "是,在下面的討論中,我們將用術語 method 來專門表示 class 實例物件的 " -#~ "method,除非另有明確說明。)" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index 58684f4aa7..c0a2f46f22 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2022-07-24 14:52+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -293,56 +293,122 @@ msgstr "" "`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。" #: ../../tutorial/controlflow.rst:164 -msgid "" -":keyword:`!break` and :keyword:`!continue` Statements, and :keyword:`!else` " -"Clauses on Loops" -msgstr "" -"迴圈內的 :keyword:`!break` 和 :keyword:`!continue` 陳述式及 :keyword:`!else` " -"子句" +msgid ":keyword:`!break` and :keyword:`!continue` Statements" +msgstr ":keyword:`!break` 和 :keyword:`!continue` 陳述式" #: ../../tutorial/controlflow.rst:166 msgid "" "The :keyword:`break` statement breaks out of the innermost enclosing :" -"keyword:`for` or :keyword:`while` loop." +"keyword:`for` or :keyword:`while` loop::" msgstr "" ":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` 或 :keyword:" -"`while` 迴圈。" +"`while` 迴圈: ::" #: ../../tutorial/controlflow.rst:169 msgid "" -"A :keyword:`!for` or :keyword:`!while` loop can include an :keyword:`!else` " -"clause." +">>> for n in range(2, 10):\n" +"... for x in range(2, n):\n" +"... if n % x == 0:\n" +"... print(f\"{n} equals {x} * {n//x}\")\n" +"... break\n" +"...\n" +"4 equals 2 * 2\n" +"6 equals 2 * 3\n" +"8 equals 2 * 4\n" +"9 equals 3 * 3" msgstr "" -":keyword:`!for` 和 :keyword:`!while` 迴圈可帶有一個 :keyword:`!else` 子句" +">>> for n in range(2, 10):\n" +"... for x in range(2, n):\n" +"... if n % x == 0:\n" +"... print(f\"{n} equals {x} * {n//x}\")\n" +"... break\n" +"...\n" +"4 equals 2 * 2\n" +"6 equals 2 * 3\n" +"8 equals 2 * 4\n" +"9 equals 3 * 3" -#: ../../tutorial/controlflow.rst:171 +#: ../../tutorial/controlflow.rst:180 +msgid "" +"The :keyword:`continue` statement continues with the next iteration of the " +"loop::" +msgstr ":keyword:`continue` 陳述式讓所屬的迴圈繼續執行下個疊代: ::" + +#: ../../tutorial/controlflow.rst:183 +msgid "" +">>> for num in range(2, 10):\n" +"... if num % 2 == 0:\n" +"... print(f\"Found an even number {num}\")\n" +"... continue\n" +"... print(f\"Found an odd number {num}\")\n" +"...\n" +"Found an even number 2\n" +"Found an odd number 3\n" +"Found an even number 4\n" +"Found an odd number 5\n" +"Found an even number 6\n" +"Found an odd number 7\n" +"Found an even number 8\n" +"Found an odd number 9" +msgstr "" +">>> for num in range(2, 10):\n" +"... if num % 2 == 0:\n" +"... print(f\"Found an even number {num}\")\n" +"... continue\n" +"... print(f\"Found an odd number {num}\")\n" +"...\n" +"Found an even number 2\n" +"Found an odd number 3\n" +"Found an even number 4\n" +"Found an odd number 5\n" +"Found an even number 6\n" +"Found an odd number 7\n" +"Found an even number 8\n" +"Found an odd number 9" + +#: ../../tutorial/controlflow.rst:201 +msgid ":keyword:`!else` Clauses on Loops" +msgstr "迴圈的 :keyword:`!else` 子句" + +#: ../../tutorial/controlflow.rst:203 +msgid "" +"In a :keyword:`!for` or :keyword:`!while` loop the :keyword:`!break` " +"statement may be paired with an :keyword:`!else` clause. If the loop " +"finishes without executing the :keyword:`!break`, the :keyword:`!else` " +"clause executes." +msgstr "" + +#: ../../tutorial/controlflow.rst:207 msgid "" "In a :keyword:`for` loop, the :keyword:`!else` clause is executed after the " -"loop reaches its final iteration." +"loop finishes its final iteration, that is, if no break occurred." msgstr "" -"在 :keyword:`for` 迴圈中,:keyword:`!else` 子句會在迴圈到達最終的疊代後執行。" +"在 :keyword:`for` 迴圈中,:keyword:`!else` 子句會在迴圈完成最終的疊代後執行。" -#: ../../tutorial/controlflow.rst:174 +#: ../../tutorial/controlflow.rst:210 msgid "" "In a :keyword:`while` loop, it's executed after the loop's condition becomes " "false." msgstr "在 :keyword:`while` 迴圈中,它會在迴圈條件變為 false 後執行。" -#: ../../tutorial/controlflow.rst:176 +#: ../../tutorial/controlflow.rst:212 msgid "" "In either kind of loop, the :keyword:`!else` clause is **not** executed if " -"the loop was terminated by a :keyword:`break`." +"the loop was terminated by a :keyword:`break`. Of course, other ways of " +"ending the loop early, such as a :keyword:`return` or a raised exception, " +"will also skip execution of the :keyword:`else` clause." msgstr "" "在任何一種迴圈中,如果迴圈由 :keyword:`break` 終止,則不會執行 :keyword:`!" -"else` 子句。" +"else` 子句。當然其他提早結束迴圈的方式(例如 :keyword:`return` 或引發例外)也" +"會跳過 :keyword:`else` 子句的執行。" -#: ../../tutorial/controlflow.rst:179 +#: ../../tutorial/controlflow.rst:217 msgid "" "This is exemplified in the following :keyword:`!for` loop, which searches " "for prime numbers::" msgstr "下面的 :keyword:`!for` 迴圈對此進行了舉例說明,該迴圈用以搜索質數: ::" -#: ../../tutorial/controlflow.rst:182 +#: ../../tutorial/controlflow.rst:220 msgid "" ">>> for n in range(2, 10):\n" "... for x in range(2, n):\n" @@ -363,74 +429,43 @@ msgid "" "9 equals 3 * 3" msgstr "" -#: ../../tutorial/controlflow.rst:200 +#: ../../tutorial/controlflow.rst:238 msgid "" "(Yes, this is the correct code. Look closely: the ``else`` clause belongs " -"to the :keyword:`for` loop, **not** the :keyword:`if` statement.)" +"to the ``for`` loop, **not** the ``if`` statement.)" msgstr "" -"(沒錯,這是正確的程式碼。請看仔細:``else`` 子句屬於 :keyword:`for` 迴圈,**" -"並非** :keyword:`if` 陳述式。)" +"(沒錯,這是正確的程式碼。請看仔細:``else`` 子句屬於 ``for`` 迴圈,**並非** " +"``if`` 陳述式。)" -#: ../../tutorial/controlflow.rst:203 -msgid "" -"When used with a loop, the ``else`` clause has more in common with the " -"``else`` clause of a :keyword:`try` statement than it does with that of :" -"keyword:`if` statements: a :keyword:`try` statement's ``else`` clause runs " -"when no exception occurs, and a loop's ``else`` clause runs when no " -"``break`` occurs. For more on the :keyword:`!try` statement and exceptions, " -"see :ref:`tut-handling`." -msgstr "" -"當 ``else`` 子句用於迴圈時,相較於搭配 :keyword:`if` 陳述式使用,它的行為與 :" -"keyword:`try` 陳述式中的 ``else`` 子句更為相似::keyword:`try` 陳述式的 " -"``else`` 子句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有" -"任何 ``break`` 發生時執行。更多有關 :keyword:`!try` 陳述式和例外的介紹,見" -"\\ :ref:`tut-handling`。" - -#: ../../tutorial/controlflow.rst:210 +#: ../../tutorial/controlflow.rst:241 msgid "" -"The :keyword:`continue` statement, also borrowed from C, continues with the " -"next iteration of the loop::" +"One way to think of the else clause is to imagine it paired with the ``if`` " +"inside the loop. As the loop executes, it will run a sequence like if/if/if/" +"else. The ``if`` is inside the loop, encountered a number of times. If the " +"condition is ever true, a ``break`` will happen. If the condition is never " +"true, the ``else`` clause outside the loop will execute." msgstr "" -":keyword:`continue` 陳述式,亦承襲於 C 語言,讓所屬的迴圈繼續執行下個疊" -"代: ::" -#: ../../tutorial/controlflow.rst:213 +#: ../../tutorial/controlflow.rst:247 msgid "" -">>> for num in range(2, 10):\n" -"... if num % 2 == 0:\n" -"... print(\"Found an even number\", num)\n" -"... continue\n" -"... print(\"Found an odd number\", num)\n" -"...\n" -"Found an even number 2\n" -"Found an odd number 3\n" -"Found an even number 4\n" -"Found an odd number 5\n" -"Found an even number 6\n" -"Found an odd number 7\n" -"Found an even number 8\n" -"Found an odd number 9" -msgstr "" -">>> for num in range(2, 10):\n" -"... if num % 2 == 0:\n" -"... print(\"Found an even number\", num)\n" -"... continue\n" -"... print(\"Found an odd number\", num)\n" -"...\n" -"Found an even number 2\n" -"Found an odd number 3\n" -"Found an even number 4\n" -"Found an odd number 5\n" -"Found an even number 6\n" -"Found an odd number 7\n" -"Found an even number 8\n" -"Found an odd number 9" - -#: ../../tutorial/controlflow.rst:231 +"When used with a loop, the ``else`` clause has more in common with the " +"``else`` clause of a :keyword:`try` statement than it does with that of " +"``if`` statements: a ``try`` statement's ``else`` clause runs when no " +"exception occurs, and a loop's ``else`` clause runs when no ``break`` " +"occurs. For more on the ``try`` statement and exceptions, see :ref:`tut-" +"handling`." +msgstr "" +"當 ``else`` 子句用於迴圈時,相較於搭配 ``if`` 陳述式使用,它的行為與 :" +"keyword:`try` 陳述式中的 ``else`` 子句更為相似:``try`` 陳述式的 ``else`` 子" +"句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有任何 " +"``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見\\ :ref:`tut-" +"handling`。" + +#: ../../tutorial/controlflow.rst:256 msgid ":keyword:`!pass` Statements" msgstr ":keyword:`!pass` 陳述式" -#: ../../tutorial/controlflow.rst:233 +#: ../../tutorial/controlflow.rst:258 msgid "" "The :keyword:`pass` statement does nothing. It can be used when a statement " "is required syntactically but the program requires no action. For example::" @@ -438,18 +473,18 @@ msgstr "" ":keyword:`pass` 陳述式不執行任何動作。它可用在語法上需要一個陳述式但程式不需" "要執行任何動作的時候。例如: ::" -#: ../../tutorial/controlflow.rst:236 +#: ../../tutorial/controlflow.rst:261 msgid "" ">>> while True:\n" "... pass # Busy-wait for keyboard interrupt (Ctrl+C)\n" "..." msgstr "" -#: ../../tutorial/controlflow.rst:240 +#: ../../tutorial/controlflow.rst:265 msgid "This is commonly used for creating minimal classes::" msgstr "這經常用於建立簡單的 class(類別): ::" -#: ../../tutorial/controlflow.rst:242 +#: ../../tutorial/controlflow.rst:267 msgid "" ">>> class MyEmptyClass:\n" "... pass\n" @@ -459,7 +494,7 @@ msgstr "" "... pass\n" "..." -#: ../../tutorial/controlflow.rst:246 +#: ../../tutorial/controlflow.rst:271 msgid "" "Another place :keyword:`pass` can be used is as a place-holder for a " "function or conditional body when you are working on new code, allowing you " @@ -469,18 +504,18 @@ msgstr "" ":keyword:`pass` 亦可作為一個函式或條件判斷主體的預留位置,在你撰寫新的程式碼" "時讓你保持在更抽象的思維層次。:keyword:`!pass` 會直接被忽略: ::" -#: ../../tutorial/controlflow.rst:250 +#: ../../tutorial/controlflow.rst:275 msgid "" ">>> def initlog(*args):\n" "... pass # Remember to implement this!\n" "..." msgstr "" -#: ../../tutorial/controlflow.rst:258 +#: ../../tutorial/controlflow.rst:283 msgid ":keyword:`!match` Statements" msgstr ":keyword:`!match` 陳述式" -#: ../../tutorial/controlflow.rst:260 +#: ../../tutorial/controlflow.rst:285 msgid "" "A :keyword:`match` statement takes an expression and compares its value to " "successive patterns given as one or more case blocks. This is superficially " @@ -496,14 +531,14 @@ msgstr "" "言中的模式匹配 (pattern matching) 更為相近。只有第一個匹配成功的模式會被執" "行,而它也可以將成分(序列元素或物件屬性)從值中提取到變數中。" -#: ../../tutorial/controlflow.rst:268 +#: ../../tutorial/controlflow.rst:293 msgid "" "The simplest form compares a subject value against one or more literals::" msgstr "" "最簡單的形式,是將一個主題值 (subject value) 與一個或多個字面值 (literal) 進" "行比較: ::" -#: ../../tutorial/controlflow.rst:270 +#: ../../tutorial/controlflow.rst:295 msgid "" "def http_error(status):\n" " match status:\n" @@ -527,7 +562,7 @@ msgstr "" " case _:\n" " return \"Something's wrong with the internet\"" -#: ../../tutorial/controlflow.rst:281 +#: ../../tutorial/controlflow.rst:306 msgid "" "Note the last block: the \"variable name\" ``_`` acts as a *wildcard* and " "never fails to match. If no case matches, none of the branches is executed." @@ -535,12 +570,12 @@ msgstr "" "請注意最後一段:「變數名稱」\\ ``_`` 是作為\\ *通用字元 (wildcard)*\\ 的角" "色,且永遠不會匹配失敗。如果沒有 case 匹配成功,則不會執行任何的分支。" -#: ../../tutorial/controlflow.rst:284 +#: ../../tutorial/controlflow.rst:309 msgid "" "You can combine several literals in a single pattern using ``|`` (\"or\")::" msgstr "你可以使用 ``|``\\ (「或」)來將多個字面值組合在單一模式中: ::" -#: ../../tutorial/controlflow.rst:286 +#: ../../tutorial/controlflow.rst:311 msgid "" "case 401 | 403 | 404:\n" " return \"Not allowed\"" @@ -548,14 +583,14 @@ msgstr "" "case 401 | 403 | 404:\n" " return \"Not allowed\"" -#: ../../tutorial/controlflow.rst:289 +#: ../../tutorial/controlflow.rst:314 msgid "" "Patterns can look like unpacking assignments, and can be used to bind " "variables::" msgstr "" "模式可以看起來像是拆解賦值 (unpacking assignment),且可以用來連結變數: ::" -#: ../../tutorial/controlflow.rst:292 +#: ../../tutorial/controlflow.rst:317 msgid "" "# point is an (x, y) tuple\n" "match point:\n" @@ -571,7 +606,7 @@ msgid "" " raise ValueError(\"Not a point\")" msgstr "" -#: ../../tutorial/controlflow.rst:305 +#: ../../tutorial/controlflow.rst:330 msgid "" "Study that one carefully! The first pattern has two literals, and can be " "thought of as an extension of the literal pattern shown above. But the next " @@ -585,7 +620,7 @@ msgstr "" "(bind)* 了來自主題 (``point``) 的一個值。第四個模式會擷取兩個值,這使得它在概" "念上類似於拆解賦值 ``(x, y) = point``。" -#: ../../tutorial/controlflow.rst:312 +#: ../../tutorial/controlflow.rst:337 msgid "" "If you are using classes to structure your data you can use the class name " "followed by an argument list resembling a constructor, but with the ability " @@ -594,7 +629,7 @@ msgstr "" "如果你要用 class 來結構化你的資料,你可以使用該 class 的名稱加上一個引數列" "表,類似一個建構式 (constructor),但它能夠將屬性擷取到變數中: ::" -#: ../../tutorial/controlflow.rst:316 +#: ../../tutorial/controlflow.rst:341 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -632,7 +667,7 @@ msgstr "" " case _:\n" " print(\"Not a point\")" -#: ../../tutorial/controlflow.rst:334 +#: ../../tutorial/controlflow.rst:359 msgid "" "You can use positional parameters with some builtin classes that provide an " "ordering for their attributes (e.g. dataclasses). You can also define a " @@ -646,7 +681,7 @@ msgstr "" "``__match_args__``,來定義模式中屬性們的特定位置。如果它被設定為 (\"x\", " "\"y\"),則以下的模式都是等價的(且都會將屬性 ``y`` 連結到變數 ``var``): ::" -#: ../../tutorial/controlflow.rst:340 +#: ../../tutorial/controlflow.rst:365 msgid "" "Point(1, var)\n" "Point(1, y=var)\n" @@ -658,7 +693,7 @@ msgstr "" "Point(x=1, y=var)\n" "Point(y=var, x=1)" -#: ../../tutorial/controlflow.rst:345 +#: ../../tutorial/controlflow.rst:370 msgid "" "A recommended way to read patterns is to look at them as an extended form of " "what you would put on the left of an assignment, to understand which " @@ -674,7 +709,7 @@ msgstr "" "的 ``x=`` 及 ``y=``)或 class 名稱(由它們後面的 \"(...)\" 被辨識,如上面的 " "``Point``)則永遠無法被賦值。" -#: ../../tutorial/controlflow.rst:352 +#: ../../tutorial/controlflow.rst:377 msgid "" "Patterns can be arbitrarily nested. For example, if we have a short list of " "Points, with ``__match_args__`` added, we could match it like this::" @@ -682,7 +717,7 @@ msgstr "" "模式可以任意地被巢套 (nested)。例如,如果我們有一個由某些點所組成的簡短 " "list,我們就可以像這樣加入 ``__match_args__`` 來對它進行匹配: ::" -#: ../../tutorial/controlflow.rst:355 +#: ../../tutorial/controlflow.rst:380 msgid "" "class Point:\n" " __match_args__ = ('x', 'y')\n" @@ -720,7 +755,7 @@ msgstr "" " case _:\n" " print(\"Something else\")" -#: ../../tutorial/controlflow.rst:373 +#: ../../tutorial/controlflow.rst:398 msgid "" "We can add an ``if`` clause to a pattern, known as a \"guard\". If the " "guard is false, ``match`` goes on to try the next case block. Note that " @@ -730,7 +765,7 @@ msgstr "" "則 ``match`` 會繼續嘗試下一個 case 區塊。請注意,值的擷取會發生在防護的評估之" "前: ::" -#: ../../tutorial/controlflow.rst:377 +#: ../../tutorial/controlflow.rst:402 msgid "" "match point:\n" " case Point(x, y) if x == y:\n" @@ -744,11 +779,11 @@ msgstr "" " case Point(x, y):\n" " print(f\"Not on the diagonal\")" -#: ../../tutorial/controlflow.rst:383 +#: ../../tutorial/controlflow.rst:408 msgid "Several other key features of this statement:" msgstr "此種陳述式的其他幾個重要特色:" -#: ../../tutorial/controlflow.rst:385 +#: ../../tutorial/controlflow.rst:410 msgid "" "Like unpacking assignments, tuple and list patterns have exactly the same " "meaning and actually match arbitrary sequences. An important exception is " @@ -757,7 +792,7 @@ msgstr "" "與拆解賦值的情況類似,tuple(元組)和 list 模式具有完全相同的意義,而且實際上" "可以匹配任意的序列。一個重要的例外,是它們不能匹配疊代器 (iterator) 或字串。" -#: ../../tutorial/controlflow.rst:389 +#: ../../tutorial/controlflow.rst:414 msgid "" "Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y, " "*rest)`` work similar to unpacking assignments. The name after ``*`` may " @@ -769,27 +804,27 @@ msgstr "" "``_``,所以 ``(x, y, *_)`` 會匹配一個至少兩項的序列,且不會連結那兩項以外的其" "餘項。" -#: ../../tutorial/controlflow.rst:394 +#: ../../tutorial/controlflow.rst:419 msgid "" "Mapping patterns: ``{\"bandwidth\": b, \"latency\": l}`` captures the " "``\"bandwidth\"`` and ``\"latency\"`` values from a dictionary. Unlike " "sequence patterns, extra keys are ignored. An unpacking like ``**rest`` is " "also supported. (But ``**_`` would be redundant, so it is not allowed.)" msgstr "" -"映射模式 (mapping pattern):``{\"bandwidth\": b, \"latency\": l}`` 能從一個 " +"對映模式 (mapping pattern):``{\"bandwidth\": b, \"latency\": l}`` 能從一個 " "dictionary(字典)中擷取 ``\"bandwidth\"`` 及 ``\"latency\"`` 的值。與序列模" "式不同,額外的鍵 (key) 會被忽略。一種像是 ``**rest`` 的拆解方式,也是可被支援" "的。(但 ``**_`` 則是多餘的做法,所以它並不被允許。)" -#: ../../tutorial/controlflow.rst:399 +#: ../../tutorial/controlflow.rst:424 msgid "Subpatterns may be captured using the ``as`` keyword::" msgstr "使用關鍵字 ``as`` 可以擷取子模式 (subpattern): ::" -#: ../../tutorial/controlflow.rst:401 +#: ../../tutorial/controlflow.rst:426 msgid "case (Point(x1, y1), Point(x2, y2) as p2): ..." msgstr "case (Point(x1, y1), Point(x2, y2) as p2): ..." -#: ../../tutorial/controlflow.rst:403 +#: ../../tutorial/controlflow.rst:428 msgid "" "will capture the second element of the input as ``p2`` (as long as the input " "is a sequence of two points)" @@ -797,7 +832,7 @@ msgstr "" "將會擷取輸入的第二個元素作為 ``p2``\\ (只要該輸入是一個由兩個點所組成的序" "列)。" -#: ../../tutorial/controlflow.rst:406 +#: ../../tutorial/controlflow.rst:431 msgid "" "Most literals are compared by equality, however the singletons ``True``, " "``False`` and ``None`` are compared by identity." @@ -805,7 +840,7 @@ msgstr "" "大部分的字面值是藉由相等性 (equality) 來比較,但是單例物件 (singleton) " "``True``、``False`` 和 ``None`` 是藉由標識值 (identity) 來比較。" -#: ../../tutorial/controlflow.rst:409 +#: ../../tutorial/controlflow.rst:434 msgid "" "Patterns may use named constants. These must be dotted names to prevent " "them from being interpreted as capture variable::" @@ -813,7 +848,7 @@ msgstr "" "模式可以使用附名常數 (named constant)。這些模式必須是點分隔名稱,以免它們被解" "釋為擷取變數: ::" -#: ../../tutorial/controlflow.rst:412 +#: ../../tutorial/controlflow.rst:437 msgid "" "from enum import Enum\n" "class Color(Enum):\n" @@ -847,24 +882,24 @@ msgstr "" " case Color.BLUE:\n" " print(\"I'm feeling the blues :(\")" -#: ../../tutorial/controlflow.rst:428 +#: ../../tutorial/controlflow.rst:453 msgid "" "For a more detailed explanation and additional examples, you can look into :" "pep:`636` which is written in a tutorial format." msgstr "" "關於更詳細的解釋和其他範例,你可以閱讀 :pep:`636`,它是以教學的格式編寫而成。" -#: ../../tutorial/controlflow.rst:434 +#: ../../tutorial/controlflow.rst:459 msgid "Defining Functions" msgstr "定義函式 (function)" -#: ../../tutorial/controlflow.rst:436 +#: ../../tutorial/controlflow.rst:461 msgid "" "We can create a function that writes the Fibonacci series to an arbitrary " "boundary::" msgstr "我們可以建立一個函式來產生費式數列到任何一個上界: ::" -#: ../../tutorial/controlflow.rst:439 +#: ../../tutorial/controlflow.rst:464 msgid "" ">>> def fib(n): # write Fibonacci series up to n\n" "... \"\"\"Print a Fibonacci series up to n.\"\"\"\n" @@ -879,7 +914,7 @@ msgid "" "0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597" msgstr "" -#: ../../tutorial/controlflow.rst:456 +#: ../../tutorial/controlflow.rst:481 msgid "" "The keyword :keyword:`def` introduces a function *definition*. It must be " "followed by the function name and the parenthesized list of formal " @@ -889,7 +924,7 @@ msgstr "" "關鍵字 :keyword:`def` 介紹一個函式的\\ *定義*。它之後必須連著該函式的名稱和置" "於括號之中的一串參數。自下一行起,所有縮排的陳述式成為該函式的主體。" -#: ../../tutorial/controlflow.rst:461 +#: ../../tutorial/controlflow.rst:486 msgid "" "The first statement of the function body can optionally be a string literal; " "this string literal is the function's documentation string, or :dfn:" @@ -905,7 +940,7 @@ msgstr "" "件,或讓使用者能以互動的方式在原始碼中瀏覽文件。在原始碼中加入 docstring 是個" "好慣例,應該養成這樣的習慣。" -#: ../../tutorial/controlflow.rst:468 +#: ../../tutorial/controlflow.rst:493 msgid "" "The *execution* of a function introduces a new symbol table used for the " "local variables of the function. More precisely, all variable assignments " @@ -926,7 +961,7 @@ msgstr "" "域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:" "`nonlocal` 陳述式中被定義)。" -#: ../../tutorial/controlflow.rst:479 +#: ../../tutorial/controlflow.rst:504 msgid "" "The actual parameters (arguments) to a function call are introduced in the " "local symbol table of the called function when it is called; thus, arguments " @@ -940,7 +975,7 @@ msgstr "" "永遠是一個物件的\\ *參照 (reference)*,而不是該物件的值)。 [#]_ 當一個函式呼" "叫別的函式或遞迴呼叫它自己時,在被呼叫的函式中會建立一個新的區域符號表。" -#: ../../tutorial/controlflow.rst:486 +#: ../../tutorial/controlflow.rst:511 msgid "" "A function definition associates the function name with the function object " "in the current symbol table. The interpreter recognizes the object pointed " @@ -951,7 +986,7 @@ msgstr "" "直譯器辨識為使用者自定函式 (user-defined function)。該值可以被指定給別的變數" "名,使該變數名也可以被當作函式使用。這是常見的重新命名方式: ::" -#: ../../tutorial/controlflow.rst:491 +#: ../../tutorial/controlflow.rst:516 msgid "" ">>> fib\n" "\n" @@ -965,7 +1000,7 @@ msgstr "" ">>> f(100)\n" "0 1 1 2 3 5 8 13 21 34 55 89" -#: ../../tutorial/controlflow.rst:497 +#: ../../tutorial/controlflow.rst:522 msgid "" "Coming from other languages, you might object that ``fib`` is not a function " "but a procedure since it doesn't return a value. In fact, even functions " @@ -980,7 +1015,7 @@ msgstr "" "亦有一個固定的回傳值。這個值稱為 ``None``\\ (它是一個內建名稱)。在直譯器中" "單獨使用 ``None`` 時,通常不會被顯示。你可以使用 :func:`print` 來看到它: ::" -#: ../../tutorial/controlflow.rst:504 +#: ../../tutorial/controlflow.rst:529 msgid "" ">>> fib(0)\n" ">>> print(fib(0))\n" @@ -990,13 +1025,13 @@ msgstr "" ">>> print(fib(0))\n" "None" -#: ../../tutorial/controlflow.rst:508 +#: ../../tutorial/controlflow.rst:533 msgid "" "It is simple to write a function that returns a list of the numbers of the " "Fibonacci series, instead of printing it::" msgstr "如果要寫一個函式回傳費式數列的 list 而不是直接印出它,這也很容易: ::" -#: ../../tutorial/controlflow.rst:511 +#: ../../tutorial/controlflow.rst:536 msgid "" ">>> def fib2(n): # return Fibonacci series up to n\n" "... \"\"\"Return a list containing the Fibonacci series up to n.\"\"\"\n" @@ -1012,11 +1047,11 @@ msgid "" "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]" msgstr "" -#: ../../tutorial/controlflow.rst:524 +#: ../../tutorial/controlflow.rst:549 msgid "This example, as usual, demonstrates some new Python features:" msgstr "這個例子一樣示範了一些新的 Python 特性:" -#: ../../tutorial/controlflow.rst:526 +#: ../../tutorial/controlflow.rst:551 msgid "" "The :keyword:`return` statement returns with a value from a function. :" "keyword:`!return` without an expression argument returns ``None``. Falling " @@ -1026,7 +1061,7 @@ msgstr "" "不外加一個運算式作為引數時會回傳 ``None``。一個函式執行到結束也會回傳 " "``None``。" -#: ../../tutorial/controlflow.rst:530 +#: ../../tutorial/controlflow.rst:555 msgid "" "The statement ``result.append(a)`` calls a *method* of the list object " "``result``. A method is a function that 'belongs' to an object and is named " @@ -1049,22 +1084,22 @@ msgstr "" "義在 list 物件中;它會在該 list 的末端加入一個新的元素。這個例子等同於 " "``result = result + [a]``,但更有效率。" -#: ../../tutorial/controlflow.rst:545 +#: ../../tutorial/controlflow.rst:570 msgid "More on Defining Functions" msgstr "深入了解函式定義" -#: ../../tutorial/controlflow.rst:547 +#: ../../tutorial/controlflow.rst:572 msgid "" "It is also possible to define functions with a variable number of arguments. " "There are three forms, which can be combined." msgstr "" "定義函式時使用的引數 (argument) 數量是可變的。總共有三種可以組合使用的形式。" -#: ../../tutorial/controlflow.rst:554 +#: ../../tutorial/controlflow.rst:579 msgid "Default Argument Values" msgstr "預設引數值" -#: ../../tutorial/controlflow.rst:556 +#: ../../tutorial/controlflow.rst:581 msgid "" "The most useful form is to specify a default value for one or more " "arguments. This creates a function that can be called with fewer arguments " @@ -1073,7 +1108,7 @@ msgstr "" "為一個或多個引數指定預設值是很有用的方式。函式建立後,可以用比定義時更少的引" "數呼叫該函式。例如: ::" -#: ../../tutorial/controlflow.rst:560 +#: ../../tutorial/controlflow.rst:585 msgid "" "def ask_ok(prompt, retries=4, reminder='Please try again!'):\n" " while True:\n" @@ -1099,22 +1134,22 @@ msgstr "" " raise ValueError('invalid user response')\n" " print(reminder)" -#: ../../tutorial/controlflow.rst:572 +#: ../../tutorial/controlflow.rst:597 msgid "This function can be called in several ways:" msgstr "該函式可以用以下幾種方式被呼叫:" -#: ../../tutorial/controlflow.rst:574 +#: ../../tutorial/controlflow.rst:599 msgid "" "giving only the mandatory argument: ``ask_ok('Do you really want to quit?')``" msgstr "只給必要引數:``ask_ok('Do you really want to quit?')``" -#: ../../tutorial/controlflow.rst:576 +#: ../../tutorial/controlflow.rst:601 msgid "" "giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', " "2)``" msgstr "給予一個選擇性引數:``ask_ok('OK to overwrite the file?', 2)``" -#: ../../tutorial/controlflow.rst:578 +#: ../../tutorial/controlflow.rst:603 msgid "" "or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come " "on, only yes or no!')``" @@ -1122,19 +1157,19 @@ msgstr "" "給予所有引數:``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or " "no!')``" -#: ../../tutorial/controlflow.rst:581 +#: ../../tutorial/controlflow.rst:606 msgid "" "This example also introduces the :keyword:`in` keyword. This tests whether " "or not a sequence contains a certain value." msgstr "此例也使用了關鍵字 :keyword:`in`,用於測試序列中是否包含某個特定值。" -#: ../../tutorial/controlflow.rst:584 +#: ../../tutorial/controlflow.rst:609 msgid "" "The default values are evaluated at the point of function definition in the " "*defining* scope, so that ::" msgstr "預設值是在函式定義當下,於\\ *定義時*\\ 的作用域中求值,所以: ::" -#: ../../tutorial/controlflow.rst:587 +#: ../../tutorial/controlflow.rst:612 msgid "" "i = 5\n" "\n" @@ -1152,11 +1187,11 @@ msgstr "" "i = 6\n" "f()" -#: ../../tutorial/controlflow.rst:595 +#: ../../tutorial/controlflow.rst:620 msgid "will print ``5``." msgstr "將會輸出 ``5``。" -#: ../../tutorial/controlflow.rst:597 +#: ../../tutorial/controlflow.rst:622 msgid "" "**Important warning:** The default value is evaluated only once. This makes " "a difference when the default is a mutable object such as a list, " @@ -1167,7 +1202,7 @@ msgstr "" "(字典)或許多類別實例時,會產生不同的結果。例如,以下函式於後續呼叫時會累積" "曾經傳遞的引數: ::" -#: ../../tutorial/controlflow.rst:602 +#: ../../tutorial/controlflow.rst:627 msgid "" "def f(a, L=[]):\n" " L.append(a)\n" @@ -1185,11 +1220,11 @@ msgstr "" "print(f(2))\n" "print(f(3))" -#: ../../tutorial/controlflow.rst:610 +#: ../../tutorial/controlflow.rst:635 msgid "This will print ::" msgstr "將會輸出: ::" -#: ../../tutorial/controlflow.rst:612 +#: ../../tutorial/controlflow.rst:637 msgid "" "[1]\n" "[1, 2]\n" @@ -1199,13 +1234,13 @@ msgstr "" "[1, 2]\n" "[1, 2, 3]" -#: ../../tutorial/controlflow.rst:616 +#: ../../tutorial/controlflow.rst:641 msgid "" "If you don't want the default to be shared between subsequent calls, you can " "write the function like this instead::" msgstr "如果不想在後續呼叫之間共用預設值,應以如下方式編寫函式:" -#: ../../tutorial/controlflow.rst:619 +#: ../../tutorial/controlflow.rst:644 msgid "" "def f(a, L=None):\n" " if L is None:\n" @@ -1219,11 +1254,11 @@ msgstr "" " L.append(a)\n" " return L" -#: ../../tutorial/controlflow.rst:629 +#: ../../tutorial/controlflow.rst:654 msgid "Keyword Arguments" msgstr "關鍵字引數" -#: ../../tutorial/controlflow.rst:631 +#: ../../tutorial/controlflow.rst:656 msgid "" "Functions can also be called using :term:`keyword arguments ` of the form ``kwarg=value``. For instance, the following " @@ -1232,7 +1267,7 @@ msgstr "" "函式也可以使用\\ :term:`關鍵字引數 `,以 ``kwarg=value`` 的" "形式呼叫。舉例來說,以下函式: ::" -#: ../../tutorial/controlflow.rst:634 +#: ../../tutorial/controlflow.rst:659 msgid "" "def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):\n" " print(\"-- This parrot wouldn't\", action, end=' ')\n" @@ -1246,7 +1281,7 @@ msgstr "" " print(\"-- Lovely plumage, the\", type)\n" " print(\"-- It's\", state, \"!\")" -#: ../../tutorial/controlflow.rst:640 +#: ../../tutorial/controlflow.rst:665 msgid "" "accepts one required argument (``voltage``) and three optional arguments " "(``state``, ``action``, and ``type``). This function can be called in any " @@ -1255,7 +1290,7 @@ msgstr "" "接受一個必要引數 (``voltage``) 和三個選擇性引數 (``state``,``action``,和 " "``type``)。該函式可用下列任一方式呼叫: ::" -#: ../../tutorial/controlflow.rst:644 +#: ../../tutorial/controlflow.rst:669 msgid "" "parrot(1000) # 1 positional " "argument\n" @@ -1268,11 +1303,11 @@ msgid "" "keyword" msgstr "" -#: ../../tutorial/controlflow.rst:651 +#: ../../tutorial/controlflow.rst:676 msgid "but all the following calls would be invalid::" msgstr "但以下呼叫方式都無效: ::" -#: ../../tutorial/controlflow.rst:653 +#: ../../tutorial/controlflow.rst:678 msgid "" "parrot() # required argument missing\n" "parrot(voltage=5.0, 'dead') # non-keyword argument after a keyword " @@ -1281,7 +1316,7 @@ msgid "" "parrot(actor='John Cleese') # unknown keyword argument" msgstr "" -#: ../../tutorial/controlflow.rst:658 +#: ../../tutorial/controlflow.rst:683 msgid "" "In a function call, keyword arguments must follow positional arguments. All " "the keyword arguments passed must match one of the arguments accepted by the " @@ -1297,7 +1332,7 @@ msgstr "" "則也包括必要引數,(\\ ``parrot(voltage=1000)`` 也有效)。一個引數不可多次被" "賦值,下面就是一個因此限制而無效的例子: ::" -#: ../../tutorial/controlflow.rst:666 +#: ../../tutorial/controlflow.rst:691 msgid "" ">>> def function(a):\n" "... pass\n" @@ -1315,7 +1350,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: function() got multiple values for argument 'a'" -#: ../../tutorial/controlflow.rst:674 +#: ../../tutorial/controlflow.rst:699 msgid "" "When a final formal parameter of the form ``**name`` is present, it receives " "a dictionary (see :ref:`typesmapping`) containing all keyword arguments " @@ -1331,7 +1366,7 @@ msgstr "" "個 :ref:`tuple `,該 tuple 包含一般參數以外的位置引數(\\ " "``*name`` 必須出現在 ``**name`` 前面)。例如,若我們定義這樣的函式: ::" -#: ../../tutorial/controlflow.rst:682 +#: ../../tutorial/controlflow.rst:707 msgid "" "def cheeseshop(kind, *arguments, **keywords):\n" " print(\"-- Do you have any\", kind, \"?\")\n" @@ -1351,11 +1386,11 @@ msgstr "" " for kw in keywords:\n" " print(kw, \":\", keywords[kw])" -#: ../../tutorial/controlflow.rst:691 +#: ../../tutorial/controlflow.rst:716 msgid "It could be called like this::" msgstr "它可以被如此呼叫: ::" -#: ../../tutorial/controlflow.rst:693 +#: ../../tutorial/controlflow.rst:718 msgid "" "cheeseshop(\"Limburger\", \"It's very runny, sir.\",\n" " \"It's really very, VERY runny, sir.\",\n" @@ -1369,11 +1404,11 @@ msgstr "" " client=\"John Cleese\",\n" " sketch=\"Cheese Shop Sketch\")" -#: ../../tutorial/controlflow.rst:699 +#: ../../tutorial/controlflow.rst:724 msgid "and of course it would print:" msgstr "輸出結果如下: ::" -#: ../../tutorial/controlflow.rst:701 +#: ../../tutorial/controlflow.rst:726 msgid "" "-- Do you have any Limburger ?\n" "-- I'm sorry, we're all out of Limburger\n" @@ -1393,17 +1428,17 @@ msgstr "" "client : John Cleese\n" "sketch : Cheese Shop Sketch" -#: ../../tutorial/controlflow.rst:712 +#: ../../tutorial/controlflow.rst:737 msgid "" "Note that the order in which the keyword arguments are printed is guaranteed " "to match the order in which they were provided in the function call." msgstr "注意,關鍵字引數的輸出順序與呼叫函式時被提供的順序必定一致。" -#: ../../tutorial/controlflow.rst:716 +#: ../../tutorial/controlflow.rst:741 msgid "Special parameters" msgstr "特殊參數" -#: ../../tutorial/controlflow.rst:718 +#: ../../tutorial/controlflow.rst:743 msgid "" "By default, arguments may be passed to a Python function either by position " "or explicitly by keyword. For readability and performance, it makes sense to " @@ -1415,11 +1450,11 @@ msgstr "" "及效能,限制引數的傳遞方式是合理的,如此,開發者只需查看函式定義,即可確定各" "項目是按位置,按位置或關鍵字,還是按關鍵字傳遞。" -#: ../../tutorial/controlflow.rst:724 +#: ../../tutorial/controlflow.rst:749 msgid "A function definition may look like:" msgstr "函式定義可能如以下樣式:" -#: ../../tutorial/controlflow.rst:726 +#: ../../tutorial/controlflow.rst:751 msgid "" "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):\n" " ----------- ---------- ----------\n" @@ -1435,7 +1470,7 @@ msgstr "" " | - Keyword only\n" " -- Positional only" -#: ../../tutorial/controlflow.rst:735 +#: ../../tutorial/controlflow.rst:760 msgid "" "where ``/`` and ``*`` are optional. If used, these symbols indicate the kind " "of parameter by how the arguments may be passed to the function: positional-" @@ -1446,22 +1481,22 @@ msgstr "" "類:僅限位置、位置或關鍵字、僅限關鍵字。關鍵字參數也稱為附名參數 (named " "parameters)。" -#: ../../tutorial/controlflow.rst:742 +#: ../../tutorial/controlflow.rst:767 msgid "Positional-or-Keyword Arguments" msgstr "位置或關鍵字引數 (Positional-or-Keyword Arguments)" -#: ../../tutorial/controlflow.rst:744 +#: ../../tutorial/controlflow.rst:769 msgid "" "If ``/`` and ``*`` are not present in the function definition, arguments may " "be passed to a function by position or by keyword." msgstr "" "若函式定義中未使用 ``/`` 和 ``*`` 時,引數可以按位置或關鍵字傳遞給函式。" -#: ../../tutorial/controlflow.rst:749 +#: ../../tutorial/controlflow.rst:774 msgid "Positional-Only Parameters" msgstr "僅限位置參數 (Positional-Only Parameters)" -#: ../../tutorial/controlflow.rst:751 +#: ../../tutorial/controlflow.rst:776 msgid "" "Looking at this in a bit more detail, it is possible to mark certain " "parameters as *positional-only*. If *positional-only*, the parameters' order " @@ -1476,17 +1511,17 @@ msgstr "" "``\\ (斜線)之前。``/`` 用於在邏輯上分開僅限位置參數與其餘參數。如果函式定義" "中沒有 ``/``,則表示沒有任何僅限位置參數。" -#: ../../tutorial/controlflow.rst:759 +#: ../../tutorial/controlflow.rst:784 msgid "" "Parameters following the ``/`` may be *positional-or-keyword* or *keyword-" "only*." msgstr "``/`` 後面的參數可以是\\ *位置或關鍵字*\\ 或\\ *僅限關鍵字*\\ 參數。" -#: ../../tutorial/controlflow.rst:763 +#: ../../tutorial/controlflow.rst:788 msgid "Keyword-Only Arguments" msgstr "僅限關鍵字引數 (Keyword-Only Arguments)" -#: ../../tutorial/controlflow.rst:765 +#: ../../tutorial/controlflow.rst:790 msgid "" "To mark parameters as *keyword-only*, indicating the parameters must be " "passed by keyword argument, place an ``*`` in the arguments list just before " @@ -1495,17 +1530,17 @@ msgstr "" "要把參數標記為\\ *僅限關鍵字*,表明參數必須以關鍵字引數傳遞,必須在引數列表中" "第一個\\ *僅限關鍵字*\\ 參數前放上 ``*``。" -#: ../../tutorial/controlflow.rst:771 +#: ../../tutorial/controlflow.rst:796 msgid "Function Examples" msgstr "函式範例" -#: ../../tutorial/controlflow.rst:773 +#: ../../tutorial/controlflow.rst:798 msgid "" "Consider the following example function definitions paying close attention " "to the markers ``/`` and ``*``::" msgstr "請看以下的函式定義範例,注意 ``/`` 和 ``*`` 記號: ::" -#: ../../tutorial/controlflow.rst:776 +#: ../../tutorial/controlflow.rst:801 msgid "" ">>> def standard_arg(arg):\n" "... print(arg)\n" @@ -1531,7 +1566,7 @@ msgstr "" ">>> def combined_example(pos_only, /, standard, *, kwd_only):\n" "... print(pos_only, standard, kwd_only)" -#: ../../tutorial/controlflow.rst:789 +#: ../../tutorial/controlflow.rst:814 msgid "" "The first function definition, ``standard_arg``, the most familiar form, " "places no restrictions on the calling convention and arguments may be passed " @@ -1540,7 +1575,7 @@ msgstr "" "第一個函式定義 ``standard_arg`` 是我們最熟悉的形式,對呼叫方式沒有任何限制," "可以按位置或關鍵字傳遞引數: ::" -#: ../../tutorial/controlflow.rst:793 +#: ../../tutorial/controlflow.rst:818 msgid "" ">>> standard_arg(2)\n" "2\n" @@ -1554,14 +1589,14 @@ msgstr "" ">>> standard_arg(arg=2)\n" "2" -#: ../../tutorial/controlflow.rst:799 +#: ../../tutorial/controlflow.rst:824 msgid "" "The second function ``pos_only_arg`` is restricted to only use positional " "parameters as there is a ``/`` in the function definition::" msgstr "" "第二個函式 ``pos_only_arg`` 的函式定義中有 ``/``,因此僅限使用位置參數: ::" -#: ../../tutorial/controlflow.rst:802 +#: ../../tutorial/controlflow.rst:827 msgid "" ">>> pos_only_arg(1)\n" "1\n" @@ -1581,14 +1616,14 @@ msgstr "" "TypeError: pos_only_arg() got some positional-only arguments passed as " "keyword arguments: 'arg'" -#: ../../tutorial/controlflow.rst:810 +#: ../../tutorial/controlflow.rst:835 msgid "" "The third function ``kwd_only_args`` only allows keyword arguments as " "indicated by a ``*`` in the function definition::" msgstr "" "第三個函式 ``kwd_only_args`` 的函式定義透過 ``*`` 表明僅限關鍵字引數: ::" -#: ../../tutorial/controlflow.rst:813 +#: ../../tutorial/controlflow.rst:838 msgid "" ">>> kwd_only_arg(3)\n" "Traceback (most recent call last):\n" @@ -1606,13 +1641,13 @@ msgstr "" ">>> kwd_only_arg(arg=3)\n" "3" -#: ../../tutorial/controlflow.rst:821 +#: ../../tutorial/controlflow.rst:846 msgid "" "And the last uses all three calling conventions in the same function " "definition::" msgstr "最後一個函式在同一個函式定義中,使用了全部三種呼叫方式: ::" -#: ../../tutorial/controlflow.rst:824 +#: ../../tutorial/controlflow.rst:849 msgid "" ">>> combined_example(1, 2, 3)\n" "Traceback (most recent call last):\n" @@ -1648,7 +1683,7 @@ msgstr "" "TypeError: combined_example() got some positional-only arguments passed as " "keyword arguments: 'pos_only'" -#: ../../tutorial/controlflow.rst:841 +#: ../../tutorial/controlflow.rst:866 msgid "" "Finally, consider this function definition which has a potential collision " "between the positional argument ``name`` and ``**kwds`` which has ``name`` " @@ -1657,7 +1692,7 @@ msgstr "" "最後,請看這個函式定義,如果 ``**kwds`` 內有 ``name`` 這個鍵,可能與位置引數 " "``name`` 產生潛在衝突: ::" -#: ../../tutorial/controlflow.rst:843 +#: ../../tutorial/controlflow.rst:868 msgid "" "def foo(name, **kwds):\n" " return 'name' in kwds" @@ -1665,7 +1700,7 @@ msgstr "" "def foo(name, **kwds):\n" " return 'name' in kwds" -#: ../../tutorial/controlflow.rst:846 +#: ../../tutorial/controlflow.rst:871 msgid "" "There is no possible call that will make it return ``True`` as the keyword " "``'name'`` will always bind to the first parameter. For example::" @@ -1673,7 +1708,7 @@ msgstr "" "呼叫該函式不可能回傳 ``True``,因為關鍵字 ``'name'`` 永遠是連結在第一個參數。" "例如: ::" -#: ../../tutorial/controlflow.rst:849 +#: ../../tutorial/controlflow.rst:874 msgid "" ">>> foo(1, **{'name': 2})\n" "Traceback (most recent call last):\n" @@ -1687,7 +1722,7 @@ msgstr "" "TypeError: foo() got multiple values for argument 'name'\n" ">>>" -#: ../../tutorial/controlflow.rst:855 +#: ../../tutorial/controlflow.rst:880 msgid "" "But using ``/`` (positional only arguments), it is possible since it allows " "``name`` as a positional argument and ``'name'`` as a key in the keyword " @@ -1696,7 +1731,7 @@ msgstr "" "使用 ``/``\\ (僅限位置引數)後,就可以了。函式定義會允許 ``name`` 當作位置引" "數,而 ``'name'`` 也可以當作關鍵字引數中的鍵: ::" -#: ../../tutorial/controlflow.rst:857 +#: ../../tutorial/controlflow.rst:882 msgid "" ">>> def foo(name, /, **kwds):\n" "... return 'name' in kwds\n" @@ -1710,31 +1745,31 @@ msgstr "" ">>> foo(1, **{'name': 2})\n" "True" -#: ../../tutorial/controlflow.rst:863 +#: ../../tutorial/controlflow.rst:888 msgid "" "In other words, the names of positional-only parameters can be used in " "``**kwds`` without ambiguity." msgstr "換句話說,僅限位置參數的名稱可以在 ``**kwds`` 中使用,而不產生歧義。" -#: ../../tutorial/controlflow.rst:868 +#: ../../tutorial/controlflow.rst:893 msgid "Recap" msgstr "回顧" -#: ../../tutorial/controlflow.rst:870 +#: ../../tutorial/controlflow.rst:895 msgid "" "The use case will determine which parameters to use in the function " "definition::" msgstr "此用例決定哪些參數可以用於函式定義: ::" -#: ../../tutorial/controlflow.rst:872 +#: ../../tutorial/controlflow.rst:897 msgid "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" msgstr "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" -#: ../../tutorial/controlflow.rst:874 +#: ../../tutorial/controlflow.rst:899 msgid "As guidance:" msgstr "說明:" -#: ../../tutorial/controlflow.rst:876 +#: ../../tutorial/controlflow.rst:901 msgid "" "Use positional-only if you want the name of the parameters to not be " "available to the user. This is useful when parameter names have no real " @@ -1746,7 +1781,7 @@ msgstr "" "想控制引數在函式呼叫的排列順序,或同時使用位置參數和任意關鍵字時,這種方式很" "有用。" -#: ../../tutorial/controlflow.rst:881 +#: ../../tutorial/controlflow.rst:906 msgid "" "Use keyword-only when names have meaning and the function definition is more " "understandable by being explicit with names or you want to prevent users " @@ -1755,7 +1790,7 @@ msgstr "" "當參數名稱有意義,且明確的名稱可讓函式定義更易理解,或是你不希望使用者依賴引" "數被傳遞時的位置時,請使用僅限關鍵字。" -#: ../../tutorial/controlflow.rst:884 +#: ../../tutorial/controlflow.rst:909 msgid "" "For an API, use positional-only to prevent breaking API changes if the " "parameter's name is modified in the future." @@ -1763,11 +1798,11 @@ msgstr "" "對於應用程式介面 (API),使用僅限位置,以防止未來參數名稱被修改時造成 API 的中" "斷性變更。" -#: ../../tutorial/controlflow.rst:890 +#: ../../tutorial/controlflow.rst:915 msgid "Arbitrary Argument Lists" msgstr "任意引數列表 (Arbitrary Argument Lists)" -#: ../../tutorial/controlflow.rst:895 +#: ../../tutorial/controlflow.rst:920 msgid "" "Finally, the least frequently used option is to specify that a function can " "be called with an arbitrary number of arguments. These arguments will be " @@ -1778,7 +1813,7 @@ msgstr "" "數會被包裝進一個 tuple 中(詳見 :ref:`tut-tuples`\\ )。在可變數量的引數之" "前,可能有零個或多個普通引數: ::" -#: ../../tutorial/controlflow.rst:900 +#: ../../tutorial/controlflow.rst:925 msgid "" "def write_multiple_items(file, separator, *args):\n" " file.write(separator.join(args))" @@ -1786,7 +1821,7 @@ msgstr "" "def write_multiple_items(file, separator, *args):\n" " file.write(separator.join(args))" -#: ../../tutorial/controlflow.rst:904 +#: ../../tutorial/controlflow.rst:929 msgid "" "Normally, these *variadic* arguments will be last in the list of formal " "parameters, because they scoop up all remaining input arguments that are " @@ -1800,7 +1835,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:910 +#: ../../tutorial/controlflow.rst:935 msgid "" ">>> def concat(*args, sep=\"/\"):\n" "... return sep.join(args)\n" @@ -1818,11 +1853,11 @@ msgstr "" ">>> concat(\"earth\", \"mars\", \"venus\", sep=\".\")\n" "'earth.mars.venus'" -#: ../../tutorial/controlflow.rst:921 +#: ../../tutorial/controlflow.rst:946 msgid "Unpacking Argument Lists" msgstr "拆解引數列表(Unpacking Argument Lists)" -#: ../../tutorial/controlflow.rst:923 +#: ../../tutorial/controlflow.rst:948 msgid "" "The reverse situation occurs when the arguments are already in a list or " "tuple but need to be unpacked for a function call requiring separate " @@ -1836,7 +1871,7 @@ msgstr "" "的 *start* 和 *stop* 引數。如果這些引數不是分開的,則要在呼叫函式時,用 " "``*`` 運算子把引數們從 list 或 tuple 中拆解出來: ::" -#: ../../tutorial/controlflow.rst:930 +#: ../../tutorial/controlflow.rst:955 msgid "" ">>> list(range(3, 6)) # normal call with separate arguments\n" "[3, 4, 5]\n" @@ -1846,13 +1881,13 @@ msgid "" "[3, 4, 5]" msgstr "" -#: ../../tutorial/controlflow.rst:939 +#: ../../tutorial/controlflow.rst:964 msgid "" "In the same fashion, dictionaries can deliver keyword arguments with the " "``**``\\ -operator::" msgstr "同樣地,dictionary(字典)可以用 ``**`` 運算子傳遞關鍵字引數: ::" -#: ../../tutorial/controlflow.rst:942 +#: ../../tutorial/controlflow.rst:967 msgid "" ">>> def parrot(voltage, state='a stiff', action='voom'):\n" "... print(\"-- This parrot wouldn't\", action, end=' ')\n" @@ -1876,11 +1911,11 @@ msgstr "" "-- This parrot wouldn't VOOM if you put four million volts through it. E's " "bleedin' demised !" -#: ../../tutorial/controlflow.rst:955 +#: ../../tutorial/controlflow.rst:980 msgid "Lambda Expressions" msgstr "Lambda 運算式" -#: ../../tutorial/controlflow.rst:957 +#: ../../tutorial/controlflow.rst:982 msgid "" "Small anonymous functions can be created with the :keyword:`lambda` keyword. " "This function returns the sum of its two arguments: ``lambda a, b: a+b``. " @@ -1895,7 +1930,7 @@ msgstr "" "能是單一運算式。在語義上,它就是一個普通函式定義的語法糖 (syntactic sugar)。" "與巢狀函式定義一樣,lambda 函式可以從包含它的作用域中引用變數: ::" -#: ../../tutorial/controlflow.rst:965 +#: ../../tutorial/controlflow.rst:990 msgid "" ">>> def make_incrementor(n):\n" "... return lambda x: x + n\n" @@ -1915,7 +1950,7 @@ msgstr "" ">>> f(1)\n" "43" -#: ../../tutorial/controlflow.rst:974 +#: ../../tutorial/controlflow.rst:999 msgid "" "The above example uses a lambda expression to return a function. Another " "use is to pass a small function as an argument::" @@ -1923,7 +1958,7 @@ msgstr "" "上面的例子用 lambda 運算式回傳了一個函式。另外的用法是傳遞一個小函式當作引" "數: ::" -#: ../../tutorial/controlflow.rst:977 +#: ../../tutorial/controlflow.rst:1002 msgid "" ">>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]\n" ">>> pairs.sort(key=lambda pair: pair[1])\n" @@ -1935,17 +1970,17 @@ msgstr "" ">>> pairs\n" "[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]" -#: ../../tutorial/controlflow.rst:986 +#: ../../tutorial/controlflow.rst:1011 msgid "Documentation Strings" msgstr "說明文件字串 (Documentation Strings)" -#: ../../tutorial/controlflow.rst:993 +#: ../../tutorial/controlflow.rst:1018 msgid "" "Here are some conventions about the content and formatting of documentation " "strings." msgstr "以下是關於說明文件字串內容和格式的慣例。" -#: ../../tutorial/controlflow.rst:996 +#: ../../tutorial/controlflow.rst:1021 msgid "" "The first line should always be a short, concise summary of the object's " "purpose. For brevity, it should not explicitly state the object's name or " @@ -1957,7 +1992,7 @@ msgstr "" "的名稱或型別,因為有其他方法可以達到相同目的(除非該名稱剛好是一個描述函式運" "算的動詞)。這一行應以大寫字母開頭,以句號結尾。" -#: ../../tutorial/controlflow.rst:1002 +#: ../../tutorial/controlflow.rst:1027 msgid "" "If there are more lines in the documentation string, the second line should " "be blank, visually separating the summary from the rest of the description. " @@ -1967,7 +2002,7 @@ msgstr "" "文件字串為多行時,第二行應為空白行,在視覺上將摘要與其餘描述分開。後面幾行可" "包含一或多個段落,描述此物件的呼叫慣例、副作用等。" -#: ../../tutorial/controlflow.rst:1007 +#: ../../tutorial/controlflow.rst:1032 msgid "" "The Python parser does not strip indentation from multi-line string literals " "in Python, so tools that process documentation have to strip indentation if " @@ -1989,11 +2024,11 @@ msgstr "" "出現了,這些行的全部前導空白字元都應被去除。展開 tab 鍵後(通常為八個空格)," "應測試空白字元量是否等價。" -#: ../../tutorial/controlflow.rst:1019 +#: ../../tutorial/controlflow.rst:1044 msgid "Here is an example of a multi-line docstring::" msgstr "下面是多行說明字串的一個範例: ::" -#: ../../tutorial/controlflow.rst:1021 +#: ../../tutorial/controlflow.rst:1046 msgid "" ">>> def my_function():\n" "... \"\"\"Do nothing, but document it.\n" @@ -2008,11 +2043,11 @@ msgid "" " No, really, it doesn't do anything." msgstr "" -#: ../../tutorial/controlflow.rst:1037 +#: ../../tutorial/controlflow.rst:1062 msgid "Function Annotations" msgstr "函式註釋 (Function Annotations)" -#: ../../tutorial/controlflow.rst:1045 +#: ../../tutorial/controlflow.rst:1070 msgid "" ":ref:`Function annotations ` are completely optional metadata " "information about the types used by user-defined functions (see :pep:`3107` " @@ -2021,7 +2056,7 @@ msgstr "" ":ref:`函式註釋 `\\ 是選擇性的元資料(metadata)資訊,描述使用者定義" "函式所使用的型別(更多資訊詳見 :pep:`3107` 和 :pep:`484`\\ )。" -#: ../../tutorial/controlflow.rst:1049 +#: ../../tutorial/controlflow.rst:1074 msgid "" ":term:`Annotations ` are stored in the :attr:`!" "__annotations__` attribute of the function as a dictionary and have no " @@ -2039,7 +2074,7 @@ msgstr "" ">`` 文字接著一個運算式。以下範例註釋了一個必要引數、一個選擇性引數,以及回傳" "值: ::" -#: ../../tutorial/controlflow.rst:1058 +#: ../../tutorial/controlflow.rst:1083 msgid "" ">>> def f(ham: str, eggs: str = 'eggs') -> str:\n" "... print(\"Annotations:\", f.__annotations__)\n" @@ -2063,11 +2098,11 @@ msgstr "" "Arguments: spam eggs\n" "'spam and eggs'" -#: ../../tutorial/controlflow.rst:1071 +#: ../../tutorial/controlflow.rst:1096 msgid "Intermezzo: Coding Style" msgstr "間奏曲:程式碼風格 (Coding Style)" -#: ../../tutorial/controlflow.rst:1076 +#: ../../tutorial/controlflow.rst:1101 msgid "" "Now that you are about to write longer, more complex pieces of Python, it is " "a good time to talk about *coding style*. Most languages can be written (or " @@ -2080,7 +2115,7 @@ msgstr "" "式比其他的更具可讀性。能讓其他人輕鬆閱讀你的程式碼永遠是一個好主意,而使用優" "良的編碼樣式對此有極大的幫助。" -#: ../../tutorial/controlflow.rst:1082 +#: ../../tutorial/controlflow.rst:1107 msgid "" "For Python, :pep:`8` has emerged as the style guide that most projects " "adhere to; it promotes a very readable and eye-pleasing coding style. Every " @@ -2090,11 +2125,11 @@ msgstr "" "對於 Python,大多數的專案都遵循 :pep:`8` 的樣式指南;它推行的編碼樣式相當可讀" "且賞心悅目。每個 Python 開發者都應該花點時間研讀;這裡是該指南的核心重點:" -#: ../../tutorial/controlflow.rst:1087 +#: ../../tutorial/controlflow.rst:1112 msgid "Use 4-space indentation, and no tabs." msgstr "用 4 個空格縮排,不要用 tab 鍵。" -#: ../../tutorial/controlflow.rst:1089 +#: ../../tutorial/controlflow.rst:1114 msgid "" "4 spaces are a good compromise between small indentation (allows greater " "nesting depth) and large indentation (easier to read). Tabs introduce " @@ -2103,11 +2138,11 @@ msgstr "" "4 個空格是小縮排(容許更大的巢套深度)和大縮排(較易閱讀)之間的折衷方案。" "Tab 鍵會造成混亂,最好別用。" -#: ../../tutorial/controlflow.rst:1093 +#: ../../tutorial/controlflow.rst:1118 msgid "Wrap lines so that they don't exceed 79 characters." msgstr "換行,使一行不超過 79 個字元。" -#: ../../tutorial/controlflow.rst:1095 +#: ../../tutorial/controlflow.rst:1120 msgid "" "This helps users with small displays and makes it possible to have several " "code files side-by-side on larger displays." @@ -2115,21 +2150,21 @@ msgstr "" "換行能讓使用小顯示器的使用者方便閱讀,也可以在較大顯示器上並排陳列多個程式碼" "檔案。" -#: ../../tutorial/controlflow.rst:1098 +#: ../../tutorial/controlflow.rst:1123 msgid "" "Use blank lines to separate functions and classes, and larger blocks of code " "inside functions." msgstr "用空行分隔函式和 class(類別),及函式內較大塊的程式碼。" -#: ../../tutorial/controlflow.rst:1101 +#: ../../tutorial/controlflow.rst:1126 msgid "When possible, put comments on a line of their own." msgstr "如果可以,把註解放在單獨一行。" -#: ../../tutorial/controlflow.rst:1103 +#: ../../tutorial/controlflow.rst:1128 msgid "Use docstrings." msgstr "使用說明字串。" -#: ../../tutorial/controlflow.rst:1105 +#: ../../tutorial/controlflow.rst:1130 msgid "" "Use spaces around operators and after commas, but not directly inside " "bracketing constructs: ``a = f(1, 2) + g(3, 4)``." @@ -2137,7 +2172,7 @@ msgstr "" "運算子前後、逗號後要加空格,但不要直接放在括號內側:``a = f(1, 2) + g(3, " "4)``。" -#: ../../tutorial/controlflow.rst:1108 +#: ../../tutorial/controlflow.rst:1133 msgid "" "Name your classes and functions consistently; the convention is to use " "``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for " @@ -2149,7 +2184,7 @@ msgstr "" "底線)。永遠用 ``self`` 作為 method 第一個引數的名稱(關於 class 和 method," "詳見 :ref:`tut-firstclasses`\\ )。" -#: ../../tutorial/controlflow.rst:1113 +#: ../../tutorial/controlflow.rst:1138 msgid "" "Don't use fancy encodings if your code is meant to be used in international " "environments. Python's default, UTF-8, or even plain ASCII work best in any " @@ -2158,7 +2193,7 @@ msgstr "" "若程式碼是為了用於國際環境時,不要用花俏的編碼。Python 預設的 UTF-8 或甚至普" "通的 ASCII,就可以勝任各種情況。" -#: ../../tutorial/controlflow.rst:1117 +#: ../../tutorial/controlflow.rst:1142 msgid "" "Likewise, don't use non-ASCII characters in identifiers if there is only the " "slightest chance people speaking a different language will read or maintain " @@ -2167,11 +2202,11 @@ msgstr "" "同樣地,若不同語言使用者閱讀或維護程式碼的可能性微乎其微,就不要在命名時使用" "非 ASCII 字元。" -#: ../../tutorial/controlflow.rst:1123 +#: ../../tutorial/controlflow.rst:1148 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/controlflow.rst:1124 +#: ../../tutorial/controlflow.rst:1149 msgid "" "Actually, *call by object reference* would be a better description, since if " "a mutable object is passed, the caller will see any changes the callee makes " @@ -2189,54 +2224,60 @@ msgstr "statement(陳述式)" msgid "for" msgstr "for" -#: ../../tutorial/controlflow.rst:451 ../../tutorial/controlflow.rst:988 +#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 msgid "documentation strings" msgstr "ddocumentation strings(說明字串)" -#: ../../tutorial/controlflow.rst:451 ../../tutorial/controlflow.rst:988 +#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 msgid "docstrings" msgstr "docstrings(說明字串)" -#: ../../tutorial/controlflow.rst:451 ../../tutorial/controlflow.rst:988 +#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 msgid "strings, documentation" msgstr "strings(字串), documentation(說明文件)" -#: ../../tutorial/controlflow.rst:892 +#: ../../tutorial/controlflow.rst:917 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../tutorial/controlflow.rst:892 ../../tutorial/controlflow.rst:936 +#: ../../tutorial/controlflow.rst:917 ../../tutorial/controlflow.rst:961 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../tutorial/controlflow.rst:936 +#: ../../tutorial/controlflow.rst:961 msgid "**" msgstr "**" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid "function" msgstr "function(函式)" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid "annotations" msgstr "annotations(註釋)" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid "->" msgstr "->" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid ": (colon)" msgstr ": (冒號)" -#: ../../tutorial/controlflow.rst:1074 +#: ../../tutorial/controlflow.rst:1099 msgid "coding" msgstr "coding(程式編寫)" -#: ../../tutorial/controlflow.rst:1074 +#: ../../tutorial/controlflow.rst:1099 msgid "style" msgstr "style(風格)" + +#~ msgid "" +#~ "A :keyword:`!for` or :keyword:`!while` loop can include an :keyword:`!" +#~ "else` clause." +#~ msgstr "" +#~ ":keyword:`!for` 和 :keyword:`!while` 迴圈可帶有一個 :keyword:`!else` 子句" diff --git a/using/mac.po b/using/mac.po index f346362e0e..79ab0b1827 100644 --- a/using/mac.po +++ b/using/mac.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-30 09:19+0000\n" "PO-Revision-Date: 2022-08-31 22:26+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,346 +23,669 @@ msgstr "" "X-Generator: Poedit 3.1.1\n" #: ../../using/mac.rst:6 -msgid "Using Python on a Mac" -msgstr "在 Mac 系統使用 Python" +msgid "Using Python on macOS" +msgstr "於 macOS 使用 Python" -#: ../../using/mac.rst:0 -msgid "Author" -msgstr "作者" +#: ../../using/mac.rst:11 +msgid "" +"This document aims to give an overview of macOS-specific behavior you should " +"know about to get started with Python on Mac computers. Python on a Mac " +"running macOS is very similar to Python on other Unix-derived platforms, but " +"there are some differences in installation and some features." +msgstr "" + +#: ../../using/mac.rst:16 +msgid "" +"There are various ways to obtain and install Python for macOS. Pre-built " +"versions of the most recent versions of Python are available from a number " +"of distributors. Much of this document describes use of the Pythons provided " +"by the CPython release team for download from the `python.org website " +"`_. See :ref:`alternative_bundles` for " +"some other options." +msgstr "" -#: ../../using/mac.rst:8 -msgid "Bob Savage " -msgstr "Bob Savage " +#: ../../using/mac.rst:34 +msgid "Using Python for macOS from ``python.org``" +msgstr "" -#: ../../using/mac.rst:11 +#: ../../using/mac.rst:37 +msgid "Installation steps" +msgstr "安裝步驟" + +#: ../../using/mac.rst:39 +msgid "" +"For `current Python versions `_ (other " +"than those in ``security`` status), the release team produces a **Python for " +"macOS** installer package for each new release. A list of available " +"installers is available `here `_. " +"We recommend using the most recent supported Python version where possible. " +"Current installers provide a `universal2 binary `_ build of Python which runs natively on all Macs " +"(Apple Silicon and Intel) that are supported by a wide range of macOS " +"versions, currently typically from at least **macOS 10.13 High Sierra** on." +msgstr "" + +#: ../../using/mac.rst:51 msgid "" -"Python on a Mac running macOS is in principle very similar to Python on any " -"other Unix platform, but there are a number of additional features such as " -"the integrated development environment (IDE) and the Package Manager that " -"are worth pointing out." +"The downloaded file is a standard macOS installer package file (``.pkg``). " +"File integrity information (checksum, size, sigstore signature, etc) for " +"each file is included on the release download page. Installer packages and " +"their contents are signed and notarized with ``Python Software Foundation`` " +"Apple Developer ID certificates to meet `macOS Gatekeeper requirements " +"`_." msgstr "" -"Python 在 Mac 的 macOS 上執行和在其他 Unix 平台上執行的原理非常相似,但值得一" -"提的是在 macOS 上有其他額外的功能,例如整合開發環境 (IDE) 與套件管理。" -#: ../../using/mac.rst:21 -msgid "Getting and Installing Python" -msgstr "取得和安裝 Python" +#: ../../using/mac.rst:57 +msgid "" +"For a default installation, double-click on the downloaded installer package " +"file. This should launch the standard macOS Installer app and display the " +"first of several installer windows steps." +msgstr "" -#: ../../using/mac.rst:23 +#: ../../using/mac.rst:63 msgid "" -"macOS used to come with Python 2.7 pre-installed between versions 10.8 and " -"`12.3 `_. You are invited to install the most " -"recent version of Python 3 from the `Python website `__. A current \"universal2 binary\" build of Python, which " -"runs natively on the Mac's new Apple Silicon and legacy Intel processors, is " -"available there." +"Clicking on the **Continue** button brings up the **Read Me** for this " +"installer. Besides other important information, the **Read Me** documents " +"which Python version is going to be installed and on what versions of macOS " +"it is supported. You may need to scroll through to read the whole file. By " +"default, this **Read Me** will also be installed in |" +"usemac_applications_folder_version| and available to read anytime." msgstr "" -"macOS 自 10.8 版本開始至 `12.3 版本 `_\\ 之間預" -"設安裝 Python 2.7。你也可以到 `Python 網站 `__\\ 安裝最新的 Python 3 版本。你可以找到建立在\"通用二進位 " -"(universal2 binary)\" 上的 Python 建置版本,它能夠原生地運行在 Mac 新的 " -"Apple Silicon CPU 與過去的 Intel CPU 上。" -#: ../../using/mac.rst:30 -msgid "What you get after installing is a number of things:" -msgstr "在安裝後你必須要做幾件事:" +#: ../../using/mac.rst:71 +msgid "" +"Clicking on **Continue** proceeds to display the license for Python and for " +"other included software. You will then need to **Agree** to the license " +"terms before proceeding to the next step. This license file will also be " +"installed and available to be read later." +msgstr "" -#: ../../using/mac.rst:32 +#: ../../using/mac.rst:78 msgid "" -"A |python_version_literal| folder in your :file:`Applications` folder. In " -"here you find IDLE, the development environment that is a standard part of " -"official Python distributions; and :program:`Python Launcher`, which handles " -"double-clicking Python scripts from the Finder." +"After the license terms are accepted, the next step is the **Installation " +"Type** display. For most uses, the standard set of installation operations " +"is appropriate." msgstr "" -"會有一個 |python_version_literal| 資料夾在你的 :file:`Applications` 資料夾" -"中。在這裡你可以找到 IDLE,它是作為官方 Python 發行版標準組成的開發環境;以" -"及 :program:`Python Launcher`,它負責處理在 Finder 中雙擊 Python 腳本的操作。" -#: ../../using/mac.rst:37 +#: ../../using/mac.rst:83 msgid "" -"A framework :file:`/Library/Frameworks/Python.framework`, which includes the " -"Python executable and libraries. The installer adds this location to your " -"shell path. To uninstall Python, you can remove these three things. A " -"symlink to the Python executable is placed in :file:`/usr/local/bin/`." +"By pressing the **Customize** button, you can choose to omit or select " +"certain package components of the installer. Click on each package name to " +"see a description of what it installs. To also install support for the " +"optional experimental free-threaded feature, see :ref:`install-freethreaded-" +"macos`." +msgstr "" + +#: ../../using/mac.rst:91 +msgid "" +"In either case, clicking **Install** will begin the install process by " +"asking permission to install new software. A macOS user name with " +"``Administrator`` privilege is needed as the installed Python will be " +"available to all users of the Mac." msgstr "" -":file:`/Library/Frameworks/Python.framework` 框架,包括 Python 可執行檔案 " -"(executable) 和函式庫 (library)。安裝程式將此位置新增到 shell 路徑。要解除安" -"裝 Python ,你可以移除這三個專案。Python 可執行檔案的符號連結 (symlink) 則放" -"在 :file:`/usr/local/bin/` 中。" -#: ../../using/mac.rst:44 +#: ../../using/mac.rst:95 +msgid "When the installation is complete, the **Summary** window will appear." +msgstr "" + +#: ../../using/mac.rst:99 msgid "" -"On macOS 10.8-12.3, the Apple-provided build of Python is installed in :file:" -"`/System/Library/Frameworks/Python.framework` and :file:`/usr/bin/python`, " -"respectively. You should never modify or delete these, as they are Apple-" -"controlled and are used by Apple- or third-party software. Remember that if " -"you choose to install a newer Python version from python.org, you will have " -"two different but functional Python installations on your computer, so it " -"will be important that your paths and usages are consistent with what you " -"want to do." +"Double-click on the :command:`Install Certificates.command` icon or file in " +"the |usemac_applications_folder_version| window to complete the installation." msgstr "" -"在 macOS 10.8-12.3,Apple 提供的 Python 建置版本分別安裝在 :file:`/System/" -"Library/Frameworks/Python.framework` 和 :file:`/usr/bin/python` 中。你不應該" -"去修改或刪除這些內容,因為它們由 Apple 控制並且被 Apple 或第三方軟體使用。請" -"記住,如果你選擇從 python.org 安裝較新的 Python 版本,那麼你的計算機上將安裝" -"兩個不同但都可運作的 Python,因此你的路徑和用法與你想要執行的操作一致非常重" -"要。" -#: ../../using/mac.rst:52 +#: ../../using/mac.rst:105 msgid "" -"IDLE includes a Help menu that allows you to access Python documentation. If " -"you are completely new to Python you should start reading the tutorial " -"introduction in that document." +"This will open a temporary :program:`Terminal` shell window that will use " +"the new Python to download and install SSL root certificates for its use." msgstr "" -"IDLE 包含一個幫助 (Help) 選單,讓你可以參閱 Python 文件。如果你是 Python 的新" -"手,你應該開始閱讀該文件中的教學介紹。" -#: ../../using/mac.rst:56 +#: ../../using/mac.rst:111 msgid "" -"If you are familiar with Python on other Unix platforms you should read the " -"section on running Python scripts from the Unix shell." +"If ``Successfully installed certifi`` and ``update complete`` appears in the " +"terminal window, the installation is complete. Close this terminal window " +"and the installer window." +msgstr "" + +#: ../../using/mac.rst:115 +msgid "A default install will include:" +msgstr "預設安裝會包含:" + +#: ../../using/mac.rst:117 +msgid "" +"A |usemac_applications_folder_name| folder in your :file:`Applications` " +"folder. In here you find :program:`IDLE`, the development environment that " +"is a standard part of official Python distributions; and :program:`Python " +"Launcher`, which handles double-clicking Python scripts from the macOS " +"`Finder `_." +msgstr "" +"會有一個 |usemac_applications_folder_name| 資料夾在你的 :file:`Applications` " +"資料夾中。在這裡你可以找到 :program:`IDLE`,它是作為官方 Python 發行版標準組" +"成的開發環境;以及 :program:`Python Launcher`,它負責處理在 `Finder `_ 中雙擊 Python 腳本的操作。" + +#: ../../using/mac.rst:122 +msgid "" +"A framework :file:`/Library/Frameworks/Python.framework`, which includes the " +"Python executable and libraries. The installer adds this location to your " +"shell path. To uninstall Python, you can remove these three things. Symlinks " +"to the Python executable are placed in :file:`/usr/local/bin/`." +msgstr "" +":file:`/Library/Frameworks/Python.framework` 框架,包括 Python 可執行檔案 " +"(executable) 和函式庫 (library)。安裝程式將此位置新增到 shell 路徑。要解除安" +"裝 Python ,你可以移除這三個東西。Python 可執行檔案的符號連結 (symlink) 則放" +"在 :file:`/usr/local/bin/` 中。" + +#: ../../using/mac.rst:129 +msgid "" +"Recent versions of macOS include a :command:`python3` command in :file:`/usr/" +"bin/python3` that links to a usually older and incomplete version of Python " +"provided by and for use by the Apple development tools, :program:`Xcode` or " +"the :program:`Command Line Tools for Xcode`. You should never modify or " +"attempt to delete this installation, as it is Apple-controlled and is used " +"by Apple-provided or third-party software. If you choose to install a newer " +"Python version from ``python.org``, you will have two different but " +"functional Python installations on your computer that can co-exist. The " +"default installer options should ensure that its :command:`python3` will be " +"used instead of the system :command:`python3`." msgstr "" -"如果你熟悉其他 Unix 平臺上的 Python,那麼你應該閱讀有關從 Unix shell 執行 " -"Python 腳本的部分。" -#: ../../using/mac.rst:61 +#: ../../using/mac.rst:140 msgid "How to run a Python script" msgstr "如何執行 Python 腳本" -#: ../../using/mac.rst:63 +#: ../../using/mac.rst:142 +msgid "" +"There are two ways to invoke the Python interpreter. If you are familiar " +"with using a Unix shell in a terminal window, you can invoke |" +"usemac_python_x_dot_y_literal| or ``python3`` optionally followed by one or " +"more command line options (described in :ref:`using-on-general`). The Python " +"tutorial also has a useful section on :ref:`using Python interactively from " +"a shell `." +msgstr "" + +#: ../../using/mac.rst:149 msgid "" -"Your best way to get started with Python on macOS is through the IDLE " -"integrated development environment; see section :ref:`ide` and use the Help " -"menu when the IDE is running." +"You can also invoke the interpreter through an integrated development " +"environment. :ref:`idle` is a basic editor and interpreter environment which " +"is included with the standard distribution of Python. :program:`IDLE` " +"includes a Help menu that allows you to access Python documentation. If you " +"are completely new to Python, you can read the tutorial introduction in that " +"document." msgstr "" -"在 macOS 上開始使用 Python 的最佳方法是透過 IDLE 整合開發環境;參見 :ref:" -"`ide` 部分,並在 IDE 執行時使用幫助選單。" -#: ../../using/mac.rst:67 +#: ../../using/mac.rst:157 msgid "" -"If you want to run Python scripts from the Terminal window command line or " -"from the Finder you first need an editor to create your script. macOS comes " -"with a number of standard Unix command line editors, :program:`vim` :program:" -"`nano` among them. If you want a more Mac-like editor, :program:`BBEdit` " -"from Bare Bones Software (see https://www.barebones.com/products/bbedit/" -"index.html) are good choices, as is :program:`TextMate` (see https://" -"macromates.com). Other editors include :program:`MacVim` (https://macvim." -"org) and :program:`Aquamacs` (https://aquamacs.org)." +"There are many other editors and IDEs available, see :ref:`editors` for more " +"information." msgstr "" -"如果要從終端機視窗命令列或 Finder 執行 Python 腳本,首先需要一個編輯器來建立" -"腳本。macOS 附帶了許多標準的 Unix 命令列編輯器,如 :program:`vim` 和 :" -"program:`nano`。如果你想要一個更 Mac 化的編輯器,那麼來自 Bare Bones " -"Software 的 :program:`BBEdit`\\ (參見 http://www.barebones.com/products/" -"bbedit/index.html) 是不錯的選擇,:program:`TextMate` (參見 https://" -"macromates.com/)也是個選擇。其他編輯器包括 :program:`MacVim` (https://" -"macvim.org) 和 :program:`Aquamacs` (https://aquamacs.org/)。" -#: ../../using/mac.rst:77 +#: ../../using/mac.rst:160 msgid "" -"To run your script from the Terminal window you must make sure that :file:`/" -"usr/local/bin` is in your shell search path." +"To run a Python script file from the terminal window, you can invoke the " +"interpreter with the name of the script file:" +msgstr "" + +#: ../../using/mac.rst:163 +msgid "|usemac_python_x_dot_y_literal| ``myscript.py``" msgstr "" -"要從終端機視窗執行腳本,你必須確保 :file:`/usr/local/bin` 位於 shell 搜尋路徑" -"中。" -#: ../../using/mac.rst:80 -msgid "To run your script from the Finder you have two options:" -msgstr "從 Finder 執行你的腳本時,你有兩個選項:" +#: ../../using/mac.rst:165 +msgid "To run your script from the Finder, you can either:" +msgstr "從 Finder 執行你的腳本時,你可以:" -#: ../../using/mac.rst:82 +#: ../../using/mac.rst:167 msgid "Drag it to :program:`Python Launcher`." msgstr "把它拖曳到 :program:`Python Launcher`" -#: ../../using/mac.rst:84 +#: ../../using/mac.rst:169 msgid "" "Select :program:`Python Launcher` as the default application to open your " -"script (or any ``.py`` script) through the finder Info window and double-" +"script (or any ``.py`` script) through the Finder Info window and double-" "click it. :program:`Python Launcher` has various preferences to control how " "your script is launched. Option-dragging allows you to change these for one " -"invocation, or use its Preferences menu to change things globally." +"invocation, or use its ``Preferences`` menu to change things globally." msgstr "" -"透過 finder Info 視窗選擇 :program:`Python Launcher` 作為開啟腳本(或任何 ``." +"透過 Finder Info 視窗選擇 :program:`Python Launcher` 作為開啟腳本(或任何 ``." "py`` 腳本)的預設應用程式,然後雙擊腳本。:program:`Python Launcher` 有各種用" -"來控制腳本啟動方式的選項。拖曳選項可以讓你一次更改多個選項,或使用其偏好設定" -"選單以全域性地更改內容。" - -#: ../../using/mac.rst:94 -msgid "Running scripts with a GUI" -msgstr "透過 GUI 執行腳本" +"來控制腳本啟動方式的選項。拖曳選項可以讓你一次更改多個選項,或使用其 " +"``Preferences`` 選單以全域性地更改內容。" -#: ../../using/mac.rst:96 +#: ../../using/mac.rst:175 msgid "" -"With older versions of Python, there is one macOS quirk that you need to be " -"aware of: programs that talk to the Aqua window manager (in other words, " -"anything that has a GUI) need to be run in a special way. Use :program:" -"`pythonw` instead of :program:`python` to start such scripts." +"Be aware that running the script directly from the macOS Finder might " +"produce different results than when running from a terminal window as the " +"script will not be run in the usual shell environment including any setting " +"of environment variables in shell profiles. And, as with any other script or " +"program, be certain of what you are about to run." +msgstr "" + +#: ../../using/mac.rst:185 +msgid "Alternative Distributions" msgstr "" -"對於舊版本的 Python,你需要注意一個 macOS 的怪異之處:與 Aqua 視窗管理器溝通" -"的程式(換而言之,任何具有 GUI(圖形化使用者介面)的程式)需要以特殊方式執" -"行。使用 :program:`pythonw` 而不是 :program:`python` 來啟動這樣的腳本。" -#: ../../using/mac.rst:101 +#: ../../using/mac.rst:187 msgid "" -"With Python 3.9, you can use either :program:`python` or :program:`pythonw`." -msgstr "Python 3.9 上,你可以使用 :program:`python` 或者 :program:`pythonw`。" +"Besides the standard ``python.org`` for macOS installer, there are third-" +"party distributions for macOS that may include additional functionality. " +"Some popular distributions and their key features:" +msgstr "" -#: ../../using/mac.rst:105 -msgid "Configuration" -msgstr "設定" +#: ../../using/mac.rst:191 +msgid "`ActivePython `_" +msgstr "`ActivePython `_" + +#: ../../using/mac.rst:192 +msgid "Installer with multi-platform compatibility, documentation" +msgstr "" -#: ../../using/mac.rst:107 +#: ../../using/mac.rst:194 +msgid "`Anaconda `_" +msgstr "`Anaconda `_" + +#: ../../using/mac.rst:195 msgid "" -"Python on macOS honors all standard Unix environment variables such as :" -"envvar:`PYTHONPATH`, but setting these variables for programs started from " -"the Finder is non-standard as the Finder does not read your :file:`.profile` " -"or :file:`.cshrc` at startup. You need to create a file :file:`~/.MacOSX/" -"environment.plist`. See Apple's `Technical Q&A QA1067 `__ for details." +"Popular scientific modules (such as numpy, scipy, and pandas) and the " +"``conda`` package manager." msgstr "" -"macOS 上的 Python 遵循所有標準的 Unix 環境變數,例如 :envvar:`PYTHONPATH`,但" -"是為 Finder 啟動的程式設定這些變數並非是標準做法,因為 Finder 在啟動時不會讀" -"取你的 :file:`.profile` 或 :file:`.cshrc`。你需要建立一個檔案 :file:`~/." -"MacOSX/environment.plist`。相關資訊請參閱 Apple 的\\ `技術問答集 QA1067 " -"`__。" -#: ../../using/mac.rst:115 +#: ../../using/mac.rst:198 +msgid "`Homebrew `_" +msgstr "`Homebrew `_" + +#: ../../using/mac.rst:199 msgid "" -"For more information on installation Python packages, see section :ref:`mac-" -"package-manager`." -msgstr "更多關於安裝 Python 套件的資訊,參閱 :ref:`mac-package-manager` 部分。" +"Package manager for macOS including multiple versions of Python and many " +"third-party Python-based packages (including numpy, scipy, and pandas)." +msgstr "" -#: ../../using/mac.rst:122 -msgid "The IDE" -msgstr "整合化開發工具 (IDE)" +#: ../../using/mac.rst:202 +msgid "`MacPorts `_" +msgstr "`MacPorts `_" -#: ../../using/mac.rst:124 +#: ../../using/mac.rst:203 msgid "" -"Python ships with the standard IDLE development environment. A good " -"introduction to using IDLE can be found at https://www.hashcollision.org/hkn/" -"python/idle_intro/index.html." +"Another package manager for macOS including multiple versions of Python and " +"many third-party Python-based packages. May include pre-built versions of " +"Python and many packages for older versions of macOS." msgstr "" -"Python 附帶標準的 IDLE 開發環境。有關使用 IDLE 的詳細介紹,請見 https://www." -"hashcollision.org/hkn/python/idle_intro/index.html。" -#: ../../using/mac.rst:132 +#: ../../using/mac.rst:207 +msgid "" +"Note that distributions might not include the latest versions of Python or " +"other libraries, and are not maintained or supported by the core Python team." +msgstr "" + +#: ../../using/mac.rst:213 msgid "Installing Additional Python Packages" msgstr "安裝額外的 Python 套件" -#: ../../using/mac.rst:134 -msgid "This section has moved to the `Python Packaging User Guide`_." -msgstr "這個章節已經被移動到 `Python Packaging User Guide`_。" +#: ../../using/mac.rst:215 +msgid "Refer to the `Python Packaging User Guide`_ for more information." +msgstr "更多資訊請見 `Python Packaging User Guide`_。" -#: ../../using/mac.rst:142 +#: ../../using/mac.rst:225 msgid "GUI Programming" msgstr "開發 GUI 程式" -#: ../../using/mac.rst:144 +#: ../../using/mac.rst:227 msgid "" "There are several options for building GUI applications on the Mac with " "Python." msgstr "於 Mac 上使用 Python 來建立 GUI 應用程式有許多選項。" -#: ../../using/mac.rst:146 +#: ../../using/mac.rst:229 msgid "" -"*PyObjC* is a Python binding to Apple's Objective-C/Cocoa framework, which " -"is the foundation of most modern Mac development. Information on PyObjC is " -"available from :pypi:`pyobjc`." +"The standard Python GUI toolkit is :mod:`tkinter`, based on the cross-" +"platform Tk toolkit (https://www.tcl.tk). A macOS-native version of Tk is " +"included with the installer." msgstr "" -"*PyObjC* 是一個 Apple Objective-C/Cocoa 框架的 Python 繫結 (binding),這是大" -"多數現代 Mac 開發的基礎。有關 PyObjC 的資訊,請見 :pypi:`pyobjc`。" +"標準的 Python GUI 工具套件是基於跨平臺 Tk 工具套件 (https://www.tcl.tk) 的 :" +"mod:`tkinter`。macOS 原生版本的 Tk 有包含於安裝程式中。" -#: ../../using/mac.rst:150 +#: ../../using/mac.rst:233 msgid "" -"The standard Python GUI toolkit is :mod:`tkinter`, based on the cross-" -"platform Tk toolkit (https://www.tcl.tk). An Aqua-native version of Tk is " -"bundled with macOS by Apple, and the latest version can be downloaded and " -"installed from https://www.activestate.com; it can also be built from source." +"*PyObjC* is a Python binding to Apple's Objective-C/Cocoa framework. " +"Information on PyObjC is available from :pypi:`pyobjc`." msgstr "" -"標準的 Python GUI 工具套件是 :mod:`tkinter`,基於跨平臺的 Tk 工具套件 " -"(https://www.tcl.tk)。Apple 的 macOS 包含了 Aqua 原生版本的 Tk,最新版本可以" -"從 https://www.activestate.com 下載和安裝;它也可以從原始碼開始建置。" +"*PyObjC* 是一個 Apple Objective-C/Cocoa 框架的 Python 繫結 (binding)。有關 " +"PyObjC 的資訊請見 :pypi:`pyobjc`。" -#: ../../using/mac.rst:155 -msgid "A number of alternative macOS GUI toolkits are available:" -msgstr "有許多替代 macOS GUI 工具套件可用:" +#: ../../using/mac.rst:236 +msgid "A number of alternative macOS GUI toolkits are available including:" +msgstr "有許多替代 macOS GUI 工具套件可用,包含:" -#: ../../using/mac.rst:157 +#: ../../using/mac.rst:238 msgid "" -"`PySide `__: Official Python bindings to " -"the `Qt GUI toolkit `__." +"`PySide `_: Official Python bindings to the " +"`Qt GUI toolkit `_." msgstr "" -"`PySide `__:`Qt GUI 工具包 `__\\ 的官方 Python 繫結。" +"`PySide `_:`Qt GUI 工具包 `_\\ 的官方 Python 繫結。" -#: ../../using/mac.rst:160 +#: ../../using/mac.rst:241 msgid "" -"`PyQt `__: Alternative " -"Python bindings to Qt." +"`PyQt `_: Alternative Python " +"bindings to Qt." msgstr "" -"`PyQt `__:Qt 的替代 " -"Python 繫結。" +"`PyQt `_:Qt 的替代 Python 繫" +"結。" -#: ../../using/mac.rst:163 +#: ../../using/mac.rst:244 msgid "" -"`Kivy `__: A cross-platform GUI toolkit that supports " +"`Kivy `_: A cross-platform GUI toolkit that supports " "desktop and mobile platforms." msgstr "" -"`Kivy `__:一個支援桌面和行動平臺的跨平臺 GUI 工具包。" +"`Kivy `_:一個支援桌面和行動平臺的跨平臺 GUI 工具包。" -#: ../../using/mac.rst:166 +#: ../../using/mac.rst:247 msgid "" -"`Toga `__: Part of the `BeeWare Project " -"`__; supports desktop, mobile, web and console apps." +"`Toga `_: Part of the `BeeWare Project `_; supports desktop, mobile, web and console apps." msgstr "" -"`Toga `__:`BeeWare 專案 `__\\ 的一部分;支援桌面、行動、網頁和控制台應用程式。" +"`Toga `_:`BeeWare 專案 `_\\ 的一部分;支援桌面、行動、網頁和控制台應用程式。" -#: ../../using/mac.rst:169 +#: ../../using/mac.rst:250 msgid "" -"`wxPython `__: A cross-platform toolkit that " -"supports desktop operating systems." +"`wxPython `_: A cross-platform toolkit that supports " +"desktop operating systems." msgstr "" -"`wxPython `__:一個支援桌面作業系統的跨平臺工具包。" +"`wxPython `_:一個支援桌面作業系統的跨平臺工具包。" -#: ../../using/mac.rst:175 +#: ../../using/mac.rst:255 +msgid "Advanced Topics" +msgstr "進階主題" + +#: ../../using/mac.rst:260 +msgid "Installing Free-threaded Binaries" +msgstr "" + +#: ../../using/mac.rst:262 +msgid "(Experimental)" +msgstr "" + +#: ../../using/mac.rst:266 +msgid "" +"Everything described in this section is considered experimental, and should " +"be expected to change in future releases." +msgstr "" + +#: ../../using/mac.rst:269 +msgid "" +"The ``python.org`` :ref:`Python for macOS ` installer package can optionally install an additional build of " +"Python |usemac_x_dot_y| that supports :pep:`703`, the experimental free-" +"threading feature (running with the :term:`global interpreter lock` " +"disabled). Check the release page on ``python.org`` for possible updated " +"information." +msgstr "" + +#: ../../using/mac.rst:275 +msgid "" +"Because this feature is still considered experimental, the support for it is " +"not installed by default. It is packaged as a separate install option, " +"available by clicking the **Customize** button on the **Installation Type** " +"step of the installer as described above." +msgstr "" + +#: ../../using/mac.rst:282 +msgid "" +"If the box next to the **Free-threaded Python** package name is checked, a " +"separate :file:`PythonT.framework` will also be installed alongside the " +"normal :file:`Python.framework` in :file:`/Library/Frameworks`. This " +"configuration allows a free-threaded Python |usemac_x_dot_y| build to co-" +"exist on your system with a traditional (GIL only) Python |usemac_x_dot_y| " +"build with minimal risk while installing or testing. This installation " +"layout is itself experimental and is subject to change in future releases." +msgstr "" + +#: ../../using/mac.rst:290 +msgid "Known cautions and limitations:" +msgstr "" + +#: ../../using/mac.rst:292 +msgid "" +"The **UNIX command-line tools** package, which is selected by default, will " +"install links in :file:`/usr/local/bin` for |" +"usemac_python_x_dot_y_t_literal|, the free-threaded interpreter, and |" +"usemac_python_x_dot_y_t_literal_config|, a configuration utility which may " +"be useful for package builders. Since :file:`/usr/local/bin` is typically " +"included in your shell ``PATH``, in most cases no changes to your ``PATH`` " +"environment variables should be needed to use |" +"usemac_python_x_dot_y_t_literal|." +msgstr "" + +#: ../../using/mac.rst:300 +msgid "" +"For this release, the **Shell profile updater** package and the :file:" +"`Update Shell Profile.command` in |usemac_applications_folder_version| do " +"not support the free-threaded package." +msgstr "" + +#: ../../using/mac.rst:304 +msgid "" +"The free-threaded build and the traditional build have separate search paths " +"and separate :file:`site-packages` directories so, by default, if you need a " +"package available in both builds, it may need to be installed in both. The " +"free-threaded package will install a separate instance of :program:`pip` for " +"use with |usemac_python_x_dot_y_t_literal|." +msgstr "" + +#: ../../using/mac.rst:310 +msgid "To install a package using :command:`pip` without a :command:`venv`:" +msgstr "" + +#: ../../using/mac.rst:312 +msgid "|usemac_python_x_dot_y_t_literal| ``-m pip install ``" +msgstr "|usemac_python_x_dot_y_t_literal| ``-m pip install ``" + +#: ../../using/mac.rst:314 +msgid "" +"When working with multiple Python environments, it is usually safest and " +"easiest to :ref:`create and use virtual environments `. This can " +"avoid possible command name conflicts and confusion about which Python is in " +"use:" +msgstr "" + +#: ../../using/mac.rst:318 +msgid "|usemac_python_x_dot_y_t_literal| ``-m venv ``" +msgstr "|usemac_python_x_dot_y_t_literal| ``-m venv ``" + +#: ../../using/mac.rst:320 +msgid "then :command:`activate`." +msgstr "然後 :command:`activate`。" + +#: ../../using/mac.rst:322 +msgid "To run a free-threaded version of IDLE:" +msgstr "執行 free-threaded(自由執行緒)版本的 IDLE:" + +#: ../../using/mac.rst:324 +msgid "|usemac_python_x_dot_y_t_literal| ``-m idlelib``" +msgstr "|usemac_python_x_dot_y_t_literal| ``-m idlelib``" + +#: ../../using/mac.rst:326 +msgid "" +"The interpreters in both builds respond to the same :ref:`PYTHON environment " +"variables ` which may have unexpected results, for " +"example, if you have ``PYTHONPATH`` set in a shell profile. If necessary, " +"there are :ref:`command line options ` like ``-" +"E`` to ignore these environment variables." +msgstr "" + +#: ../../using/mac.rst:333 +msgid "" +"The free-threaded build links to the third-party shared libraries, such as " +"``OpenSSL`` and ``Tk``, installed in the traditional framework. This means " +"that both builds also share one set of trust certificates as installed by " +"the :command:`Install Certificates.command` script, thus it only needs to be " +"run once." +msgstr "" + +#: ../../using/mac.rst:339 +msgid "" +"If you cannot depend on the link in ``/usr/local/bin`` pointing to the " +"``python.org`` free-threaded |usemac_python_x_dot_y_t_literal| (for example, " +"if you want to install your own version there or some other distribution " +"does), you can explicitly set your shell ``PATH`` environment variable to " +"include the ``PythonT`` framework ``bin`` directory:" +msgstr "" + +#: ../../using/mac.rst:345 +msgid "" +"export PATH=\"/Library/Frameworks/PythonT.framework/Versions/3.13/bin\":" +"\"$PATH\"" +msgstr "" +"export PATH=\"/Library/Frameworks/PythonT.framework/Versions/3.13/bin\":" +"\"$PATH\"" + +#: ../../using/mac.rst:349 +msgid "" +"The traditional framework installation by default does something similar, " +"except for :file:`Python.framework`. Be aware that having both framework " +"``bin`` directories in ``PATH`` can lead to confusion if there are duplicate " +"names like ``python3.13`` in both; which one is actually used depends on the " +"order they appear in ``PATH``. The ``which python3.x`` or ``which python3." +"xt`` commands can show which path is being used. Using virtual environments " +"can help avoid such ambiguities. Another option might be to create a shell :" +"command:`alias` to the desired interpreter, like:" +msgstr "" + +#: ../../using/mac.rst:358 +msgid "" +"alias py3.13=\"/Library/Frameworks/Python.framework/Versions/3.13/bin/" +"python3.13\"\n" +"alias py3.13t=\"/Library/Frameworks/PythonT.framework/Versions/3.13/bin/" +"python3.13t\"" +msgstr "" +"alias py3.13=\"/Library/Frameworks/Python.framework/Versions/3.13/bin/" +"python3.13\"\n" +"alias py3.13t=\"/Library/Frameworks/PythonT.framework/Versions/3.13/bin/" +"python3.13t\"" + +#: ../../using/mac.rst:364 +msgid "Installing using the command line" +msgstr "使用命令列安裝" + +#: ../../using/mac.rst:366 +msgid "" +"If you want to use automation to install the ``python.org`` installer " +"package (rather than by using the familiar macOS :program:`Installer` GUI " +"app), the macOS command line :command:`installer` utility lets you select " +"non-default options, too. If you are not familiar with :command:`installer`, " +"it can be somewhat cryptic (see :command:`man installer` for more " +"information). As an example, the following shell snippet shows one way to do " +"it, using the ``3.13.0b2`` release and selecting the free-threaded " +"interpreter option:" +msgstr "" + +#: ../../using/mac.rst:375 +msgid "" +"RELEASE=\"python-3.13.0b2-macos11.pkg\"\n" +"\n" +"# download installer pkg\n" +"curl -O https://www.python.org/ftp/python/3.13.0/${RELEASE}\n" +"\n" +"# create installer choicechanges to customize the install:\n" +"# enable the PythonTFramework-3.13 package\n" +"# while accepting the other defaults (install all other packages)\n" +"cat > ./choicechanges.plist <\n" +"\n" +"\n" +"\n" +" \n" +" attributeSetting\n" +" 1\n" +" choiceAttribute\n" +" selected\n" +" choiceIdentifier\n" +" org.python.Python.PythonTFramework-3.13\n" +" \n" +"\n" +"\n" +"EOF\n" +"\n" +"sudo installer -pkg ./${RELEASE} -applyChoiceChangesXML ./choicechanges." +"plist -target /" +msgstr "" + +#: ../../using/mac.rst:405 +msgid "" +"You can then test that both installer builds are now available with " +"something like:" +msgstr "" + +#: ../../using/mac.rst:407 +msgid "" +"$ # test that the free-threaded interpreter was installed if the Unix " +"Command Tools package was enabled\n" +"$ /usr/local/bin/python3.13t -VV\n" +"Python 3.13.0b2 experimental free-threading build (v3.13.0b2:3a83b172af, " +"Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]\n" +"$ # and the traditional interpreter\n" +"$ /usr/local/bin/python3.13 -VV\n" +"Python 3.13.0b2 (v3.13.0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 " +"(clang-1500.3.9.4)]\n" +"$ # test that they are also available without the prefix if /usr/local/bin " +"is on $PATH\n" +"$ python3.13t -VV\n" +"Python 3.13.0b2 experimental free-threading build (v3.13.0b2:3a83b172af, " +"Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]\n" +"$ python3.13 -VV\n" +"Python 3.13.0b2 (v3.13.0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 " +"(clang-1500.3.9.4)]" +msgstr "" + +#: ../../using/mac.rst:423 +msgid "" +"Current ``python.org`` installers only install to fixed locations like :file:" +"`/Library/Frameworks/`, :file:`/Applications`, and :file:`/usr/local/bin`. " +"You cannot use the :command:`installer` ``-domain`` option to install to " +"other locations." +msgstr "" + +#: ../../using/mac.rst:431 msgid "Distributing Python Applications" msgstr "發行 Python 應用程式" -#: ../../using/mac.rst:177 +#: ../../using/mac.rst:433 msgid "" "A range of tools exist for converting your Python code into a standalone " "distributable application:" msgstr "" -#: ../../using/mac.rst:180 +#: ../../using/mac.rst:436 msgid "" ":pypi:`py2app`: Supports creating macOS ``.app`` bundles from a Python " "project." msgstr ":pypi:`py2app`:支援從 Python 專案打包成 macOS ``.app``。" -#: ../../using/mac.rst:183 +#: ../../using/mac.rst:439 msgid "" -"`Briefcase `__: Part of the `BeeWare " -"Project `__; a cross-platform packaging tool that " +"`Briefcase `_: Part of the `BeeWare " +"Project `_; a cross-platform packaging tool that " "supports creation of ``.app`` bundles on macOS, as well as managing signing " "and notarization." msgstr "" +"`Briefcase `_:`BeeWare 專案 `__\\ 的一部分;支援建立 macOS ``.app`` 的跨平台打包工具,亦為管" +"理簽署和驗證 (notarization) 的工具。" -#: ../../using/mac.rst:188 +#: ../../using/mac.rst:444 msgid "" -"`PyInstaller `__: A cross-platform packaging tool " +"`PyInstaller `_: A cross-platform packaging tool " "that creates a single file or folder as a distributable artifact." msgstr "" -"`PyInstaller `__:一個跨平臺打包工具,可以將單一檔" -"案或資料夾打包成可分發的檔案。" +"`PyInstaller `_:一個跨平臺打包工具,可以將單一檔案" +"或資料夾打包成可分發的檔案。" -#: ../../using/mac.rst:192 +#: ../../using/mac.rst:448 msgid "App Store Compliance" msgstr "" -#: ../../using/mac.rst:194 +#: ../../using/mac.rst:450 msgid "" "Apps submitted for distribution through the macOS App Store must pass " "Apple's app review process. This process includes a set of automated " @@ -370,7 +693,7 @@ msgid "" "problematic code." msgstr "" -#: ../../using/mac.rst:198 +#: ../../using/mac.rst:454 msgid "" "The Python standard library contains some code that is known to violate " "these automated rules. While these violations appear to be false positives, " @@ -378,7 +701,7 @@ msgid "" "modify the Python standard library for an app to pass App Store review." msgstr "" -#: ../../using/mac.rst:203 +#: ../../using/mac.rst:459 msgid "" "The Python source tree contains :source:`a patch file ` that will remove all code that is known to cause " @@ -387,7 +710,7 @@ msgid "" "compliance` option." msgstr "" -#: ../../using/mac.rst:209 +#: ../../using/mac.rst:465 msgid "" "This patch is not normally required to use CPython on a Mac; nor is it " "required if you are distributing an app *outside* the macOS App Store. It is " @@ -395,26 +718,14 @@ msgid "" "channel." msgstr "" -#: ../../using/mac.rst:214 +#: ../../using/mac.rst:470 msgid "Other Resources" msgstr "其他資源" -#: ../../using/mac.rst:216 +#: ../../using/mac.rst:472 msgid "" -"The Pythonmac-SIG mailing list is an excellent support resource for Python " -"users and developers on the Mac:" +"The `python.org Help page `_ has links " +"to many useful resources. The `Pythonmac-SIG mailing list `_ is another support " +"resource specifically for Python users and developers on the Mac." msgstr "" -"Pythonmac-SIG 郵件清單對於 Mac 上的 Python 使用者和開發者是一個極佳的支援資" -"源:" - -#: ../../using/mac.rst:219 -msgid "https://www.python.org/community/sigs/current/pythonmac-sig/" -msgstr "https://www.python.org/community/sigs/current/pythonmac-sig/" - -#: ../../using/mac.rst:221 -msgid "Another useful resource is the MacPython wiki:" -msgstr "另一個好用資源是 MacPython wiki:" - -#: ../../using/mac.rst:223 -msgid "https://wiki.python.org/moin/MacPython" -msgstr "https://wiki.python.org/moin/MacPython" diff --git a/whatsnew/2.1.po b/whatsnew/2.1.po index bdb865bf96..72d4b9a90d 100644 --- a/whatsnew/2.1.po +++ b/whatsnew/2.1.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -705,9 +705,9 @@ msgstr "" #: ../../whatsnew/2.1.rst:445 msgid "" "The dictionary containing attributes can be accessed as the function's :attr:" -"`~object.__dict__`. Unlike the :attr:`~object.__dict__` attribute of class " +"`~function.__dict__`. Unlike the :attr:`~type.__dict__` attribute of class " "instances, in functions you can actually assign a new dictionary to :attr:" -"`~object.__dict__`, though the new value is restricted to a regular Python " +"`~function.__dict__`, though the new value is restricted to a regular Python " "dictionary; you *can't* be tricky and set it to a :class:`!UserDict` " "instance, or any other random object that behaves like a mapping." msgstr "" diff --git a/whatsnew/2.2.po b/whatsnew/2.2.po index 337bc0870a..440d72550b 100644 --- a/whatsnew/2.2.po +++ b/whatsnew/2.2.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -266,8 +266,8 @@ msgid ":attr:`~definition.__name__` is the attribute's name." msgstr ":attr:`~definition.__name__` 是屬性的名稱。" #: ../../whatsnew/2.2.rst:174 -msgid ":attr:`!__doc__` is the attribute's docstring." -msgstr ":attr:`!__doc__` 是屬性的文件字串 (docstring)。" +msgid ":attr:`~definition.__doc__` is the attribute's docstring." +msgstr ":attr:`~definition.__doc__` 是屬性的文件字串 (docstring)。" #: ../../whatsnew/2.2.rst:176 msgid "" @@ -298,17 +298,17 @@ msgstr "" #: ../../whatsnew/2.2.rst:189 msgid "" -"For methods, :meth:`!descriptor.__get__` returns a temporary object that's " -"callable, and wraps up the instance and the method to be called on it. This " -"is also why static methods and class methods are now possible; they have " -"descriptors that wrap up just the method, or the method and the class. As a " -"brief explanation of these new kinds of methods, static methods aren't " -"passed the instance, and therefore resemble regular functions. Class " -"methods are passed the class of the object, but not the object itself. " -"Static and class methods are defined like this::" +"For methods, :meth:`descriptor.__get__ ` returns a temporary " +"object that's callable, and wraps up the instance and the method to be " +"called on it. This is also why static methods and class methods are now " +"possible; they have descriptors that wrap up just the method, or the method " +"and the class. As a brief explanation of these new kinds of methods, static " +"methods aren't passed the instance, and therefore resemble regular " +"functions. Class methods are passed the class of the object, but not the " +"object itself. Static and class methods are defined like this::" msgstr "" -#: ../../whatsnew/2.2.rst:198 +#: ../../whatsnew/2.2.rst:199 msgid "" "class C(object):\n" " def f(arg1, arg2):\n" @@ -319,8 +319,16 @@ msgid "" " ...\n" " g = classmethod(g)" msgstr "" +"class C(object):\n" +" def f(arg1, arg2):\n" +" ...\n" +" f = staticmethod(f)\n" +"\n" +" def g(cls, arg1, arg2):\n" +" ...\n" +" g = classmethod(g)" -#: ../../whatsnew/2.2.rst:207 +#: ../../whatsnew/2.2.rst:208 msgid "" "The :func:`staticmethod` function takes the function :func:`!f`, and returns " "it wrapped up in a descriptor so it can be stored in the class object. You " @@ -329,7 +337,7 @@ msgid "" "has been defined yet; that's been left for future versions of Python." msgstr "" -#: ../../whatsnew/2.2.rst:213 +#: ../../whatsnew/2.2.rst:214 msgid "" "More new features, such as slots and properties, are also implemented as new " "kinds of descriptors, and it's not difficult to write a descriptor class " @@ -339,7 +347,7 @@ msgid "" "defined like this::" msgstr "" -#: ../../whatsnew/2.2.rst:220 +#: ../../whatsnew/2.2.rst:221 msgid "" "from eiffel import eiffelmethod\n" "\n" @@ -357,7 +365,7 @@ msgid "" " f = eiffelmethod(f, pre_f, post_f)" msgstr "" -#: ../../whatsnew/2.2.rst:235 +#: ../../whatsnew/2.2.rst:236 msgid "" "Note that a person using the new :func:`!eiffelmethod` doesn't have to " "understand anything about descriptors. This is why I think the new features " @@ -367,18 +375,18 @@ msgid "" "resulting libraries and ignore the implementation details." msgstr "" -#: ../../whatsnew/2.2.rst:244 +#: ../../whatsnew/2.2.rst:245 msgid "Multiple Inheritance: The Diamond Rule" msgstr "" -#: ../../whatsnew/2.2.rst:246 +#: ../../whatsnew/2.2.rst:247 msgid "" "Multiple inheritance has also been made more useful through changing the " "rules under which names are resolved. Consider this set of classes (diagram " "taken from :pep:`253` by Guido van Rossum)::" msgstr "" -#: ../../whatsnew/2.2.rst:250 +#: ../../whatsnew/2.2.rst:251 msgid "" " class A:\n" " ^ ^ def save(self): ...\n" @@ -394,8 +402,21 @@ msgid "" " \\ /\n" " class D" msgstr "" +" class A:\n" +" ^ ^ def save(self): ...\n" +" / \\\n" +" / \\\n" +" / \\\n" +" / \\\n" +"class B class C:\n" +" ^ ^ def save(self): ...\n" +" \\ /\n" +" \\ /\n" +" \\ /\n" +" \\ /\n" +" class D" -#: ../../whatsnew/2.2.rst:264 +#: ../../whatsnew/2.2.rst:265 msgid "" "The lookup rule for classic classes is simple but not very smart; the base " "classes are searched depth-first, going from left to right. A reference to :" @@ -406,7 +427,7 @@ msgid "" "not calling it will result in that state never getting saved." msgstr "" -#: ../../whatsnew/2.2.rst:272 +#: ../../whatsnew/2.2.rst:273 msgid "" "New-style classes follow a different algorithm that's a bit more complicated " "to explain, but does the right thing in this situation. (Note that Python " @@ -415,7 +436,7 @@ msgid "" "graphs.)" msgstr "" -#: ../../whatsnew/2.2.rst:277 +#: ../../whatsnew/2.2.rst:278 msgid "" "List all the base classes, following the classic lookup rule and include a " "class multiple times if it's visited repeatedly. In the above example, the " @@ -423,7 +444,7 @@ msgid "" "C`, :class:`!A`]." msgstr "" -#: ../../whatsnew/2.2.rst:282 +#: ../../whatsnew/2.2.rst:283 msgid "" "Scan the list for duplicated classes. If any are found, remove all but one " "occurrence, leaving the *last* one in the list. In the above example, the " @@ -431,7 +452,7 @@ msgid "" "dropping duplicates." msgstr "" -#: ../../whatsnew/2.2.rst:287 +#: ../../whatsnew/2.2.rst:288 msgid "" "Following this rule, referring to :meth:`!D.save` will return :meth:`!C." "save`, which is the behaviour we're after. This lookup rule is the same as " @@ -444,7 +465,7 @@ msgid "" "like this::" msgstr "" -#: ../../whatsnew/2.2.rst:296 +#: ../../whatsnew/2.2.rst:297 msgid "" "class D (B,C):\n" " def save (self):\n" @@ -454,18 +475,18 @@ msgid "" " ..." msgstr "" -#: ../../whatsnew/2.2.rst:303 +#: ../../whatsnew/2.2.rst:304 msgid "" ":func:`super` can also return unbound superclass objects when called as " "``super(class)`` or ``super(class1, class2)``, but this probably won't often " "be useful." msgstr "" -#: ../../whatsnew/2.2.rst:309 +#: ../../whatsnew/2.2.rst:310 msgid "Attribute Access" msgstr "" -#: ../../whatsnew/2.2.rst:311 +#: ../../whatsnew/2.2.rst:312 msgid "" "A fair number of sophisticated Python classes define hooks for attribute " "access using :meth:`~object.__getattr__`; most commonly this is done for " @@ -474,7 +495,7 @@ msgid "" "get_parent``. Python 2.2 adds some new ways of controlling attribute access." msgstr "" -#: ../../whatsnew/2.2.rst:317 +#: ../../whatsnew/2.2.rst:318 msgid "" "First, ``__getattr__(attr_name)`` is still supported by new-style classes, " "and nothing about it has changed. As before, it will be called when an " @@ -482,7 +503,7 @@ msgid "" "found in the instance's dictionary." msgstr "" -#: ../../whatsnew/2.2.rst:322 +#: ../../whatsnew/2.2.rst:323 msgid "" "New-style classes also support a new method, " "``__getattribute__(attr_name)``. The difference between the two methods is " @@ -491,7 +512,7 @@ msgid "" "called if ``foo`` isn't found in the instance's dictionary." msgstr "" -#: ../../whatsnew/2.2.rst:328 +#: ../../whatsnew/2.2.rst:329 msgid "" "However, Python 2.2's support for :dfn:`properties` will often be a simpler " "way to trap attribute references. Writing a :meth:`!__getattr__` method is " @@ -504,7 +525,7 @@ msgid "" "in a sizable performance loss." msgstr "" -#: ../../whatsnew/2.2.rst:337 +#: ../../whatsnew/2.2.rst:338 msgid "" ":class:`property` is a new built-in type that packages up three functions " "that get, set, or delete an attribute, and a docstring. For example, if you " @@ -512,7 +533,7 @@ msgid "" "you could write::" msgstr "" -#: ../../whatsnew/2.2.rst:342 +#: ../../whatsnew/2.2.rst:343 msgid "" "class C(object):\n" " def get_size (self):\n" @@ -530,7 +551,7 @@ msgid "" " \"Storage size of this instance\")" msgstr "" -#: ../../whatsnew/2.2.rst:357 +#: ../../whatsnew/2.2.rst:358 msgid "" "That is certainly clearer and easier to write than a pair of :meth:`!" "__getattr__`/:meth:`!__setattr__` methods that check for the :attr:`!size` " @@ -540,7 +561,7 @@ msgid "" "references to other attributes run at their usual speed." msgstr "" -#: ../../whatsnew/2.2.rst:364 +#: ../../whatsnew/2.2.rst:365 msgid "" "Finally, it's possible to constrain the list of attributes that can be " "referenced on an object using the new :attr:`~object.__slots__` class " @@ -551,7 +572,7 @@ msgid "" "names. An example will make this clear::" msgstr "" -#: ../../whatsnew/2.2.rst:371 +#: ../../whatsnew/2.2.rst:372 msgid "" ">>> class C(object):\n" "... __slots__ = ('template', 'name')\n" @@ -568,17 +589,17 @@ msgid "" "AttributeError: 'C' object has no attribute 'newattr'" msgstr "" -#: ../../whatsnew/2.2.rst:385 +#: ../../whatsnew/2.2.rst:386 msgid "" "Note how you get an :exc:`AttributeError` on the attempt to assign to an " "attribute not listed in :attr:`~object.__slots__`." msgstr "" -#: ../../whatsnew/2.2.rst:392 +#: ../../whatsnew/2.2.rst:393 msgid "Related Links" msgstr "相關連結" -#: ../../whatsnew/2.2.rst:394 +#: ../../whatsnew/2.2.rst:395 msgid "" "This section has just been a quick overview of the new features, giving " "enough of an explanation to start you programming, but many details have " @@ -586,7 +607,7 @@ msgid "" "picture?" msgstr "" -#: ../../whatsnew/2.2.rst:398 +#: ../../whatsnew/2.2.rst:399 msgid "" "The :ref:`descriptorhowto` is a lengthy tutorial introduction to the " "descriptor features, written by Guido van Rossum. If my description has " @@ -594,7 +615,7 @@ msgid "" "more detail about the new features while still remaining quite easy to read." msgstr "" -#: ../../whatsnew/2.2.rst:403 +#: ../../whatsnew/2.2.rst:404 msgid "" "Next, there are two relevant PEPs, :pep:`252` and :pep:`253`. :pep:`252` is " "titled \"Making Types Look More Like Classes\", and covers the descriptor " @@ -606,7 +627,7 @@ msgid "" "substantial assistance from the rest of the Zope Corp. team." msgstr "" -#: ../../whatsnew/2.2.rst:412 +#: ../../whatsnew/2.2.rst:413 msgid "" "Finally, there's the ultimate authority: the source code. Most of the " "machinery for the type handling is in :file:`Objects/typeobject.c`, but you " @@ -614,31 +635,31 @@ msgid "" "including posting a question to python-list or python-dev." msgstr "" -#: ../../whatsnew/2.2.rst:421 +#: ../../whatsnew/2.2.rst:422 msgid "PEP 234: Iterators" msgstr "PEP 234:疊代器" -#: ../../whatsnew/2.2.rst:423 +#: ../../whatsnew/2.2.rst:424 msgid "" "Another significant addition to 2.2 is an iteration interface at both the C " "and Python levels. Objects can define how they can be looped over by " "callers." msgstr "" -#: ../../whatsnew/2.2.rst:426 +#: ../../whatsnew/2.2.rst:427 msgid "" "In Python versions up to 2.1, the usual way to make ``for item in obj`` work " "is to define a :meth:`~object.__getitem__` method that looks something like " "this::" msgstr "" -#: ../../whatsnew/2.2.rst:429 +#: ../../whatsnew/2.2.rst:430 msgid "" "def __getitem__(self, index):\n" " return " msgstr "" -#: ../../whatsnew/2.2.rst:432 +#: ../../whatsnew/2.2.rst:433 msgid "" ":meth:`~object.__getitem__` is more properly used to define an indexing " "operation on an object so that you can write ``obj[5]`` to retrieve the " @@ -652,7 +673,7 @@ msgid "" "really should." msgstr "" -#: ../../whatsnew/2.2.rst:442 +#: ../../whatsnew/2.2.rst:443 msgid "" "In Python 2.2, iteration can be implemented separately, and :meth:`~object." "__getitem__` methods can be limited to classes that really do support random " @@ -663,7 +684,7 @@ msgid "" "until it returns *sentinel* to signal that the iterator is done." msgstr "" -#: ../../whatsnew/2.2.rst:450 +#: ../../whatsnew/2.2.rst:451 msgid "" "Python classes can define an :meth:`!__iter__` method, which should create " "and return a new iterator for the object; if the object is its own iterator, " @@ -674,7 +695,7 @@ msgid "" "`~PyTypeObject.tp_iternext` function." msgstr "" -#: ../../whatsnew/2.2.rst:457 +#: ../../whatsnew/2.2.rst:458 msgid "" "So, after all this, what do iterators actually do? They have one required " "method, :meth:`next`, which takes no arguments and returns the next value. " @@ -682,7 +703,7 @@ msgid "" "raise the :exc:`StopIteration` exception. ::" msgstr "" -#: ../../whatsnew/2.2.rst:462 +#: ../../whatsnew/2.2.rst:463 msgid "" ">>> L = [1,2,3]\n" ">>> i = iter(L)\n" @@ -701,7 +722,7 @@ msgid "" ">>>" msgstr "" -#: ../../whatsnew/2.2.rst:478 +#: ../../whatsnew/2.2.rst:479 msgid "" "In 2.2, Python's :keyword:`for` statement no longer expects a sequence; it " "expects something for which :func:`iter` will return an iterator. For " @@ -713,7 +734,7 @@ msgid "" "this::" msgstr "" -#: ../../whatsnew/2.2.rst:486 +#: ../../whatsnew/2.2.rst:487 msgid "" ">>> L = [1,2,3]\n" ">>> i = iter(L)\n" @@ -722,14 +743,14 @@ msgid "" "(1, 2, 3)" msgstr "" -#: ../../whatsnew/2.2.rst:492 +#: ../../whatsnew/2.2.rst:493 msgid "" "Iterator support has been added to some of Python's basic types. Calling :" "func:`iter` on a dictionary will return an iterator which loops over its " "keys::" msgstr "" -#: ../../whatsnew/2.2.rst:495 +#: ../../whatsnew/2.2.rst:496 msgid "" ">>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n" "... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n" @@ -749,7 +770,7 @@ msgid "" "Oct 10" msgstr "" -#: ../../whatsnew/2.2.rst:512 +#: ../../whatsnew/2.2.rst:513 msgid "" "That's just the default behaviour. If you want to iterate over keys, " "values, or key/value pairs, you can explicitly call the :meth:`!iterkeys`, :" @@ -758,21 +779,21 @@ msgid "" "dictionaries, so ``key in dict`` is now equivalent to ``dict.has_key(key)``." msgstr "" -#: ../../whatsnew/2.2.rst:518 +#: ../../whatsnew/2.2.rst:519 msgid "" "Files also provide an iterator, which calls the :meth:`readline` method " "until there are no more lines in the file. This means you can now read each " "line of a file using code like this::" msgstr "" -#: ../../whatsnew/2.2.rst:522 +#: ../../whatsnew/2.2.rst:523 msgid "" "for line in file:\n" " # do something for each line\n" " ..." msgstr "" -#: ../../whatsnew/2.2.rst:526 +#: ../../whatsnew/2.2.rst:527 msgid "" "Note that you can only go forward in an iterator; there's no way to get the " "previous element, reset the iterator, or make a copy of it. An iterator " @@ -780,11 +801,11 @@ msgid "" "only requires a :meth:`next` method." msgstr "" -#: ../../whatsnew/2.2.rst:534 +#: ../../whatsnew/2.2.rst:535 msgid ":pep:`234` - Iterators" msgstr ":pep:`234` - 疊代器" -#: ../../whatsnew/2.2.rst:535 +#: ../../whatsnew/2.2.rst:536 msgid "" "Written by Ka-Ping Yee and GvR; implemented by the Python Labs crew, mostly " "by GvR and Tim Peters." @@ -792,17 +813,17 @@ msgstr "" "由 Ka-Ping Yee 和 GvR 撰寫;由 Python Labs 團隊實作,主要為 GvR 和 Tim " "Peters 所貢獻。" -#: ../../whatsnew/2.2.rst:542 +#: ../../whatsnew/2.2.rst:543 msgid "PEP 255: Simple Generators" msgstr "" -#: ../../whatsnew/2.2.rst:544 +#: ../../whatsnew/2.2.rst:545 msgid "" "Generators are another new feature, one that interacts with the introduction " "of iterators." msgstr "" -#: ../../whatsnew/2.2.rst:547 +#: ../../whatsnew/2.2.rst:548 msgid "" "You're doubtless familiar with how function calls work in Python or C. When " "you call a function, it gets a private namespace where its local variables " @@ -815,18 +836,18 @@ msgid "" "functions." msgstr "" -#: ../../whatsnew/2.2.rst:556 +#: ../../whatsnew/2.2.rst:557 msgid "Here's the simplest example of a generator function::" msgstr "" -#: ../../whatsnew/2.2.rst:558 +#: ../../whatsnew/2.2.rst:559 msgid "" "def generate_ints(N):\n" " for i in range(N):\n" " yield i" msgstr "" -#: ../../whatsnew/2.2.rst:562 +#: ../../whatsnew/2.2.rst:563 msgid "" "A new keyword, :keyword:`yield`, was introduced for generators. Any " "function containing a :keyword:`!yield` statement is a generator function; " @@ -837,7 +858,7 @@ msgid "" "Python 2.3 this statement will become unnecessary." msgstr "" -#: ../../whatsnew/2.2.rst:570 +#: ../../whatsnew/2.2.rst:571 msgid "" "When you call a generator function, it doesn't return a single value; " "instead it returns a generator object that supports the iterator protocol. " @@ -853,11 +874,11 @@ msgid "" "explanation of the interaction between :keyword:`!yield` and exceptions.)" msgstr "" -#: ../../whatsnew/2.2.rst:583 +#: ../../whatsnew/2.2.rst:584 msgid "Here's a sample usage of the :func:`!generate_ints` generator::" msgstr "" -#: ../../whatsnew/2.2.rst:585 +#: ../../whatsnew/2.2.rst:586 msgid "" ">>> gen = generate_ints(3)\n" ">>> gen\n" @@ -875,13 +896,13 @@ msgid "" "StopIteration" msgstr "" -#: ../../whatsnew/2.2.rst:600 +#: ../../whatsnew/2.2.rst:601 msgid "" "You could equally write ``for i in generate_ints(5)``, or ``a,b,c = " "generate_ints(3)``." msgstr "" -#: ../../whatsnew/2.2.rst:603 +#: ../../whatsnew/2.2.rst:604 msgid "" "Inside a generator function, the :keyword:`return` statement can only be " "used without a value, and signals the end of the procession of values; " @@ -892,7 +913,7 @@ msgid "" "flow of execution fall off the bottom of the function." msgstr "" -#: ../../whatsnew/2.2.rst:611 +#: ../../whatsnew/2.2.rst:612 msgid "" "You could achieve the effect of generators manually by writing your own " "class and storing all the local variables of the generator as instance " @@ -905,7 +926,7 @@ msgid "" "recursively. ::" msgstr "" -#: ../../whatsnew/2.2.rst:620 +#: ../../whatsnew/2.2.rst:621 msgid "" "# A recursive generator that generates Tree leaves in in-order.\n" "def inorder(t):\n" @@ -917,7 +938,7 @@ msgid "" " yield x" msgstr "" -#: ../../whatsnew/2.2.rst:629 +#: ../../whatsnew/2.2.rst:630 msgid "" "Two other examples in :file:`Lib/test/test_generators.py` produce solutions " "for the N-Queens problem (placing $N$ queens on an $NxN$ chess board so that " @@ -926,7 +947,7 @@ msgid "" "twice)." msgstr "" -#: ../../whatsnew/2.2.rst:634 +#: ../../whatsnew/2.2.rst:635 msgid "" "The idea of generators comes from other programming languages, especially " "Icon (https://www2.cs.arizona.edu/icon/), where the idea of generators is " @@ -936,13 +957,13 @@ msgid "" "of what this looks like::" msgstr "" -#: ../../whatsnew/2.2.rst:641 +#: ../../whatsnew/2.2.rst:642 msgid "" "sentence := \"Store it in the neighboring harbor\"\n" "if (i := find(\"or\", sentence)) > 5 then write(i)" msgstr "" -#: ../../whatsnew/2.2.rst:644 +#: ../../whatsnew/2.2.rst:645 msgid "" "In Icon the :func:`!find` function returns the indexes at which the " "substring \"or\" is found: 3, 23, 33. In the :keyword:`if` statement, ``i`` " @@ -952,7 +973,7 @@ msgid "" "screen." msgstr "" -#: ../../whatsnew/2.2.rst:650 +#: ../../whatsnew/2.2.rst:651 msgid "" "Python doesn't go nearly as far as Icon in adopting generators as a central " "concept. Generators are considered a new part of the core Python language, " @@ -963,22 +984,22 @@ msgid "" "other functions or stored in a data structure." msgstr "" -#: ../../whatsnew/2.2.rst:661 +#: ../../whatsnew/2.2.rst:662 msgid ":pep:`255` - Simple Generators" msgstr "" -#: ../../whatsnew/2.2.rst:662 +#: ../../whatsnew/2.2.rst:663 msgid "" "Written by Neil Schemenauer, Tim Peters, Magnus Lie Hetland. Implemented " "mostly by Neil Schemenauer and Tim Peters, with other fixes from the Python " "Labs crew." msgstr "" -#: ../../whatsnew/2.2.rst:669 +#: ../../whatsnew/2.2.rst:670 msgid "PEP 237: Unifying Long Integers and Integers" msgstr "" -#: ../../whatsnew/2.2.rst:671 +#: ../../whatsnew/2.2.rst:672 msgid "" "In recent versions, the distinction between regular integers, which are 32-" "bit values on most machines, and long integers, which can be of arbitrary " @@ -991,7 +1012,7 @@ msgid "" "exception with the message 'slice index must be int'." msgstr "" -#: ../../whatsnew/2.2.rst:681 +#: ../../whatsnew/2.2.rst:682 msgid "" "Python 2.2 will shift values from short to long integers as required. The " "'L' suffix is no longer needed to indicate a long integer literal, as now " @@ -1002,7 +1023,7 @@ msgid "" "result. For example::" msgstr "" -#: ../../whatsnew/2.2.rst:689 +#: ../../whatsnew/2.2.rst:690 msgid "" ">>> 1234567890123\n" "1234567890123L\n" @@ -1010,28 +1031,28 @@ msgid "" "18446744073709551616L" msgstr "" -#: ../../whatsnew/2.2.rst:694 +#: ../../whatsnew/2.2.rst:695 msgid "" "In most cases, integers and long integers will now be treated identically. " "You can still distinguish them with the :func:`type` built-in function, but " "that's rarely needed." msgstr "" -#: ../../whatsnew/2.2.rst:701 +#: ../../whatsnew/2.2.rst:702 msgid ":pep:`237` - Unifying Long Integers and Integers" msgstr "" -#: ../../whatsnew/2.2.rst:702 +#: ../../whatsnew/2.2.rst:703 msgid "" "Written by Moshe Zadka and Guido van Rossum. Implemented mostly by Guido " "van Rossum." msgstr "" -#: ../../whatsnew/2.2.rst:709 +#: ../../whatsnew/2.2.rst:710 msgid "PEP 238: Changing the Division Operator" msgstr "" -#: ../../whatsnew/2.2.rst:711 +#: ../../whatsnew/2.2.rst:712 msgid "" "The most controversial change in Python 2.2 heralds the start of an effort " "to fix an old design flaw that's been in Python from the beginning. " @@ -1044,7 +1065,7 @@ msgid "" "difficult to determine the possible types of the operands." msgstr "" -#: ../../whatsnew/2.2.rst:721 +#: ../../whatsnew/2.2.rst:722 msgid "" "(The controversy is over whether this is *really* a design flaw, and whether " "it's worth breaking existing code to fix this. It's caused endless " @@ -1054,14 +1075,14 @@ msgid "" "Read :pep:`238` for a summary of arguments and counter-arguments.)" msgstr "" -#: ../../whatsnew/2.2.rst:728 +#: ../../whatsnew/2.2.rst:729 msgid "" "Because this change might break code, it's being introduced very gradually. " "Python 2.2 begins the transition, but the switch won't be complete until " "Python 3.0." msgstr "" -#: ../../whatsnew/2.2.rst:732 +#: ../../whatsnew/2.2.rst:733 msgid "" "First, I'll borrow some terminology from :pep:`238`. \"True division\" is " "the division that most non-programmers are familiar with: 3/2 is 1.5, 1/4 is " @@ -1073,11 +1094,11 @@ msgid "" "the operands is a floating-point number." msgstr "" -#: ../../whatsnew/2.2.rst:740 +#: ../../whatsnew/2.2.rst:741 msgid "Here are the changes 2.2 introduces:" msgstr "" -#: ../../whatsnew/2.2.rst:742 +#: ../../whatsnew/2.2.rst:743 msgid "" "A new operator, ``//``, is the floor division operator. (Yes, we know it " "looks like C++'s comment symbol.) ``//`` *always* performs floor division " @@ -1085,13 +1106,13 @@ msgid "" "``1.0 // 2.0`` is also 0.0." msgstr "" -#: ../../whatsnew/2.2.rst:747 +#: ../../whatsnew/2.2.rst:748 msgid "" "``//`` is always available in Python 2.2; you don't need to enable it using " "a ``__future__`` statement." msgstr "" -#: ../../whatsnew/2.2.rst:750 +#: ../../whatsnew/2.2.rst:751 msgid "" "By including a ``from __future__ import division`` in a module, the ``/`` " "operator will be changed to return the result of true division, so ``1/2`` " @@ -1099,7 +1120,7 @@ msgid "" "division. The default meaning of ``/`` will not change until Python 3.0." msgstr "" -#: ../../whatsnew/2.2.rst:755 +#: ../../whatsnew/2.2.rst:756 msgid "" "Classes can define methods called :meth:`~object.__truediv__` and :meth:" "`~object.__floordiv__` to overload the two division operators. At the C " @@ -1107,7 +1128,7 @@ msgid "" "extension types can define the two operators." msgstr "" -#: ../../whatsnew/2.2.rst:760 +#: ../../whatsnew/2.2.rst:761 msgid "" "Python 2.2 supports some command-line arguments for testing whether code " "will work with the changed division semantics. Running python with :option:" @@ -1117,21 +1138,21 @@ msgid "" "without a warning; the warning will be turned on by default in Python 2.3." msgstr "" -#: ../../whatsnew/2.2.rst:770 +#: ../../whatsnew/2.2.rst:771 msgid ":pep:`238` - Changing the Division Operator" msgstr "" -#: ../../whatsnew/2.2.rst:771 +#: ../../whatsnew/2.2.rst:772 msgid "" "Written by Moshe Zadka and Guido van Rossum. Implemented by Guido van " "Rossum.." msgstr "" -#: ../../whatsnew/2.2.rst:777 +#: ../../whatsnew/2.2.rst:778 msgid "Unicode Changes" msgstr "Unicode 變更" -#: ../../whatsnew/2.2.rst:779 +#: ../../whatsnew/2.2.rst:780 msgid "" "Python's Unicode support has been enhanced a bit in 2.2. Unicode strings " "are usually stored as UCS-2, as 16-bit unsigned integers. Python 2.2 can " @@ -1141,7 +1162,7 @@ msgid "" "completely disable Unicode support.)" msgstr "" -#: ../../whatsnew/2.2.rst:786 +#: ../../whatsnew/2.2.rst:787 msgid "" "When built to use UCS-4 (a \"wide Python\"), the interpreter can natively " "handle Unicode characters from U+000000 to U+110000, so the range of legal " @@ -1152,7 +1173,7 @@ msgid "" "characters\"; consult it for further details." msgstr "" -#: ../../whatsnew/2.2.rst:794 +#: ../../whatsnew/2.2.rst:795 msgid "" "Another change is simpler to explain. Since their introduction, Unicode " "strings have supported an :meth:`!encode` method to convert the string to a " @@ -1163,14 +1184,14 @@ msgid "" "codec." msgstr "" -#: ../../whatsnew/2.2.rst:801 +#: ../../whatsnew/2.2.rst:802 msgid "" "Using this new feature, codecs have been added for tasks not directly " "related to Unicode. For example, codecs have been added for uu-encoding, " "MIME's base64 encoding, and compression with the :mod:`zlib` module::" msgstr "" -#: ../../whatsnew/2.2.rst:805 +#: ../../whatsnew/2.2.rst:806 msgid "" ">>> s = \"\"\"Here is a lengthy piece of redundant, overly verbose,\n" "... and repetitive text.\n" @@ -1191,32 +1212,32 @@ msgid "" "'furrfu'" msgstr "" -#: ../../whatsnew/2.2.rst:822 +#: ../../whatsnew/2.2.rst:823 msgid "" "To convert a class instance to Unicode, a :meth:`!__unicode__` method can be " "defined by a class, analogous to :meth:`!__str__`." msgstr "" -#: ../../whatsnew/2.2.rst:825 +#: ../../whatsnew/2.2.rst:826 msgid "" ":meth:`!encode`, :meth:`!decode`, and :meth:`!__unicode__` were implemented " "by Marc-André Lemburg. The changes to support using UCS-4 internally were " "implemented by Fredrik Lundh and Martin von Löwis." msgstr "" -#: ../../whatsnew/2.2.rst:832 +#: ../../whatsnew/2.2.rst:833 msgid ":pep:`261` - Support for 'wide' Unicode characters" msgstr ":pep:`261` - 支援 'wide' Unicode 字元" -#: ../../whatsnew/2.2.rst:833 +#: ../../whatsnew/2.2.rst:834 msgid "Written by Paul Prescod." msgstr "由 Paul Prescod 撰寫。" -#: ../../whatsnew/2.2.rst:839 +#: ../../whatsnew/2.2.rst:840 msgid "PEP 227: Nested Scopes" msgstr "" -#: ../../whatsnew/2.2.rst:841 +#: ../../whatsnew/2.2.rst:842 msgid "" "In Python 2.1, statically nested scopes were added as an optional feature, " "to be enabled by a ``from __future__ import nested_scopes`` directive. In " @@ -1226,7 +1247,7 @@ msgid "" "2.1 came out, you can skip the rest of this section." msgstr "" -#: ../../whatsnew/2.2.rst:848 +#: ../../whatsnew/2.2.rst:849 msgid "" "The largest change introduced in Python 2.1, and made complete in 2.2, is to " "Python's scoping rules. In Python 2.0, at any given time there are at most " @@ -1236,7 +1257,7 @@ msgid "" "definition doesn't work::" msgstr "" -#: ../../whatsnew/2.2.rst:855 +#: ../../whatsnew/2.2.rst:856 msgid "" "def f():\n" " ...\n" @@ -1246,7 +1267,7 @@ msgid "" " ..." msgstr "" -#: ../../whatsnew/2.2.rst:862 +#: ../../whatsnew/2.2.rst:863 msgid "" "The function :func:`!g` will always raise a :exc:`NameError` exception, " "because the binding of the name ``g`` isn't in either its local namespace or " @@ -1258,7 +1279,7 @@ msgid "" "arguments. ::" msgstr "" -#: ../../whatsnew/2.2.rst:870 +#: ../../whatsnew/2.2.rst:871 msgid "" "def find(self, name):\n" " \"Return list of any entries equal to 'name'\"\n" @@ -1267,13 +1288,13 @@ msgid "" " return L" msgstr "" -#: ../../whatsnew/2.2.rst:876 +#: ../../whatsnew/2.2.rst:877 msgid "" "The readability of Python code written in a strongly functional style " "suffers greatly as a result." msgstr "" -#: ../../whatsnew/2.2.rst:879 +#: ../../whatsnew/2.2.rst:880 msgid "" "The most significant change to Python 2.2 is that static scoping has been " "added to the language to fix this problem. As a first effect, the " @@ -1285,7 +1306,7 @@ msgid "" "rules, and a dissection of the implementation, can be found in the PEP." msgstr "" -#: ../../whatsnew/2.2.rst:888 +#: ../../whatsnew/2.2.rst:889 msgid "" "This change may cause some compatibility problems for code where the same " "variable name is used both at the module level and as a local variable " @@ -1294,7 +1315,7 @@ msgid "" "read in the first place." msgstr "" -#: ../../whatsnew/2.2.rst:894 +#: ../../whatsnew/2.2.rst:895 msgid "" "One side effect of the change is that the ``from module import *`` and " "``exec`` statements have been made illegal inside a function scope under " @@ -1310,11 +1331,11 @@ msgid "" "the compiler will flag this by raising a :exc:`SyntaxError` exception." msgstr "" -#: ../../whatsnew/2.2.rst:907 +#: ../../whatsnew/2.2.rst:908 msgid "To make the preceding explanation a bit clearer, here's an example::" msgstr "" -#: ../../whatsnew/2.2.rst:909 +#: ../../whatsnew/2.2.rst:910 msgid "" "x = 1\n" "def f():\n" @@ -1324,33 +1345,33 @@ msgid "" " return x" msgstr "" -#: ../../whatsnew/2.2.rst:916 +#: ../../whatsnew/2.2.rst:917 msgid "" "Line 4 containing the ``exec`` statement is a syntax error, since ``exec`` " "would define a new local variable named ``x`` whose value should be accessed " "by :func:`!g`." msgstr "" -#: ../../whatsnew/2.2.rst:920 +#: ../../whatsnew/2.2.rst:921 msgid "" "This shouldn't be much of a limitation, since ``exec`` is rarely used in " "most Python code (and when it is used, it's often a sign of a poor design " "anyway)." msgstr "" -#: ../../whatsnew/2.2.rst:927 +#: ../../whatsnew/2.2.rst:928 msgid ":pep:`227` - Statically Nested Scopes" msgstr "" -#: ../../whatsnew/2.2.rst:928 +#: ../../whatsnew/2.2.rst:929 msgid "Written and implemented by Jeremy Hylton." msgstr "" -#: ../../whatsnew/2.2.rst:934 +#: ../../whatsnew/2.2.rst:935 msgid "New and Improved Modules" msgstr "" -#: ../../whatsnew/2.2.rst:936 +#: ../../whatsnew/2.2.rst:937 msgid "" "The :mod:`xmlrpclib ` module was contributed to the standard " "library by Fredrik Lundh, providing support for writing XML-RPC clients. " @@ -1360,7 +1381,7 @@ msgid "" "channel::" msgstr "" -#: ../../whatsnew/2.2.rst:942 +#: ../../whatsnew/2.2.rst:943 msgid "" "import xmlrpclib\n" "s = xmlrpclib.Server(\n" @@ -1380,20 +1401,20 @@ msgid "" "# 'title': 'html2fo 0.3 (Default)'}, ... ]" msgstr "" -#: ../../whatsnew/2.2.rst:959 +#: ../../whatsnew/2.2.rst:960 msgid "" "The :mod:`SimpleXMLRPCServer ` module makes it easy to create " "straightforward XML-RPC servers. See http://xmlrpc.scripting.com/ for more " "information about XML-RPC." msgstr "" -#: ../../whatsnew/2.2.rst:962 +#: ../../whatsnew/2.2.rst:963 msgid "" "The new :mod:`hmac` module implements the HMAC algorithm described by :rfc:" "`2104`. (Contributed by Gerhard Häring.)" msgstr "" -#: ../../whatsnew/2.2.rst:965 +#: ../../whatsnew/2.2.rst:966 msgid "" "Several functions that originally returned lengthy tuples now return pseudo-" "sequences that still behave like tuples but also have mnemonic attributes " @@ -1404,7 +1425,7 @@ msgid "" "`time` module." msgstr "" -#: ../../whatsnew/2.2.rst:972 +#: ../../whatsnew/2.2.rst:973 msgid "" "For example, to obtain a file's size using the old tuples, you'd end up " "writing something like ``file_size = os.stat(filename)[stat.ST_SIZE]``, but " @@ -1412,25 +1433,25 @@ msgid "" "st_size``." msgstr "" -#: ../../whatsnew/2.2.rst:976 +#: ../../whatsnew/2.2.rst:977 msgid "The original patch for this feature was contributed by Nick Mathewson." msgstr "" -#: ../../whatsnew/2.2.rst:978 +#: ../../whatsnew/2.2.rst:979 msgid "" "The Python profiler has been extensively reworked and various errors in its " "output have been corrected. (Contributed by Fred L. Drake, Jr. and Tim " "Peters.)" msgstr "" -#: ../../whatsnew/2.2.rst:981 +#: ../../whatsnew/2.2.rst:982 msgid "" "The :mod:`socket` module can be compiled to support IPv6; specify the :" "option:`!--enable-ipv6` option to Python's configure script. (Contributed " "by Jun-ichiro \"itojun\" Hagino.)" msgstr "" -#: ../../whatsnew/2.2.rst:985 +#: ../../whatsnew/2.2.rst:986 msgid "" "Two new format characters were added to the :mod:`struct` module for 64-bit " "integers on platforms that support the C :c:expr:`long long` type. ``q`` is " @@ -1438,7 +1459,7 @@ msgid "" "returned in Python's long integer type. (Contributed by Tim Peters.)" msgstr "" -#: ../../whatsnew/2.2.rst:990 +#: ../../whatsnew/2.2.rst:991 msgid "" "In the interpreter's interactive mode, there's a new built-in function :func:" "`help` that uses the :mod:`pydoc` module introduced in Python 2.1 to provide " @@ -1449,7 +1470,7 @@ msgid "" "`pydoc` module.)" msgstr "" -#: ../../whatsnew/2.2.rst:998 +#: ../../whatsnew/2.2.rst:999 msgid "" "Various bugfixes and performance improvements have been made to the SRE " "engine underlying the :mod:`re` module. For example, the :func:`re.sub` " @@ -1460,7 +1481,7 @@ msgid "" "Fredrik Lundh. The BIGCHARSET patch was contributed by Martin von Löwis.)" msgstr "" -#: ../../whatsnew/2.2.rst:1006 +#: ../../whatsnew/2.2.rst:1007 msgid "" "The :mod:`smtplib` module now supports :rfc:`2487`, \"Secure SMTP over " "TLS\", so it's now possible to encrypt the SMTP traffic between a Python " @@ -1468,7 +1489,7 @@ msgid "" "also supports SMTP authentication. (Contributed by Gerhard Häring.)" msgstr "" -#: ../../whatsnew/2.2.rst:1011 +#: ../../whatsnew/2.2.rst:1012 msgid "" "The :mod:`imaplib` module, maintained by Piers Lauder, has support for " "several new extensions: the NAMESPACE extension defined in :rfc:`2342`, " @@ -1476,7 +1497,7 @@ msgid "" "Pelletier.)" msgstr "" -#: ../../whatsnew/2.2.rst:1015 +#: ../../whatsnew/2.2.rst:1016 msgid "" "The :mod:`!rfc822` module's parsing of email addresses is now compliant " "with :rfc:`2822`, an update to :rfc:`822`. (The module's name is *not* " @@ -1485,7 +1506,7 @@ msgid "" "Barry Warsaw, and arising out of his work on Mailman.)" msgstr "" -#: ../../whatsnew/2.2.rst:1021 +#: ../../whatsnew/2.2.rst:1022 msgid "" "The :mod:`difflib` module now contains a new :class:`!Differ` class for " "producing human-readable lists of changes (a \"delta\") between two " @@ -1496,7 +1517,7 @@ msgid "" "the generatorization.)" msgstr "" -#: ../../whatsnew/2.2.rst:1028 +#: ../../whatsnew/2.2.rst:1029 msgid "" "New constants :const:`!ascii_letters`, :const:`!ascii_lowercase`, and :const:" "`!ascii_uppercase` were added to the :mod:`string` module. There were " @@ -1508,25 +1529,25 @@ msgid "" "person; fixed by Fred L. Drake, Jr.)" msgstr "" -#: ../../whatsnew/2.2.rst:1037 +#: ../../whatsnew/2.2.rst:1038 msgid "" "The :mod:`mimetypes` module now makes it easier to use alternative MIME-type " "databases by the addition of a :class:`~mimetypes.MimeTypes` class, which " "takes a list of filenames to be parsed. (Contributed by Fred L. Drake, Jr.)" msgstr "" -#: ../../whatsnew/2.2.rst:1041 +#: ../../whatsnew/2.2.rst:1042 msgid "" "A :class:`~threading.Timer` class was added to the :mod:`threading` module " "that allows scheduling an activity to happen at some future time. " "(Contributed by Itamar Shtull-Trauring.)" msgstr "" -#: ../../whatsnew/2.2.rst:1049 +#: ../../whatsnew/2.2.rst:1050 msgid "Interpreter Changes and Fixes" msgstr "直譯器的變更與修正" -#: ../../whatsnew/2.2.rst:1051 +#: ../../whatsnew/2.2.rst:1052 msgid "" "Some of the changes only affect people who deal with the Python interpreter " "at the C level because they're writing Python extension modules, embedding " @@ -1535,7 +1556,7 @@ msgid "" "much." msgstr "" -#: ../../whatsnew/2.2.rst:1056 +#: ../../whatsnew/2.2.rst:1057 msgid "" "Profiling and tracing functions can now be implemented in C, which can " "operate at much higher speeds than Python-based functions and should reduce " @@ -1547,7 +1568,7 @@ msgid "" "(Contributed by Fred L. Drake, Jr.)" msgstr "" -#: ../../whatsnew/2.2.rst:1065 +#: ../../whatsnew/2.2.rst:1066 msgid "" "Another low-level API, primarily of interest to implementers of Python " "debuggers and development tools, was added. :c:func:" @@ -1558,7 +1579,7 @@ msgid "" "David Beazley.)" msgstr "" -#: ../../whatsnew/2.2.rst:1072 +#: ../../whatsnew/2.2.rst:1073 msgid "" "The C-level interface to the garbage collector has been changed to make it " "easier to write extension types that support garbage collection and to debug " @@ -1569,41 +1590,41 @@ msgid "" "priority." msgstr "" -#: ../../whatsnew/2.2.rst:1079 +#: ../../whatsnew/2.2.rst:1080 msgid "" "To upgrade an extension module to the new API, perform the following steps:" msgstr "" -#: ../../whatsnew/2.2.rst:1081 +#: ../../whatsnew/2.2.rst:1082 msgid "Rename :c:macro:`!Py_TPFLAGS_GC` to :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" "將 :c:macro:`!Py_TPFLAGS_GC` 重新命名為 :c:macro:`Py_TPFLAGS_HAVE_GC`。" -#: ../../whatsnew/2.2.rst:1083 +#: ../../whatsnew/2.2.rst:1084 msgid "" "Use :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar` to allocate" msgstr "" -#: ../../whatsnew/2.2.rst:1084 +#: ../../whatsnew/2.2.rst:1085 msgid "objects, and :c:func:`PyObject_GC_Del` to deallocate them." msgstr "" -#: ../../whatsnew/2.2.rst:1086 +#: ../../whatsnew/2.2.rst:1087 msgid "" "Rename :c:func:`!PyObject_GC_Init` to :c:func:`PyObject_GC_Track` and :c:" "func:`!PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`." msgstr "" -#: ../../whatsnew/2.2.rst:1089 +#: ../../whatsnew/2.2.rst:1090 msgid "Remove :c:macro:`!PyGC_HEAD_SIZE` from object size calculations." msgstr "" -#: ../../whatsnew/2.2.rst:1091 +#: ../../whatsnew/2.2.rst:1092 msgid "" "Remove calls to :c:func:`!PyObject_AS_GC` and :c:func:`!PyObject_FROM_GC`." msgstr "" -#: ../../whatsnew/2.2.rst:1093 +#: ../../whatsnew/2.2.rst:1094 msgid "" "A new ``et`` format sequence was added to :c:func:`PyArg_ParseTuple`; ``et`` " "takes both a parameter and an encoding name, and converts the parameter to " @@ -1615,7 +1636,7 @@ msgid "" "and used for the MBCS support on Windows described in the following section.)" msgstr "" -#: ../../whatsnew/2.2.rst:1102 +#: ../../whatsnew/2.2.rst:1103 msgid "" "A different argument parsing function, :c:func:`PyArg_UnpackTuple`, has been " "added that's simpler and presumably faster. Instead of specifying a format " @@ -1624,7 +1645,7 @@ msgid "" "be filled in with argument values." msgstr "" -#: ../../whatsnew/2.2.rst:1108 +#: ../../whatsnew/2.2.rst:1109 msgid "" "Two new flags :c:macro:`METH_NOARGS` and :c:macro:`METH_O` are available in " "method definition tables to simplify implementation of methods with no " @@ -1634,7 +1655,7 @@ msgid "" "methods is now officially deprecated." msgstr "" -#: ../../whatsnew/2.2.rst:1114 +#: ../../whatsnew/2.2.rst:1115 msgid "" "Two new wrapper functions, :c:func:`PyOS_snprintf` and :c:func:" "`PyOS_vsnprintf` were added to provide cross-platform implementations for " @@ -1644,7 +1665,7 @@ msgid "" "protect against buffer overruns. (Contributed by M.-A. Lemburg.)" msgstr "" -#: ../../whatsnew/2.2.rst:1121 +#: ../../whatsnew/2.2.rst:1122 msgid "" "The :c:func:`_PyTuple_Resize` function has lost an unused parameter, so now " "it takes 2 parameters instead of 3. The third argument was never used, and " @@ -1652,11 +1673,11 @@ msgid "" "2.2." msgstr "" -#: ../../whatsnew/2.2.rst:1129 +#: ../../whatsnew/2.2.rst:1130 msgid "Other Changes and Fixes" msgstr "其他改動與修正" -#: ../../whatsnew/2.2.rst:1131 +#: ../../whatsnew/2.2.rst:1132 msgid "" "As usual there were a bunch of other improvements and bugfixes scattered " "throughout the source tree. A search through the CVS change logs finds " @@ -1665,18 +1686,18 @@ msgid "" "and fixed 82 bugs. These figures are likely to be underestimates." msgstr "" -#: ../../whatsnew/2.2.rst:1137 +#: ../../whatsnew/2.2.rst:1138 msgid "Some of the more notable changes are:" msgstr "一些較顯著的變更為:" -#: ../../whatsnew/2.2.rst:1139 +#: ../../whatsnew/2.2.rst:1140 msgid "" "The code for the MacOS port for Python, maintained by Jack Jansen, is now " "kept in the main Python CVS tree, and many changes have been made to support " "MacOS X." msgstr "" -#: ../../whatsnew/2.2.rst:1142 +#: ../../whatsnew/2.2.rst:1143 msgid "" "The most significant change is the ability to build Python as a framework, " "enabled by supplying the :option:`!--enable-framework` option to the " @@ -1690,7 +1711,7 @@ msgid "" "OSA scripting language and much more.\"" msgstr "" -#: ../../whatsnew/2.2.rst:1153 +#: ../../whatsnew/2.2.rst:1154 msgid "" "Most of the MacPython toolbox modules, which interface to MacOS APIs such as " "windowing, QuickTime, scripting, etc. have been ported to OS X, but they've " @@ -1698,14 +1719,14 @@ msgid "" "with these modules can uncomment them manually." msgstr "" -#: ../../whatsnew/2.2.rst:1176 +#: ../../whatsnew/2.2.rst:1177 msgid "" "Keyword arguments passed to built-in functions that don't take them now " "cause a :exc:`TypeError` exception to be raised, with the message " "\"*function* takes no keyword arguments\"." msgstr "" -#: ../../whatsnew/2.2.rst:1180 +#: ../../whatsnew/2.2.rst:1181 msgid "" "Weak references, added in Python 2.1 as an extension module, are now part of " "the core because they're used in the implementation of new-style classes. " @@ -1713,14 +1734,14 @@ msgid "" "`weakref` module to become a built-in exception." msgstr "" -#: ../../whatsnew/2.2.rst:1185 +#: ../../whatsnew/2.2.rst:1186 msgid "" "A new script, :file:`Tools/scripts/cleanfuture.py` by Tim Peters, " "automatically removes obsolete ``__future__`` statements from Python source " "code." msgstr "" -#: ../../whatsnew/2.2.rst:1189 +#: ../../whatsnew/2.2.rst:1190 msgid "" "An additional *flags* argument has been added to the built-in function :func:" "`compile`, so the behaviour of ``__future__`` statements can now be " @@ -1729,7 +1750,7 @@ msgid "" "(Contributed by Michael Hudson.)" msgstr "" -#: ../../whatsnew/2.2.rst:1195 +#: ../../whatsnew/2.2.rst:1196 msgid "" "The new license introduced with Python 1.6 wasn't GPL-compatible. This is " "fixed by some minor textual changes to the 2.2 license, so it's now legal to " @@ -1739,7 +1760,7 @@ msgid "" "to the Python 2.0.1 and 2.1.1 releases." msgstr "" -#: ../../whatsnew/2.2.rst:1202 +#: ../../whatsnew/2.2.rst:1203 msgid "" "When presented with a Unicode filename on Windows, Python will now convert " "it to an MBCS encoded string, as used by the Microsoft file APIs. As MBCS " @@ -1750,18 +1771,18 @@ msgid "" "Unix support was added by Martin von Löwis.)" msgstr "" -#: ../../whatsnew/2.2.rst:1210 +#: ../../whatsnew/2.2.rst:1211 msgid "" "Large file support is now enabled on Windows. (Contributed by Tim Peters.)" msgstr "" -#: ../../whatsnew/2.2.rst:1212 +#: ../../whatsnew/2.2.rst:1213 msgid "" "The :file:`Tools/scripts/ftpmirror.py` script now parses a :file:`.netrc` " "file, if you have one. (Contributed by Mike Romberg.)" msgstr "" -#: ../../whatsnew/2.2.rst:1215 +#: ../../whatsnew/2.2.rst:1216 msgid "" "Some features of the object returned by the :func:`!xrange` function are now " "deprecated, and trigger warnings when they're accessed; they'll disappear in " @@ -1774,7 +1795,7 @@ msgid "" "been deprecated." msgstr "" -#: ../../whatsnew/2.2.rst:1224 +#: ../../whatsnew/2.2.rst:1225 msgid "" "There were a bunch of patches to the dictionary implementation, mostly to " "fix potential core dumps if a dictionary contains objects that sneakily " @@ -1784,14 +1805,14 @@ msgid "" "case, and round and round it went." msgstr "" -#: ../../whatsnew/2.2.rst:1231 +#: ../../whatsnew/2.2.rst:1232 msgid "" "On Windows, Python can now be compiled with Borland C thanks to a number of " "patches contributed by Stephen Hansen, though the result isn't fully " "functional yet. (But this *is* progress...)" msgstr "" -#: ../../whatsnew/2.2.rst:1235 +#: ../../whatsnew/2.2.rst:1236 msgid "" "Another Windows enhancement: Wise Solutions generously offered PythonLabs " "use of their InstallerMaster 8.1 system. Earlier PythonLabs Windows " @@ -1799,7 +1820,7 @@ msgid "" "up by Tim Peters.)" msgstr "" -#: ../../whatsnew/2.2.rst:1239 +#: ../../whatsnew/2.2.rst:1240 msgid "" "Files ending in ``.pyw`` can now be imported on Windows. ``.pyw`` is a " "Windows-only thing, used to indicate that a script needs to be run using " @@ -1809,7 +1830,7 @@ msgid "" "Bolen.)" msgstr "" -#: ../../whatsnew/2.2.rst:1245 +#: ../../whatsnew/2.2.rst:1246 msgid "" "On platforms where Python uses the C :c:func:`dlopen` function to load " "extension modules, it's now possible to set the flags used by :c:func:" @@ -1817,7 +1838,7 @@ msgid "" "functions. (Contributed by Bram Stolk.)" msgstr "" -#: ../../whatsnew/2.2.rst:1250 +#: ../../whatsnew/2.2.rst:1251 msgid "" "The :func:`pow` built-in function no longer supports 3 arguments when " "floating-point numbers are supplied. ``pow(x, y, z)`` returns ``(x**y) % " @@ -1826,11 +1847,11 @@ msgid "" "``pow(2.0, 8.0, 7.0)`` will now raise a :exc:`TypeError` exception." msgstr "" -#: ../../whatsnew/2.2.rst:1260 +#: ../../whatsnew/2.2.rst:1261 msgid "Acknowledgements" msgstr "致謝" -#: ../../whatsnew/2.2.rst:1262 +#: ../../whatsnew/2.2.rst:1263 msgid "" "The author would like to thank the following people for offering " "suggestions, corrections and assistance with various drafts of this article: " diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index 6e32c82426..3173149b94 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -874,9 +874,9 @@ msgstr "" msgid "" "When encoding a Unicode string into a byte string, unencodable characters " "may be encountered. So far, Python has allowed specifying the error " -"processing as either \"strict\" (raising :exc:`UnicodeError`), \"ignore\" " -"(skipping the character), or \"replace\" (using a question mark in the " -"output string), with \"strict\" being the default behavior. It may be " +"processing as either \"strict\" (raising :exc:`UnicodeError`), " +"\"ignore\" (skipping the character), or \"replace\" (using a question mark " +"in the output string), with \"strict\" being the default behavior. It may be " "desirable to specify alternative processing of such errors, such as " "inserting an XML character reference or HTML entity reference into the " "converted string." @@ -1663,11 +1663,11 @@ msgstr "" #: ../../whatsnew/2.3.rst:1115 msgid "" "One of the noted incompatibilities between old- and new-style classes has " -"been removed: you can now assign to the :attr:`~definition.__name__` and :" -"attr:`~class.__bases__` attributes of new-style classes. There are some " -"restrictions on what can be assigned to :attr:`~class.__bases__` along the " -"lines of those relating to assigning to an instance's :attr:`~instance." -"__class__` attribute." +"been removed: you can now assign to the :attr:`~type.__name__` and :attr:" +"`~type.__bases__` attributes of new-style classes. There are some " +"restrictions on what can be assigned to :attr:`!__bases__` along the lines " +"of those relating to assigning to an instance's :attr:`~object.__class__` " +"attribute." msgstr "" #: ../../whatsnew/2.3.rst:1125 @@ -2892,8 +2892,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1927 msgid "" "If you dynamically allocate type objects in your extension, you should be " -"aware of a change in the rules relating to the :attr:`!__module__` and :attr:" -"`~definition.__name__` attributes. In summary, you will want to ensure the " +"aware of a change in the rules relating to the :attr:`~type.__module__` and :" +"attr:`~type.__name__` attributes. In summary, you will want to ensure the " "type's dictionary contains a ``'__module__'`` key; making the module name " "the part of the type name leading up to the final period will no longer have " "the desired effect. For more detail, read the API reference documentation " diff --git a/whatsnew/3.1.po b/whatsnew/3.1.po index c931bef0cf..df59f43bf2 100644 --- a/whatsnew/3.1.po +++ b/whatsnew/3.1.po @@ -34,6 +34,8 @@ msgid "" "This article explains the new features in Python 3.1, compared to 3.0. " "Python 3.1 was released on June 27, 2009." msgstr "" +"本文介紹了 Python 3.1 與 3.0 相比的新功能。Python 3.1 已於 2009 年 6 月 27 日" +"發布。" #: ../../whatsnew/3.1.rst:54 msgid "PEP 372: Ordered Dictionaries" @@ -912,7 +914,7 @@ msgstr "(由 Larry Hastings 貢獻;:issue:`5630`。)" #: ../../whatsnew/3.1.rst:548 msgid "Porting to Python 3.1" -msgstr "" +msgstr "移植至 Python 3.1" #: ../../whatsnew/3.1.rst:550 msgid "" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index d81741b506..ee2fe63fc7 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -35,12 +35,12 @@ msgid "" "Python 3.10 was released on October 4, 2021. For full details, see the :ref:" "`changelog `." msgstr "" -"本文介紹了 Python 3.10 與 3.9 相比的新功能。Python 3.10 於 2021 年 10 月 4 日" -"發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" +"本文介紹了 Python 3.10 與 3.9 相比多了哪些新功能。Python 3.10 已於 2021 年 " +"10 月 4 日發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" #: ../../whatsnew/3.10.rst:52 msgid "Summary -- Release highlights" -msgstr "摘要 -- 發布重點" +msgstr "發布重點摘要" #: ../../whatsnew/3.10.rst:60 msgid "New syntax features:" @@ -127,7 +127,7 @@ msgstr ":pep:`597`,新增可選的 EncodingWarning" #: ../../whatsnew/3.10.rst:92 ../../whatsnew/3.10.rst:2053 msgid "New Features" -msgstr "新功能" +msgstr "新增功能" #: ../../whatsnew/3.10.rst:97 msgid "Parenthesized context managers" diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index ee765c9437..0d18eb3a67 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -36,7 +36,7 @@ msgid "" "Python 3.11 was released on October 24, 2022. For full details, see the :ref:" "`changelog `." msgstr "" -"此文章解釋了 Python 3.11 和 3.10 相比多了哪些新特性。Python 3.11 於 2022 年 " +"此文章解釋了 Python 3.11 和 3.10 相比多了哪些新功能。Python 3.11 於 2022 年 " "10 月 24 日發布。完整細節請見 :ref:`changelog`。" #: ../../whatsnew/3.11.rst:55 @@ -63,7 +63,7 @@ msgstr ":ref:`whatsnew311-pep654`" #: ../../whatsnew/3.11.rst:70 msgid "New built-in features:" -msgstr "新增內建特性:" +msgstr "新的內建功能:" #: ../../whatsnew/3.11.rst:72 msgid ":ref:`whatsnew311-pep678`" @@ -149,7 +149,7 @@ msgstr ":pep:`670`::ref:`轉換為靜態行內函式的巨集 \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,8 +34,8 @@ msgid "" "Python 3.12 was released on October 2, 2023. For full details, see the :ref:" "`changelog `." msgstr "" -"本文介紹了 Python 3.12 與 3.11 相比的新功能。 Python 3.12 於 2023 年 10 月 2 " -"日發布。完整詳請請見 :ref:`changelog `。" +"本文介紹了 Python 3.12 與 3.11 相比多了哪些新功能。 Python 3.12 於 2023 年 " +"10 月 2 日發布。完整詳請請見 :ref:`changelog `。" #: ../../whatsnew/3.12.rst:54 msgid ":pep:`693` -- Python 3.12 Release Schedule" @@ -129,7 +129,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:111 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.12.rst:113 msgid "The :class:`pathlib.Path` class now supports subclassing" @@ -267,7 +267,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1825 msgid "New Features" -msgstr "新增特性" +msgstr "新增功能" #: ../../whatsnew/3.12.rst:181 msgid "PEP 695: Type Parameter Syntax" @@ -1844,37 +1844,37 @@ msgid "" msgstr ":mod:`importlib.abc`:棄用下列類別,預定於 Python 3.14 中移除:" #: ../../whatsnew/3.12.rst:1205 -#: ../../deprecations/pending-removal-in-3.14.rst:55 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" #: ../../whatsnew/3.12.rst:1206 -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" #: ../../whatsnew/3.12.rst:1207 -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" #: ../../whatsnew/3.12.rst:1209 -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" #: ../../whatsnew/3.12.rst:1211 -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" #: ../../whatsnew/3.12.rst:1212 -#: ../../deprecations/pending-removal-in-3.14.rst:62 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" #: ../../whatsnew/3.12.rst:1214 -#: ../../deprecations/pending-removal-in-3.14.rst:64 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" @@ -1958,7 +1958,7 @@ msgstr "" "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" #: ../../whatsnew/3.12.rst:1267 -#: ../../deprecations/pending-removal-in-3.14.rst:94 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" @@ -1994,7 +1994,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1290 -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:53 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" @@ -2281,18 +2281,10 @@ msgstr "" "Alan Williams 於 :gh:`72346` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:50 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -2303,7 +2295,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:72 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -2320,7 +2312,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:80 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -2328,7 +2320,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -2338,23 +2330,23 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:92 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -2364,7 +2356,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -2372,7 +2364,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:105 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -2384,7 +2376,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -2392,7 +2384,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:115 +#: ../../deprecations/pending-removal-in-3.14.rst:112 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -2440,10 +2432,18 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:20 +msgid "" +":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " +"taken into consideration by the import system (:gh:`97879`)." +msgstr "" +":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " +"系統考慮。 (:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:23 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:22 +#: ../../deprecations/pending-removal-in-3.15.rst:25 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -2456,11 +2456,11 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:30 +#: ../../deprecations/pending-removal-in-3.15.rst:33 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-3.15.rst:35 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -2468,11 +2468,11 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:36 +#: ../../deprecations/pending-removal-in-3.15.rst:39 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:38 +#: ../../deprecations/pending-removal-in-3.15.rst:41 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -2481,11 +2481,11 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:45 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:47 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -2496,7 +2496,7 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:52 +#: ../../deprecations/pending-removal-in-3.15.rst:55 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -2507,7 +2507,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:58 +#: ../../deprecations/pending-removal-in-3.15.rst:61 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -2517,11 +2517,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:63 +#: ../../deprecations/pending-removal-in-3.15.rst:66 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:65 +#: ../../deprecations/pending-removal-in-3.15.rst:68 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -3702,7 +3702,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:1663 ../../whatsnew/3.12.rst:1987 msgid "Porting to Python 3.12" -msgstr "" +msgstr "移植至 Python 3.12" #: ../../whatsnew/3.12.rst:1665 msgid "" @@ -4094,8 +4094,8 @@ msgstr "" msgid "" "The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " -"classes to support object ``__dict__`` and weakrefs with less bookkeeping, " -"using less memory and with faster access." +"classes to support object :attr:`~object.__dict__` and weakrefs with less " +"bookkeeping, using less memory and with faster access." msgstr "" #: ../../whatsnew/3.12.rst:1893 @@ -4304,7 +4304,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:2008 msgid "" -"To get a list of subclasses, call the Python method :py:meth:`~class." +"To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__` (using :c:func:`PyObject_CallMethod`, for example)." msgstr "" @@ -4334,8 +4334,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:2028 msgid "" -"Extension classes wanting to add a ``__dict__`` or weak reference slot " -"should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"Extension classes wanting to add a :attr:`~object.__dict__` or weak " +"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " "``tp_weaklistoffset``, respectively. The use of ``tp_dictoffset`` and " "``tp_weaklistoffset`` is still supported, but does not fully support " diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index 22c2f71389..48215f745d 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 15:56+0800\n" +"POT-Creation-Date: 2024-10-05 00:13+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-" @@ -31,9 +31,11 @@ msgstr "Adam Turner 和 Thomas Wouters" #: ../../whatsnew/3.13.rst:48 msgid "" "This article explains the new features in Python 3.13, compared to 3.12. " -"Python 3.13 will be released on October 1, 2024. For full details, see the :" +"Python 3.13 will be released on October 7, 2024. For full details, see the :" "ref:`changelog `." msgstr "" +"本文介紹了 Python 3.13 與 3.12 相比多了哪些新功能。Python 3.13 將於 2024 年 " +"10 月 7 日發布。完整詳請請見 :ref:`changelog `。" #: ../../whatsnew/3.13.rst:54 msgid ":pep:`719` -- Python 3.13 Release Schedule" @@ -131,157 +133,158 @@ msgstr "Python 資料模型改進:" #: ../../whatsnew/3.13.rst:124 msgid "" -":attr:`~class.__static_attributes__` stores the names of attributes accessed " +":attr:`~type.__static_attributes__` stores the names of attributes accessed " "through ``self.X`` in any function in a class body." msgstr "" #: ../../whatsnew/3.13.rst:126 msgid "" -":attr:`!__firstlineno__` records the first line number of a class definition." +":attr:`~type.__firstlineno__` records the first line number of a class " +"definition." msgstr "" -#: ../../whatsnew/3.13.rst:128 +#: ../../whatsnew/3.13.rst:129 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" -#: ../../whatsnew/3.13.rst:130 +#: ../../whatsnew/3.13.rst:131 msgid "" "Add a new :exc:`PythonFinalizationError` exception, raised when an operation " "is blocked during :term:`finalization `." msgstr "" -#: ../../whatsnew/3.13.rst:132 +#: ../../whatsnew/3.13.rst:133 msgid "" "The :mod:`argparse` module now supports deprecating command-line options, " "positional arguments, and subcommands." msgstr "" -#: ../../whatsnew/3.13.rst:134 +#: ../../whatsnew/3.13.rst:135 msgid "" "The new functions :func:`base64.z85encode` and :func:`base64.z85decode` " "support encoding and decoding `Z85 data`_." msgstr "" -#: ../../whatsnew/3.13.rst:136 +#: ../../whatsnew/3.13.rst:137 msgid "" "The :mod:`copy` module now has a :func:`copy.replace` function, with support " "for many builtin types and any class defining the :func:`~object." "__replace__` method." msgstr "" -#: ../../whatsnew/3.13.rst:139 +#: ../../whatsnew/3.13.rst:140 msgid "" "The new :mod:`dbm.sqlite3` module is now the default :mod:`dbm` backend." -msgstr "" +msgstr "新的 :mod:`dbm.sqlite3` 模組現在是預設的 :mod:`dbm` 後端。" -#: ../../whatsnew/3.13.rst:140 +#: ../../whatsnew/3.13.rst:141 msgid "" "The :mod:`os` module has a :ref:`suite of new functions ` for " "working with Linux's timer notification file descriptors." msgstr "" -#: ../../whatsnew/3.13.rst:142 +#: ../../whatsnew/3.13.rst:143 msgid "" "The :mod:`random` module now has a :ref:`command-line interface `." -msgstr "" +msgstr "現在 :mod:`random` 模組有一個\\ :ref:`命令列介面 `。" -#: ../../whatsnew/3.13.rst:144 +#: ../../whatsnew/3.13.rst:145 msgid "Security improvements:" msgstr "安全性改進:" -#: ../../whatsnew/3.13.rst:146 +#: ../../whatsnew/3.13.rst:147 msgid "" ":func:`ssl.create_default_context` sets :data:`ssl." "VERIFY_X509_PARTIAL_CHAIN` and :data:`ssl.VERIFY_X509_STRICT` as default " "flags." msgstr "" -#: ../../whatsnew/3.13.rst:149 +#: ../../whatsnew/3.13.rst:150 msgid "C API improvements:" msgstr "C API 改進:" -#: ../../whatsnew/3.13.rst:151 +#: ../../whatsnew/3.13.rst:152 msgid "" "The :c:data:`Py_mod_gil` slot is now used to indicate that an extension " "module supports running with the :term:`GIL` disabled." msgstr "" -#: ../../whatsnew/3.13.rst:153 +#: ../../whatsnew/3.13.rst:154 msgid "" "The :doc:`PyTime C API ` has been added, providing access to " "system clocks." msgstr "" -#: ../../whatsnew/3.13.rst:155 +#: ../../whatsnew/3.13.rst:156 msgid "" ":c:type:`PyMutex` is a new lightweight mutex that occupies a single byte." msgstr "" -#: ../../whatsnew/3.13.rst:156 +#: ../../whatsnew/3.13.rst:157 msgid "" "There is a new :ref:`suite of functions ` for generating :" "pep:`669` monitoring events in the C API." msgstr "" -#: ../../whatsnew/3.13.rst:159 +#: ../../whatsnew/3.13.rst:160 msgid "New typing features:" msgstr "新增型別特性:" -#: ../../whatsnew/3.13.rst:161 +#: ../../whatsnew/3.13.rst:162 msgid "" ":pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing." "ParamSpec`, and :data:`typing.TypeVarTuple`) now support defaults." msgstr "" -#: ../../whatsnew/3.13.rst:163 +#: ../../whatsnew/3.13.rst:164 msgid "" ":pep:`702`: The new :func:`warnings.deprecated` decorator adds support for " "marking deprecations in the type system and at runtime." msgstr "" -#: ../../whatsnew/3.13.rst:165 +#: ../../whatsnew/3.13.rst:166 msgid "" ":pep:`705`: :data:`typing.ReadOnly` can be used to mark an item of a :class:" "`typing.TypedDict` as read-only for type checkers." msgstr "" -#: ../../whatsnew/3.13.rst:167 +#: ../../whatsnew/3.13.rst:168 msgid "" ":pep:`742`: :data:`typing.TypeIs` provides more intuitive type narrowing " "behavior, as an alternative to :data:`typing.TypeGuard`." msgstr "" -#: ../../whatsnew/3.13.rst:170 +#: ../../whatsnew/3.13.rst:171 msgid "Platform support:" -msgstr "" +msgstr "平台支援:" -#: ../../whatsnew/3.13.rst:172 +#: ../../whatsnew/3.13.rst:173 msgid "" ":pep:`730`: Apple's iOS is now an :ref:`officially supported platform " "`, at :pep:`tier 3 <11#tier-3>`." msgstr "" -#: ../../whatsnew/3.13.rst:174 +#: ../../whatsnew/3.13.rst:175 msgid "" ":pep:`738`: Android is now an :ref:`officially supported platform " "`, at :pep:`tier 3 <11#tier-3>`." msgstr "" -#: ../../whatsnew/3.13.rst:176 +#: ../../whatsnew/3.13.rst:177 msgid "" "``wasm32-wasi`` is now supported as a :pep:`tier 2 <11#tier-2>` platform." -msgstr "" +msgstr "``wasm32-wasi`` 現在作為 :pep:`tier 2 <11#tier-2>` 平台支援。" -#: ../../whatsnew/3.13.rst:177 +#: ../../whatsnew/3.13.rst:178 msgid "``wasm32-emscripten`` is no longer an officially supported platform." -msgstr "" +msgstr "``wasm32-emscripten`` 不再是官方支援的平台。" -#: ../../whatsnew/3.13.rst:179 +#: ../../whatsnew/3.13.rst:180 msgid "Important removals:" -msgstr "" +msgstr "重要的移除:" -#: ../../whatsnew/3.13.rst:181 +#: ../../whatsnew/3.13.rst:182 msgid "" ":ref:`PEP 594 `: The remaining 19 \"dead batteries\" " "(legacy stdlib modules) have been removed from the standard library: :mod:`!" @@ -290,118 +293,124 @@ msgid "" "nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!sndhdr`, :mod:`!spwd`, :" "mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:`!xdrlib`." msgstr "" +":ref:`PEP 594 `: 剩下的 19 個 \"dead batteries\" (遺留標" +"準函式庫模組)以字標準函式庫中移除::mod:`!aifc`、:mod:`!audioop`、:mod:`!" +"cgi`、:mod:`!cgitb`、:mod:`!chunk`、:mod:`!crypt`、:mod:`!imghdr`、:mod:`!" +"mailcap`、:mod:`!msilib`、:mod:`!nis`、:mod:`!nntplib`、:mod:`!" +"ossaudiodev`、:mod:`!pipes`、:mod:`!sndhdr`、:mod:`!spwd`、:mod:`!sunau`、:" +"mod:`!telnetlib`、:mod:`!uu` 和 :mod:`!xdrlib`." -#: ../../whatsnew/3.13.rst:187 +#: ../../whatsnew/3.13.rst:188 msgid "" "Remove the :program:`2to3` tool and :mod:`!lib2to3` module (deprecated in " "Python 3.11)." msgstr "" -#: ../../whatsnew/3.13.rst:189 +#: ../../whatsnew/3.13.rst:190 msgid "Remove the :mod:`!tkinter.tix` module (deprecated in Python 3.6)." -msgstr "" +msgstr "移除 :mod:`!tkinter.tix` 模組(在 Python 3.6 中已棄用)。" -#: ../../whatsnew/3.13.rst:190 +#: ../../whatsnew/3.13.rst:191 msgid "Remove the :func:`!locale.resetlocale` function." -msgstr "" +msgstr "移除 :func:`!locale.resetlocale` 函式。" -#: ../../whatsnew/3.13.rst:191 +#: ../../whatsnew/3.13.rst:192 msgid "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces." -msgstr "" +msgstr "移除 :mod:`!typing.io` 和 :mod:`!typing.re` 命名空間。" -#: ../../whatsnew/3.13.rst:192 +#: ../../whatsnew/3.13.rst:193 msgid "Remove chained :class:`classmethod` descriptors." msgstr "" -#: ../../whatsnew/3.13.rst:194 +#: ../../whatsnew/3.13.rst:195 msgid "Release schedule changes:" msgstr "" -#: ../../whatsnew/3.13.rst:196 +#: ../../whatsnew/3.13.rst:197 msgid "" ":pep:`602` (\"Annual Release Cycle for Python\") has been updated to extend " "the full support ('bugfix') period for new releases to two years. This " "updated policy means that:" msgstr "" -#: ../../whatsnew/3.13.rst:200 +#: ../../whatsnew/3.13.rst:201 msgid "" "Python 3.9--3.12 have one and a half years of full support, followed by " "three and a half years of security fixes." msgstr "" -#: ../../whatsnew/3.13.rst:202 +#: ../../whatsnew/3.13.rst:203 msgid "" "Python 3.13 and later have two years of full support, followed by three " "years of security fixes." msgstr "" -#: ../../whatsnew/3.13.rst:207 ../../whatsnew/3.13.rst:2005 +#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:1964 msgid "New Features" -msgstr "新增特性" +msgstr "新增功能" -#: ../../whatsnew/3.13.rst:213 +#: ../../whatsnew/3.13.rst:214 msgid "A better interactive interpreter" msgstr "" -#: ../../whatsnew/3.13.rst:215 +#: ../../whatsnew/3.13.rst:216 msgid "" "Python now uses a new :term:`interactive` shell by default, based on code " "from the `PyPy project`_. When the user starts the :term:`REPL` from an " "interactive terminal, the following new features are now supported:" msgstr "" -#: ../../whatsnew/3.13.rst:220 +#: ../../whatsnew/3.13.rst:221 msgid "Multiline editing with history preservation." msgstr "" -#: ../../whatsnew/3.13.rst:221 +#: ../../whatsnew/3.13.rst:222 msgid "" "Direct support for REPL-specific commands like :kbd:`help`, :kbd:`exit`, " "and :kbd:`quit`, without the need to call them as functions." msgstr "" -#: ../../whatsnew/3.13.rst:223 +#: ../../whatsnew/3.13.rst:224 msgid "" "Prompts and tracebacks with :ref:`color enabled by default `." msgstr "" -#: ../../whatsnew/3.13.rst:225 +#: ../../whatsnew/3.13.rst:226 msgid "" "Interactive help browsing using :kbd:`F1` with a separate command history." msgstr "" -#: ../../whatsnew/3.13.rst:227 +#: ../../whatsnew/3.13.rst:228 msgid "" "History browsing using :kbd:`F2` that skips output as well as the :term:" "`>>>` and :term:`...` prompts." msgstr "" -#: ../../whatsnew/3.13.rst:229 +#: ../../whatsnew/3.13.rst:230 msgid "" "\"Paste mode\" with :kbd:`F3` that makes pasting larger blocks of code " "easier (press :kbd:`F3` again to return to the regular prompt)." msgstr "" -#: ../../whatsnew/3.13.rst:232 +#: ../../whatsnew/3.13.rst:233 msgid "" "To disable the new interactive shell, set the :envvar:`PYTHON_BASIC_REPL` " "environment variable. For more on interactive mode, see :ref:`tut-interac`." msgstr "" -#: ../../whatsnew/3.13.rst:236 +#: ../../whatsnew/3.13.rst:237 msgid "" "(Contributed by Pablo Galindo Salgado, Łukasz Langa, and Lysandros Nikolaou " "in :gh:`111201` based on code from the PyPy project. Windows support " "contributed by Dino Viehland and Anthony Shaw.)" msgstr "" -#: ../../whatsnew/3.13.rst:246 +#: ../../whatsnew/3.13.rst:247 msgid "Improved error messages" msgstr "" -#: ../../whatsnew/3.13.rst:248 +#: ../../whatsnew/3.13.rst:249 msgid "" "The interpreter now uses color by default when displaying tracebacks in the " "terminal. This feature :ref:`can be controlled ` " @@ -410,14 +419,14 @@ msgid "" "by Pablo Galindo Salgado in :gh:`112730`.)" msgstr "" -#: ../../whatsnew/3.13.rst:263 +#: ../../whatsnew/3.13.rst:264 msgid "" "A common mistake is to write a script with the same name as a standard " "library module. When this results in errors, we now display a more helpful " "error message:" msgstr "" -#: ../../whatsnew/3.13.rst:267 +#: ../../whatsnew/3.13.rst:268 msgid "" "$ python random.py\n" "Traceback (most recent call last):\n" @@ -430,15 +439,25 @@ msgid "" "renaming '/home/me/random.py' since it has the same name as the standard " "library module named 'random' and the import system gives it precedence)" msgstr "" +"$ python random.py\n" +"Traceback (most recent call last):\n" +" File \"/home/me/random.py\", line 1, in \n" +" import random\n" +" File \"/home/me/random.py\", line 3, in \n" +" print(random.randint(5))\n" +" ^^^^^^^^^^^^^^\n" +"AttributeError: module 'random' has no attribute 'randint' (consider " +"renaming '/home/me/random.py' since it has the same name as the standard " +"library module named 'random' and the import system gives it precedence)" -#: ../../whatsnew/3.13.rst:278 +#: ../../whatsnew/3.13.rst:279 msgid "" "Similarly, if a script has the same name as a third-party module that it " "attempts to import and this results in errors, we also display a more " "helpful error message:" msgstr "" -#: ../../whatsnew/3.13.rst:282 +#: ../../whatsnew/3.13.rst:283 msgid "" "$ python numpy.py\n" "Traceback (most recent call last):\n" @@ -451,18 +470,28 @@ msgid "" "home/me/numpy.py' if it has the same name as a third-party module you " "intended to import)" msgstr "" +"$ python numpy.py\n" +"Traceback (most recent call last):\n" +" File \"/home/me/numpy.py\", line 1, in \n" +" import numpy as np\n" +" File \"/home/me/numpy.py\", line 3, in \n" +" np.array([1, 2, 3])\n" +" ^^^^^^^^\n" +"AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/" +"home/me/numpy.py' if it has the same name as a third-party module you " +"intended to import)" -#: ../../whatsnew/3.13.rst:293 +#: ../../whatsnew/3.13.rst:294 msgid "(Contributed by Shantanu Jain in :gh:`95754`.)" msgstr "" -#: ../../whatsnew/3.13.rst:295 +#: ../../whatsnew/3.13.rst:296 msgid "" "The error message now tries to suggest the correct keyword argument when an " "incorrect keyword argument is passed to a function." msgstr "" -#: ../../whatsnew/3.13.rst:298 +#: ../../whatsnew/3.13.rst:299 msgid "" ">>> \"Better error messages!\".split(max_split=1)\n" "Traceback (most recent call last):\n" @@ -472,17 +501,24 @@ msgid "" "TypeError: split() got an unexpected keyword argument 'max_split'. Did you " "mean 'maxsplit'?" msgstr "" +">>> \"Better error messages!\".split(max_split=1)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" \"Better error messages!\".split(max_split=1)\n" +" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^\n" +"TypeError: split() got an unexpected keyword argument 'max_split'. Did you " +"mean 'maxsplit'?" -#: ../../whatsnew/3.13.rst:307 +#: ../../whatsnew/3.13.rst:308 msgid "" "(Contributed by Pablo Galindo Salgado and Shantanu Jain in :gh:`107944`.)" msgstr "" -#: ../../whatsnew/3.13.rst:313 +#: ../../whatsnew/3.13.rst:314 msgid "Free-threaded CPython" msgstr "" -#: ../../whatsnew/3.13.rst:315 +#: ../../whatsnew/3.13.rst:316 msgid "" "CPython now has experimental support for running in a free-threaded mode, " "with the :term:`global interpreter lock` (GIL) disabled. This is an " @@ -490,12 +526,12 @@ msgid "" "threaded mode requires a different executable, usually called " "``python3.13t`` or ``python3.13t.exe``. Pre-built binaries marked as *free-" "threaded* can be installed as part of the official :ref:`Windows ` and :ref:`macOS ` " +"freethreaded-windows>` and :ref:`macOS ` " "installers, or CPython can be built from source with the :option:`--disable-" "gil` option." msgstr "" -#: ../../whatsnew/3.13.rst:328 +#: ../../whatsnew/3.13.rst:326 msgid "" "Free-threaded execution allows for full utilization of the available " "processing power by running threads in parallel on available CPU cores. " @@ -508,7 +544,7 @@ msgid "" "command-line option :option:`-X gil=1`." msgstr "" -#: ../../whatsnew/3.13.rst:338 +#: ../../whatsnew/3.13.rst:336 msgid "" "To check if the current interpreter supports free-threading, :option:`python " "-VV <-V>` and :attr:`sys.version` contain \"experimental free-threading " @@ -516,7 +552,7 @@ msgid "" "whether the GIL is actually disabled in the running process." msgstr "" -#: ../../whatsnew/3.13.rst:343 +#: ../../whatsnew/3.13.rst:341 msgid "" "C-API extension modules need to be built specifically for the free-threaded " "build. Extensions that support running with the :term:`GIL` disabled should " @@ -529,24 +565,35 @@ msgid "" "extensions in the free-threaded build." msgstr "" -#: ../../whatsnew/3.13.rst:356 +#: ../../whatsnew/3.13.rst:352 +msgid "" +"This work was made possible thanks to many individuals and organizations, " +"including the large community of contributors to Python and third-party " +"projects to test and enable free-threading support. Notable contributors " +"include: Sam Gross, Ken Jin, Donghee Na, Itamar Oren, Matt Page, Brett " +"Simmers, Dino Viehland, Carl Meyer, Nathan Goldbaum, Ralf Gommers, Lysandros " +"Nikolaou, and many others. Many of these contributors are employed by Meta, " +"which has provided significant engineering resources to support this project." +msgstr "" + +#: ../../whatsnew/3.13.rst:364 msgid "" ":pep:`703` \"Making the Global Interpreter Lock Optional in CPython\" " "contains rationale and information surrounding this work." msgstr "" -#: ../../whatsnew/3.13.rst:359 +#: ../../whatsnew/3.13.rst:367 msgid "" "`Porting Extension Modules to Support Free-Threading `_: A community-maintained porting guide for " "extension authors." msgstr "" -#: ../../whatsnew/3.13.rst:367 +#: ../../whatsnew/3.13.rst:375 msgid "An experimental just-in-time (JIT) compiler" msgstr "" -#: ../../whatsnew/3.13.rst:369 +#: ../../whatsnew/3.13.rst:377 msgid "" "When CPython is configured and built using the :option:`!--enable-" "experimental-jit` option, a just-in-time (JIT) compiler is added which may " @@ -556,100 +603,100 @@ msgid "" "information `are contained at`__ :file:`Tools/jit/README.md`." msgstr "" -#: ../../whatsnew/3.13.rst:379 +#: ../../whatsnew/3.13.rst:387 msgid "" "The :option:`!--enable-experimental-jit` option takes these (optional) " "values, defaulting to ``yes`` if :option:`!--enable-experimental-jit` is " "present without the optional value." msgstr "" -#: ../../whatsnew/3.13.rst:383 +#: ../../whatsnew/3.13.rst:391 msgid "``no``: Disable the entire Tier 2 and JIT pipeline." msgstr "" -#: ../../whatsnew/3.13.rst:384 +#: ../../whatsnew/3.13.rst:392 msgid "" "``yes``: Enable the JIT. To disable the JIT at runtime, pass the environment " "variable ``PYTHON_JIT=0``." msgstr "" -#: ../../whatsnew/3.13.rst:386 +#: ../../whatsnew/3.13.rst:394 msgid "" "``yes-off``: Build the JIT but disable it by default. To enable the JIT at " "runtime, pass the environment variable ``PYTHON_JIT=1``." msgstr "" -#: ../../whatsnew/3.13.rst:388 +#: ../../whatsnew/3.13.rst:396 msgid "" "``interpreter``: Enable the Tier 2 interpreter but disable the JIT. The " "interpreter can be disabled by running with ``PYTHON_JIT=0``." msgstr "" -#: ../../whatsnew/3.13.rst:391 +#: ../../whatsnew/3.13.rst:399 msgid "The internal architecture is roughly as follows:" msgstr "" -#: ../../whatsnew/3.13.rst:393 +#: ../../whatsnew/3.13.rst:401 msgid "" "We start with specialized *Tier 1 bytecode*. See :ref:`What's new in 3.11 " "` for details." msgstr "" -#: ../../whatsnew/3.13.rst:395 +#: ../../whatsnew/3.13.rst:403 msgid "" "When the Tier 1 bytecode gets hot enough, it gets translated to a new purely " "internal intermediate representation (IR), called the *Tier 2 IR*, and " "sometimes referred to as micro-ops (\"uops\")." msgstr "" -#: ../../whatsnew/3.13.rst:398 +#: ../../whatsnew/3.13.rst:406 msgid "" "The Tier 2 IR uses the same stack-based virtual machine as Tier 1, but the " "instruction format is better suited to translation to machine code." msgstr "" -#: ../../whatsnew/3.13.rst:400 +#: ../../whatsnew/3.13.rst:408 msgid "" "We have several optimization passes for Tier 2 IR, which are applied before " "it is interpreted or translated to machine code." msgstr "" -#: ../../whatsnew/3.13.rst:402 +#: ../../whatsnew/3.13.rst:410 msgid "" "There is a Tier 2 interpreter, but it is mostly intended for debugging the " "earlier stages of the optimization pipeline. The Tier 2 interpreter can be " "enabled by configuring Python with ``--enable-experimental-jit=interpreter``." msgstr "" -#: ../../whatsnew/3.13.rst:406 +#: ../../whatsnew/3.13.rst:414 msgid "" "When the JIT is enabled, the optimized Tier 2 IR is translated to machine " "code, which is then executed." msgstr "" -#: ../../whatsnew/3.13.rst:408 +#: ../../whatsnew/3.13.rst:416 msgid "" "The machine code translation process uses a technique called *copy-and-" "patch*. It has no runtime dependencies, but there is a new build-time " "dependency on LLVM." msgstr "" -#: ../../whatsnew/3.13.rst:412 +#: ../../whatsnew/3.13.rst:420 msgid ":pep:`744`" msgstr ":pep:`744`" -#: ../../whatsnew/3.13.rst:414 +#: ../../whatsnew/3.13.rst:422 msgid "" "(JIT by Brandt Bucher, inspired by a paper by Haoran Xu and Fredrik " "Kjolstad. Tier 2 IR by Mark Shannon and Guido van Rossum. Tier 2 optimizer " "by Ken Jin.)" msgstr "" -#: ../../whatsnew/3.13.rst:422 +#: ../../whatsnew/3.13.rst:430 msgid "Defined mutation semantics for :py:func:`locals`" msgstr "" -#: ../../whatsnew/3.13.rst:424 +#: ../../whatsnew/3.13.rst:432 msgid "" "Historically, the expected result of mutating the return value of :func:" "`locals` has been left to individual Python implementations to define. " @@ -661,7 +708,7 @@ msgid "" "referenced nonlocal variables captured in closures." msgstr "" -#: ../../whatsnew/3.13.rst:433 +#: ../../whatsnew/3.13.rst:441 msgid "" "This change to the semantics of :func:`locals` in optimized scopes also " "affects the default behavior of code execution functions that implicitly " @@ -682,7 +729,7 @@ msgid "" "disk)." msgstr "" -#: ../../whatsnew/3.13.rst:452 +#: ../../whatsnew/3.13.rst:460 msgid "" "To ensure debuggers and similar tools can reliably update local variables in " "scopes affected by this change, :attr:`FrameType.f_locals ` " @@ -692,7 +739,7 @@ msgid "" "semantics." msgstr "" -#: ../../whatsnew/3.13.rst:458 +#: ../../whatsnew/3.13.rst:466 msgid "" "See :pep:`667` for more details, including related C API changes and " "deprecations. Porting notes are also provided below for the affected :ref:" @@ -700,18 +747,18 @@ msgid "" "notes-c>`." msgstr "" -#: ../../whatsnew/3.13.rst:463 +#: ../../whatsnew/3.13.rst:471 msgid "" "(PEP and implementation contributed by Mark Shannon and Tian Gao in :gh:" "`74929`. Documentation updates provided by Guido van Rossum and Alyssa " "Coghlan.)" msgstr "" -#: ../../whatsnew/3.13.rst:471 +#: ../../whatsnew/3.13.rst:479 msgid "Support for mobile platforms" msgstr "" -#: ../../whatsnew/3.13.rst:473 +#: ../../whatsnew/3.13.rst:481 msgid "" ":pep:`730`: iOS is now a :pep:`11` supported platform, with the ``arm64-" "apple-ios`` and ``arm64-apple-ios-simulator`` targets at tier 3 (iPhone and " @@ -722,7 +769,7 @@ msgid "" "implementation contributed by Russell Keith-Magee in :gh:`114099`.)" msgstr "" -#: ../../whatsnew/3.13.rst:483 +#: ../../whatsnew/3.13.rst:491 msgid "" ":pep:`738`: Android is now a :pep:`11` supported platform, with the " "``aarch64-linux-android`` and ``x86_64-linux-android`` targets at tier 3. " @@ -731,51 +778,15 @@ msgid "" "written and implementation contributed by Malcolm Smith in :gh:`116622`.)" msgstr "" -#: ../../whatsnew/3.13.rst:490 +#: ../../whatsnew/3.13.rst:498 msgid ":pep:`730`, :pep:`738`" msgstr ":pep:`730`、:pep:`738`" -#: ../../whatsnew/3.13.rst:496 -msgid "Incremental garbage collection" -msgstr "" - -#: ../../whatsnew/3.13.rst:498 -msgid "" -"The cycle garbage collector is now incremental. This means that maximum " -"pause times are reduced by an order of magnitude or more for larger heaps." -msgstr "" - #: ../../whatsnew/3.13.rst:502 -msgid "" -"There are now only two generations: young and old. When :func:`gc.collect` " -"is not called directly, the GC is invoked a little less frequently. When " -"invoked, it collects the young generation and an increment of the old " -"generation, instead of collecting one or more generations." -msgstr "" - -#: ../../whatsnew/3.13.rst:508 -msgid "The behavior of :func:`!gc.collect` changes slightly:" -msgstr "" - -#: ../../whatsnew/3.13.rst:510 ../../whatsnew/3.13.rst:2617 -msgid "" -"``gc.collect(1)``: Performs an increment of garbage collection, rather than " -"collecting generation 1." -msgstr "" - -#: ../../whatsnew/3.13.rst:512 ../../whatsnew/3.13.rst:2619 -msgid "Other calls to :func:`!gc.collect` are unchanged." -msgstr "" - -#: ../../whatsnew/3.13.rst:514 -msgid "(Contributed by Mark Shannon in :gh:`108362`.)" -msgstr "" - -#: ../../whatsnew/3.13.rst:518 msgid "Other Language Changes" msgstr "其他語言更動" -#: ../../whatsnew/3.13.rst:520 +#: ../../whatsnew/3.13.rst:504 msgid "" "The compiler now strips common leading whitespace from every line in a " "docstring. This reduces the size of the :term:`bytecode cache ` " @@ -784,7 +795,7 @@ msgid "" "affects tools that use docstrings, such as :mod:`doctest`." msgstr "" -#: ../../whatsnew/3.13.rst:527 +#: ../../whatsnew/3.13.rst:511 msgid "" ">>> def spam():\n" "... \"\"\"\n" @@ -799,18 +810,18 @@ msgid "" "multiple paragraphs!\\n'" msgstr "" -#: ../../whatsnew/3.13.rst:540 +#: ../../whatsnew/3.13.rst:524 msgid "(Contributed by Inada Naoki in :gh:`81283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:542 +#: ../../whatsnew/3.13.rst:526 msgid "" ":ref:`Annotation scopes ` within class scopes can now " "contain lambdas and comprehensions. Comprehensions that are located within " "class scopes are not inlined into their parent scope." msgstr "" -#: ../../whatsnew/3.13.rst:547 +#: ../../whatsnew/3.13.rst:531 msgid "" "class C[T]:\n" " type Alias = lambda: T" @@ -818,11 +829,11 @@ msgstr "" "class C[T]:\n" " type Alias = lambda: T" -#: ../../whatsnew/3.13.rst:552 +#: ../../whatsnew/3.13.rst:536 msgid "(Contributed by Jelle Zijlstra in :gh:`109118` and :gh:`118160`.)" msgstr "" -#: ../../whatsnew/3.13.rst:554 +#: ../../whatsnew/3.13.rst:538 msgid "" ":ref:`Future statements ` are no longer triggered by relative " "imports of the :mod:`__future__` module, meaning that statements of the form " @@ -831,7 +842,7 @@ msgid "" "in :gh:`118216`.)" msgstr "" -#: ../../whatsnew/3.13.rst:560 +#: ../../whatsnew/3.13.rst:544 msgid "" ":keyword:`global` declarations are now permitted in :keyword:`except` blocks " "when that global is used in the :keyword:`else` block. Previously this " @@ -839,7 +850,7 @@ msgid "" "`111123`.)" msgstr "" -#: ../../whatsnew/3.13.rst:565 +#: ../../whatsnew/3.13.rst:549 msgid "" "Add :envvar:`PYTHON_FROZEN_MODULES`, a new environment variable that " "determines whether frozen modules are ignored by the import machinery, " @@ -847,7 +858,7 @@ msgid "" "(Contributed by Yilei Yang in :gh:`111374`.)" msgstr "" -#: ../../whatsnew/3.13.rst:570 +#: ../../whatsnew/3.13.rst:554 msgid "" "Add :ref:`support for the perf profiler ` working without " "`frame pointers `_ through the new " @@ -856,36 +867,36 @@ msgid "" "`118518`.)" msgstr "" -#: ../../whatsnew/3.13.rst:576 +#: ../../whatsnew/3.13.rst:560 msgid "" "The location of a :file:`.python_history` file can be changed via the new :" "envvar:`PYTHON_HISTORY` environment variable. (Contributed by Levi Sabah, " "Zackery Spytz and Hugo van Kemenade in :gh:`73965`.)" msgstr "" -#: ../../whatsnew/3.13.rst:581 +#: ../../whatsnew/3.13.rst:565 msgid "" -"Classes have a new :attr:`~class.__static_attributes__` attribute. This is " +"Classes have a new :attr:`~type.__static_attributes__` attribute. This is " "populated by the compiler with a tuple of the class's attribute names which " "are assigned through ``self.`` from any function in its body. " "(Contributed by Irit Katriel in :gh:`115775`.)" msgstr "" -#: ../../whatsnew/3.13.rst:586 +#: ../../whatsnew/3.13.rst:570 msgid "" "The compiler now creates a :attr:`!__firstlineno__` attribute on classes " "with the line number of the first line of the class definition. (Contributed " "by Serhiy Storchaka in :gh:`118465`.)" msgstr "" -#: ../../whatsnew/3.13.rst:590 +#: ../../whatsnew/3.13.rst:574 msgid "" "The :func:`exec` and :func:`eval` builtins now accept the *globals* and " "*locals* arguments as keywords. (Contributed by Raphael Gaschignard in :gh:" "`105879`)" msgstr "" -#: ../../whatsnew/3.13.rst:594 +#: ../../whatsnew/3.13.rst:578 msgid "" "The :func:`compile` builtin now accepts a new flag, ``ast." "PyCF_OPTIMIZED_AST``, which is similar to ``ast.PyCF_ONLY_AST`` except that " @@ -893,13 +904,13 @@ msgid "" "argument. (Contributed by Irit Katriel in :gh:`108113`)." msgstr "" -#: ../../whatsnew/3.13.rst:600 +#: ../../whatsnew/3.13.rst:584 msgid "" "Add a :attr:`~property.__name__` attribute on :class:`property` objects. " "(Contributed by Eugene Toder in :gh:`101860`.)" msgstr "" -#: ../../whatsnew/3.13.rst:603 +#: ../../whatsnew/3.13.rst:587 msgid "" "Add :exc:`PythonFinalizationError`, a new exception derived from :exc:" "`RuntimeError` and used to signal when operations are blocked during :term:" @@ -907,65 +918,65 @@ msgid "" "exc:`!PythonFinalizationError`, instead of :exc:`RuntimeError`:" msgstr "" -#: ../../whatsnew/3.13.rst:609 +#: ../../whatsnew/3.13.rst:593 msgid ":func:`_thread.start_new_thread`" msgstr ":func:`_thread.start_new_thread`" -#: ../../whatsnew/3.13.rst:610 +#: ../../whatsnew/3.13.rst:594 msgid ":func:`os.fork`" msgstr ":func:`os.fork`" -#: ../../whatsnew/3.13.rst:611 +#: ../../whatsnew/3.13.rst:595 msgid ":func:`os.forkpty`" msgstr ":func:`os.forkpty`" -#: ../../whatsnew/3.13.rst:612 +#: ../../whatsnew/3.13.rst:596 msgid ":class:`subprocess.Popen`" msgstr ":class:`subprocess.Popen`" -#: ../../whatsnew/3.13.rst:614 +#: ../../whatsnew/3.13.rst:598 msgid "(Contributed by Victor Stinner in :gh:`114570`.)" msgstr "" -#: ../../whatsnew/3.13.rst:616 +#: ../../whatsnew/3.13.rst:600 msgid "" "Allow the *count* argument of :meth:`str.replace` to be a keyword. " "(Contributed by Hugo van Kemenade in :gh:`106487`.)" msgstr "" -#: ../../whatsnew/3.13.rst:619 +#: ../../whatsnew/3.13.rst:603 msgid "" "Many functions now emit a warning if a boolean value is passed as a file " "descriptor argument. This can help catch some errors earlier. (Contributed " "by Serhiy Storchaka in :gh:`82626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:624 +#: ../../whatsnew/3.13.rst:608 msgid "" "Added :attr:`!name` and :attr:`!mode` attributes for compressed and archived " "file-like objects in the :mod:`bz2`, :mod:`lzma`, :mod:`tarfile`, and :mod:" "`zipfile` modules. (Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" -#: ../../whatsnew/3.13.rst:631 +#: ../../whatsnew/3.13.rst:615 msgid "New Modules" msgstr "新增模組" -#: ../../whatsnew/3.13.rst:633 +#: ../../whatsnew/3.13.rst:617 msgid "" ":mod:`dbm.sqlite3`: An SQLite backend for :mod:`dbm`. (Contributed by " "Raymond Hettinger and Erlend E. Aasland in :gh:`100414`.)" msgstr "" -#: ../../whatsnew/3.13.rst:638 +#: ../../whatsnew/3.13.rst:622 msgid "Improved Modules" msgstr "改進的模組" -#: ../../whatsnew/3.13.rst:642 +#: ../../whatsnew/3.13.rst:626 msgid "argparse" msgstr "argparse" -#: ../../whatsnew/3.13.rst:644 +#: ../../whatsnew/3.13.rst:628 msgid "" "Add the *deprecated* parameter to the :meth:`~argparse.ArgumentParser." "add_argument` and :meth:`!add_parser` methods, to enable deprecating command-" @@ -973,36 +984,36 @@ msgid "" "Storchaka in :gh:`83648`.)" msgstr "" -#: ../../whatsnew/3.13.rst:652 +#: ../../whatsnew/3.13.rst:636 msgid "array" msgstr "array" -#: ../../whatsnew/3.13.rst:654 +#: ../../whatsnew/3.13.rst:638 msgid "" "Add the ``'w'`` type code (``Py_UCS4``) for Unicode characters. It should be " "used instead of the deprecated ``'u'`` type code. (Contributed by Inada " "Naoki in :gh:`80480`.)" msgstr "" -#: ../../whatsnew/3.13.rst:658 +#: ../../whatsnew/3.13.rst:642 msgid "" "Register :class:`array.array` as a :class:`~collections.abc.MutableSequence` " "by implementing the :meth:`~array.array.clear` method. (Contributed by Mike " "Zimin in :gh:`114894`.)" msgstr "" -#: ../../whatsnew/3.13.rst:664 +#: ../../whatsnew/3.13.rst:648 msgid "ast" msgstr "ast" -#: ../../whatsnew/3.13.rst:666 +#: ../../whatsnew/3.13.rst:650 msgid "" "The constructors of node types in the :mod:`ast` module are now stricter in " "the arguments they accept, with more intuitive behavior when arguments are " "omitted." msgstr "" -#: ../../whatsnew/3.13.rst:670 +#: ../../whatsnew/3.13.rst:654 msgid "" "If an optional field on an AST node is not included as an argument when " "constructing an instance, the field will now be set to ``None``. Similarly, " @@ -1012,7 +1023,7 @@ msgid "" "the newly constructed AST node instance.)" msgstr "" -#: ../../whatsnew/3.13.rst:678 +#: ../../whatsnew/3.13.rst:662 msgid "" "In all other cases, where a required argument is omitted, the node " "constructor will emit a :exc:`DeprecationWarning`. This will raise an " @@ -1021,31 +1032,31 @@ msgid "" "and will raise an exception in Python 3.15." msgstr "" -#: ../../whatsnew/3.13.rst:685 +#: ../../whatsnew/3.13.rst:669 msgid "" "These changes do not apply to user-defined subclasses of :class:`ast.AST` " "unless the class opts in to the new behavior by defining the :attr:`.AST." "_field_types` mapping." msgstr "" -#: ../../whatsnew/3.13.rst:689 +#: ../../whatsnew/3.13.rst:673 msgid "" "(Contributed by Jelle Zijlstra in :gh:`105858`, :gh:`117486`, and :gh:" "`118851`.)" msgstr "" -#: ../../whatsnew/3.13.rst:691 +#: ../../whatsnew/3.13.rst:675 msgid "" ":func:`ast.parse` now accepts an optional argument *optimize* which is " "passed on to :func:`compile`. This makes it possible to obtain an optimized " "AST. (Contributed by Irit Katriel in :gh:`108113`.)" msgstr "" -#: ../../whatsnew/3.13.rst:698 +#: ../../whatsnew/3.13.rst:682 msgid "asyncio" msgstr "asyncio" -#: ../../whatsnew/3.13.rst:700 +#: ../../whatsnew/3.13.rst:684 msgid "" ":func:`asyncio.as_completed` now returns an object that is both an :term:" "`asynchronous iterator` and a plain :term:`iterator` of :term:`awaitables " @@ -1055,14 +1066,14 @@ msgid "" "Arthur in :gh:`77714`.)" msgstr "" -#: ../../whatsnew/3.13.rst:708 +#: ../../whatsnew/3.13.rst:692 msgid "" ":meth:`asyncio.loop.create_unix_server` will now automatically remove the " "Unix socket when the server is closed. (Contributed by Pierre Ossman in :gh:" "`111246`.)" msgstr "" -#: ../../whatsnew/3.13.rst:712 +#: ../../whatsnew/3.13.rst:696 msgid "" ":meth:`.DatagramTransport.sendto` will now send zero-length datagrams if " "called with an empty bytes object. The transport flow control also now " @@ -1070,28 +1081,28 @@ msgid "" "(Contributed by Jamie Phan in :gh:`115199`.)" msgstr "" -#: ../../whatsnew/3.13.rst:718 +#: ../../whatsnew/3.13.rst:702 msgid "" "Add :meth:`Queue.shutdown ` and :exc:`~asyncio." "QueueShutDown` to manage queue termination. (Contributed by Laurie Opperman " "and Yves Duprat in :gh:`104228`.)" msgstr "" -#: ../../whatsnew/3.13.rst:722 +#: ../../whatsnew/3.13.rst:706 msgid "" "Add the :meth:`.Server.close_clients` and :meth:`.Server.abort_clients` " "methods, which more forcefully close an asyncio server. (Contributed by " "Pierre Ossman in :gh:`113538`.)" msgstr "" -#: ../../whatsnew/3.13.rst:726 +#: ../../whatsnew/3.13.rst:710 msgid "" "Accept a tuple of separators in :meth:`.StreamReader.readuntil`, stopping " "when any one of them is encountered. (Contributed by Bruce Merry in :gh:" "`81322`.)" msgstr "" -#: ../../whatsnew/3.13.rst:730 +#: ../../whatsnew/3.13.rst:714 msgid "" "Improve the behavior of :class:`~asyncio.TaskGroup` when an external " "cancellation collides with an internal cancellation. For example, when two " @@ -1100,7 +1111,7 @@ msgid "" "because its internal cancellation was swallowed by the inner task group." msgstr "" -#: ../../whatsnew/3.13.rst:737 +#: ../../whatsnew/3.13.rst:721 msgid "" "In the case where a task group is cancelled externally and also must raise " "an :exc:`ExceptionGroup`, it will now call the parent task's :meth:`~asyncio." @@ -1108,24 +1119,24 @@ msgid "" "be raised at the next :keyword:`await`, so the cancellation is not lost." msgstr "" -#: ../../whatsnew/3.13.rst:743 +#: ../../whatsnew/3.13.rst:727 msgid "" "An added benefit of these changes is that task groups now preserve the " "cancellation count (:meth:`~asyncio.Task.cancelling`)." msgstr "" -#: ../../whatsnew/3.13.rst:746 +#: ../../whatsnew/3.13.rst:730 msgid "" "In order to handle some corner cases, :meth:`~asyncio.Task.uncancel` may now " "reset the undocumented ``_must_cancel`` flag when the cancellation count " "reaches zero." msgstr "" -#: ../../whatsnew/3.13.rst:750 +#: ../../whatsnew/3.13.rst:734 msgid "(Inspired by an issue reported by Arthur Tacca in :gh:`116720`.)" msgstr "" -#: ../../whatsnew/3.13.rst:752 +#: ../../whatsnew/3.13.rst:736 msgid "" "When :meth:`.TaskGroup.create_task` is called on an inactive :class:" "`~asyncio.TaskGroup`, the given coroutine will be closed (which prevents a :" @@ -1133,46 +1144,38 @@ msgid "" "(Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)" msgstr "" -#: ../../whatsnew/3.13.rst:760 +#: ../../whatsnew/3.13.rst:744 msgid "base64" msgstr "base64" -#: ../../whatsnew/3.13.rst:762 +#: ../../whatsnew/3.13.rst:746 msgid "" "Add :func:`~base64.z85encode` and :func:`~base64.z85decode` functions for " "encoding :class:`bytes` as `Z85 data`_ and decoding Z85-encoded data to :" "class:`!bytes`. (Contributed by Matan Perelman in :gh:`75299`.)" msgstr "" -#: ../../whatsnew/3.13.rst:771 +#: ../../whatsnew/3.13.rst:755 msgid "compileall" msgstr "compileall" -#: ../../whatsnew/3.13.rst:773 ../../whatsnew/3.13.rst:789 -#: ../../whatsnew/3.13.rst:1049 +#: ../../whatsnew/3.13.rst:757 ../../whatsnew/3.13.rst:765 +#: ../../whatsnew/3.13.rst:1013 msgid "" "The default number of worker threads and processes is now selected using :" "func:`os.process_cpu_count` instead of :func:`os.cpu_count`. (Contributed by " "Victor Stinner in :gh:`109649`.)" msgstr "" -#: ../../whatsnew/3.13.rst:779 ../../whatsnew/3.13.rst:795 -#: ../../whatsnew/3.13.rst:1649 -msgid "configparser" -msgstr "configparser" - -#: ../../whatsnew/3.13.rst:781 -msgid "" -"The :class:`configparser.ConfigParser` now accepts unnamed sections before " -"named ones if configured to do so. (Contributed by Pedro Sousa Lacerda in :" -"gh:`66449`.)" -msgstr "" - -#: ../../whatsnew/3.13.rst:787 +#: ../../whatsnew/3.13.rst:763 msgid "concurrent.futures" msgstr "concurrent.futures" -#: ../../whatsnew/3.13.rst:797 +#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1608 +msgid "configparser" +msgstr "configparser" + +#: ../../whatsnew/3.13.rst:773 msgid "" ":class:`~configparser.ConfigParser` now has support for unnamed sections, " "which allows for top-level key-value pairs. This can be enabled with the new " @@ -1180,11 +1183,11 @@ msgid "" "gh:`66449`.)" msgstr "" -#: ../../whatsnew/3.13.rst:804 +#: ../../whatsnew/3.13.rst:780 msgid "copy" msgstr "copy" -#: ../../whatsnew/3.13.rst:806 +#: ../../whatsnew/3.13.rst:782 msgid "" "The new :func:`~copy.replace` function and the :meth:`replace protocol " "` make creating modified copies of objects much simpler. " @@ -1193,62 +1196,92 @@ msgid "" "protocol:" msgstr "" -#: ../../whatsnew/3.13.rst:812 +#: ../../whatsnew/3.13.rst:788 msgid ":func:`collections.namedtuple`" msgstr ":func:`collections.namedtuple`" -#: ../../whatsnew/3.13.rst:813 +#: ../../whatsnew/3.13.rst:789 msgid ":class:`dataclasses.dataclass`" msgstr ":class:`dataclasses.dataclass`" -#: ../../whatsnew/3.13.rst:814 +#: ../../whatsnew/3.13.rst:790 msgid "" ":class:`datetime.datetime`, :class:`datetime.date`, :class:`datetime.time`" msgstr "" ":class:`datetime.datetime`、:class:`datetime.date`、:class:`datetime.time`" -#: ../../whatsnew/3.13.rst:815 +#: ../../whatsnew/3.13.rst:791 msgid ":class:`inspect.Signature`, :class:`inspect.Parameter`" msgstr ":class:`inspect.Signature`、:class:`inspect.Parameter`" -#: ../../whatsnew/3.13.rst:816 +#: ../../whatsnew/3.13.rst:792 msgid ":class:`types.SimpleNamespace`" msgstr ":class:`types.SimpleNamespace`" -#: ../../whatsnew/3.13.rst:817 +#: ../../whatsnew/3.13.rst:793 msgid ":ref:`code objects `" -msgstr "" +msgstr ":ref:`程式碼物件 `" -#: ../../whatsnew/3.13.rst:819 +#: ../../whatsnew/3.13.rst:795 msgid "" "Any user-defined class can also support :func:`copy.replace` by defining " "the :meth:`~object.__replace__` method. (Contributed by Serhiy Storchaka in :" "gh:`108751`.)" msgstr "" -#: ../../whatsnew/3.13.rst:825 +#: ../../whatsnew/3.13.rst:801 +msgid "ctypes" +msgstr "ctypes" + +#: ../../whatsnew/3.13.rst:803 +msgid "" +"As a consequence of necessary internal refactoring, initialization of " +"internal metaclasses now happens in ``__init__`` rather than in ``__new__``. " +"This affects projects that subclass these internal metaclasses to provide " +"custom initialization. Generally:" +msgstr "" + +#: ../../whatsnew/3.13.rst:809 +msgid "" +"Custom logic that was done in ``__new__`` after calling ``super().__new__`` " +"should be moved to ``__init__``." +msgstr "" + +#: ../../whatsnew/3.13.rst:811 +msgid "" +"To create a class, call the metaclass, not only the metaclass's ``__new__`` " +"method." +msgstr "" + +#: ../../whatsnew/3.13.rst:814 +msgid "" +"See :gh:`124520` for discussion and links to changes in some affected " +"projects." +msgstr "" + +#: ../../whatsnew/3.13.rst:819 msgid "dbm" msgstr "dbm" -#: ../../whatsnew/3.13.rst:827 +#: ../../whatsnew/3.13.rst:821 msgid "" "Add :mod:`dbm.sqlite3`, a new module which implements an SQLite backend, and " "make it the default :mod:`!dbm` backend. (Contributed by Raymond Hettinger " "and Erlend E. Aasland in :gh:`100414`.)" msgstr "" -#: ../../whatsnew/3.13.rst:831 +#: ../../whatsnew/3.13.rst:825 msgid "" "Allow removing all items from the database through the new :meth:`.gdbm." "clear` and :meth:`.ndbm.clear` methods. (Contributed by Donghee Na in :gh:" "`107122`.)" msgstr "" -#: ../../whatsnew/3.13.rst:837 +#: ../../whatsnew/3.13.rst:831 msgid "dis" msgstr "dis" -#: ../../whatsnew/3.13.rst:839 +#: ../../whatsnew/3.13.rst:833 msgid "" "Change the output of :mod:`dis` module functions to show logical labels for " "jump targets and exception handlers, rather than offsets. The offsets can be " @@ -1256,7 +1289,7 @@ msgid "" "the *show_offsets* argument. (Contributed by Irit Katriel in :gh:`112137`.)" msgstr "" -#: ../../whatsnew/3.13.rst:846 +#: ../../whatsnew/3.13.rst:840 msgid "" ":meth:`~dis.get_instructions` no longer represents cache entries as separate " "instructions. Instead, it returns them as part of the :class:`~dis." @@ -1265,11 +1298,11 @@ msgid "" "(Contributed by Irit Katriel in :gh:`112962`.)" msgstr "" -#: ../../whatsnew/3.13.rst:858 +#: ../../whatsnew/3.13.rst:852 msgid "doctest" msgstr "doctest" -#: ../../whatsnew/3.13.rst:860 +#: ../../whatsnew/3.13.rst:854 msgid "" ":mod:`doctest` output is now colored by default. This can be controlled via " "the new :envvar:`PYTHON_COLORS` environment variable as well as the " @@ -1278,18 +1311,18 @@ msgid "" "`117225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:867 +#: ../../whatsnew/3.13.rst:861 msgid "" "The :meth:`.DocTestRunner.run` method now counts the number of skipped " "tests. Add the :attr:`.DocTestRunner.skips` and :attr:`.TestResults.skipped` " "attributes. (Contributed by Victor Stinner in :gh:`108794`.)" msgstr "" -#: ../../whatsnew/3.13.rst:873 +#: ../../whatsnew/3.13.rst:867 msgid "email" msgstr "email" -#: ../../whatsnew/3.13.rst:875 +#: ../../whatsnew/3.13.rst:869 msgid "" "Headers with embedded newlines are now quoted on output. The :mod:`~email." "generator` will now refuse to serialize (write) headers that are improperly " @@ -1299,7 +1332,7 @@ msgid "" "Bloemsaat and Petr Viktorin in :gh:`121650`.)" msgstr "" -#: ../../whatsnew/3.13.rst:883 +#: ../../whatsnew/3.13.rst:877 msgid "" ":func:`~email.utils.getaddresses` and :func:`~email.utils.parseaddr` now " "return ``('', '')`` pairs in more situations where invalid email addresses " @@ -1311,11 +1344,11 @@ msgid "" "Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" msgstr "" -#: ../../whatsnew/3.13.rst:895 +#: ../../whatsnew/3.13.rst:889 msgid "fractions" msgstr "fractions" -#: ../../whatsnew/3.13.rst:897 +#: ../../whatsnew/3.13.rst:891 msgid "" ":class:`~fractions.Fraction` objects now support the standard :ref:`format " "specification mini-language ` rules for fill, alignment, sign " @@ -1323,61 +1356,22 @@ msgid "" "`111320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:904 -msgid "gc" -msgstr "gc" - -#: ../../whatsnew/3.13.rst:906 -msgid "" -"The cyclic garbage collector is now incremental, which changes the meaning " -"of the results of :meth:`~gc.get_threshold` and :meth:`~gc.set_threshold` as " -"well as :meth:`~gc.get_count` and :meth:`~gc.get_stats`." -msgstr "" - -#: ../../whatsnew/3.13.rst:911 -msgid "" -"For backwards compatibility, :meth:`~gc.get_threshold` continues to return a " -"three-item tuple. The first value is the threshold for young collections, as " -"before; the second value determines the rate at which the old collection is " -"scanned (the default is 10, and higher values mean that the old collection " -"is scanned more slowly). The third value is meaningless and is always zero." -msgstr "" - -#: ../../whatsnew/3.13.rst:919 -msgid ":meth:`~gc.set_threshold` ignores any items after the second." -msgstr "" - -#: ../../whatsnew/3.13.rst:921 -msgid "" -":meth:`~gc.get_count` and :meth:`~gc.get_stats` continue to return the same " -"format of results. The only difference is that instead of the results " -"referring to the young, aging and old generations, the results refer to the " -"young generation and the aging and collecting spaces of the old generation." -msgstr "" - -#: ../../whatsnew/3.13.rst:928 -msgid "" -"In summary, code that attempted to manipulate the behavior of the cycle GC " -"may not work exactly as intended, but it is very unlikely to be harmful. All " -"other code will work just fine." -msgstr "" - -#: ../../whatsnew/3.13.rst:934 +#: ../../whatsnew/3.13.rst:898 msgid "glob" msgstr "glob" -#: ../../whatsnew/3.13.rst:936 +#: ../../whatsnew/3.13.rst:900 msgid "" "Add :func:`~glob.translate`, a function to convert a path specification with " "shell-style wildcards to a regular expression. (Contributed by Barney Gale " "in :gh:`72904`.)" msgstr "" -#: ../../whatsnew/3.13.rst:942 +#: ../../whatsnew/3.13.rst:906 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.13.rst:944 +#: ../../whatsnew/3.13.rst:908 msgid "" "The following functions in :mod:`importlib.resources` now allow accessing a " "directory (or tree) of resources, using multiple positional arguments (the " @@ -1385,37 +1379,37 @@ msgid "" "keyword-only):" msgstr "" -#: ../../whatsnew/3.13.rst:949 +#: ../../whatsnew/3.13.rst:913 msgid ":func:`~importlib.resources.is_resource`" msgstr ":func:`~importlib.resources.is_resource`" -#: ../../whatsnew/3.13.rst:950 +#: ../../whatsnew/3.13.rst:914 msgid ":func:`~importlib.resources.open_binary`" msgstr ":func:`~importlib.resources.open_binary`" -#: ../../whatsnew/3.13.rst:951 +#: ../../whatsnew/3.13.rst:915 msgid ":func:`~importlib.resources.open_text`" msgstr ":func:`~importlib.resources.open_text`" -#: ../../whatsnew/3.13.rst:952 +#: ../../whatsnew/3.13.rst:916 msgid ":func:`~importlib.resources.path`" msgstr ":func:`~importlib.resources.path`" -#: ../../whatsnew/3.13.rst:953 +#: ../../whatsnew/3.13.rst:917 msgid ":func:`~importlib.resources.read_binary`" msgstr ":func:`~importlib.resources.read_binary`" -#: ../../whatsnew/3.13.rst:954 +#: ../../whatsnew/3.13.rst:918 msgid ":func:`~importlib.resources.read_text`" msgstr ":func:`~importlib.resources.read_text`" -#: ../../whatsnew/3.13.rst:956 +#: ../../whatsnew/3.13.rst:920 msgid "" "These functions are no longer deprecated and are not scheduled for removal. " "(Contributed by Petr Viktorin in :gh:`106532`.)" msgstr "" -#: ../../whatsnew/3.13.rst:959 +#: ../../whatsnew/3.13.rst:923 msgid "" ":func:`~importlib.resources.contents` remains deprecated in favor of the " "fully-featured :class:`~importlib.resources.abc.Traversable` API. However, " @@ -1423,11 +1417,11 @@ msgid "" "`106532`.)" msgstr "" -#: ../../whatsnew/3.13.rst:966 +#: ../../whatsnew/3.13.rst:930 msgid "io" msgstr "io" -#: ../../whatsnew/3.13.rst:968 +#: ../../whatsnew/3.13.rst:932 msgid "" "The :class:`~io.IOBase` finalizer now logs any errors raised by the :meth:" "`~io.IOBase.close` method with :data:`sys.unraisablehook`. Previously, " @@ -1436,17 +1430,17 @@ msgid "" "build>`. (Contributed by Victor Stinner in :gh:`62948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:977 +#: ../../whatsnew/3.13.rst:941 msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.13.rst:979 +#: ../../whatsnew/3.13.rst:943 msgid "" "Add the :attr:`.IPv4Address.ipv6_mapped` property, which returns the IPv4-" "mapped IPv6 address. (Contributed by Charles Machalow in :gh:`109466`.)" msgstr "" -#: ../../whatsnew/3.13.rst:983 +#: ../../whatsnew/3.13.rst:947 msgid "" "Fix ``is_global`` and ``is_private`` behavior in :class:`~ipaddress." "IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress." @@ -1454,22 +1448,22 @@ msgid "" "Stasiak in :gh:`113171`.)" msgstr "" -#: ../../whatsnew/3.13.rst:990 +#: ../../whatsnew/3.13.rst:954 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.13.rst:992 +#: ../../whatsnew/3.13.rst:956 msgid "" ":func:`~itertools.batched` has a new *strict* parameter, which raises a :exc:" "`ValueError` if the final batch is shorter than the specified batch size. " "(Contributed by Raymond Hettinger in :gh:`113202`.)" msgstr "" -#: ../../whatsnew/3.13.rst:999 +#: ../../whatsnew/3.13.rst:963 msgid "marshal" msgstr "marshal" -#: ../../whatsnew/3.13.rst:1001 +#: ../../whatsnew/3.13.rst:965 msgid "" "Add the *allow_code* parameter in module functions. Passing " "``allow_code=False`` prevents serialization and de-serialization of code " @@ -1477,11 +1471,11 @@ msgid "" "Serhiy Storchaka in :gh:`113626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1008 +#: ../../whatsnew/3.13.rst:972 msgid "math" msgstr "math" -#: ../../whatsnew/3.13.rst:1010 +#: ../../whatsnew/3.13.rst:974 msgid "" "The new function :func:`~math.fma` performs fused multiply-add operations. " "This computes ``x * y + z`` with only a single round, and so avoids any " @@ -1491,11 +1485,11 @@ msgid "" "Stinner in :gh:`73468`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1020 +#: ../../whatsnew/3.13.rst:984 msgid "mimetypes" msgstr "mimetypes" -#: ../../whatsnew/3.13.rst:1022 +#: ../../whatsnew/3.13.rst:986 msgid "" "Add the :func:`~mimetypes.guess_file_type` function to guess a MIME type " "from a filesystem path. Using paths with :func:`~mimetypes.guess_type` is " @@ -1503,18 +1497,18 @@ msgid "" "`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1029 +#: ../../whatsnew/3.13.rst:993 msgid "mmap" msgstr "mmap" -#: ../../whatsnew/3.13.rst:1031 +#: ../../whatsnew/3.13.rst:995 msgid "" ":class:`~mmap.mmap` is now protected from crashing on Windows when the " "mapped memory is inaccessible due to file system errors or access " "violations. (Contributed by Jannis Weigend in :gh:`118209`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1035 +#: ../../whatsnew/3.13.rst:999 msgid "" ":class:`~mmap.mmap` has a new :meth:`~mmap.mmap.seekable` method that can be " "used when a seekable file-like object is required. The :meth:`~mmap.mmap." @@ -1522,7 +1516,7 @@ msgid "" "Na and Sylvie Liberman in :gh:`111835`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1040 +#: ../../whatsnew/3.13.rst:1004 msgid "" "The new UNIX-only *trackfd* parameter for :class:`~mmap.mmap` controls file " "descriptor duplication; if false, the file descriptor specified by *fileno* " @@ -1530,22 +1524,22 @@ msgid "" "gh:`78502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1047 +#: ../../whatsnew/3.13.rst:1011 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.13.rst:1055 +#: ../../whatsnew/3.13.rst:1019 msgid "os" msgstr "os" -#: ../../whatsnew/3.13.rst:1057 +#: ../../whatsnew/3.13.rst:1021 msgid "" "Add :func:`~os.process_cpu_count` function to get the number of logical CPU " "cores usable by the calling thread of the current process. (Contributed by " "Victor Stinner in :gh:`109649`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1061 +#: ../../whatsnew/3.13.rst:1025 msgid "" ":func:`~os.cpu_count` and :func:`~os.process_cpu_count` can be overridden " "through the new environment variable :envvar:`PYTHON_CPU_COUNT` or the new " @@ -1555,7 +1549,7 @@ msgid "" "Na in :gh:`109595`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1069 +#: ../../whatsnew/3.13.rst:1033 msgid "" "Add a :ref:`low level interface ` to Linux's :manpage:`timer " "file descriptors ` via :func:`~os.timerfd_create`, :func:" @@ -1566,7 +1560,7 @@ msgid "" "in :gh:`108277`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1078 +#: ../../whatsnew/3.13.rst:1042 msgid "" ":func:`~os.lchmod` and the *follow_symlinks* argument of :func:`~os.chmod` " "are both now available on Windows. Note that the default value of " @@ -1574,14 +1568,14 @@ msgid "" "by Serhiy Storchaka in :gh:`59616`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1084 +#: ../../whatsnew/3.13.rst:1048 msgid "" ":func:`~os.fchmod` and support for file descriptors in :func:`~os.chmod` are " "both now available on Windows. (Contributed by Serhiy Storchaka in :gh:" "`113191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1088 +#: ../../whatsnew/3.13.rst:1052 msgid "" "On Windows, :func:`~os.mkdir` and :func:`~os.makedirs` now support passing a " "*mode* value of ``0o700`` to apply access control to the new directory. This " @@ -1590,14 +1584,14 @@ msgid "" "Steve Dower in :gh:`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1095 +#: ../../whatsnew/3.13.rst:1059 msgid "" ":func:`~os.posix_spawn` now accepts ``None`` for the *env* argument, which " "makes the newly spawned process use the current process environment. " "(Contributed by Jakub Kulik in :gh:`113119`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1099 +#: ../../whatsnew/3.13.rst:1063 msgid "" ":func:`~os.posix_spawn` can now use the :attr:`~os.POSIX_SPAWN_CLOSEFROM` " "attribute in the *file_actions* parameter on platforms that support :c:func:" @@ -1605,76 +1599,76 @@ msgid "" "gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1106 +#: ../../whatsnew/3.13.rst:1070 msgid "os.path" msgstr "os.path" -#: ../../whatsnew/3.13.rst:1108 +#: ../../whatsnew/3.13.rst:1072 msgid "" "Add :func:`~os.path.isreserved` to check if a path is reserved on the " "current system. This function is only available on Windows. (Contributed by " "Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1113 +#: ../../whatsnew/3.13.rst:1077 msgid "" "On Windows, :func:`~os.path.isabs` no longer considers paths starting with " "exactly one slash (``\\`` or ``/``) to be absolute. (Contributed by Barney " "Gale and Jon Foster in :gh:`44626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1117 +#: ../../whatsnew/3.13.rst:1081 msgid "" ":func:`~os.path.realpath` now resolves MS-DOS style file names even if the " "file is not accessible. (Contributed by Moonsik Park in :gh:`82367`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1123 ../../whatsnew/3.13.rst:1689 +#: ../../whatsnew/3.13.rst:1087 ../../whatsnew/3.13.rst:1648 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.13.rst:1125 +#: ../../whatsnew/3.13.rst:1089 msgid "" "Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead of :exc:" "`NotImplementedError` when a path operation isn't supported. (Contributed by " "Barney Gale in :gh:`89812`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1129 +#: ../../whatsnew/3.13.rst:1093 msgid "" "Add a new constructor for creating :class:`~pathlib.Path` objects from " "'file' URIs (``file:///``), :meth:`.Path.from_uri`. (Contributed by Barney " "Gale in :gh:`107465`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1133 +#: ../../whatsnew/3.13.rst:1097 msgid "" "Add :meth:`.PurePath.full_match` for matching paths with shell-style " "wildcards, including the recursive wildcard \"``**``\". (Contributed by " "Barney Gale in :gh:`73435`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1137 +#: ../../whatsnew/3.13.rst:1101 msgid "" "Add the :attr:`.PurePath.parser` class attribute to store the implementation " "of :mod:`os.path` used for low-level path parsing and joining. This will be " "either :mod:`!posixpath` or :mod:`!ntpath`." msgstr "" -#: ../../whatsnew/3.13.rst:1142 +#: ../../whatsnew/3.13.rst:1106 msgid "" "Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` and :meth:" "`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1146 +#: ../../whatsnew/3.13.rst:1110 msgid "" ":meth:`.Path.glob` and :meth:`~pathlib.Path.rglob` now return files and " "directories when given a pattern that ends with \"``**``\". Previously, only " "directories were returned. (Contributed by Barney Gale in :gh:`70303`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1151 +#: ../../whatsnew/3.13.rst:1115 msgid "" "Add the *follow_symlinks* keyword-only argument to :meth:`Path.is_file " "`, :meth:`Path.is_dir `, :meth:`." @@ -1682,11 +1676,11 @@ msgid "" "`105793` and Kamil Turek in :gh:`107962`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1159 +#: ../../whatsnew/3.13.rst:1123 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.13.rst:1161 +#: ../../whatsnew/3.13.rst:1125 msgid "" ":func:`breakpoint` and :func:`~pdb.set_trace` now enter the debugger " "immediately rather than on the next line of code to be executed. This change " @@ -1695,20 +1689,20 @@ msgid "" "Gao in :gh:`118579`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1167 +#: ../../whatsnew/3.13.rst:1131 msgid "" "``sys.path[0]`` is no longer replaced by the directory of the script being " "debugged when :attr:`sys.flags.safe_path` is set. (Contributed by Tian Gao " "and Christian Walther in :gh:`111762`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1171 +#: ../../whatsnew/3.13.rst:1135 msgid "" ":mod:`zipapp` is now supported as a debugging target. (Contributed by Tian " "Gao in :gh:`118501`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1174 +#: ../../whatsnew/3.13.rst:1138 msgid "" "Add ability to move between chained exceptions during post-mortem debugging " "in :func:`~pdb.pm` using the new :pdbcmd:`exceptions [exc_number] " @@ -1716,117 +1710,121 @@ msgid "" "`106676`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1179 +#: ../../whatsnew/3.13.rst:1143 msgid "" "Expressions and statements whose prefix is a pdb command are now correctly " "identified and executed. (Contributed by Tian Gao in :gh:`108464`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1185 +#: ../../whatsnew/3.13.rst:1149 msgid "queue" msgstr "queue" -#: ../../whatsnew/3.13.rst:1187 +#: ../../whatsnew/3.13.rst:1151 msgid "" "Add :meth:`Queue.shutdown ` and :exc:`~queue.ShutDown` " "to manage queue termination. (Contributed by Laurie Opperman and Yves Duprat " "in :gh:`104750`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1193 +#: ../../whatsnew/3.13.rst:1157 msgid "random" msgstr "random" -#: ../../whatsnew/3.13.rst:1195 +#: ../../whatsnew/3.13.rst:1159 msgid "" "Add a :ref:`command-line interface `. (Contributed by Hugo van " "Kemenade in :gh:`118131`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1200 ../../whatsnew/3.13.rst:1697 +#: ../../whatsnew/3.13.rst:1164 ../../whatsnew/3.13.rst:1656 msgid "re" msgstr "re" -#: ../../whatsnew/3.13.rst:1202 +#: ../../whatsnew/3.13.rst:1166 msgid "" "Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved clarity. :" "exc:`!re.error` is kept for backward compatibility." msgstr "" -#: ../../whatsnew/3.13.rst:1207 +#: ../../whatsnew/3.13.rst:1171 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.13.rst:1209 +#: ../../whatsnew/3.13.rst:1173 msgid "" "Support the *dir_fd* and *follow_symlinks* keyword arguments in :func:" "`~shutil.chown`. (Contributed by Berker Peksag and Tahia K in :gh:`62308`)" msgstr "" -#: ../../whatsnew/3.13.rst:1215 +#: ../../whatsnew/3.13.rst:1179 msgid "site" msgstr "site" -#: ../../whatsnew/3.13.rst:1217 +#: ../../whatsnew/3.13.rst:1181 msgid "" ":file:`.pth` files are now decoded using UTF-8 first, and then with the :" "term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada Naoki " "in :gh:`117802`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1223 +#: ../../whatsnew/3.13.rst:1187 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.13.rst:1225 +#: ../../whatsnew/3.13.rst:1189 msgid "" "A :exc:`ResourceWarning` is now emitted if a :class:`~sqlite3.Connection` " "object is not :meth:`closed ` explicitly. " "(Contributed by Erlend E. Aasland in :gh:`105539`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1229 +#: ../../whatsnew/3.13.rst:1193 msgid "" "Add the *filter* keyword-only parameter to :meth:`.Connection.iterdump` for " "filtering database objects to dump. (Contributed by Mariusz Felisiak in :gh:" "`91602`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1235 +#: ../../whatsnew/3.13.rst:1199 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.13.rst:1237 +#: ../../whatsnew/3.13.rst:1201 msgid "" "The :func:`~ssl.create_default_context` API now includes :data:`~ssl." "VERIFY_X509_PARTIAL_CHAIN` and :data:`~ssl.VERIFY_X509_STRICT` in its " "default flags." msgstr "" -#: ../../whatsnew/3.13.rst:1243 +#: ../../whatsnew/3.13.rst:1207 msgid "" ":data:`~ssl.VERIFY_X509_STRICT` may reject pre-:rfc:`5280` or malformed " "certificates that the underlying OpenSSL implementation might otherwise " "accept. Whilst disabling this is not recommended, you can do so using:" msgstr "" -#: ../../whatsnew/3.13.rst:1248 +#: ../../whatsnew/3.13.rst:1212 msgid "" "import ssl\n" "\n" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" msgstr "" +"import ssl\n" +"\n" +"ctx = ssl.create_default_context()\n" +"ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" -#: ../../whatsnew/3.13.rst:1255 +#: ../../whatsnew/3.13.rst:1219 msgid "(Contributed by William Woodruff in :gh:`112389`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1259 +#: ../../whatsnew/3.13.rst:1223 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.13.rst:1261 +#: ../../whatsnew/3.13.rst:1225 msgid "" "Add :func:`~statistics.kde` for kernel density estimation. This makes it " "possible to estimate a continuous probability density function from a fixed " @@ -1834,24 +1832,24 @@ msgid "" "`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1266 +#: ../../whatsnew/3.13.rst:1230 msgid "" "Add :func:`~statistics.kde_random` for sampling from an estimated " "probability density function created by :func:`~statistics.kde`. " "(Contributed by Raymond Hettinger in :gh:`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1274 +#: ../../whatsnew/3.13.rst:1238 msgid "subprocess" msgstr "subprocess" -#: ../../whatsnew/3.13.rst:1276 +#: ../../whatsnew/3.13.rst:1240 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations." msgstr "" -#: ../../whatsnew/3.13.rst:1279 +#: ../../whatsnew/3.13.rst:1243 msgid "" "Notably, when *close_fds* is ``True`` (the default), :func:`~os.posix_spawn` " "will be used when the C library provides :c:func:`!" @@ -1860,7 +1858,7 @@ msgid "" "existing Linux :c:func:`!vfork` based code." msgstr "" -#: ../../whatsnew/3.13.rst:1286 +#: ../../whatsnew/3.13.rst:1250 msgid "" "A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can be set to " "``False`` if you need to force :mod:`subprocess` to never use :func:`~os." @@ -1870,22 +1868,22 @@ msgid "" "`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1296 +#: ../../whatsnew/3.13.rst:1260 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.13.rst:1298 +#: ../../whatsnew/3.13.rst:1262 msgid "" "Add the :func:`~sys._is_interned` function to test if a string was interned. " "This function is not guaranteed to exist in all implementations of Python. " "(Contributed by Serhiy Storchaka in :gh:`78573`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1304 +#: ../../whatsnew/3.13.rst:1268 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.13.rst:1306 +#: ../../whatsnew/3.13.rst:1270 msgid "" "On Windows, the default mode ``0o700`` used by :func:`tempfile.mkdtemp` now " "limits access to the new directory due to changes to :func:`os.mkdir`. This " @@ -1893,11 +1891,11 @@ msgid "" "`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1313 +#: ../../whatsnew/3.13.rst:1277 msgid "time" msgstr "time" -#: ../../whatsnew/3.13.rst:1315 +#: ../../whatsnew/3.13.rst:1279 msgid "" "On Windows, :func:`~time.monotonic` now uses the " "``QueryPerformanceCounter()`` clock for a resolution of 1 microsecond, " @@ -1905,7 +1903,7 @@ msgid "" "milliseconds. (Contributed by Victor Stinner in :gh:`88494`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1321 +#: ../../whatsnew/3.13.rst:1285 msgid "" "On Windows, :func:`~time.time` now uses the " "``GetSystemTimePreciseAsFileTime()`` clock for a resolution of 1 " @@ -1914,11 +1912,11 @@ msgid "" "`63207`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1329 +#: ../../whatsnew/3.13.rst:1293 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.13.rst:1331 +#: ../../whatsnew/3.13.rst:1295 msgid "" "Add :mod:`tkinter` widget methods: :meth:`!tk_busy_hold`, :meth:`!" "tk_busy_configure`, :meth:`!tk_busy_cget`, :meth:`!tk_busy_forget`, :meth:`!" @@ -1926,7 +1924,7 @@ msgid "" "klappnase and Serhiy Storchaka in :gh:`72684`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1337 +#: ../../whatsnew/3.13.rst:1301 msgid "" "The :mod:`tkinter` widget method :meth:`!wm_attributes` now accepts the " "attribute name without the minus prefix to get window attributes, for " @@ -1935,14 +1933,14 @@ msgid "" "wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1344 +#: ../../whatsnew/3.13.rst:1308 msgid "" ":meth:`!wm_attributes` can now return attributes as a :class:`dict`, by " "using the new optional keyword-only parameter *return_python_dict*. " "(Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1348 +#: ../../whatsnew/3.13.rst:1312 msgid "" ":meth:`!Text.count` can now return a simple :class:`int` when the new " "optional keyword-only parameter *return_ints* is used. Otherwise, the single " @@ -1950,27 +1948,27 @@ msgid "" "in :gh:`97928`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1353 +#: ../../whatsnew/3.13.rst:1317 msgid "" "Support the \"vsapi\" element type in the :meth:`~tkinter.ttk.Style." "element_create` method of :class:`tkinter.ttk.Style`. (Contributed by Serhiy " "Storchaka in :gh:`68166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1358 +#: ../../whatsnew/3.13.rst:1322 msgid "" "Add the :meth:`!after_info` method for Tkinter widgets. (Contributed by " "Cheryl Sabella in :gh:`77020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1361 +#: ../../whatsnew/3.13.rst:1325 msgid "" "Add a new :meth:`!copy_replace` method to :class:`!PhotoImage` to copy a " "region from one image to another, possibly with pixel zooming, subsampling, " "or both. (Contributed by Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1366 +#: ../../whatsnew/3.13.rst:1330 msgid "" "Add *from_coords* parameter to the :class:`!PhotoImage` methods :meth:`!" "copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and *subsample* " @@ -1978,7 +1976,7 @@ msgid "" "Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1372 +#: ../../whatsnew/3.13.rst:1336 msgid "" "Add the :class:`!PhotoImage` methods :meth:`!read` to read an image from a " "file and :meth:`!data` to get the image data. Add *background* and " @@ -1986,11 +1984,11 @@ msgid "" "Storchaka in :gh:`118271`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1380 +#: ../../whatsnew/3.13.rst:1344 msgid "traceback" msgstr "traceback" -#: ../../whatsnew/3.13.rst:1382 +#: ../../whatsnew/3.13.rst:1346 msgid "" "Add the :attr:`~traceback.TracebackException.exc_type_str` attribute to :" "class:`~traceback.TracebackException`, which holds a string display of the " @@ -2000,7 +1998,7 @@ msgid "" "(Contributed by Irit Katriel in :gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1391 +#: ../../whatsnew/3.13.rst:1355 msgid "" "Add a new *show_group* keyword-only parameter to :meth:`.TracebackException." "format_exception_only` to (recursively) format the nested exceptions of a :" @@ -2008,11 +2006,11 @@ msgid "" "`105292`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1398 +#: ../../whatsnew/3.13.rst:1362 msgid "types" msgstr "types" -#: ../../whatsnew/3.13.rst:1400 +#: ../../whatsnew/3.13.rst:1364 msgid "" ":class:`~types.SimpleNamespace` can now take a single positional argument to " "initialise the namespace's arguments. This argument must either be a mapping " @@ -2020,63 +2018,63 @@ msgid "" "`108191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1407 ../../whatsnew/3.13.rst:1722 +#: ../../whatsnew/3.13.rst:1371 ../../whatsnew/3.13.rst:1681 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.13.rst:1409 +#: ../../whatsnew/3.13.rst:1373 msgid "" ":pep:`705`: Add :data:`~typing.ReadOnly`, a special typing construct to mark " "a :class:`~typing.TypedDict` item as read-only for type checkers." msgstr "" -#: ../../whatsnew/3.13.rst:1412 +#: ../../whatsnew/3.13.rst:1376 msgid "" ":pep:`742`: Add :data:`~typing.TypeIs`, a typing construct that can be used " "to instruct a type checker how to narrow a type." msgstr "" -#: ../../whatsnew/3.13.rst:1415 +#: ../../whatsnew/3.13.rst:1379 msgid "" "Add :data:`~typing.NoDefault`, a sentinel object used to represent the " "defaults of some parameters in the :mod:`typing` module. (Contributed by " "Jelle Zijlstra in :gh:`116126`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1419 +#: ../../whatsnew/3.13.rst:1383 msgid "" "Add :func:`~typing.get_protocol_members` to return the set of members " "defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:" "`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1423 +#: ../../whatsnew/3.13.rst:1387 msgid "" "Add :func:`~typing.is_protocol` to check whether a class is a :class:" "`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1427 +#: ../../whatsnew/3.13.rst:1391 msgid "" ":data:`~typing.ClassVar` can now be nested in :data:`~typing.Final`, and " "vice versa. (Contributed by Mehdi Drissi in :gh:`89547`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1433 +#: ../../whatsnew/3.13.rst:1397 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.13.rst:1435 +#: ../../whatsnew/3.13.rst:1399 msgid "" "Update the Unicode database to `version 15.1.0`__. (Contributed by James " "Gerity in :gh:`109559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1442 +#: ../../whatsnew/3.13.rst:1406 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.13.rst:1444 +#: ../../whatsnew/3.13.rst:1408 msgid "" "Add support for creating source control management (SCM) ignore files in a " "virtual environment's directory. By default, Git is supported. This is " @@ -2086,11 +2084,11 @@ msgid "" "Cannon in :gh:`108125`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1455 +#: ../../whatsnew/3.13.rst:1419 msgid "warnings" msgstr "warnings" -#: ../../whatsnew/3.13.rst:1457 +#: ../../whatsnew/3.13.rst:1421 msgid "" ":pep:`702`: The new :func:`warnings.deprecated` decorator provides a way to " "communicate deprecations to a :term:`static type checker` and to warn on " @@ -2099,69 +2097,62 @@ msgid "" "(Contributed by Jelle Zijlstra in :gh:`104003`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1466 +#: ../../whatsnew/3.13.rst:1430 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.13.rst:1468 +#: ../../whatsnew/3.13.rst:1432 msgid "" "Allow controlling Expat >=2.6.0 reparse deferral (:cve:`2023-52425`) by " "adding five new methods:" msgstr "" -#: ../../whatsnew/3.13.rst:1471 +#: ../../whatsnew/3.13.rst:1435 msgid ":meth:`xml.etree.ElementTree.XMLParser.flush`" msgstr ":meth:`xml.etree.ElementTree.XMLParser.flush`" -#: ../../whatsnew/3.13.rst:1472 +#: ../../whatsnew/3.13.rst:1436 msgid ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" msgstr ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" -#: ../../whatsnew/3.13.rst:1473 +#: ../../whatsnew/3.13.rst:1437 msgid ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" msgstr ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1474 +#: ../../whatsnew/3.13.rst:1438 msgid ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" msgstr ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1475 +#: ../../whatsnew/3.13.rst:1439 msgid ":meth:`!xml.sax.expatreader.ExpatParser.flush`" msgstr ":meth:`!xml.sax.expatreader.ExpatParser.flush`" -#: ../../whatsnew/3.13.rst:1477 +#: ../../whatsnew/3.13.rst:1441 msgid "(Contributed by Sebastian Pipping in :gh:`115623`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1479 +#: ../../whatsnew/3.13.rst:1443 msgid "" "Add the :meth:`!close` method for the iterator returned by :func:`~xml.etree." "ElementTree.iterparse` for explicit cleanup. (Contributed by Serhiy " "Storchaka in :gh:`69893`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1485 +#: ../../whatsnew/3.13.rst:1449 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.13.rst:1487 +#: ../../whatsnew/3.13.rst:1451 msgid "" "Add support for ZIP64_ format files. Everybody loves huge data, right? " "(Contributed by Tim Hatch in :gh:`94146`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1495 +#: ../../whatsnew/3.13.rst:1459 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.13.rst:1497 -msgid "" -"The new :ref:`incremental garbage collector ` " -"means that maximum pause times are reduced by an order of magnitude or more " -"for larger heaps. (Contributed by Mark Shannon in :gh:`108362`.)" -msgstr "" - -#: ../../whatsnew/3.13.rst:1502 +#: ../../whatsnew/3.13.rst:1461 msgid "" "Several standard library modules have had their import times significantly " "improved. For example, the import time of the :mod:`typing` module has been " @@ -2172,13 +2163,13 @@ msgid "" "Turner, Daniel Hollas, and others in :gh:`109653`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1513 +#: ../../whatsnew/3.13.rst:1472 msgid "" ":func:`textwrap.indent` is now around 30% faster than before for large " "input. (Contributed by Inada Naoki in :gh:`107369`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1516 +#: ../../whatsnew/3.13.rst:1475 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations, including when *close_fds* is ``True`` (the default) on " @@ -2188,15 +2179,15 @@ msgid "" "Kulik in :gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1526 +#: ../../whatsnew/3.13.rst:1485 msgid "Removed Modules And APIs" msgstr "" -#: ../../whatsnew/3.13.rst:1532 +#: ../../whatsnew/3.13.rst:1491 msgid "PEP 594: Remove \"dead batteries\" from the standard library" msgstr "" -#: ../../whatsnew/3.13.rst:1534 +#: ../../whatsnew/3.13.rst:1493 msgid "" ":pep:`594` proposed removing 19 modules from the standard library, " "colloquially referred to as 'dead batteries' due to their historic, " @@ -2204,23 +2195,23 @@ msgid "" "in Python 3.11, and are now removed:" msgstr "" -#: ../../whatsnew/3.13.rst:1540 +#: ../../whatsnew/3.13.rst:1499 msgid ":mod:`!aifc`" msgstr ":mod:`!aifc`" -#: ../../whatsnew/3.13.rst:1541 +#: ../../whatsnew/3.13.rst:1500 msgid ":mod:`!audioop`" msgstr ":mod:`!audioop`" -#: ../../whatsnew/3.13.rst:1542 +#: ../../whatsnew/3.13.rst:1501 msgid ":mod:`!chunk`" msgstr ":mod:`!chunk`" -#: ../../whatsnew/3.13.rst:1543 +#: ../../whatsnew/3.13.rst:1502 msgid ":mod:`!cgi` and :mod:`!cgitb`" msgstr ":mod:`!cgi` 和 :mod:`!cgitb`" -#: ../../whatsnew/3.13.rst:1545 +#: ../../whatsnew/3.13.rst:1504 msgid "" ":class:`!cgi.FieldStorage` can typically be replaced with :func:`urllib." "parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." @@ -2228,7 +2219,7 @@ msgid "" "requests." msgstr "" -#: ../../whatsnew/3.13.rst:1550 +#: ../../whatsnew/3.13.rst:1509 msgid "" ":func:`!cgi.parse` can be replaced by calling :func:`urllib.parse.parse_qs` " "directly on the desired query string, unless the input is ``multipart/form-" @@ -2236,14 +2227,14 @@ msgid "" "parse_multipart`." msgstr "" -#: ../../whatsnew/3.13.rst:1555 +#: ../../whatsnew/3.13.rst:1514 msgid "" ":func:`!cgi.parse_header` can be replaced with the functionality in the :mod:" "`email` package, which implements the same MIME RFCs. For example, with :" "class:`email.message.EmailMessage`:" msgstr "" -#: ../../whatsnew/3.13.rst:1559 +#: ../../whatsnew/3.13.rst:1518 msgid "" "from email.message import EmailMessage\n" "\n" @@ -2252,7 +2243,7 @@ msgid "" "main, params = msg.get_content_type(), msg['content-type'].params" msgstr "" -#: ../../whatsnew/3.13.rst:1567 +#: ../../whatsnew/3.13.rst:1526 msgid "" ":func:`!cgi.parse_multipart` can be replaced with the functionality in the :" "mod:`email` package, which implements the same MIME RFCs, or with the :pypi:" @@ -2260,41 +2251,41 @@ msgid "" "and :class:`email.message.Message` classes." msgstr "" -#: ../../whatsnew/3.13.rst:1573 +#: ../../whatsnew/3.13.rst:1532 msgid "" ":mod:`!crypt` and the private :mod:`!_crypt` extension. The :mod:`hashlib` " "module may be an appropriate replacement when simply hashing a value is " "required. Otherwise, various third-party libraries on PyPI are available:" msgstr "" -#: ../../whatsnew/3.13.rst:1578 +#: ../../whatsnew/3.13.rst:1537 msgid "" ":pypi:`bcrypt`: Modern password hashing for your software and your servers." msgstr "" -#: ../../whatsnew/3.13.rst:1580 +#: ../../whatsnew/3.13.rst:1539 msgid "" ":pypi:`passlib`: Comprehensive password hashing framework supporting over 30 " "schemes." msgstr "" -#: ../../whatsnew/3.13.rst:1582 +#: ../../whatsnew/3.13.rst:1541 msgid ":pypi:`argon2-cffi`: The secure Argon2 password hashing algorithm." msgstr "" -#: ../../whatsnew/3.13.rst:1584 +#: ../../whatsnew/3.13.rst:1543 msgid "" ":pypi:`legacycrypt`: :mod:`ctypes` wrapper to the POSIX crypt library call " "and associated functionality." msgstr "" -#: ../../whatsnew/3.13.rst:1587 +#: ../../whatsnew/3.13.rst:1546 msgid "" ":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to the :manpage:" "`crypt_r(3)` library call and associated functionality." msgstr "" -#: ../../whatsnew/3.13.rst:1592 +#: ../../whatsnew/3.13.rst:1551 msgid "" ":mod:`!imghdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements. For example, the :func:`!" @@ -2302,83 +2293,83 @@ msgid "" "function for all file formats that were supported by :mod:`!imghdr`." msgstr "" -#: ../../whatsnew/3.13.rst:1598 +#: ../../whatsnew/3.13.rst:1557 msgid ":mod:`!mailcap`: Use the :mod:`mimetypes` module instead." msgstr "" -#: ../../whatsnew/3.13.rst:1600 +#: ../../whatsnew/3.13.rst:1559 msgid ":mod:`!msilib`" msgstr ":mod:`!msilib`" -#: ../../whatsnew/3.13.rst:1601 +#: ../../whatsnew/3.13.rst:1560 msgid ":mod:`!nis`" msgstr ":mod:`!nis`" -#: ../../whatsnew/3.13.rst:1602 -msgid ":mod:`!nntplib`: Use the :pypi:`nntplib` library from PyPI instead." +#: ../../whatsnew/3.13.rst:1561 +msgid ":mod:`!nntplib`: Use the :pypi:`pynntp` library from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1604 +#: ../../whatsnew/3.13.rst:1563 msgid "" ":mod:`!ossaudiodev`: For audio playback, use the :pypi:`pygame` library from " "PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1606 +#: ../../whatsnew/3.13.rst:1565 msgid ":mod:`!pipes`: Use the :mod:`subprocess` module instead." msgstr "" -#: ../../whatsnew/3.13.rst:1608 +#: ../../whatsnew/3.13.rst:1567 msgid "" ":mod:`!sndhdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements." msgstr "" -#: ../../whatsnew/3.13.rst:1611 +#: ../../whatsnew/3.13.rst:1570 msgid ":mod:`!spwd`: Use the :pypi:`python-pam` library from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1613 +#: ../../whatsnew/3.13.rst:1572 msgid ":mod:`!sunau`" msgstr ":mod:`!sunau`" -#: ../../whatsnew/3.13.rst:1614 +#: ../../whatsnew/3.13.rst:1573 msgid "" ":mod:`!telnetlib`, Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries " "from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1616 +#: ../../whatsnew/3.13.rst:1575 msgid "" ":mod:`!uu`: Use the :mod:`base64` module instead, as a modern alternative." msgstr "" -#: ../../whatsnew/3.13.rst:1618 +#: ../../whatsnew/3.13.rst:1577 msgid ":mod:`!xdrlib`" msgstr ":mod:`!xdrlib`" -#: ../../whatsnew/3.13.rst:1620 +#: ../../whatsnew/3.13.rst:1579 msgid "" "(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" "`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1624 +#: ../../whatsnew/3.13.rst:1583 msgid "2to3" msgstr "2to3" -#: ../../whatsnew/3.13.rst:1626 +#: ../../whatsnew/3.13.rst:1585 msgid "" "Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " "previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" "`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1632 +#: ../../whatsnew/3.13.rst:1591 msgid "builtins" msgstr "builtins" -#: ../../whatsnew/3.13.rst:1634 +#: ../../whatsnew/3.13.rst:1593 msgid "" "Remove support for chained :class:`classmethod` descriptors (introduced in :" "gh:`63272`). These can no longer be used to wrap other descriptors, such as :" @@ -2388,47 +2379,47 @@ msgid "" "(Contributed by Raymond Hettinger in :gh:`89519`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1643 +#: ../../whatsnew/3.13.rst:1602 msgid "" "Raise a :exc:`RuntimeError` when calling :meth:`frame.clear` on a suspended " "frame (as has always been the case for an executing frame). (Contributed by " "Irit Katriel in :gh:`79932`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1651 +#: ../../whatsnew/3.13.rst:1610 msgid "" "Remove the undocumented :class:`!LegacyInterpolation` class, deprecated in " "the docstring since Python 3.2, and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104886`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1658 +#: ../../whatsnew/3.13.rst:1617 msgid "importlib.metadata" msgstr "importlib.metadata" -#: ../../whatsnew/3.13.rst:1660 +#: ../../whatsnew/3.13.rst:1619 msgid "" "Remove deprecated subscript (:meth:`~object.__getitem__`) access for :ref:" "`EntryPoint ` objects. (Contributed by Jason R. Coombs in :gh:" "`113175`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1666 +#: ../../whatsnew/3.13.rst:1625 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.13.rst:1668 +#: ../../whatsnew/3.13.rst:1627 msgid "" "Remove the :func:`!locale.resetlocale` function, deprecated in Python 3.11. " "Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. (Contributed by " "Victor Stinner in :gh:`104783`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1674 +#: ../../whatsnew/3.13.rst:1633 msgid "opcode" msgstr "opcode" -#: ../../whatsnew/3.13.rst:1676 +#: ../../whatsnew/3.13.rst:1635 msgid "" "Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." "ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " @@ -2436,7 +2427,7 @@ msgid "" "Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1681 +#: ../../whatsnew/3.13.rst:1640 msgid "" "Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" "attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " @@ -2444,43 +2435,43 @@ msgid "" "be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1691 +#: ../../whatsnew/3.13.rst:1650 msgid "" "Remove the ability to use :class:`~pathlib.Path` objects as context " "managers. This functionality was deprecated and has had no effect since " "Python 3.9. (Contributed by Barney Gale in :gh:`83863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1699 +#: ../../whatsnew/3.13.rst:1658 msgid "" "Remove the undocumented, deprecated, and broken :func:`!re.template` " "function and :attr:`!re.TEMPLATE` / :attr:`!re.T` flag. (Contributed by " "Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1705 +#: ../../whatsnew/3.13.rst:1664 msgid "tkinter.tix" msgstr "tkinter.tix" -#: ../../whatsnew/3.13.rst:1707 +#: ../../whatsnew/3.13.rst:1666 msgid "" "Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The third-" "party Tix library which the module wrapped is unmaintained. (Contributed by " "Zachary Ware in :gh:`75552`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1713 +#: ../../whatsnew/3.13.rst:1672 msgid "turtle" msgstr "turtle" -#: ../../whatsnew/3.13.rst:1715 +#: ../../whatsnew/3.13.rst:1674 msgid "" "Remove the :meth:`!RawTurtle.settiltangle` method, deprecated in the " "documentation since Python 3.1 and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104876`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1724 +#: ../../whatsnew/3.13.rst:1683 msgid "" "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " "since Python 3.8. The items in those namespaces can be imported directly " @@ -2488,66 +2479,66 @@ msgid "" "`92871`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1730 +#: ../../whatsnew/3.13.rst:1689 msgid "" "Remove the keyword-argument method of creating :class:`~typing.TypedDict` " "types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" "`104786`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1736 +#: ../../whatsnew/3.13.rst:1695 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.13.rst:1738 +#: ../../whatsnew/3.13.rst:1697 msgid "" "Remove the following :mod:`unittest` functions, deprecated in Python 3.11:" msgstr "" -#: ../../whatsnew/3.13.rst:1740 +#: ../../whatsnew/3.13.rst:1699 msgid ":func:`!unittest.findTestCases`" msgstr ":func:`!unittest.findTestCases`" -#: ../../whatsnew/3.13.rst:1741 +#: ../../whatsnew/3.13.rst:1700 msgid ":func:`!unittest.makeSuite`" msgstr ":func:`!unittest.makeSuite`" -#: ../../whatsnew/3.13.rst:1742 +#: ../../whatsnew/3.13.rst:1701 msgid ":func:`!unittest.getTestCaseNames`" msgstr ":func:`!unittest.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1744 +#: ../../whatsnew/3.13.rst:1703 msgid "Use :class:`~unittest.TestLoader` methods instead:" msgstr "" -#: ../../whatsnew/3.13.rst:1746 +#: ../../whatsnew/3.13.rst:1705 msgid ":meth:`~unittest.TestLoader.loadTestsFromModule`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromModule`" -#: ../../whatsnew/3.13.rst:1747 +#: ../../whatsnew/3.13.rst:1706 msgid ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" -#: ../../whatsnew/3.13.rst:1748 +#: ../../whatsnew/3.13.rst:1707 msgid ":meth:`~unittest.TestLoader.getTestCaseNames`" msgstr ":meth:`~unittest.TestLoader.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1750 +#: ../../whatsnew/3.13.rst:1709 msgid "(Contributed by Hugo van Kemenade in :gh:`104835`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1752 +#: ../../whatsnew/3.13.rst:1711 msgid "" "Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " "deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" "`104992`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1758 +#: ../../whatsnew/3.13.rst:1717 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.13.rst:1760 +#: ../../whatsnew/3.13.rst:1719 msgid "" "Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" "`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " @@ -2558,33 +2549,33 @@ msgid "" "Victor Stinner in :gh:`105382`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1771 +#: ../../whatsnew/3.13.rst:1730 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.13.rst:1773 +#: ../../whatsnew/3.13.rst:1732 msgid "" "Remove the untested and undocumented :class:`!MacOSX` class, deprecated in " "Python 3.11. Use the :class:`!MacOSXOSAScript` class (introduced in Python " "3.2) instead. (Contributed by Hugo van Kemenade in :gh:`104804`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1778 +#: ../../whatsnew/3.13.rst:1737 msgid "" "Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use the :" "attr:`MacOSXOSAScript.name ` attribute instead. " "(Contributed by Nikita Sobolev in :gh:`105546`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1785 +#: ../../whatsnew/3.13.rst:1744 msgid "New Deprecations" msgstr "" -#: ../../whatsnew/3.13.rst:1787 +#: ../../whatsnew/3.13.rst:1746 msgid ":ref:`User-defined functions `:" msgstr "" -#: ../../whatsnew/3.13.rst:1789 +#: ../../whatsnew/3.13.rst:1748 msgid "" "Deprecate assignment to a function's :attr:`~function.__code__` attribute, " "where the new code object's type does not match the function's type. The " @@ -2592,12 +2583,12 @@ msgid "" "coroutine. (Contributed by Irit Katriel in :gh:`81137`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1795 +#: ../../whatsnew/3.13.rst:1754 #: ../../deprecations/pending-removal-in-3.16.rst:13 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../whatsnew/3.13.rst:1797 +#: ../../whatsnew/3.13.rst:1756 msgid "" "Deprecate the ``'u'`` format code (:c:type:`wchar_t`) at runtime. This " "format code has been deprecated in documentation since Python 3.3, and will " @@ -2606,50 +2597,50 @@ msgid "" "`80480`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1804 +#: ../../whatsnew/3.13.rst:1763 #: ../../deprecations/pending-removal-in-3.15.rst:4 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" -#: ../../whatsnew/3.13.rst:1806 +#: ../../whatsnew/3.13.rst:1765 msgid "" "Deprecate the undocumented :func:`!SetPointerType` function, to be removed " "in Python 3.15. (Contributed by Victor Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1810 +#: ../../whatsnew/3.13.rst:1769 msgid "" ":term:`Soft-deprecate ` the :func:`~ctypes.ARRAY` function " "in favour of ``type * length`` multiplication. (Contributed by Victor " "Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1814 +#: ../../whatsnew/3.13.rst:1773 msgid ":mod:`decimal`:" msgstr ":mod:`decimal`:" -#: ../../whatsnew/3.13.rst:1816 +#: ../../whatsnew/3.13.rst:1775 msgid "" "Deprecate the non-standard and undocumented :class:`~decimal.Decimal` format " "specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C " "implementation. (Contributed by Serhiy Storchaka in :gh:`89902`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1821 +#: ../../whatsnew/3.13.rst:1780 msgid ":mod:`dis`:" msgstr ":mod:`dis`:" -#: ../../whatsnew/3.13.rst:1823 +#: ../../whatsnew/3.13.rst:1782 msgid "" "Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership in :data:" "`~dis.hasarg` instead. (Contributed by Irit Katriel in :gh:`109319`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1827 +#: ../../whatsnew/3.13.rst:1786 msgid ":mod:`getopt` and :mod:`optparse`:" msgstr ":mod:`getopt` 和 :mod:`optparse`:" -#: ../../whatsnew/3.13.rst:1829 +#: ../../whatsnew/3.13.rst:1788 msgid "" "Both modules are now :term:`soft deprecated`, with :mod:`argparse` preferred " "for new projects. This is a new soft-deprecation for the :mod:`!getopt` " @@ -2657,22 +2648,22 @@ msgid "" "deprecated. (Contributed by Victor Stinner in :gh:`106535`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1835 +#: ../../whatsnew/3.13.rst:1794 msgid ":mod:`gettext`:" msgstr ":mod:`gettext`:" -#: ../../whatsnew/3.13.rst:1837 +#: ../../whatsnew/3.13.rst:1796 msgid "" "Deprecate non-integer numbers as arguments to functions and methods that " "consider plural forms in the :mod:`!gettext` module, even if no translation " "was found. (Contributed by Serhiy Storchaka in :gh:`88434`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1842 +#: ../../whatsnew/3.13.rst:1801 msgid ":mod:`glob`:" msgstr ":mod:`glob`:" -#: ../../whatsnew/3.13.rst:1844 +#: ../../whatsnew/3.13.rst:1803 msgid "" "Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. Use :" "func:`~glob.glob` and pass a :term:`path-like object` specifying the root " @@ -2680,12 +2671,12 @@ msgid "" "in :gh:`117337`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1849 +#: ../../whatsnew/3.13.rst:1808 #: ../../deprecations/pending-removal-in-3.15.rst:9 msgid ":mod:`http.server`:" msgstr ":mod:`http.server`:" -#: ../../whatsnew/3.13.rst:1851 +#: ../../whatsnew/3.13.rst:1810 msgid "" "Deprecate :class:`~http.server.CGIHTTPRequestHandler`, to be removed in " "Python 3.15. Process-based CGI HTTP servers have been out of favor for a " @@ -2694,30 +2685,29 @@ msgid "" "by Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1858 +#: ../../whatsnew/3.13.rst:1817 msgid "" "Deprecate the :option:`!--cgi` flag to the :program:`python -m http.server` " "command-line interface, to be removed in Python 3.15. (Contributed by " "Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1863 +#: ../../whatsnew/3.13.rst:1822 msgid ":mod:`mimetypes`:" msgstr ":mod:`mimetypes`:" -#: ../../whatsnew/3.13.rst:1865 +#: ../../whatsnew/3.13.rst:1824 msgid "" ":term:`Soft-deprecate ` file path arguments to :func:" "`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` instead. " "(Contributed by Serhiy Storchaka in :gh:`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1870 -#, fuzzy +#: ../../whatsnew/3.13.rst:1829 msgid ":mod:`re`:" -msgstr ":mod:`re`。" +msgstr ":mod:`re`:" -#: ../../whatsnew/3.13.rst:1872 +#: ../../whatsnew/3.13.rst:1831 msgid "" "Deprecate passing the optional *maxsplit*, *count*, or *flags* arguments as " "positional arguments to the module-level :func:`~re.split`, :func:`~re.sub`, " @@ -2726,46 +2716,46 @@ msgid "" "by Serhiy Storchaka in :gh:`56166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1879 -#: ../../deprecations/pending-removal-in-3.15.rst:30 +#: ../../whatsnew/3.13.rst:1838 +#: ../../deprecations/pending-removal-in-3.15.rst:33 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../whatsnew/3.13.rst:1881 +#: ../../whatsnew/3.13.rst:1840 msgid "" "Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows. (Contributed " "by Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1886 -#: ../../deprecations/pending-removal-in-3.15.rst:36 +#: ../../whatsnew/3.13.rst:1845 +#: ../../deprecations/pending-removal-in-3.15.rst:39 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../whatsnew/3.13.rst:1888 +#: ../../whatsnew/3.13.rst:1847 msgid "" "Deprecate :func:`~platform.java_ver`, to be removed in Python 3.15. This " "function is only useful for Jython support, has a confusing API, and is " "largely untested. (Contributed by Nikita Sobolev in :gh:`116349`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1894 +#: ../../whatsnew/3.13.rst:1853 msgid ":mod:`pydoc`:" msgstr ":mod:`pydoc`:" -#: ../../whatsnew/3.13.rst:1896 +#: ../../whatsnew/3.13.rst:1855 msgid "" "Deprecate the undocumented :func:`!ispackage` function. (Contributed by " "Zackery Spytz in :gh:`64020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1899 -#: ../../deprecations/pending-removal-in-3.14.rst:94 +#: ../../whatsnew/3.13.rst:1858 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../whatsnew/3.13.rst:1901 +#: ../../whatsnew/3.13.rst:1860 msgid "" "Deprecate passing more than one positional argument to the :func:`~sqlite3." "connect` function and the :class:`~sqlite3.Connection` constructor. The " @@ -2773,7 +2763,7 @@ msgid "" "by Erlend E. Aasland in :gh:`107948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1907 +#: ../../whatsnew/3.13.rst:1866 msgid "" "Deprecate passing name, number of arguments, and the callable as keyword " "arguments for :meth:`.Connection.create_function` and :meth:`.Connection." @@ -2781,7 +2771,7 @@ msgid "" "3.15. (Contributed by Erlend E. Aasland in :gh:`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1913 +#: ../../whatsnew/3.13.rst:1872 msgid "" "Deprecate passing the callback callable by keyword for the :meth:`~sqlite3." "Connection.set_authorizer`, :meth:`~sqlite3.Connection." @@ -2791,47 +2781,46 @@ msgid "" "`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1921 +#: ../../whatsnew/3.13.rst:1880 #: ../../deprecations/pending-removal-in-3.16.rst:33 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../whatsnew/3.13.rst:1923 +#: ../../whatsnew/3.13.rst:1882 msgid "" "Deprecate the :func:`~sys._enablelegacywindowsfsencoding` function, to be " "removed in Python 3.16. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable instead. (Contributed by Inada Naoki in :gh:`73427`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1928 +#: ../../whatsnew/3.13.rst:1887 #: ../../deprecations/pending-removal-in-3.16.rst:39 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../whatsnew/3.13.rst:1930 +#: ../../whatsnew/3.13.rst:1889 msgid "" "Deprecate the undocumented and unused :attr:`!TarFile.tarfile` attribute, to " "be removed in Python 3.16. (Contributed in :gh:`115256`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1934 -#, fuzzy +#: ../../whatsnew/3.13.rst:1893 msgid ":mod:`traceback`:" -msgstr ":mod:`traceback`。" +msgstr ":mod:`traceback`:" -#: ../../whatsnew/3.13.rst:1936 +#: ../../whatsnew/3.13.rst:1895 msgid "" "Deprecate the :attr:`.TracebackException.exc_type` attribute. Use :attr:`." "TracebackException.exc_type_str` instead. (Contributed by Irit Katriel in :" "gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1940 -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../whatsnew/3.13.rst:1899 +#: ../../deprecations/pending-removal-in-3.15.rst:53 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../whatsnew/3.13.rst:1942 +#: ../../whatsnew/3.13.rst:1901 msgid "" "Deprecate the undocumented keyword argument syntax for creating :class:" "`~typing.NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, " @@ -2839,7 +2828,7 @@ msgid "" "functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1949 +#: ../../whatsnew/3.13.rst:1908 msgid "" "Deprecate omitting the *fields* parameter when creating a :class:`~typing." "NamedTuple` or :class:`typing.TypedDict` class, and deprecate passing " @@ -2851,7 +2840,7 @@ msgid "" "Alex Waygood in :gh:`105566` and :gh:`105570`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1959 +#: ../../whatsnew/3.13.rst:1918 msgid "" "Deprecate the :func:`typing.no_type_check_decorator` decorator function, to " "be removed in in Python 3.15. After eight years in the :mod:`typing` module, " @@ -2859,7 +2848,7 @@ msgid "" "Waygood in :gh:`106309`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1965 +#: ../../whatsnew/3.13.rst:1924 msgid "" "Deprecate :data:`typing.AnyStr`. In Python 3.16, it will be removed from " "``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted at " @@ -2868,12 +2857,12 @@ msgid "" "(Contributed by Michael The in :gh:`107116`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1973 -#: ../../deprecations/pending-removal-in-3.15.rst:63 +#: ../../whatsnew/3.13.rst:1932 +#: ../../deprecations/pending-removal-in-3.15.rst:66 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../whatsnew/3.13.rst:1975 +#: ../../whatsnew/3.13.rst:1934 msgid "" "Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:" "`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :" @@ -2992,46 +2981,38 @@ msgstr "" "Alan Williams 於 :gh:`72346` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:50 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:55 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:62 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:64 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -3042,7 +3023,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:72 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -3059,7 +3040,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:80 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -3067,7 +3048,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -3077,23 +3058,23 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:92 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -3103,7 +3084,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -3111,7 +3092,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:105 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -3123,7 +3104,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -3131,7 +3112,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:115 +#: ../../deprecations/pending-removal-in-3.14.rst:112 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -3171,10 +3152,18 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:20 +msgid "" +":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " +"taken into consideration by the import system (:gh:`97879`)." +msgstr "" +":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " +"系統考慮。 (:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:23 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:22 +#: ../../deprecations/pending-removal-in-3.15.rst:25 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -3187,7 +3176,7 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-3.15.rst:35 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -3195,7 +3184,7 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:38 +#: ../../deprecations/pending-removal-in-3.15.rst:41 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -3204,11 +3193,11 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:45 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:47 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -3219,7 +3208,7 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:52 +#: ../../deprecations/pending-removal-in-3.15.rst:55 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -3230,7 +3219,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:58 +#: ../../deprecations/pending-removal-in-3.15.rst:61 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -3240,7 +3229,7 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:65 +#: ../../deprecations/pending-removal-in-3.15.rst:68 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -3739,11 +3728,11 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../whatsnew/3.13.rst:1992 +#: ../../whatsnew/3.13.rst:1951 msgid "CPython Bytecode Changes" msgstr "" -#: ../../whatsnew/3.13.rst:1994 +#: ../../whatsnew/3.13.rst:1953 msgid "" "The oparg of :opcode:`YIELD_VALUE` is now ``1`` if the yield is part of a " "yield-from or await, and ``0`` otherwise. The oparg of :opcode:`RESUME` was " @@ -3752,97 +3741,97 @@ msgid "" "`111354`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2002 +#: ../../whatsnew/3.13.rst:1961 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.13.rst:2007 +#: ../../whatsnew/3.13.rst:1966 msgid "" "Add the :ref:`PyMonitoring C API ` for generating :pep:" "`669` monitoring events:" msgstr "" -#: ../../whatsnew/3.13.rst:2010 +#: ../../whatsnew/3.13.rst:1969 msgid ":c:type:`PyMonitoringState`" msgstr ":c:type:`PyMonitoringState`" -#: ../../whatsnew/3.13.rst:2011 +#: ../../whatsnew/3.13.rst:1970 msgid ":c:func:`PyMonitoring_FirePyStartEvent`" msgstr ":c:func:`PyMonitoring_FirePyStartEvent`" -#: ../../whatsnew/3.13.rst:2012 +#: ../../whatsnew/3.13.rst:1971 msgid ":c:func:`PyMonitoring_FirePyResumeEvent`" msgstr ":c:func:`PyMonitoring_FirePyResumeEvent`" -#: ../../whatsnew/3.13.rst:2013 +#: ../../whatsnew/3.13.rst:1972 msgid ":c:func:`PyMonitoring_FirePyReturnEvent`" msgstr ":c:func:`PyMonitoring_FirePyReturnEvent`" -#: ../../whatsnew/3.13.rst:2014 +#: ../../whatsnew/3.13.rst:1973 msgid ":c:func:`PyMonitoring_FirePyYieldEvent`" msgstr ":c:func:`PyMonitoring_FirePyYieldEvent`" -#: ../../whatsnew/3.13.rst:2015 +#: ../../whatsnew/3.13.rst:1974 msgid ":c:func:`PyMonitoring_FireCallEvent`" msgstr ":c:func:`PyMonitoring_FireCallEvent`" -#: ../../whatsnew/3.13.rst:2016 +#: ../../whatsnew/3.13.rst:1975 msgid ":c:func:`PyMonitoring_FireLineEvent`" msgstr ":c:func:`PyMonitoring_FireLineEvent`" -#: ../../whatsnew/3.13.rst:2017 +#: ../../whatsnew/3.13.rst:1976 msgid ":c:func:`PyMonitoring_FireJumpEvent`" msgstr ":c:func:`PyMonitoring_FireJumpEvent`" -#: ../../whatsnew/3.13.rst:2018 +#: ../../whatsnew/3.13.rst:1977 msgid ":c:func:`PyMonitoring_FireBranchEvent`" msgstr ":c:func:`PyMonitoring_FireBranchEvent`" -#: ../../whatsnew/3.13.rst:2019 +#: ../../whatsnew/3.13.rst:1978 msgid ":c:func:`PyMonitoring_FireCReturnEvent`" msgstr ":c:func:`PyMonitoring_FireCReturnEvent`" -#: ../../whatsnew/3.13.rst:2020 +#: ../../whatsnew/3.13.rst:1979 msgid ":c:func:`PyMonitoring_FirePyThrowEvent`" msgstr ":c:func:`PyMonitoring_FirePyThrowEvent`" -#: ../../whatsnew/3.13.rst:2021 +#: ../../whatsnew/3.13.rst:1980 msgid ":c:func:`PyMonitoring_FireRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireRaiseEvent`" -#: ../../whatsnew/3.13.rst:2022 +#: ../../whatsnew/3.13.rst:1981 msgid ":c:func:`PyMonitoring_FireCRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireCRaiseEvent`" -#: ../../whatsnew/3.13.rst:2023 +#: ../../whatsnew/3.13.rst:1982 msgid ":c:func:`PyMonitoring_FireReraiseEvent`" msgstr ":c:func:`PyMonitoring_FireReraiseEvent`" -#: ../../whatsnew/3.13.rst:2024 +#: ../../whatsnew/3.13.rst:1983 msgid ":c:func:`PyMonitoring_FireExceptionHandledEvent`" msgstr ":c:func:`PyMonitoring_FireExceptionHandledEvent`" -#: ../../whatsnew/3.13.rst:2025 +#: ../../whatsnew/3.13.rst:1984 msgid ":c:func:`PyMonitoring_FirePyUnwindEvent`" msgstr ":c:func:`PyMonitoring_FirePyUnwindEvent`" -#: ../../whatsnew/3.13.rst:2026 +#: ../../whatsnew/3.13.rst:1985 msgid ":c:func:`PyMonitoring_FireStopIterationEvent`" msgstr ":c:func:`PyMonitoring_FireStopIterationEvent`" -#: ../../whatsnew/3.13.rst:2027 +#: ../../whatsnew/3.13.rst:1986 msgid ":c:func:`PyMonitoring_EnterScope`" msgstr ":c:func:`PyMonitoring_EnterScope`" -#: ../../whatsnew/3.13.rst:2028 +#: ../../whatsnew/3.13.rst:1987 msgid ":c:func:`PyMonitoring_ExitScope`" msgstr ":c:func:`PyMonitoring_ExitScope`" -#: ../../whatsnew/3.13.rst:2030 +#: ../../whatsnew/3.13.rst:1989 msgid "(Contributed by Irit Katriel in :gh:`111997`)." msgstr "" -#: ../../whatsnew/3.13.rst:2032 +#: ../../whatsnew/3.13.rst:1991 msgid "" "Add :c:type:`PyMutex`, a lightweight mutex that occupies a single byte, and " "the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` functions. :c:" @@ -3850,52 +3839,52 @@ msgid "" "operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2038 +#: ../../whatsnew/3.13.rst:1997 msgid "" "Add the :ref:`PyTime C API ` to provide access to system clocks:" msgstr "" -#: ../../whatsnew/3.13.rst:2040 +#: ../../whatsnew/3.13.rst:1999 msgid ":c:type:`PyTime_t`." msgstr ":c:type:`PyTime_t`。" -#: ../../whatsnew/3.13.rst:2041 +#: ../../whatsnew/3.13.rst:2000 msgid ":c:var:`PyTime_MIN` and :c:var:`PyTime_MAX`." msgstr "" -#: ../../whatsnew/3.13.rst:2042 +#: ../../whatsnew/3.13.rst:2001 msgid ":c:func:`PyTime_AsSecondsDouble`." msgstr ":c:func:`PyTime_AsSecondsDouble`。" -#: ../../whatsnew/3.13.rst:2043 +#: ../../whatsnew/3.13.rst:2002 msgid ":c:func:`PyTime_Monotonic`." msgstr ":c:func:`PyTime_Monotonic`。" -#: ../../whatsnew/3.13.rst:2044 +#: ../../whatsnew/3.13.rst:2003 msgid ":c:func:`PyTime_MonotonicRaw`." msgstr ":c:func:`PyTime_MonotonicRaw`。" -#: ../../whatsnew/3.13.rst:2045 +#: ../../whatsnew/3.13.rst:2004 msgid ":c:func:`PyTime_PerfCounter`." msgstr ":c:func:`PyTime_PerfCounter`。" -#: ../../whatsnew/3.13.rst:2046 +#: ../../whatsnew/3.13.rst:2005 msgid ":c:func:`PyTime_PerfCounterRaw`." msgstr ":c:func:`PyTime_PerfCounterRaw`。" -#: ../../whatsnew/3.13.rst:2047 +#: ../../whatsnew/3.13.rst:2006 msgid ":c:func:`PyTime_Time`." msgstr ":c:func:`PyTime_Time`。" -#: ../../whatsnew/3.13.rst:2048 +#: ../../whatsnew/3.13.rst:2007 msgid ":c:func:`PyTime_TimeRaw`." msgstr ":c:func:`PyTime_TimeRaw`。" -#: ../../whatsnew/3.13.rst:2050 +#: ../../whatsnew/3.13.rst:2009 msgid "(Contributed by Victor Stinner and Petr Viktorin in :gh:`110850`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2052 +#: ../../whatsnew/3.13.rst:2011 msgid "" "Add the :c:func:`PyDict_ContainsString` function with the same behavior as :" "c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` " @@ -3903,7 +3892,7 @@ msgid "" "by Victor Stinner in :gh:`108314`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2058 +#: ../../whatsnew/3.13.rst:2017 msgid "" "Add the :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` " "functions, which behave similarly to :c:func:`PyDict_GetItemWithError`, but " @@ -3913,7 +3902,7 @@ msgid "" "`106004`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2066 +#: ../../whatsnew/3.13.rst:2025 msgid "" "Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly to :" "c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` instead " @@ -3922,7 +3911,7 @@ msgid "" "dictionary. (Contributed by Sam Gross in :gh:`112066`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2074 +#: ../../whatsnew/3.13.rst:2033 msgid "" "Add the :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions to " "remove a key from a dictionary and optionally return the removed value. This " @@ -3931,7 +3920,7 @@ msgid "" "Victor Stinner in :gh:`111262`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2081 +#: ../../whatsnew/3.13.rst:2040 msgid "" "Add the :c:func:`PyMapping_GetOptionalItem` and :c:func:" "`PyMapping_GetOptionalItemString` functions as alternatives to :c:func:" @@ -3942,7 +3931,7 @@ msgid "" "gh:`106307`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2091 +#: ../../whatsnew/3.13.rst:2050 msgid "" "Add the :c:func:`PyObject_GetOptionalAttr` and :c:func:" "`PyObject_GetOptionalAttrString` functions as alternatives to :c:func:" @@ -3953,37 +3942,37 @@ msgid "" "Serhiy Storchaka in :gh:`106521`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2101 +#: ../../whatsnew/3.13.rst:2060 msgid "" "Add the :c:func:`PyErr_FormatUnraisable` function as an extension to :c:func:" "`PyErr_WriteUnraisable` that allows customizing the warning message. " "(Contributed by Serhiy Storchaka in :gh:`108082`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2106 +#: ../../whatsnew/3.13.rst:2065 msgid "" "Add new functions that return a :term:`strong reference` instead of a :term:" "`borrowed reference` for frame locals, globals, and builtins, as part of :" "ref:`PEP 667 `:" msgstr "" -#: ../../whatsnew/3.13.rst:2110 +#: ../../whatsnew/3.13.rst:2069 msgid ":c:func:`PyEval_GetFrameBuiltins` replaces :c:func:`PyEval_GetBuiltins`" msgstr "" -#: ../../whatsnew/3.13.rst:2111 +#: ../../whatsnew/3.13.rst:2070 msgid ":c:func:`PyEval_GetFrameGlobals` replaces :c:func:`PyEval_GetGlobals`" msgstr "" -#: ../../whatsnew/3.13.rst:2112 +#: ../../whatsnew/3.13.rst:2071 msgid ":c:func:`PyEval_GetFrameLocals` replaces :c:func:`PyEval_GetLocals`" msgstr "" -#: ../../whatsnew/3.13.rst:2114 +#: ../../whatsnew/3.13.rst:2073 msgid "(Contributed by Mark Shannon and Tian Gao in :gh:`74929`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2116 +#: ../../whatsnew/3.13.rst:2075 msgid "" "Add the :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` " "functions to get :term:`strong ` or :term:`borrowed " @@ -3992,7 +3981,7 @@ msgid "" "constant zero. (Contributed by Victor Stinner in :gh:`115754`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2123 +#: ../../whatsnew/3.13.rst:2082 msgid "" "Add the :c:func:`PyImport_AddModuleRef` function as a replacement for :c:" "func:`PyImport_AddModule` that returns a :term:`strong reference` instead of " @@ -4000,35 +3989,35 @@ msgid "" "`105922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2128 +#: ../../whatsnew/3.13.rst:2087 msgid "" "Add the :c:func:`Py_IsFinalizing` function to check whether the main Python " "interpreter is :term:`shutting down `. (Contributed by " "Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2133 +#: ../../whatsnew/3.13.rst:2092 msgid "" "Add the :c:func:`PyList_GetItemRef` function as a replacement for :c:func:" "`PyList_GetItem` that returns a :term:`strong reference` instead of a :term:" "`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2138 +#: ../../whatsnew/3.13.rst:2097 msgid "" "Add the :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions, " "mirroring the Python :meth:`!list.extend` and :meth:`!list.clear` methods. " "(Contributed by Victor Stinner in :gh:`111138`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2142 +#: ../../whatsnew/3.13.rst:2101 msgid "" "Add the :c:func:`PyLong_AsInt` function. It behaves similarly to :c:func:" "`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead of a C :" "c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2147 +#: ../../whatsnew/3.13.rst:2106 msgid "" "Add the :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes`, " "and :c:func:`PyLong_FromUnsignedNativeBytes` functions to simplify " @@ -4036,27 +4025,27 @@ msgid "" "(Contributed by Steve Dower in :gh:`111140`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2153 +#: ../../whatsnew/3.13.rst:2112 msgid "" "Add :c:func:`PyModule_Add` function, which is similar to :c:func:" "`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals " "a reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2158 +#: ../../whatsnew/3.13.rst:2117 msgid "" "Add the :c:func:`PyObject_GenericHash` function that implements the default " "hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" "`113024`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2162 +#: ../../whatsnew/3.13.rst:2121 msgid "" "Add the :c:func:`Py_HashPointer` function to hash a raw pointer. " "(Contributed by Victor Stinner in :gh:`111545`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2165 +#: ../../whatsnew/3.13.rst:2124 msgid "" "Add the :c:func:`PyObject_VisitManagedDict` and :c:func:" "`PyObject_ClearManagedDict` functions. which must be called by the traverse " @@ -4065,7 +4054,7 @@ msgid "" "with Python 3.11 and 3.12. (Contributed by Victor Stinner in :gh:`107073`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2173 +#: ../../whatsnew/3.13.rst:2132 msgid "" "Add the :c:func:`PyRefTracer_SetTracer` and :c:func:`PyRefTracer_GetTracer` " "functions, which enable tracking object creation and destruction in the same " @@ -4073,14 +4062,14 @@ msgid "" "in :gh:`93502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2179 +#: ../../whatsnew/3.13.rst:2138 msgid "" "Add the :c:func:`PySys_AuditTuple` function as an alternative to :c:func:" "`PySys_Audit` that takes event arguments as a Python :class:`tuple` object. " "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2184 +#: ../../whatsnew/3.13.rst:2143 msgid "" "Add the :c:func:`PyThreadState_GetUnchecked()` function as an alternative " "to :c:func:`PyThreadState_Get()` that doesn't kill the process with a fatal " @@ -4088,22 +4077,22 @@ msgid "" "result is ``NULL``. (Contributed by Victor Stinner in :gh:`108867`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2190 +#: ../../whatsnew/3.13.rst:2149 msgid "" "Add the :c:func:`PyType_GetFullyQualifiedName` function to get the type's " -"fully qualified name. The module name is prepended if ``type.__module__`` is " -"a string and is not equal to either ``'builtins'`` or ``'__main__'``. " -"(Contributed by Victor Stinner in :gh:`111696`.)" +"fully qualified name. The module name is prepended if :attr:`type." +"__module__` is a string and is not equal to either ``'builtins'`` or " +"``'__main__'``. (Contributed by Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2196 +#: ../../whatsnew/3.13.rst:2155 msgid "" "Add the :c:func:`PyType_GetModuleName` function to get the type's module " -"name. This is equivalent to getting the ``type.__module__`` attribute. " +"name. This is equivalent to getting the :attr:`type.__module__` attribute. " "(Contributed by Eric Snow and Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2201 +#: ../../whatsnew/3.13.rst:2160 msgid "" "Add the :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" "`PyUnicode_EqualToUTF8` functions to compare a Unicode object with a :c:expr:" @@ -4112,7 +4101,7 @@ msgid "" "Storchaka in :gh:`110289`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2208 +#: ../../whatsnew/3.13.rst:2167 msgid "" "Add the :c:func:`PyWeakref_GetRef` function as an alternative to :c:func:" "`PyWeakref_GetObject` that returns a :term:`strong reference` or ``NULL`` if " @@ -4120,47 +4109,47 @@ msgid "" "`105927`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2214 +#: ../../whatsnew/3.13.rst:2173 msgid "Add fixed variants of functions which silently ignore errors:" msgstr "" -#: ../../whatsnew/3.13.rst:2216 +#: ../../whatsnew/3.13.rst:2175 msgid "" ":c:func:`PyObject_HasAttrWithError` replaces :c:func:`PyObject_HasAttr`." msgstr "" -#: ../../whatsnew/3.13.rst:2217 +#: ../../whatsnew/3.13.rst:2176 msgid "" ":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" "`PyObject_HasAttrString`." msgstr "" -#: ../../whatsnew/3.13.rst:2219 +#: ../../whatsnew/3.13.rst:2178 msgid "" ":c:func:`PyMapping_HasKeyWithError` replaces :c:func:`PyMapping_HasKey`." msgstr "" -#: ../../whatsnew/3.13.rst:2220 +#: ../../whatsnew/3.13.rst:2179 msgid "" ":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" "`PyMapping_HasKeyString`." msgstr "" -#: ../../whatsnew/3.13.rst:2223 +#: ../../whatsnew/3.13.rst:2182 msgid "" "The new functions return ``-1`` for errors and the standard ``1`` for true " "and ``0`` for false." msgstr "" -#: ../../whatsnew/3.13.rst:2226 +#: ../../whatsnew/3.13.rst:2185 msgid "(Contributed by Serhiy Storchaka in :gh:`108511`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2230 +#: ../../whatsnew/3.13.rst:2189 msgid "Changed C APIs" msgstr "" -#: ../../whatsnew/3.13.rst:2232 +#: ../../whatsnew/3.13.rst:2191 msgid "" "The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" "func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " @@ -4173,20 +4162,20 @@ msgid "" "`65210`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2244 +#: ../../whatsnew/3.13.rst:2203 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword " "parameter names. (Contributed by Serhiy Storchaka in :gh:`110815`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2248 +#: ../../whatsnew/3.13.rst:2207 msgid "" "The :c:func:`!PyCode_GetFirstFree` function is now unstable API and is now " "named :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan " "Romanyuk in :gh:`115781`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2252 +#: ../../whatsnew/3.13.rst:2211 msgid "" "The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" "`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" @@ -4197,35 +4186,35 @@ msgid "" "documentation. (Contributed by Serhiy Storchaka in :gh:`106672`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2261 +#: ../../whatsnew/3.13.rst:2220 msgid "" "Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" "`PyUnicode_FromFormat`:" msgstr "" -#: ../../whatsnew/3.13.rst:2264 +#: ../../whatsnew/3.13.rst:2223 msgid "``%T``: Get the fully qualified name of an object type" msgstr "" -#: ../../whatsnew/3.13.rst:2265 +#: ../../whatsnew/3.13.rst:2224 msgid "``%#T``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2266 +#: ../../whatsnew/3.13.rst:2225 msgid "``%N``: Get the fully qualified name of a type" msgstr "" -#: ../../whatsnew/3.13.rst:2267 +#: ../../whatsnew/3.13.rst:2226 msgid "``%#N``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2269 +#: ../../whatsnew/3.13.rst:2228 msgid "" "See :pep:`737` for more information. (Contributed by Victor Stinner in :gh:" "`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2272 +#: ../../whatsnew/3.13.rst:2231 msgid "" "You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " "including :file:`Python.h` when using ``#`` formats in :ref:`format codes " @@ -4234,7 +4223,7 @@ msgid "" "`104922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2278 +#: ../../whatsnew/3.13.rst:2237 msgid "" "If Python is built in :ref:`debug mode ` or :option:`with " "assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" @@ -4242,60 +4231,60 @@ msgid "" "(Contributed by Victor Stinner in :gh:`106168`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2286 +#: ../../whatsnew/3.13.rst:2245 msgid "Limited C API Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2288 +#: ../../whatsnew/3.13.rst:2247 msgid "The following functions are now included in the Limited C API:" msgstr "" -#: ../../whatsnew/3.13.rst:2290 +#: ../../whatsnew/3.13.rst:2249 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../whatsnew/3.13.rst:2291 +#: ../../whatsnew/3.13.rst:2250 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../whatsnew/3.13.rst:2292 +#: ../../whatsnew/3.13.rst:2251 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../whatsnew/3.13.rst:2293 +#: ../../whatsnew/3.13.rst:2252 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../whatsnew/3.13.rst:2294 +#: ../../whatsnew/3.13.rst:2253 msgid ":c:func:`PySys_Audit`" msgstr ":c:func:`PySys_Audit`" -#: ../../whatsnew/3.13.rst:2295 +#: ../../whatsnew/3.13.rst:2254 msgid ":c:func:`PySys_AuditTuple`" msgstr ":c:func:`PySys_AuditTuple`" -#: ../../whatsnew/3.13.rst:2296 +#: ../../whatsnew/3.13.rst:2255 msgid ":c:func:`PyType_GetModuleByDef`" msgstr ":c:func:`PyType_GetModuleByDef`" -#: ../../whatsnew/3.13.rst:2298 +#: ../../whatsnew/3.13.rst:2257 msgid "" "(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, and :gh:" "`116936`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2300 +#: ../../whatsnew/3.13.rst:2259 msgid "" "Python built with :option:`--with-trace-refs` (tracing references) now " "supports the :ref:`Limited API `. (Contributed by Victor " "Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2306 +#: ../../whatsnew/3.13.rst:2265 msgid "Removed C APIs" msgstr "" -#: ../../whatsnew/3.13.rst:2308 +#: ../../whatsnew/3.13.rst:2267 msgid "" "Remove several functions, macros, variables, etc with names prefixed by " "``_Py`` or ``_PY`` (which are considered private). If your project is " @@ -4305,13 +4294,13 @@ msgid "" "Victor Stinner. (Contributed by Victor Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2316 +#: ../../whatsnew/3.13.rst:2275 msgid "" "Remove old buffer protocols deprecated in Python 3.0. Use :ref:" "`bufferobjects` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2319 +#: ../../whatsnew/3.13.rst:2278 msgid "" ":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " "test whether the object supports the buffer protocol. Note that :c:func:" @@ -4320,13 +4309,13 @@ msgid "" "example of :c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../whatsnew/3.13.rst:2327 +#: ../../whatsnew/3.13.rst:2286 msgid "" ":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: Use :c:" "func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" msgstr "" -#: ../../whatsnew/3.13.rst:2330 +#: ../../whatsnew/3.13.rst:2289 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {\n" @@ -4337,13 +4326,13 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2340 +#: ../../whatsnew/3.13.rst:2299 msgid "" ":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" "func:`PyBuffer_Release` instead:" msgstr "" -#: ../../whatsnew/3.13.rst:2343 +#: ../../whatsnew/3.13.rst:2302 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {\n" @@ -4353,21 +4342,21 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2352 +#: ../../whatsnew/3.13.rst:2311 msgid "(Contributed by Inada Naoki in :gh:`85275`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2354 +#: ../../whatsnew/3.13.rst:2313 msgid "Remove various functions deprecated in Python 3.9:" msgstr "" -#: ../../whatsnew/3.13.rst:2356 +#: ../../whatsnew/3.13.rst:2315 msgid "" ":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: Use :" "c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2361 +#: ../../whatsnew/3.13.rst:2320 msgid "" "In :c:func:`PyObject_Call`, positional arguments must be a :class:`tuple` " "and must not be ``NULL``, and keyword arguments must be a :class:`dict` or " @@ -4378,106 +4367,106 @@ msgid "" "`PyTuple_New(0) `." msgstr "" -#: ../../whatsnew/3.13.rst:2371 +#: ../../whatsnew/3.13.rst:2330 msgid "" ":c:func:`!PyEval_CallFunction`: Use :c:func:`PyObject_CallFunction` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2373 +#: ../../whatsnew/3.13.rst:2332 msgid "" ":c:func:`!PyEval_CallMethod`: Use :c:func:`PyObject_CallMethod` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2375 +#: ../../whatsnew/3.13.rst:2334 msgid ":c:func:`!PyCFunction_Call`: Use :c:func:`PyObject_Call` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2378 +#: ../../whatsnew/3.13.rst:2337 msgid "(Contributed by Victor Stinner in :gh:`105107`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2380 +#: ../../whatsnew/3.13.rst:2339 msgid "" "Remove the following old functions to configure the Python initialization, " "deprecated in Python 3.11:" msgstr "" -#: ../../whatsnew/3.13.rst:2383 +#: ../../whatsnew/3.13.rst:2342 msgid "" ":c:func:`!PySys_AddWarnOptionUnicode`: Use :c:member:`PyConfig.warnoptions` " "instead." msgstr "" -#: ../../whatsnew/3.13.rst:2385 +#: ../../whatsnew/3.13.rst:2344 msgid "" ":c:func:`!PySys_AddWarnOption`: Use :c:member:`PyConfig.warnoptions` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2387 +#: ../../whatsnew/3.13.rst:2346 msgid ":c:func:`!PySys_AddXOption`: Use :c:member:`PyConfig.xoptions` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2389 +#: ../../whatsnew/3.13.rst:2348 msgid "" ":c:func:`!PySys_HasWarnOptions`: Use :c:member:`PyConfig.xoptions` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2391 +#: ../../whatsnew/3.13.rst:2350 msgid "" ":c:func:`!PySys_SetPath`: Set :c:member:`PyConfig.module_search_paths` " "instead." msgstr "" -#: ../../whatsnew/3.13.rst:2393 +#: ../../whatsnew/3.13.rst:2352 msgid "" ":c:func:`!Py_SetPath`: Set :c:member:`PyConfig.module_search_paths` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2395 +#: ../../whatsnew/3.13.rst:2354 msgid "" ":c:func:`!Py_SetStandardStreamEncoding`: Set :c:member:`PyConfig." "stdio_encoding` instead, and set also maybe :c:member:`PyConfig." "legacy_windows_stdio` (on Windows)." msgstr "" -#: ../../whatsnew/3.13.rst:2398 +#: ../../whatsnew/3.13.rst:2357 msgid "" ":c:func:`!_Py_SetProgramFullPath`: Set :c:member:`PyConfig.executable` " "instead." msgstr "" -#: ../../whatsnew/3.13.rst:2401 +#: ../../whatsnew/3.13.rst:2360 msgid "" "Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " "Configuration ` instead (:pep:`587`), added to Python 3.8. " "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2405 +#: ../../whatsnew/3.13.rst:2364 msgid "" "Remove :c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_ReleaseLock` " "functions, deprecated in Python 3.2. They didn't update the current thread " "state. They can be replaced with:" msgstr "" -#: ../../whatsnew/3.13.rst:2410 +#: ../../whatsnew/3.13.rst:2369 msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`;" msgstr ":c:func:`PyEval_SaveThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2411 +#: ../../whatsnew/3.13.rst:2370 msgid "" "low-level :c:func:`PyEval_AcquireThread` and :c:func:`PyEval_RestoreThread`;" msgstr "" -#: ../../whatsnew/3.13.rst:2412 +#: ../../whatsnew/3.13.rst:2371 msgid "or :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`." msgstr "" -#: ../../whatsnew/3.13.rst:2414 +#: ../../whatsnew/3.13.rst:2373 msgid "(Contributed by Victor Stinner in :gh:`105182`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2416 +#: ../../whatsnew/3.13.rst:2375 msgid "" "Remove the :c:func:`!PyEval_ThreadsInitialized` function, deprecated in " "Python 3.9. Since Python 3.7, :c:func:`!Py_Initialize` always creates the " @@ -4486,7 +4475,7 @@ msgid "" "Stinner in :gh:`105182`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2423 +#: ../../whatsnew/3.13.rst:2382 msgid "" "Remove the :c:func:`!_PyInterpreterState_Get` alias to :c:func:" "`PyInterpreterState_Get()` which was kept for backward compatibility with " @@ -4495,26 +4484,26 @@ msgid "" "Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2430 +#: ../../whatsnew/3.13.rst:2389 msgid "" "Remove the private :c:func:`!_PyObject_FastCall` function: use :c:func:`!" "PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " "(Contributed by Victor Stinner in :gh:`106023`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2435 +#: ../../whatsnew/3.13.rst:2394 msgid "" "Remove the ``cpython/pytime.h`` header file, which only contained private " "functions. (Contributed by Victor Stinner in :gh:`106316`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2439 +#: ../../whatsnew/3.13.rst:2398 msgid "" "Remove the undocumented ``PY_TIMEOUT_MAX`` constant from the limited C API. " "(Contributed by Victor Stinner in :gh:`110014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2442 +#: ../../whatsnew/3.13.rst:2401 msgid "" "Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END``. Replace both with the new macros " @@ -4522,15 +4511,15 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2449 +#: ../../whatsnew/3.13.rst:2408 msgid "Deprecated C APIs" msgstr "器用的 C API" -#: ../../whatsnew/3.13.rst:2451 +#: ../../whatsnew/3.13.rst:2410 msgid "Deprecate old Python initialization functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2453 +#: ../../whatsnew/3.13.rst:2412 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" @@ -4539,32 +4528,32 @@ msgstr "" ":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" "data:`!warnings.filters`。" -#: ../../whatsnew/3.13.rst:2455 +#: ../../whatsnew/3.13.rst:2414 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../whatsnew/3.13.rst:2457 +#: ../../whatsnew/3.13.rst:2416 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../whatsnew/3.13.rst:2459 +#: ../../whatsnew/3.13.rst:2418 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../whatsnew/3.13.rst:2461 +#: ../../whatsnew/3.13.rst:2420 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2463 +#: ../../whatsnew/3.13.rst:2422 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2465 +#: ../../whatsnew/3.13.rst:2424 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" ":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" @@ -4573,32 +4562,32 @@ msgstr "" ":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" "`PYTHONHOME` 環境變數。" -#: ../../whatsnew/3.13.rst:2469 +#: ../../whatsnew/3.13.rst:2428 msgid "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2471 +#: ../../whatsnew/3.13.rst:2430 msgid "" ":term:`Soft deprecate ` the :c:func:`PyEval_GetBuiltins`, :" "c:func:`PyEval_GetGlobals`, and :c:func:`PyEval_GetLocals` functions, which " "return a :term:`borrowed reference`. (Soft deprecated as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2477 +#: ../../whatsnew/3.13.rst:2436 msgid "" "Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function, which is just " "an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " "by Victor Stinner in :gh:`105396`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2481 +#: ../../whatsnew/3.13.rst:2440 msgid "" ":term:`Soft deprecate ` the :c:func:`PyModule_AddObject` " "function. It should be replaced with :c:func:`PyModule_Add` or :c:func:" "`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2487 +#: ../../whatsnew/3.13.rst:2446 msgid "" "Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and the :c:" "macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type directly " @@ -4607,7 +4596,7 @@ msgid "" "`105156`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2494 +#: ../../whatsnew/3.13.rst:2453 msgid "" "Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" "`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`. " @@ -4968,55 +4957,55 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.13.rst:2514 +#: ../../whatsnew/3.13.rst:2473 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.13.rst:2516 +#: ../../whatsnew/3.13.rst:2475 msgid "" "``arm64-apple-ios`` and ``arm64-apple-ios-simulator`` are both now :pep:`11` " "tier 3 platforms. (:ref:`PEP 730 ` written and " "implementation contributed by Russell Keith-Magee in :gh:`114099`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2521 +#: ../../whatsnew/3.13.rst:2480 msgid "" "``aarch64-linux-android`` and ``x86_64-linux-android`` are both now :pep:" "`11` tier 3 platforms. (:ref:`PEP 738 ` " "written and implementation contributed by Malcolm Smith in :gh:`116622`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2526 +#: ../../whatsnew/3.13.rst:2485 msgid "" "``wasm32-wasi`` is now a :pep:`11` tier 2 platform. (Contributed by Brett " "Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2529 +#: ../../whatsnew/3.13.rst:2488 msgid "" "``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " "(Contributed by Brett Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2532 +#: ../../whatsnew/3.13.rst:2491 msgid "" "Building CPython now requires a compiler with support for the C11 atomic " "library, GCC built-in atomic functions, or MSVC interlocked intrinsics." msgstr "" -#: ../../whatsnew/3.13.rst:2535 +#: ../../whatsnew/3.13.rst:2494 msgid "" "Autoconf 2.71 and aclocal 1.16.4 are now required to regenerate the :file:" "`configure` script. (Contributed by Christian Heimes in :gh:`89886`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2539 +#: ../../whatsnew/3.13.rst:2498 msgid "" "SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension " "module. (Contributed by Erlend Aasland in :gh:`105875`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2543 +#: ../../whatsnew/3.13.rst:2502 msgid "" "CPython now bundles the `mimalloc library`_ by default. It is licensed under " "the MIT license; see :ref:`mimalloc license `. The bundled " @@ -5024,28 +5013,28 @@ msgid "" "Dino Viehland in :gh:`109914`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2551 +#: ../../whatsnew/3.13.rst:2510 msgid "" "The :file:`configure` option :option:`--with-system-libmpdec` now defaults " "to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python " "3.15." msgstr "" -#: ../../whatsnew/3.13.rst:2555 +#: ../../whatsnew/3.13.rst:2514 msgid "" "Python built with :file:`configure` :option:`--with-trace-refs` (tracing " "references) is now ABI compatible with the Python release build and :ref:" "`debug build `. (Contributed by Victor Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2560 +#: ../../whatsnew/3.13.rst:2519 msgid "" "On POSIX systems, the pkg-config (``.pc``) filenames now include the ABI " "flags. For example, the free-threaded build generates ``python-3.13t.pc`` " "and the debug build generates ``python-3.13d.pc``." msgstr "" -#: ../../whatsnew/3.13.rst:2564 +#: ../../whatsnew/3.13.rst:2523 msgid "" "The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " "``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." @@ -5055,27 +5044,27 @@ msgid "" "`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2573 +#: ../../whatsnew/3.13.rst:2532 msgid "Porting to Python 3.13" -msgstr "" +msgstr "移植至 Python 3.13" -#: ../../whatsnew/3.13.rst:2575 +#: ../../whatsnew/3.13.rst:2534 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.13.rst:2579 +#: ../../whatsnew/3.13.rst:2538 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.13.rst:2583 +#: ../../whatsnew/3.13.rst:2542 msgid "" ":ref:`PEP 667 ` introduces several changes to " "the semantics of :func:`locals` and :attr:`f_locals `:" msgstr "" -#: ../../whatsnew/3.13.rst:2586 +#: ../../whatsnew/3.13.rst:2545 msgid "" "Calling :func:`locals` in an :term:`optimized scope` now produces an " "independent snapshot on each call, and hence no longer implicitly updates " @@ -5087,7 +5076,7 @@ msgid "" "scope. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2595 +#: ../../whatsnew/3.13.rst:2554 msgid "" "Calling :func:`locals` from a comprehension at module or class scope " "(including via ``exec`` or ``eval``) once more behaves as if the " @@ -5097,7 +5086,7 @@ msgid "" "implementing :pep:`709`. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2602 +#: ../../whatsnew/3.13.rst:2561 msgid "" "Accessing :attr:`FrameType.f_locals ` in an :term:`optimized " "scope` now returns a write-through proxy rather than a snapshot that gets " @@ -5106,7 +5095,7 @@ msgid "" "of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2608 +#: ../../whatsnew/3.13.rst:2567 msgid "" ":class:`functools.partial` now emits a :exc:`FutureWarning` when used as a " "method. The behavior will change in future Python versions. Wrap it in :func:" @@ -5114,20 +5103,14 @@ msgid "" "Serhiy Storchaka in :gh:`121027`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2614 -msgid "" -"The :ref:`garbage collector is now incremental `, which means that the behavior of :func:`gc.collect` changes slightly:" -msgstr "" - -#: ../../whatsnew/3.13.rst:2621 +#: ../../whatsnew/3.13.rst:2573 msgid "" "An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure " "to retrieve a username, instead of :exc:`ImportError` on non-Unix platforms " "or :exc:`KeyError` on Unix platforms where the password database is empty." msgstr "" -#: ../../whatsnew/3.13.rst:2626 +#: ../../whatsnew/3.13.rst:2578 msgid "" "The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` is now a " "string (``'rb'`` or ``'wb'``) instead of an integer (``1`` or ``2``). The " @@ -5136,13 +5119,13 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2632 +#: ../../whatsnew/3.13.rst:2584 msgid "" ":class:`mailbox.Maildir` now ignores files with a leading dot (``.``). " "(Contributed by Zackery Spytz in :gh:`65559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2635 +#: ../../whatsnew/3.13.rst:2587 msgid "" ":meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both " "files and directories if a pattern that ends with \"``**``\" is given, " @@ -5150,25 +5133,25 @@ msgid "" "behavior and only match directories." msgstr "" -#: ../../whatsnew/3.13.rst:2640 +#: ../../whatsnew/3.13.rst:2592 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an :func:`!_is_main_interpreter` function. This function takes no arguments " "and returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.13.rst:2645 +#: ../../whatsnew/3.13.rst:2597 msgid "" "Any library or application that provides a custom :mod:`!_thread` module " "must provide :func:`!_is_main_interpreter`, just like the module's other " "\"private\" attributes. (:gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2652 +#: ../../whatsnew/3.13.rst:2604 msgid "Changes in the C API" -msgstr "" +msgstr "C API 中的改動" -#: ../../whatsnew/3.13.rst:2654 +#: ../../whatsnew/3.13.rst:2606 msgid "" "``Python.h`` no longer includes the ```` standard header. It was " "included for the :c:func:`!finite` function which is now provided by the " @@ -5177,7 +5160,7 @@ msgid "" "`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2660 +#: ../../whatsnew/3.13.rst:2612 msgid "" "``Python.h`` no longer includes these standard header files: ````, " "```` and ````. If needed, they should now be " @@ -5188,7 +5171,7 @@ msgid "" "Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2668 +#: ../../whatsnew/3.13.rst:2620 msgid "" "On Windows, ``Python.h`` no longer includes the ```` standard " "header file. If needed, it should now be included explicitly. For example, " @@ -5198,7 +5181,7 @@ msgid "" "(Contributed by Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2675 +#: ../../whatsnew/3.13.rst:2627 msgid "" "If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!" "Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!" @@ -5206,18 +5189,18 @@ msgid "" "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2680 +#: ../../whatsnew/3.13.rst:2632 msgid "" "The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END`` were removed. They should be replaced by the new " "macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." msgstr "" -#: ../../whatsnew/3.13.rst:2684 +#: ../../whatsnew/3.13.rst:2636 msgid "A ``tp_dealloc`` function that has the old macros, such as::" msgstr "" -#: ../../whatsnew/3.13.rst:2686 +#: ../../whatsnew/3.13.rst:2638 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5228,12 +5211,20 @@ msgid "" " Py_TRASHCAN_SAFE_END\n" "}" msgstr "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_SAFE_BEGIN(p);\n" +" ...\n" +" Py_TRASHCAN_SAFE_END\n" +"}" -#: ../../whatsnew/3.13.rst:2695 +#: ../../whatsnew/3.13.rst:2647 msgid "should migrate to the new macros as follows::" msgstr "" -#: ../../whatsnew/3.13.rst:2697 +#: ../../whatsnew/3.13.rst:2649 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5244,8 +5235,16 @@ msgid "" " Py_TRASHCAN_END\n" "}" msgstr "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_BEGIN(p, mytype_dealloc)\n" +" ...\n" +" Py_TRASHCAN_END\n" +"}" -#: ../../whatsnew/3.13.rst:2706 +#: ../../whatsnew/3.13.rst:2658 msgid "" "Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " "deallocation function it is in. The new macros were added in Python 3.8 and " @@ -5253,13 +5252,13 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2713 +#: ../../whatsnew/3.13.rst:2665 msgid "" ":ref:`PEP 667 ` introduces several changes to " "frame-related functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2716 +#: ../../whatsnew/3.13.rst:2668 msgid "" "The effects of mutating the dictionary returned from :c:func:" "`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " @@ -5273,7 +5272,7 @@ msgid "" "being used, so refer to the deprecation notice on the function for details." msgstr "" -#: ../../whatsnew/3.13.rst:2729 +#: ../../whatsnew/3.13.rst:2681 msgid "" "Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " "returns a write-through proxy rather than a snapshot that gets updated at " @@ -5282,25 +5281,25 @@ msgid "" "`PyEval_GetFrameLocals` API." msgstr "" -#: ../../whatsnew/3.13.rst:2736 +#: ../../whatsnew/3.13.rst:2688 msgid "" ":c:func:`!PyFrame_FastToLocals` and :c:func:`!PyFrame_FastToLocalsWithError` " "no longer have any effect. Calling these functions has been redundant since " "Python 3.11, when :c:func:`PyFrame_GetLocals` was first introduced." msgstr "" -#: ../../whatsnew/3.13.rst:2741 +#: ../../whatsnew/3.13.rst:2693 msgid "" ":c:func:`!PyFrame_LocalsToFast` no longer has any effect. Calling this " "function is redundant now that :c:func:`PyFrame_GetLocals` returns a write-" "through proxy for :term:`optimized scopes `." msgstr "" -#: ../../whatsnew/3.13.rst:2746 +#: ../../whatsnew/3.13.rst:2698 msgid "Regression Test Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2748 +#: ../../whatsnew/3.13.rst:2700 msgid "" "Python built with :file:`configure` :option:`--with-pydebug` now supports a :" "option:`-X presite=package.module <-X>` command-line option. If used, it " diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index 5f49805ffb..a451e0c31c 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -40,7 +40,7 @@ msgstr "" #: ../../whatsnew/3.2.rst:60 msgid ":pep:`392` - Python 3.2 Release Schedule" -msgstr "" +msgstr ":pep:`392` - Python 3.2 發佈時程" #: ../../whatsnew/3.2.rst:64 msgid "PEP 384: Defining a Stable ABI" @@ -4251,7 +4251,7 @@ msgstr "" #: ../../whatsnew/3.2.rst:2611 msgid "Porting to Python 3.2" -msgstr "" +msgstr "移植至 Python 3.2" #: ../../whatsnew/3.2.rst:2613 msgid "" diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index bba85bbba6..bd3546dee4 100644 --- a/whatsnew/3.3.po +++ b/whatsnew/3.3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,14 +27,17 @@ msgid "" "Python 3.3 was released on September 29, 2012. For full details, see the " "`changelog `_." msgstr "" +"本文介紹了 Python 3.3 與 3.2 相比多了哪些新功能。Python 3.1 已於 2012 年 9 " +"月 29 日發布。完整詳情請見 `changelog `_。" #: ../../whatsnew/3.3.rst:51 msgid ":pep:`398` - Python 3.3 Release Schedule" -msgstr ":pep:`398` - Python 3.3 發佈時間表" +msgstr ":pep:`398` - Python 3.3 發佈時程" #: ../../whatsnew/3.3.rst:55 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.3.rst:60 msgid "New syntax features:" @@ -216,7 +219,7 @@ msgid "" "dimensional NumPy-style arrays is explained." msgstr "" -#: ../../whatsnew/3.3.rst:161 ../../whatsnew/3.3.rst:1123 +#: ../../whatsnew/3.3.rst:161 ../../whatsnew/3.3.rst:1125 msgid "Features" msgstr "功能" @@ -253,7 +256,7 @@ msgid "" "now possible to reverse a memoryview in *O*\\ (1) by using a negative step." msgstr "" -#: ../../whatsnew/3.3.rst:180 ../../whatsnew/3.3.rst:1133 +#: ../../whatsnew/3.3.rst:180 ../../whatsnew/3.3.rst:1135 msgid "API changes" msgstr "API 變更" @@ -872,19 +875,19 @@ msgstr "" #: ../../whatsnew/3.3.rst:552 msgid "" -"Functions and class objects have a new ``__qualname__`` attribute " -"representing the \"path\" from the module top-level to their definition. " -"For global functions and classes, this is the same as ``__name__``. For " -"other functions and classes, it provides better information about where they " -"were actually defined, and how they might be accessible from the global " -"scope." +"Functions and class objects have a new :attr:`~definition.__qualname__` " +"attribute representing the \"path\" from the module top-level to their " +"definition. For global functions and classes, this is the same as :attr:" +"`~definition.__name__`. For other functions and classes, it provides better " +"information about where they were actually defined, and how they might be " +"accessible from the global scope." msgstr "" -#: ../../whatsnew/3.3.rst:558 +#: ../../whatsnew/3.3.rst:560 msgid "Example with (non-bound) methods::" msgstr "" -#: ../../whatsnew/3.3.rst:560 +#: ../../whatsnew/3.3.rst:562 msgid "" ">>> class C:\n" "... def meth(self):\n" @@ -904,11 +907,11 @@ msgstr "" ">>> C.meth.__qualname__\n" "'C.meth'" -#: ../../whatsnew/3.3.rst:569 +#: ../../whatsnew/3.3.rst:571 msgid "Example with nested classes::" msgstr "巢狀類別範例: ::" -#: ../../whatsnew/3.3.rst:571 +#: ../../whatsnew/3.3.rst:573 msgid "" ">>> class C:\n" "... class D:\n" @@ -938,11 +941,11 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../whatsnew/3.3.rst:585 +#: ../../whatsnew/3.3.rst:587 msgid "Example with nested functions::" msgstr "巢狀函式範例: ::" -#: ../../whatsnew/3.3.rst:587 +#: ../../whatsnew/3.3.rst:589 msgid "" ">>> def outer():\n" "... def inner():\n" @@ -964,13 +967,13 @@ msgstr "" ">>> outer().__qualname__\n" "'outer..inner'" -#: ../../whatsnew/3.3.rst:597 +#: ../../whatsnew/3.3.rst:599 msgid "" "The string representation of those objects is also changed to include the " "new, more precise information::" msgstr "" -#: ../../whatsnew/3.3.rst:600 +#: ../../whatsnew/3.3.rst:602 msgid "" ">>> str(C.D)\n" "\"\"\n" @@ -982,19 +985,19 @@ msgstr "" ">>> str(C.D.meth)\n" "''" -#: ../../whatsnew/3.3.rst:607 +#: ../../whatsnew/3.3.rst:609 msgid ":pep:`3155` - Qualified name for classes and functions" msgstr "" -#: ../../whatsnew/3.3.rst:608 +#: ../../whatsnew/3.3.rst:610 msgid "PEP written and implemented by Antoine Pitrou." msgstr "由 Antoine Pitrou 撰寫 PEP 與實作。" -#: ../../whatsnew/3.3.rst:614 +#: ../../whatsnew/3.3.rst:616 msgid "PEP 412: Key-Sharing Dictionary" msgstr "" -#: ../../whatsnew/3.3.rst:616 +#: ../../whatsnew/3.3.rst:618 msgid "" "Dictionaries used for the storage of objects' attributes are now able to " "share part of their internal storage between each other (namely, the part " @@ -1002,19 +1005,19 @@ msgid "" "consumption of programs creating many instances of non-builtin types." msgstr "" -#: ../../whatsnew/3.3.rst:623 +#: ../../whatsnew/3.3.rst:625 msgid ":pep:`412` - Key-Sharing Dictionary" msgstr ":pep:`412` - 密鑰共享字典" -#: ../../whatsnew/3.3.rst:624 +#: ../../whatsnew/3.3.rst:626 msgid "PEP written and implemented by Mark Shannon." msgstr "由 Mark Shannon 撰寫 PEP 與實作。" -#: ../../whatsnew/3.3.rst:628 +#: ../../whatsnew/3.3.rst:630 msgid "PEP 362: Function Signature Object" msgstr "PEP 362:函式簽名物件" -#: ../../whatsnew/3.3.rst:630 +#: ../../whatsnew/3.3.rst:632 msgid "" "A new function :func:`inspect.signature` makes introspection of python " "callables easy and straightforward. A broad range of callables is " @@ -1026,11 +1029,11 @@ msgid "" "code that validates or amends calling signatures or arguments." msgstr "" -#: ../../whatsnew/3.3.rst:641 +#: ../../whatsnew/3.3.rst:643 msgid ":pep:`362`: - Function Signature Object" msgstr ":pep:`362`: - 函式簽名物件" -#: ../../whatsnew/3.3.rst:642 +#: ../../whatsnew/3.3.rst:644 msgid "" "PEP written by Brett Cannon, Yury Selivanov, Larry Hastings, Jiwon Seo; " "implemented by Yury Selivanov." @@ -1038,11 +1041,11 @@ msgstr "" "PEP 由 Brett Cannon、Yury Selivanov、Larry Hastings、Jiwon Seo 撰寫;由 Yury " "Selivanov 實作。" -#: ../../whatsnew/3.3.rst:647 +#: ../../whatsnew/3.3.rst:649 msgid "PEP 421: Adding sys.implementation" msgstr "PEP 421:新增 sys.implementation" -#: ../../whatsnew/3.3.rst:649 +#: ../../whatsnew/3.3.rst:651 msgid "" "A new attribute on the :mod:`sys` module exposes details specific to the " "implementation of the currently running interpreter. The initial set of " @@ -1050,7 +1053,7 @@ msgid "" "``hexversion``, and ``cache_tag``." msgstr "" -#: ../../whatsnew/3.3.rst:654 +#: ../../whatsnew/3.3.rst:656 msgid "" "The intention of ``sys.implementation`` is to consolidate into one namespace " "the implementation-specific data used by the standard library. This allows " @@ -1060,7 +1063,7 @@ msgid "" "ratio will shift in order to make the standard library more portable." msgstr "" -#: ../../whatsnew/3.3.rst:661 +#: ../../whatsnew/3.3.rst:663 msgid "" "One example of improved standard library portability is ``cache_tag``. As " "of Python 3.3, ``sys.implementation.cache_tag`` is used by :mod:`importlib` " @@ -1069,11 +1072,11 @@ msgid "" "control the caching behavior for modules." msgstr "" -#: ../../whatsnew/3.3.rst:668 +#: ../../whatsnew/3.3.rst:670 msgid "SimpleNamespace" msgstr "SimpleNamespace" -#: ../../whatsnew/3.3.rst:670 +#: ../../whatsnew/3.3.rst:672 msgid "" "The implementation of ``sys.implementation`` also introduces a new type to " "Python: :class:`types.SimpleNamespace`. In contrast to a mapping-based " @@ -1083,19 +1086,19 @@ msgid "" "through normal attribute access." msgstr "" -#: ../../whatsnew/3.3.rst:679 +#: ../../whatsnew/3.3.rst:681 msgid ":pep:`421` - Adding sys.implementation" msgstr ":pep:`421` - 新增 sys.implementation" -#: ../../whatsnew/3.3.rst:680 +#: ../../whatsnew/3.3.rst:682 msgid "PEP written and implemented by Eric Snow." msgstr "由 Eric Snow 撰寫 PEP 與實作。" -#: ../../whatsnew/3.3.rst:686 +#: ../../whatsnew/3.3.rst:688 msgid "Using importlib as the Implementation of Import" msgstr "使用 importlib 作為 import 的實作" -#: ../../whatsnew/3.3.rst:687 +#: ../../whatsnew/3.3.rst:689 msgid "" ":issue:`2377` - Replace __import__ w/ importlib.__import__ :issue:`13959` - " "Re-implement parts of :mod:`!imp` in pure Python :issue:`14605` - Make " @@ -1103,7 +1106,7 @@ msgid "" "and __package__" msgstr "" -#: ../../whatsnew/3.3.rst:692 +#: ../../whatsnew/3.3.rst:694 msgid "" "The :func:`__import__` function is now powered by :func:`importlib." "__import__`. This work leads to the completion of \"phase 2\" of :pep:`302`. " @@ -1115,7 +1118,7 @@ msgid "" "import, allowing for future growth to occur." msgstr "" -#: ../../whatsnew/3.3.rst:701 +#: ../../whatsnew/3.3.rst:703 msgid "" "For the common user, there should be no visible change in semantics. For " "those whose code currently manipulates import or calls import " @@ -1123,18 +1126,18 @@ msgid "" "covered in the `Porting Python code`_ section of this document." msgstr "" -#: ../../whatsnew/3.3.rst:707 +#: ../../whatsnew/3.3.rst:709 msgid "New APIs" msgstr "新 API" -#: ../../whatsnew/3.3.rst:708 +#: ../../whatsnew/3.3.rst:710 msgid "" "One of the large benefits of this work is the exposure of what goes into " "making the import statement work. That means the various importers that were " "once implicit are now fully exposed as part of the :mod:`importlib` package." msgstr "" -#: ../../whatsnew/3.3.rst:712 +#: ../../whatsnew/3.3.rst:714 msgid "" "The abstract base classes defined in :mod:`importlib.abc` have been expanded " "to properly delineate between :term:`meta path finders ` " @@ -1145,14 +1148,14 @@ msgid "" "requirements." msgstr "" -#: ../../whatsnew/3.3.rst:720 +#: ../../whatsnew/3.3.rst:722 msgid "" "In terms of finders, :class:`importlib.machinery.FileFinder` exposes the " "mechanism used to search for source and bytecode files of a module. " "Previously this class was an implicit member of :data:`sys.path_hooks`." msgstr "" -#: ../../whatsnew/3.3.rst:724 +#: ../../whatsnew/3.3.rst:726 msgid "" "For loaders, the new abstract base class :class:`importlib.abc.FileLoader` " "helps write a loader that uses the file system as the storage mechanism for " @@ -1162,7 +1165,7 @@ msgid "" "ExtensionFileLoader`) are now available for direct use." msgstr "" -#: ../../whatsnew/3.3.rst:732 +#: ../../whatsnew/3.3.rst:734 msgid "" ":exc:`ImportError` now has ``name`` and ``path`` attributes which are set " "when there is relevant data to provide. The message for failed imports will " @@ -1170,24 +1173,24 @@ msgid "" "the module's name." msgstr "" -#: ../../whatsnew/3.3.rst:737 +#: ../../whatsnew/3.3.rst:739 msgid "" "The :func:`importlib.invalidate_caches` function will now call the method " "with the same name on all finders cached in :data:`sys.path_importer_cache` " "to help clean up any stored state as necessary." msgstr "" -#: ../../whatsnew/3.3.rst:742 +#: ../../whatsnew/3.3.rst:744 msgid "Visible Changes" msgstr "明顯的變更" -#: ../../whatsnew/3.3.rst:744 +#: ../../whatsnew/3.3.rst:746 msgid "" "For potential required changes to code, see the `Porting Python code`_ " "section." msgstr "" -#: ../../whatsnew/3.3.rst:747 +#: ../../whatsnew/3.3.rst:749 msgid "" "Beyond the expanse of what :mod:`importlib` now exposes, there are other " "visible changes to import. The biggest is that :data:`sys.meta_path` and :" @@ -1198,7 +1201,7 @@ msgid "" "fit one's needs." msgstr "" -#: ../../whatsnew/3.3.rst:754 +#: ../../whatsnew/3.3.rst:756 msgid "" "Another change is that all modules have a ``__loader__`` attribute, storing " "the loader used to create the module. :pep:`302` has been updated to make " @@ -1208,14 +1211,14 @@ msgid "" "load." msgstr "" -#: ../../whatsnew/3.3.rst:760 +#: ../../whatsnew/3.3.rst:762 msgid "" "Loaders are also now expected to set the ``__package__`` attribute from :pep:" "`366`. Once again, import itself is already setting this on all loaders " "from :mod:`importlib` and import itself is setting the attribute post-load." msgstr "" -#: ../../whatsnew/3.3.rst:764 +#: ../../whatsnew/3.3.rst:766 msgid "" "``None`` is now inserted into :data:`sys.path_importer_cache` when no finder " "can be found on :data:`sys.path_hooks`. Since :class:`!imp.NullImporter` is " @@ -1223,66 +1226,66 @@ msgid "" "upon to always be available to use as a value representing no finder found." msgstr "" -#: ../../whatsnew/3.3.rst:769 +#: ../../whatsnew/3.3.rst:771 msgid "" "All other changes relate to semantic changes which should be taken into " "consideration when updating code for Python 3.3, and thus should be read " "about in the `Porting Python code`_ section of this document." msgstr "" -#: ../../whatsnew/3.3.rst:773 +#: ../../whatsnew/3.3.rst:775 msgid "(Implementation by Brett Cannon)" msgstr "(由 Brett Cannon 實作)" -#: ../../whatsnew/3.3.rst:777 +#: ../../whatsnew/3.3.rst:779 msgid "Other Language Changes" msgstr "其他語言更動" -#: ../../whatsnew/3.3.rst:779 +#: ../../whatsnew/3.3.rst:781 msgid "Some smaller changes made to the core Python language are:" msgstr "對核心 Python 語言所做的一些較小的更改包括:" -#: ../../whatsnew/3.3.rst:781 +#: ../../whatsnew/3.3.rst:783 msgid "" "Added support for Unicode name aliases and named sequences. Both :func:" "`unicodedata.lookup` and ``'\\N{...}'`` now resolve name aliases, and :func:" "`unicodedata.lookup` resolves named sequences too." msgstr "" -#: ../../whatsnew/3.3.rst:785 +#: ../../whatsnew/3.3.rst:787 msgid "(Contributed by Ezio Melotti in :issue:`12753`.)" msgstr "(由 Ezio Melotti 在 :issue:`12753` 中貢獻。)" -#: ../../whatsnew/3.3.rst:787 +#: ../../whatsnew/3.3.rst:789 msgid "Unicode database updated to UCD version 6.1.0" msgstr "Unicode 資料庫更新至 UCD 版本 6.1.0" -#: ../../whatsnew/3.3.rst:789 +#: ../../whatsnew/3.3.rst:791 msgid "" "Equality comparisons on :func:`range` objects now return a result reflecting " "the equality of the underlying sequences generated by those range objects. (:" "issue:`13201`)" msgstr "" -#: ../../whatsnew/3.3.rst:793 +#: ../../whatsnew/3.3.rst:795 msgid "" "The ``count()``, ``find()``, ``rfind()``, ``index()`` and ``rindex()`` " "methods of :class:`bytes` and :class:`bytearray` objects now accept an " "integer between 0 and 255 as their first argument." msgstr "" -#: ../../whatsnew/3.3.rst:797 +#: ../../whatsnew/3.3.rst:799 msgid "(Contributed by Petri Lehtinen in :issue:`12170`.)" msgstr "(由 Petri Lehtinen 在 :issue:`12170` 中貢獻。)" -#: ../../whatsnew/3.3.rst:799 +#: ../../whatsnew/3.3.rst:801 msgid "" "The ``rjust()``, ``ljust()``, and ``center()`` methods of :class:`bytes` " "and :class:`bytearray` now accept a :class:`bytearray` for the ``fill`` " "argument. (Contributed by Petri Lehtinen in :issue:`12380`.)" msgstr "" -#: ../../whatsnew/3.3.rst:803 +#: ../../whatsnew/3.3.rst:805 msgid "" "New methods have been added to :class:`list` and :class:`bytearray`: " "``copy()`` and ``clear()`` (:issue:`10516`). Consequently, :class:" @@ -1290,40 +1293,40 @@ msgid "" "abc.MutableSequence.clear` method (:issue:`11388`)." msgstr "" -#: ../../whatsnew/3.3.rst:808 +#: ../../whatsnew/3.3.rst:810 msgid "" "Raw bytes literals can now be written ``rb\"...\"`` as well as ``br\"...\"``." msgstr "" -#: ../../whatsnew/3.3.rst:810 +#: ../../whatsnew/3.3.rst:812 msgid "(Contributed by Antoine Pitrou in :issue:`13748`.)" msgstr "(由 Antoine Pitrou 在 :issue:`13748` 中貢獻。)" -#: ../../whatsnew/3.3.rst:812 +#: ../../whatsnew/3.3.rst:814 msgid "" ":meth:`dict.setdefault` now does only one lookup for the given key, making " "it atomic when used with built-in types." msgstr "" -#: ../../whatsnew/3.3.rst:815 +#: ../../whatsnew/3.3.rst:817 msgid "(Contributed by Filip Gruszczyński in :issue:`13521`.)" msgstr "(由 Filip Gruszczyński 在 :issue:`13521` 中貢獻。)" -#: ../../whatsnew/3.3.rst:817 +#: ../../whatsnew/3.3.rst:819 msgid "" "The error messages produced when a function call does not match the function " "signature have been significantly improved." msgstr "" -#: ../../whatsnew/3.3.rst:820 +#: ../../whatsnew/3.3.rst:822 msgid "(Contributed by Benjamin Peterson.)" msgstr "(由 Benjamin Peterson 貢獻。)" -#: ../../whatsnew/3.3.rst:824 +#: ../../whatsnew/3.3.rst:826 msgid "A Finer-Grained Import Lock" msgstr "" -#: ../../whatsnew/3.3.rst:826 +#: ../../whatsnew/3.3.rst:828 msgid "" "Previous versions of CPython have always relied on a global import lock. " "This led to unexpected annoyances, such as deadlocks when importing a module " @@ -1332,7 +1335,7 @@ msgid "" "`PyImport_ImportModuleNoBlock` C API function." msgstr "" -#: ../../whatsnew/3.3.rst:832 +#: ../../whatsnew/3.3.rst:834 msgid "" "In Python 3.3, importing a module takes a per-module lock. This correctly " "serializes importation of a given module from multiple threads (preventing " @@ -1340,15 +1343,15 @@ msgid "" "aforementioned annoyances." msgstr "" -#: ../../whatsnew/3.3.rst:837 +#: ../../whatsnew/3.3.rst:839 msgid "(Contributed by Antoine Pitrou in :issue:`9260`.)" msgstr "(由 Antoine Pitrou 在 :issue:`9260` 中貢獻。)" -#: ../../whatsnew/3.3.rst:841 +#: ../../whatsnew/3.3.rst:843 msgid "Builtin functions and types" msgstr "內建函式和型別" -#: ../../whatsnew/3.3.rst:843 +#: ../../whatsnew/3.3.rst:845 msgid "" ":func:`open` gets a new *opener* parameter: the underlying file descriptor " "for the file object is then obtained by calling *opener* with (*file*, " @@ -1357,26 +1360,26 @@ msgid "" "the file already exists." msgstr "" -#: ../../whatsnew/3.3.rst:848 +#: ../../whatsnew/3.3.rst:850 msgid "" ":func:`print`: added the *flush* keyword argument. If the *flush* keyword " "argument is true, the stream is forcibly flushed." msgstr "" -#: ../../whatsnew/3.3.rst:850 +#: ../../whatsnew/3.3.rst:852 msgid "" ":func:`hash`: hash randomization is enabled by default, see :meth:`object." "__hash__` and :envvar:`PYTHONHASHSEED`." msgstr "" -#: ../../whatsnew/3.3.rst:852 +#: ../../whatsnew/3.3.rst:854 msgid "" "The :class:`str` type gets a new :meth:`~str.casefold` method: return a " "casefolded copy of the string, casefolded strings may be used for caseless " "matching. For example, ``'ß'.casefold()`` returns ``'ss'``." msgstr "" -#: ../../whatsnew/3.3.rst:855 +#: ../../whatsnew/3.3.rst:857 msgid "" "The sequence documentation has been substantially rewritten to better " "explain the binary/text sequence distinction and to provide specific " @@ -1384,15 +1387,15 @@ msgid "" "`4966`)." msgstr "" -#: ../../whatsnew/3.3.rst:862 +#: ../../whatsnew/3.3.rst:864 msgid "New Modules" msgstr "新模組" -#: ../../whatsnew/3.3.rst:865 +#: ../../whatsnew/3.3.rst:867 msgid "faulthandler" msgstr "faulthandler" -#: ../../whatsnew/3.3.rst:867 +#: ../../whatsnew/3.3.rst:869 msgid "" "This new debug module :mod:`faulthandler` contains functions to dump Python " "tracebacks explicitly, on a fault (a crash like a segmentation fault), after " @@ -1403,11 +1406,11 @@ msgid "" "by using :option:`-X` ``faulthandler`` command line option." msgstr "" -#: ../../whatsnew/3.3.rst:875 +#: ../../whatsnew/3.3.rst:877 msgid "Example of a segmentation fault on Linux:" msgstr "" -#: ../../whatsnew/3.3.rst:877 +#: ../../whatsnew/3.3.rst:879 msgid "" "$ python -q -X faulthandler\n" ">>> import ctypes\n" @@ -1431,45 +1434,45 @@ msgstr "" " File \"\", line 1 in \n" "Segmentation fault" -#: ../../whatsnew/3.3.rst:891 +#: ../../whatsnew/3.3.rst:893 msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.3.rst:893 +#: ../../whatsnew/3.3.rst:895 msgid "" "The new :mod:`ipaddress` module provides tools for creating and manipulating " "objects representing IPv4 and IPv6 addresses, networks and interfaces (i.e. " "an IP address associated with a specific IP subnet)." msgstr "" -#: ../../whatsnew/3.3.rst:897 +#: ../../whatsnew/3.3.rst:899 msgid "(Contributed by Google and Peter Moody in :pep:`3144`.)" msgstr "(由 Google 和 Peter Moody 在 :pep:`3144` 中貢獻。)" -#: ../../whatsnew/3.3.rst:900 +#: ../../whatsnew/3.3.rst:902 msgid "lzma" msgstr "lzma" -#: ../../whatsnew/3.3.rst:902 +#: ../../whatsnew/3.3.rst:904 msgid "" "The newly added :mod:`lzma` module provides data compression and " "decompression using the LZMA algorithm, including support for the ``.xz`` " "and ``.lzma`` file formats." msgstr "" -#: ../../whatsnew/3.3.rst:906 +#: ../../whatsnew/3.3.rst:908 msgid "(Contributed by Nadeem Vawda and Per Øyvind Karlsen in :issue:`6715`.)" msgstr "(由 Nadeem Vawda 和 Per Øyvind Karlsen 在 :issue:`6715` 中貢獻。)" -#: ../../whatsnew/3.3.rst:910 +#: ../../whatsnew/3.3.rst:912 msgid "Improved Modules" msgstr "改進的模組" -#: ../../whatsnew/3.3.rst:913 +#: ../../whatsnew/3.3.rst:915 msgid "abc" msgstr "abc" -#: ../../whatsnew/3.3.rst:915 +#: ../../whatsnew/3.3.rst:917 msgid "" "Improved support for abstract base classes containing descriptors composed " "with abstract methods. The recommended approach to declaring abstract " @@ -1477,7 +1480,7 @@ msgid "" "updated property. The built-in descriptors have been updated accordingly." msgstr "" -#: ../../whatsnew/3.3.rst:920 ../../whatsnew/3.3.rst:2246 +#: ../../whatsnew/3.3.rst:922 ../../whatsnew/3.3.rst:2248 msgid "" ":class:`abc.abstractproperty` has been deprecated, use :class:`property` " "with :func:`abc.abstractmethod` instead." @@ -1485,7 +1488,7 @@ msgstr "" ":class:`abc.abstractproperty` 已被棄用,請改 :class:`property` 和 :func:`abc." "abstractmethod`。" -#: ../../whatsnew/3.3.rst:922 ../../whatsnew/3.3.rst:2248 +#: ../../whatsnew/3.3.rst:924 ../../whatsnew/3.3.rst:2250 msgid "" ":class:`abc.abstractclassmethod` has been deprecated, use :class:" "`classmethod` with :func:`abc.abstractmethod` instead." @@ -1493,7 +1496,7 @@ msgstr "" ":class:`abc.abstractclassmethod` 已被棄用,請改用 :class:`classmethod` 和 :" "func:`abc.abstractmethod`。" -#: ../../whatsnew/3.3.rst:924 ../../whatsnew/3.3.rst:2250 +#: ../../whatsnew/3.3.rst:926 ../../whatsnew/3.3.rst:2252 msgid "" ":class:`abc.abstractstaticmethod` has been deprecated, use :class:" "`staticmethod` with :func:`abc.abstractmethod` instead." @@ -1501,35 +1504,35 @@ msgstr "" ":class:`abc.abstractstaticmethod` 已被棄用,請改用 :class:`staticmethod` 和 :" "func:`abc.abstractmethod`。" -#: ../../whatsnew/3.3.rst:927 +#: ../../whatsnew/3.3.rst:929 msgid "(Contributed by Darren Dale in :issue:`11610`.)" msgstr "(由 Darren Dale 在 :issue:`11610` 中貢獻。)" -#: ../../whatsnew/3.3.rst:929 +#: ../../whatsnew/3.3.rst:931 msgid "" ":meth:`abc.ABCMeta.register` now returns the registered subclass, which " "means it can now be used as a class decorator (:issue:`10868`)." msgstr "" -#: ../../whatsnew/3.3.rst:934 +#: ../../whatsnew/3.3.rst:936 msgid "array" msgstr "array" -#: ../../whatsnew/3.3.rst:936 +#: ../../whatsnew/3.3.rst:938 msgid "" "The :mod:`array` module supports the :c:expr:`long long` type using ``q`` " "and ``Q`` type codes." msgstr "" -#: ../../whatsnew/3.3.rst:939 +#: ../../whatsnew/3.3.rst:941 msgid "(Contributed by Oren Tirosh and Hirokazu Yamamoto in :issue:`1172711`.)" msgstr "(由 Oren Tirosh 和 Hirokazu Yamamoto 在 :issue:`1172711` 中貢獻。)" -#: ../../whatsnew/3.3.rst:943 +#: ../../whatsnew/3.3.rst:945 msgid "base64" msgstr "base64" -#: ../../whatsnew/3.3.rst:945 +#: ../../whatsnew/3.3.rst:947 msgid "" "ASCII-only Unicode strings are now accepted by the decoding functions of " "the :mod:`base64` modern interface. For example, ``base64." @@ -1537,44 +1540,44 @@ msgid "" "issue:`13641`.)" msgstr "" -#: ../../whatsnew/3.3.rst:951 +#: ../../whatsnew/3.3.rst:953 msgid "binascii" msgstr "binascii" -#: ../../whatsnew/3.3.rst:953 +#: ../../whatsnew/3.3.rst:955 msgid "" "In addition to the binary objects they normally accept, the ``a2b_`` " "functions now all also accept ASCII-only strings as input. (Contributed by " "Antoine Pitrou in :issue:`13637`.)" msgstr "" -#: ../../whatsnew/3.3.rst:959 +#: ../../whatsnew/3.3.rst:961 msgid "bz2" msgstr "bz2" -#: ../../whatsnew/3.3.rst:961 +#: ../../whatsnew/3.3.rst:963 msgid "" "The :mod:`bz2` module has been rewritten from scratch. In the process, " "several new features have been added:" msgstr "" -#: ../../whatsnew/3.3.rst:964 +#: ../../whatsnew/3.3.rst:966 msgid "" "New :func:`bz2.open` function: open a bzip2-compressed file in binary or " "text mode." msgstr "" -#: ../../whatsnew/3.3.rst:967 +#: ../../whatsnew/3.3.rst:969 msgid "" ":class:`bz2.BZ2File` can now read from and write to arbitrary file-like " "objects, by means of its constructor's *fileobj* argument." msgstr "" -#: ../../whatsnew/3.3.rst:970 +#: ../../whatsnew/3.3.rst:972 msgid "(Contributed by Nadeem Vawda in :issue:`5863`.)" msgstr "(由 Nadeem Vawda 在 :issue:`5863` 中貢獻。)" -#: ../../whatsnew/3.3.rst:972 +#: ../../whatsnew/3.3.rst:974 msgid "" ":class:`bz2.BZ2File` and :func:`bz2.decompress` can now decompress multi-" "stream inputs (such as those produced by the :program:`pbzip2` tool). :class:" @@ -1582,21 +1585,21 @@ msgid "" "``'a'`` (append) mode." msgstr "" -#: ../../whatsnew/3.3.rst:977 +#: ../../whatsnew/3.3.rst:979 msgid "(Contributed by Nir Aides in :issue:`1625`.)" msgstr "(由 Nir Aides 在 :issue:`1625` 中貢獻。)" -#: ../../whatsnew/3.3.rst:979 +#: ../../whatsnew/3.3.rst:981 msgid "" ":class:`bz2.BZ2File` now implements all of the :class:`io.BufferedIOBase` " "API, except for the :meth:`detach` and :meth:`truncate` methods." msgstr "" -#: ../../whatsnew/3.3.rst:984 +#: ../../whatsnew/3.3.rst:986 msgid "codecs" msgstr "codecs" -#: ../../whatsnew/3.3.rst:986 +#: ../../whatsnew/3.3.rst:988 msgid "" "The :mod:`~encodings.mbcs` codec has been rewritten to handle correctly " "``replace`` and ``ignore`` error handlers on all Windows versions. The :mod:" @@ -1604,7 +1607,7 @@ msgid "" "``replace`` to encode and ``ignore`` to decode." msgstr "" -#: ../../whatsnew/3.3.rst:991 +#: ../../whatsnew/3.3.rst:993 msgid "" "A new Windows-only codec has been added: ``cp65001`` (:issue:`13216`). It is " "the Windows code page 65001 (Windows UTF-8, ``CP_UTF8``). For example, it " @@ -1612,7 +1615,7 @@ msgid "" "(e.g., using ``chcp 65001`` command)." msgstr "" -#: ../../whatsnew/3.3.rst:996 +#: ../../whatsnew/3.3.rst:998 msgid "" "Multibyte CJK decoders now resynchronize faster. They only ignore the first " "byte of an invalid byte sequence. For example, ``b'\\xff\\n'." @@ -1620,17 +1623,17 @@ msgid "" "character." msgstr "" -#: ../../whatsnew/3.3.rst:1000 +#: ../../whatsnew/3.3.rst:1002 msgid "(:issue:`12016`)" msgstr "(:issue:`12016`)" -#: ../../whatsnew/3.3.rst:1002 +#: ../../whatsnew/3.3.rst:1004 msgid "" "Incremental CJK codec encoders are no longer reset at each call to their " "encode() methods. For example::" msgstr "" -#: ../../whatsnew/3.3.rst:1005 +#: ../../whatsnew/3.3.rst:1007 msgid "" ">>> import codecs\n" ">>> encoder = codecs.getincrementalencoder('hz')('strict')\n" @@ -1644,32 +1647,32 @@ msgstr "" "Bye.')\n" "b'~{NpJ)l6HK!#~} Bye.'" -#: ../../whatsnew/3.3.rst:1010 +#: ../../whatsnew/3.3.rst:1012 msgid "" "This example gives ``b'~{Np~}~{J)~}~{l6~}~{HK~}~{!#~} Bye.'`` with older " "Python versions." msgstr "" -#: ../../whatsnew/3.3.rst:1013 +#: ../../whatsnew/3.3.rst:1015 msgid "(:issue:`12100`)" msgstr "(:issue:`12100`)" -#: ../../whatsnew/3.3.rst:1015 +#: ../../whatsnew/3.3.rst:1017 msgid "The ``unicode_internal`` codec has been deprecated." msgstr "``unicode_internal`` 編解碼器已被棄用。" -#: ../../whatsnew/3.3.rst:1019 +#: ../../whatsnew/3.3.rst:1021 msgid "collections" msgstr "collections" -#: ../../whatsnew/3.3.rst:1021 +#: ../../whatsnew/3.3.rst:1023 msgid "" "Addition of a new :class:`~collections.ChainMap` class to allow treating a " "number of mappings as a single unit. (Written by Raymond Hettinger for :" "issue:`11089`, made public in :issue:`11297`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1025 +#: ../../whatsnew/3.3.rst:1027 msgid "" "The abstract base classes have been moved in a new :mod:`collections.abc` " "module, to better differentiate between the abstract and the concrete " @@ -1677,18 +1680,18 @@ msgid "" "`collections` module to preserve existing imports. (:issue:`11085`)" msgstr "" -#: ../../whatsnew/3.3.rst:1032 +#: ../../whatsnew/3.3.rst:1034 msgid "" "The :class:`~collections.Counter` class now supports the unary ``+`` and ``-" "`` operators, as well as the in-place operators ``+=``, ``-=``, ``|=``, and " "``&=``. (Contributed by Raymond Hettinger in :issue:`13121`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1038 +#: ../../whatsnew/3.3.rst:1040 msgid "contextlib" msgstr "contextlib" -#: ../../whatsnew/3.3.rst:1040 +#: ../../whatsnew/3.3.rst:1042 msgid "" ":class:`~contextlib.ExitStack` now provides a solid foundation for " "programmatic manipulation of context managers and similar cleanup " @@ -1700,46 +1703,46 @@ msgid "" "module)." msgstr "" -#: ../../whatsnew/3.3.rst:1049 +#: ../../whatsnew/3.3.rst:1051 msgid "(:issue:`13585`)" msgstr "(:issue:`13585`)" -#: ../../whatsnew/3.3.rst:1053 +#: ../../whatsnew/3.3.rst:1055 msgid "crypt" msgstr "crypt" -#: ../../whatsnew/3.3.rst:1055 +#: ../../whatsnew/3.3.rst:1057 msgid "" "Addition of salt and modular crypt format (hashing method) and the :func:`!" "mksalt` function to the :mod:`!crypt` module." msgstr "" -#: ../../whatsnew/3.3.rst:1058 +#: ../../whatsnew/3.3.rst:1060 msgid "(:issue:`10924`)" msgstr "(:issue:`10924`)" -#: ../../whatsnew/3.3.rst:1061 +#: ../../whatsnew/3.3.rst:1063 msgid "curses" msgstr "curses" -#: ../../whatsnew/3.3.rst:1063 +#: ../../whatsnew/3.3.rst:1065 msgid "" "If the :mod:`curses` module is linked to the ncursesw library, use Unicode " "functions when Unicode strings or characters are passed (e.g. :c:func:" "`waddwstr`), and bytes functions otherwise (e.g. :c:func:`waddstr`)." msgstr "" -#: ../../whatsnew/3.3.rst:1066 +#: ../../whatsnew/3.3.rst:1068 msgid "Use the locale encoding instead of ``utf-8`` to encode Unicode strings." msgstr "" -#: ../../whatsnew/3.3.rst:1067 +#: ../../whatsnew/3.3.rst:1069 msgid "" ":class:`curses.window` has a new :attr:`curses.window.encoding` attribute." msgstr "" ":class:`curses.window` 有一個新的 :attr:`curses.window.encoding` 屬性。" -#: ../../whatsnew/3.3.rst:1068 +#: ../../whatsnew/3.3.rst:1070 msgid "" "The :class:`curses.window` class has a new :meth:`~curses.window.get_wch` " "method to get a wide character" @@ -1747,59 +1750,59 @@ msgstr "" ":class:`curses.window` 類別有一個新的 :meth:`~curses.window.get_wch` 方法來獲" "取寬字元" -#: ../../whatsnew/3.3.rst:1070 +#: ../../whatsnew/3.3.rst:1072 msgid "" "The :mod:`curses` module has a new :meth:`~curses.unget_wch` function to " "push a wide character so the next :meth:`~curses.window.get_wch` will return " "it" msgstr "" -#: ../../whatsnew/3.3.rst:1074 +#: ../../whatsnew/3.3.rst:1076 msgid "(Contributed by Iñigo Serna in :issue:`6755`.)" msgstr "(由 Iñigo Serna 在 :issue:`6755` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1077 +#: ../../whatsnew/3.3.rst:1079 msgid "datetime" msgstr "datetime" -#: ../../whatsnew/3.3.rst:1079 +#: ../../whatsnew/3.3.rst:1081 msgid "" "Equality comparisons between naive and aware :class:`~datetime.datetime` " "instances now return :const:`False` instead of raising :exc:`TypeError` (:" "issue:`15006`)." msgstr "" -#: ../../whatsnew/3.3.rst:1082 +#: ../../whatsnew/3.3.rst:1084 msgid "" "New :meth:`datetime.datetime.timestamp` method: Return POSIX timestamp " "corresponding to the :class:`~datetime.datetime` instance." msgstr "" -#: ../../whatsnew/3.3.rst:1084 +#: ../../whatsnew/3.3.rst:1086 msgid "" "The :meth:`datetime.datetime.strftime` method supports formatting years " "older than 1000." msgstr "" -#: ../../whatsnew/3.3.rst:1086 +#: ../../whatsnew/3.3.rst:1088 msgid "" "The :meth:`datetime.datetime.astimezone` method can now be called without " "arguments to convert datetime instance to the system timezone." msgstr "" -#: ../../whatsnew/3.3.rst:1094 +#: ../../whatsnew/3.3.rst:1096 msgid "decimal" msgstr "decimal" -#: ../../whatsnew/3.3.rst:1096 +#: ../../whatsnew/3.3.rst:1098 msgid ":issue:`7652` - integrate fast native decimal arithmetic." msgstr "" -#: ../../whatsnew/3.3.rst:1097 +#: ../../whatsnew/3.3.rst:1099 msgid "C-module and libmpdec written by Stefan Krah." msgstr "由 Stefan Krah 編寫的 C 模組和 libmpdec。" -#: ../../whatsnew/3.3.rst:1099 +#: ../../whatsnew/3.3.rst:1101 msgid "" "The new C version of the decimal module integrates the high speed libmpdec " "library for arbitrary precision correctly rounded decimal floating-point " @@ -1807,7 +1810,7 @@ msgid "" "Specification." msgstr "" -#: ../../whatsnew/3.3.rst:1103 +#: ../../whatsnew/3.3.rst:1105 msgid "" "Performance gains range from 10x for database applications to 100x for " "numerically intensive applications. These numbers are expected gains for " @@ -1816,128 +1819,128 @@ msgid "" "integer bignum arithmetic the differences can be significantly higher." msgstr "" -#: ../../whatsnew/3.3.rst:1109 +#: ../../whatsnew/3.3.rst:1111 msgid "" "The following table is meant as an illustration. Benchmarks are available at " "https://www.bytereef.org/mpdecimal/quickstart.html." msgstr "" -#: ../../whatsnew/3.3.rst:1113 +#: ../../whatsnew/3.3.rst:1115 msgid "decimal.py" msgstr "decimal.py" -#: ../../whatsnew/3.3.rst:1113 +#: ../../whatsnew/3.3.rst:1115 msgid "_decimal" msgstr "_decimal" -#: ../../whatsnew/3.3.rst:1113 +#: ../../whatsnew/3.3.rst:1115 msgid "speedup" msgstr "speedup" -#: ../../whatsnew/3.3.rst:1115 +#: ../../whatsnew/3.3.rst:1117 msgid "pi" msgstr "pi" -#: ../../whatsnew/3.3.rst:1115 +#: ../../whatsnew/3.3.rst:1117 msgid "42.02s" msgstr "42.02s" -#: ../../whatsnew/3.3.rst:1115 +#: ../../whatsnew/3.3.rst:1117 msgid "0.345s" msgstr "0.345s" -#: ../../whatsnew/3.3.rst:1115 +#: ../../whatsnew/3.3.rst:1117 msgid "120x" msgstr "120x" -#: ../../whatsnew/3.3.rst:1117 +#: ../../whatsnew/3.3.rst:1119 msgid "telco" msgstr "telco" -#: ../../whatsnew/3.3.rst:1117 +#: ../../whatsnew/3.3.rst:1119 msgid "172.19s" msgstr "172.19s" -#: ../../whatsnew/3.3.rst:1117 +#: ../../whatsnew/3.3.rst:1119 msgid "5.68s" msgstr "5.68s" -#: ../../whatsnew/3.3.rst:1117 +#: ../../whatsnew/3.3.rst:1119 msgid "30x" msgstr "30x" -#: ../../whatsnew/3.3.rst:1119 +#: ../../whatsnew/3.3.rst:1121 msgid "psycopg" msgstr "psycopg" -#: ../../whatsnew/3.3.rst:1119 +#: ../../whatsnew/3.3.rst:1121 msgid "3.57s" msgstr "3.57s" -#: ../../whatsnew/3.3.rst:1119 +#: ../../whatsnew/3.3.rst:1121 msgid "0.29s" msgstr "0.29s" -#: ../../whatsnew/3.3.rst:1119 +#: ../../whatsnew/3.3.rst:1121 msgid "12x" msgstr "12x" -#: ../../whatsnew/3.3.rst:1125 +#: ../../whatsnew/3.3.rst:1127 msgid "" "The :exc:`~decimal.FloatOperation` signal optionally enables stricter " "semantics for mixing floats and Decimals." msgstr "" -#: ../../whatsnew/3.3.rst:1128 +#: ../../whatsnew/3.3.rst:1130 msgid "" "If Python is compiled without threads, the C version automatically disables " "the expensive thread local context machinery. In this case, the variable :" "const:`~decimal.HAVE_THREADS` is set to ``False``." msgstr "" -#: ../../whatsnew/3.3.rst:1135 +#: ../../whatsnew/3.3.rst:1137 msgid "" "The C module has the following context limits, depending on the machine " "architecture:" msgstr "" -#: ../../whatsnew/3.3.rst:1139 +#: ../../whatsnew/3.3.rst:1141 msgid "32-bit" msgstr "32 位元" -#: ../../whatsnew/3.3.rst:1139 +#: ../../whatsnew/3.3.rst:1141 msgid "64-bit" msgstr "64 位元" -#: ../../whatsnew/3.3.rst:1141 +#: ../../whatsnew/3.3.rst:1143 msgid ":const:`MAX_PREC`" msgstr ":const:`MAX_PREC`" -#: ../../whatsnew/3.3.rst:1141 ../../whatsnew/3.3.rst:1143 +#: ../../whatsnew/3.3.rst:1143 ../../whatsnew/3.3.rst:1145 msgid "``425000000``" msgstr "``425000000``" -#: ../../whatsnew/3.3.rst:1141 ../../whatsnew/3.3.rst:1143 +#: ../../whatsnew/3.3.rst:1143 ../../whatsnew/3.3.rst:1145 msgid "``999999999999999999``" msgstr "``999999999999999999``" -#: ../../whatsnew/3.3.rst:1143 +#: ../../whatsnew/3.3.rst:1145 msgid ":const:`MAX_EMAX`" msgstr ":const:`MAX_EMAX`" -#: ../../whatsnew/3.3.rst:1145 +#: ../../whatsnew/3.3.rst:1147 msgid ":const:`MIN_EMIN`" msgstr ":const:`MIN_EMIN`" -#: ../../whatsnew/3.3.rst:1145 +#: ../../whatsnew/3.3.rst:1147 msgid "``-425000000``" msgstr "``-425000000``" -#: ../../whatsnew/3.3.rst:1145 +#: ../../whatsnew/3.3.rst:1147 msgid "``-999999999999999999``" msgstr "``-999999999999999999``" -#: ../../whatsnew/3.3.rst:1148 +#: ../../whatsnew/3.3.rst:1150 msgid "" "In the context templates (:class:`~decimal.DefaultContext`, :class:`~decimal." "BasicContext` and :class:`~decimal.ExtendedContext`) the magnitude of :attr:" @@ -1945,7 +1948,7 @@ msgid "" "``999999``." msgstr "" -#: ../../whatsnew/3.3.rst:1153 +#: ../../whatsnew/3.3.rst:1155 msgid "" "The :class:`~decimal.Decimal` constructor in decimal.py does not observe the " "context limits and converts values with arbitrary exponents or precision " @@ -1956,7 +1959,7 @@ msgid "" "obtain a rounded or inexact value." msgstr "" -#: ../../whatsnew/3.3.rst:1162 +#: ../../whatsnew/3.3.rst:1164 msgid "" "The power function in decimal.py is always correctly rounded. In the C " "version, it is defined in terms of the correctly rounded :meth:`~decimal." @@ -1964,7 +1967,7 @@ msgid "" "is only \"almost always correctly rounded\"." msgstr "" -#: ../../whatsnew/3.3.rst:1168 +#: ../../whatsnew/3.3.rst:1170 msgid "" "In the C version, the context dictionary containing the signals is a :class:" "`~collections.abc.MutableMapping`. For speed reasons, :attr:`~decimal." @@ -1975,33 +1978,33 @@ msgid "" "do not reference the RHS dictionary." msgstr "" -#: ../../whatsnew/3.3.rst:1178 +#: ../../whatsnew/3.3.rst:1180 msgid "" "Pickling a :class:`~decimal.Context` produces a different output in order to " "have a common interchange format for the Python and C versions." msgstr "" -#: ../../whatsnew/3.3.rst:1182 +#: ../../whatsnew/3.3.rst:1184 msgid "" "The order of arguments in the :class:`~decimal.Context` constructor has been " "changed to match the order displayed by :func:`repr`." msgstr "" -#: ../../whatsnew/3.3.rst:1186 +#: ../../whatsnew/3.3.rst:1188 msgid "" "The ``watchexp`` parameter in the :meth:`~decimal.Decimal.quantize` method " "is deprecated." msgstr ":meth:`~decimal.Decimal.quantize` 方法中的 ``watchexp`` 參數已棄用。" -#: ../../whatsnew/3.3.rst:1193 +#: ../../whatsnew/3.3.rst:1195 msgid "email" msgstr "email" -#: ../../whatsnew/3.3.rst:1196 +#: ../../whatsnew/3.3.rst:1198 msgid "Policy Framework" msgstr "" -#: ../../whatsnew/3.3.rst:1198 +#: ../../whatsnew/3.3.rst:1200 msgid "" "The email package now has a :mod:`~email.policy` framework. A :class:" "`~email.policy.Policy` is an object with several methods and properties that " @@ -2017,52 +2020,52 @@ msgid "" "data:`~email.policy.compat32`." msgstr "" -#: ../../whatsnew/3.3.rst:1211 +#: ../../whatsnew/3.3.rst:1213 msgid "The minimum set of controls implemented by all ``policy`` objects are:" msgstr "" -#: ../../whatsnew/3.3.rst:1216 +#: ../../whatsnew/3.3.rst:1218 msgid "max_line_length" msgstr "max_line_length" -#: ../../whatsnew/3.3.rst:1216 +#: ../../whatsnew/3.3.rst:1218 msgid "" "The maximum length, excluding the linesep character(s), individual lines may " "have when a ``Message`` is serialized. Defaults to 78." msgstr "" -#: ../../whatsnew/3.3.rst:1220 +#: ../../whatsnew/3.3.rst:1222 msgid "linesep" msgstr "linesep" -#: ../../whatsnew/3.3.rst:1220 +#: ../../whatsnew/3.3.rst:1222 msgid "" "The character used to separate individual lines when a ``Message`` is " "serialized. Defaults to ``\\n``." msgstr "" -#: ../../whatsnew/3.3.rst:1223 +#: ../../whatsnew/3.3.rst:1225 msgid "cte_type" msgstr "cte_type" -#: ../../whatsnew/3.3.rst:1223 +#: ../../whatsnew/3.3.rst:1225 msgid "" "``7bit`` or ``8bit``. ``8bit`` applies only to a ``Bytes`` ``generator``, " "and means that non-ASCII may be used where allowed by the protocol (or where " "it exists in the original input)." msgstr "" -#: ../../whatsnew/3.3.rst:1228 +#: ../../whatsnew/3.3.rst:1230 msgid "raise_on_defect" msgstr "raise_on_defect" -#: ../../whatsnew/3.3.rst:1228 +#: ../../whatsnew/3.3.rst:1230 msgid "" "Causes a ``parser`` to raise error when defects are encountered instead of " "adding them to the ``Message`` object's ``defects`` list." msgstr "" -#: ../../whatsnew/3.3.rst:1233 +#: ../../whatsnew/3.3.rst:1235 msgid "" "A new policy instance, with new settings, is created using the :meth:`~email." "policy.Policy.clone` method of policy objects. ``clone`` takes any of the " @@ -2071,11 +2074,11 @@ msgid "" "``\\r\\n`` linesep characters like this::" msgstr "" -#: ../../whatsnew/3.3.rst:1239 +#: ../../whatsnew/3.3.rst:1241 msgid "mypolicy = compat32.clone(linesep='\\r\\n')" msgstr "mypolicy = compat32.clone(linesep='\\r\\n')" -#: ../../whatsnew/3.3.rst:1241 +#: ../../whatsnew/3.3.rst:1243 msgid "" "Policies can be used to make the generation of messages in the format needed " "by your application simpler. Instead of having to remember to specify " @@ -2088,11 +2091,11 @@ msgid "" "when you create the ``generator``." msgstr "" -#: ../../whatsnew/3.3.rst:1253 +#: ../../whatsnew/3.3.rst:1255 msgid "Provisional Policy with New Header API" msgstr "" -#: ../../whatsnew/3.3.rst:1255 +#: ../../whatsnew/3.3.rst:1257 msgid "" "While the policy framework is worthwhile all by itself, the main motivation " "for introducing it is to allow the creation of new policies that implement " @@ -2104,17 +2107,17 @@ msgid "" "the core developers." msgstr "" -#: ../../whatsnew/3.3.rst:1263 +#: ../../whatsnew/3.3.rst:1265 msgid "" "The new policies are instances of :class:`~email.policy.EmailPolicy`, and " "add the following additional controls:" msgstr "" -#: ../../whatsnew/3.3.rst:1269 +#: ../../whatsnew/3.3.rst:1271 msgid "refold_source" msgstr "refold_source" -#: ../../whatsnew/3.3.rst:1269 +#: ../../whatsnew/3.3.rst:1271 msgid "" "Controls whether or not headers parsed by a :mod:`~email.parser` are " "refolded by the :mod:`~email.generator`. It can be ``none``, ``long``, or " @@ -2123,17 +2126,17 @@ msgid "" "get refolded, and ``all`` means that all lines get refolded." msgstr "" -#: ../../whatsnew/3.3.rst:1278 +#: ../../whatsnew/3.3.rst:1280 msgid "header_factory" msgstr "header_factory" -#: ../../whatsnew/3.3.rst:1278 +#: ../../whatsnew/3.3.rst:1280 msgid "" "A callable that take a ``name`` and ``value`` and produces a custom header " "object." msgstr "" -#: ../../whatsnew/3.3.rst:1282 +#: ../../whatsnew/3.3.rst:1284 msgid "" "The ``header_factory`` is the key to the new features provided by the new " "policies. When one of the new policies is used, any header retrieved from a " @@ -2145,7 +2148,7 @@ msgid "" "now do things like this::" msgstr "" -#: ../../whatsnew/3.3.rst:1291 +#: ../../whatsnew/3.3.rst:1293 msgid "" ">>> m = Message(policy=SMTP)\n" ">>> m['To'] = 'Éric '\n" @@ -2187,7 +2190,7 @@ msgstr "" "To: =?utf-8?q?=C3=89ric?= \n" "Date: Fri, 25 May 2012 21:44:27 -0400" -#: ../../whatsnew/3.3.rst:1310 +#: ../../whatsnew/3.3.rst:1312 msgid "" "You will note that the unicode display name is automatically encoded as " "``utf-8`` when the message is serialized, but that when the header is " @@ -2196,11 +2199,11 @@ msgid "" "meth:`~email.header.make_header` functions." msgstr "" -#: ../../whatsnew/3.3.rst:1316 +#: ../../whatsnew/3.3.rst:1318 msgid "You can also create addresses from parts::" msgstr "" -#: ../../whatsnew/3.3.rst:1318 +#: ../../whatsnew/3.3.rst:1320 msgid "" ">>> m['cc'] = [Group('pals', [Address('Bob', 'bob', 'example.com'),\n" "... Address('Sally', 'sally', 'example.com')]),\n" @@ -2212,25 +2215,25 @@ msgid "" "" msgstr "" -#: ../../whatsnew/3.3.rst:1326 +#: ../../whatsnew/3.3.rst:1328 msgid "Decoding to unicode is done automatically::" msgstr "解碼為 unicode 是自動完成的: ::" -#: ../../whatsnew/3.3.rst:1328 +#: ../../whatsnew/3.3.rst:1330 msgid "" ">>> m2 = message_from_string(str(m))\n" ">>> m2['to']\n" "'Éric '" msgstr "" -#: ../../whatsnew/3.3.rst:1332 +#: ../../whatsnew/3.3.rst:1334 msgid "" "When you parse a message, you can use the ``addresses`` and ``groups`` " "attributes of the header objects to access the groups and individual " "addresses::" msgstr "" -#: ../../whatsnew/3.3.rst:1336 +#: ../../whatsnew/3.3.rst:1338 msgid "" ">>> m2['cc'].addresses\n" "(Address(display_name='Bob', username='bob', domain='example.com'), " @@ -2254,7 +2257,7 @@ msgstr "" "addresses=(Address(display_name='Bonzo', username='bonz', domain='laugh." "com'),))" -#: ../../whatsnew/3.3.rst:1341 +#: ../../whatsnew/3.3.rst:1343 msgid "" "In summary, if you use one of the new policies, header manipulation works " "the way it ought to: your application works with unicode strings, and the " @@ -2262,35 +2265,35 @@ msgid "" "RFC standard Content Transfer Encodings." msgstr "" -#: ../../whatsnew/3.3.rst:1347 +#: ../../whatsnew/3.3.rst:1349 msgid "Other API Changes" msgstr "其他 API 變更" -#: ../../whatsnew/3.3.rst:1349 +#: ../../whatsnew/3.3.rst:1351 msgid "" "New :class:`~email.parser.BytesHeaderParser`, added to the :mod:`~email." "parser` module to complement :class:`~email.parser.HeaderParser` and " "complete the Bytes API." msgstr "" -#: ../../whatsnew/3.3.rst:1353 +#: ../../whatsnew/3.3.rst:1355 msgid "New utility functions:" msgstr "新工具函式:" -#: ../../whatsnew/3.3.rst:1355 +#: ../../whatsnew/3.3.rst:1357 msgid "" ":func:`~email.utils.format_datetime`: given a :class:`~datetime.datetime`, " "produce a string formatted for use in an email header." msgstr "" -#: ../../whatsnew/3.3.rst:1358 +#: ../../whatsnew/3.3.rst:1360 msgid "" ":func:`~email.utils.parsedate_to_datetime`: given a date string from an " "email header, convert it into an aware :class:`~datetime.datetime`, or a " "naive :class:`~datetime.datetime` if the offset is ``-0000``." msgstr "" -#: ../../whatsnew/3.3.rst:1362 +#: ../../whatsnew/3.3.rst:1364 msgid "" ":func:`~email.utils.localtime`: With no argument, returns the current local " "time as an aware :class:`~datetime.datetime` using the local :class:" @@ -2299,11 +2302,11 @@ msgid "" "`~datetime.timezone`." msgstr "" -#: ../../whatsnew/3.3.rst:1370 +#: ../../whatsnew/3.3.rst:1372 msgid "ftplib" msgstr "ftplib" -#: ../../whatsnew/3.3.rst:1372 +#: ../../whatsnew/3.3.rst:1374 msgid "" ":class:`ftplib.FTP` now accepts a ``source_address`` keyword argument to " "specify the ``(host, port)`` to use as the source address in the bind call " @@ -2311,7 +2314,7 @@ msgid "" "issue:`8594`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1377 +#: ../../whatsnew/3.3.rst:1379 msgid "" "The :class:`~ftplib.FTP_TLS` class now provides a new :func:`~ftplib.FTP_TLS." "ccc` function to revert control channel back to plaintext. This can be " @@ -2320,18 +2323,18 @@ msgid "" "in :issue:`12139`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1383 +#: ../../whatsnew/3.3.rst:1385 msgid "" "Added :meth:`ftplib.FTP.mlsd` method which provides a parsable directory " "listing format and deprecates :meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP." "dir`. (Contributed by Giampaolo Rodolà in :issue:`11072`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1389 +#: ../../whatsnew/3.3.rst:1391 msgid "functools" msgstr "functools" -#: ../../whatsnew/3.3.rst:1391 +#: ../../whatsnew/3.3.rst:1393 msgid "" "The :func:`functools.lru_cache` decorator now accepts a ``typed`` keyword " "argument (that defaults to ``False`` to ensure that it caches values of " @@ -2339,32 +2342,32 @@ msgid "" "Raymond Hettinger in :issue:`13227`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1398 +#: ../../whatsnew/3.3.rst:1400 msgid "gc" msgstr "gc" -#: ../../whatsnew/3.3.rst:1400 +#: ../../whatsnew/3.3.rst:1402 msgid "" "It is now possible to register callbacks invoked by the garbage collector " "before and after collection using the new :data:`~gc.callbacks` list." msgstr "" -#: ../../whatsnew/3.3.rst:1405 +#: ../../whatsnew/3.3.rst:1407 msgid "hmac" msgstr "hmac" -#: ../../whatsnew/3.3.rst:1407 +#: ../../whatsnew/3.3.rst:1409 msgid "" "A new :func:`~hmac.compare_digest` function has been added to prevent side " "channel attacks on digests through timing analysis. (Contributed by Nick " "Coghlan and Christian Heimes in :issue:`15061`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1413 +#: ../../whatsnew/3.3.rst:1415 msgid "http" msgstr "http" -#: ../../whatsnew/3.3.rst:1415 +#: ../../whatsnew/3.3.rst:1417 msgid "" ":class:`http.server.BaseHTTPRequestHandler` now buffers the headers and " "writes them all at once when :meth:`~http.server.BaseHTTPRequestHandler." @@ -2374,24 +2377,24 @@ msgid "" "`3709`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1421 +#: ../../whatsnew/3.3.rst:1423 msgid "" ":class:`http.server` now produces valid ``HTML 4.01 strict`` output. " "(Contributed by Ezio Melotti in :issue:`13295`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1424 +#: ../../whatsnew/3.3.rst:1426 msgid "" ":class:`http.client.HTTPResponse` now has a :meth:`~http.client.HTTPResponse." "readinto` method, which means it can be used as an :class:`io.RawIOBase` " "class. (Contributed by John Kuhn in :issue:`13464`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1431 +#: ../../whatsnew/3.3.rst:1433 msgid "html" msgstr "html" -#: ../../whatsnew/3.3.rst:1433 +#: ../../whatsnew/3.3.rst:1435 msgid "" ":class:`html.parser.HTMLParser` is now able to parse broken markup without " "raising errors, therefore the *strict* argument of the constructor and the :" @@ -2404,7 +2407,7 @@ msgid "" "`12888`, :issue:`7311`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1443 +#: ../../whatsnew/3.3.rst:1445 msgid "" "A new :data:`~html.entities.html5` dictionary that maps HTML5 named " "character references to the equivalent Unicode character(s) (e.g. " @@ -2413,25 +2416,25 @@ msgid "" "(Contributed by Ezio Melotti in :issue:`11113` and :issue:`15156`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1451 +#: ../../whatsnew/3.3.rst:1453 msgid "imaplib" msgstr "imaplib" -#: ../../whatsnew/3.3.rst:1453 +#: ../../whatsnew/3.3.rst:1455 msgid "" "The :class:`~imaplib.IMAP4_SSL` constructor now accepts an SSLContext " "parameter to control parameters of the secure channel." msgstr "" -#: ../../whatsnew/3.3.rst:1456 +#: ../../whatsnew/3.3.rst:1458 msgid "(Contributed by Sijin Joseph in :issue:`8808`.)" msgstr "(由 Sijin Joseph 在 :issue:`8808` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1460 +#: ../../whatsnew/3.3.rst:1462 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.3.rst:1462 +#: ../../whatsnew/3.3.rst:1464 msgid "" "A new :func:`~inspect.getclosurevars` function has been added. This function " "reports the current binding of all names referenced from the function body " @@ -2439,11 +2442,11 @@ msgid "" "internal state when testing code that relies on stateful closures." msgstr "" -#: ../../whatsnew/3.3.rst:1467 +#: ../../whatsnew/3.3.rst:1469 msgid "(Contributed by Meador Inge and Nick Coghlan in :issue:`13062`.)" msgstr "(由 Meador Inge 與 Nick Coghlan 在 :issue:`13062` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1469 +#: ../../whatsnew/3.3.rst:1471 msgid "" "A new :func:`~inspect.getgeneratorlocals` function has been added. This " "function reports the current binding of local variables in the generator's " @@ -2451,26 +2454,26 @@ msgid "" "generators." msgstr "" -#: ../../whatsnew/3.3.rst:1474 +#: ../../whatsnew/3.3.rst:1476 msgid "(Contributed by Meador Inge in :issue:`15153`.)" msgstr "(由 Meador Inge 於 :issue:`15153` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1477 +#: ../../whatsnew/3.3.rst:1479 msgid "io" msgstr "io" -#: ../../whatsnew/3.3.rst:1479 +#: ../../whatsnew/3.3.rst:1481 msgid "" "The :func:`~io.open` function has a new ``'x'`` mode that can be used to " "exclusively create a new file, and raise a :exc:`FileExistsError` if the " "file already exists. It is based on the C11 'x' mode to fopen()." msgstr "" -#: ../../whatsnew/3.3.rst:1483 +#: ../../whatsnew/3.3.rst:1485 msgid "(Contributed by David Townshend in :issue:`12760`.)" msgstr "(由 David Townshend 於 :issue:`12760` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1485 +#: ../../whatsnew/3.3.rst:1487 msgid "" "The constructor of the :class:`~io.TextIOWrapper` class has a new " "*write_through* optional argument. If *write_through* is ``True``, calls to :" @@ -2479,28 +2482,28 @@ msgid "" "its underlying binary buffer." msgstr "" -#: ../../whatsnew/3.3.rst:1493 +#: ../../whatsnew/3.3.rst:1495 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.3.rst:1495 +#: ../../whatsnew/3.3.rst:1497 msgid "" ":func:`~itertools.accumulate` now takes an optional ``func`` argument for " "providing a user-supplied binary function." msgstr "" -#: ../../whatsnew/3.3.rst:1500 +#: ../../whatsnew/3.3.rst:1502 msgid "logging" msgstr "logging" -#: ../../whatsnew/3.3.rst:1502 +#: ../../whatsnew/3.3.rst:1504 msgid "" "The :func:`~logging.basicConfig` function now supports an optional " "``handlers`` argument taking an iterable of handlers to be added to the root " "logger." msgstr "" -#: ../../whatsnew/3.3.rst:1505 +#: ../../whatsnew/3.3.rst:1507 msgid "" "A class level attribute :attr:`~logging.handlers.SysLogHandler.append_nul` " "has been added to :class:`~logging.handlers.SysLogHandler` to allow control " @@ -2509,25 +2512,25 @@ msgid "" "log." msgstr "" -#: ../../whatsnew/3.3.rst:1513 +#: ../../whatsnew/3.3.rst:1515 msgid "math" msgstr "math" -#: ../../whatsnew/3.3.rst:1515 +#: ../../whatsnew/3.3.rst:1517 msgid "" "The :mod:`math` module has a new function, :func:`~math.log2`, which " "returns the base-2 logarithm of *x*." msgstr "" -#: ../../whatsnew/3.3.rst:1518 +#: ../../whatsnew/3.3.rst:1520 msgid "(Written by Mark Dickinson in :issue:`11888`.)" msgstr "(由 Mark Dickinson 於 :issue:`11888` 中撰寫)" -#: ../../whatsnew/3.3.rst:1522 +#: ../../whatsnew/3.3.rst:1524 msgid "mmap" msgstr "mmap" -#: ../../whatsnew/3.3.rst:1524 +#: ../../whatsnew/3.3.rst:1526 msgid "" "The :meth:`~mmap.mmap.read` method is now more compatible with other file-" "like objects: if the argument is omitted or specified as ``None``, it " @@ -2535,39 +2538,39 @@ msgid "" "(Contributed by Petri Lehtinen in :issue:`12021`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1531 +#: ../../whatsnew/3.3.rst:1533 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.3.rst:1533 +#: ../../whatsnew/3.3.rst:1535 msgid "" "The new :func:`multiprocessing.connection.wait` function allows polling " "multiple objects (such as connections, sockets and pipes) with a timeout. " "(Contributed by Richard Oudkerk in :issue:`12328`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1537 +#: ../../whatsnew/3.3.rst:1539 msgid "" ":class:`multiprocessing.Connection` objects can now be transferred over " "multiprocessing connections. (Contributed by Richard Oudkerk in :issue:" "`4892`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1541 +#: ../../whatsnew/3.3.rst:1543 msgid "" ":class:`multiprocessing.Process` now accepts a ``daemon`` keyword argument " "to override the default behavior of inheriting the ``daemon`` flag from the " "parent process (:issue:`6064`)." msgstr "" -#: ../../whatsnew/3.3.rst:1545 +#: ../../whatsnew/3.3.rst:1547 msgid "" "New attribute :data:`multiprocessing.Process.sentinel` allows a program to " "wait on multiple :class:`~multiprocessing.Process` objects at one time using " "the appropriate OS primitives (for example, :mod:`select` on posix systems)." msgstr "" -#: ../../whatsnew/3.3.rst:1550 +#: ../../whatsnew/3.3.rst:1552 msgid "" "New methods :meth:`multiprocessing.pool.Pool.starmap` and :meth:" "`~multiprocessing.pool.Pool.starmap_async` provide :func:`itertools.starmap` " @@ -2576,18 +2579,18 @@ msgid "" "Schlawack in :issue:`12708`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1559 +#: ../../whatsnew/3.3.rst:1561 msgid "nntplib" msgstr "nntplib" -#: ../../whatsnew/3.3.rst:1561 +#: ../../whatsnew/3.3.rst:1563 msgid "" "The :class:`!nntplib.NNTP` class now supports the context management " "protocol to unconditionally consume :exc:`socket.error` exceptions and to " "close the NNTP connection when done::" msgstr "" -#: ../../whatsnew/3.3.rst:1565 +#: ../../whatsnew/3.3.rst:1567 msgid "" ">>> from nntplib import NNTP\n" ">>> with NNTP('news.gmane.org') as n:\n" @@ -2605,15 +2608,15 @@ msgstr "" "python.committers')\n" ">>>" -#: ../../whatsnew/3.3.rst:1572 +#: ../../whatsnew/3.3.rst:1574 msgid "(Contributed by Giampaolo Rodolà in :issue:`9795`.)" msgstr "(由 Giampaolo Rodolà 於 :issue:`9795` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1576 +#: ../../whatsnew/3.3.rst:1578 msgid "os" msgstr "os" -#: ../../whatsnew/3.3.rst:1578 +#: ../../whatsnew/3.3.rst:1580 msgid "" "The :mod:`os` module has a new :func:`~os.pipe2` function that makes it " "possible to create a pipe with :const:`~os.O_CLOEXEC` or :const:`~os." @@ -2621,7 +2624,7 @@ msgid "" "conditions in multi-threaded programs." msgstr "" -#: ../../whatsnew/3.3.rst:1583 +#: ../../whatsnew/3.3.rst:1585 msgid "" "The :mod:`os` module has a new :func:`~os.sendfile` function which provides " "an efficient \"zero-copy\" way for copying data from one file (or socket) " @@ -2632,12 +2635,12 @@ msgid "" "socket, e.g. for downloading a file." msgstr "" -#: ../../whatsnew/3.3.rst:1591 +#: ../../whatsnew/3.3.rst:1593 msgid "" "(Patch submitted by Ross Lagerwall and Giampaolo Rodolà in :issue:`10882`.)" msgstr "(由 Ross Lagerwall 和 Giampaolo Rodolà 於 :issue:`10882` 提交補丁。)" -#: ../../whatsnew/3.3.rst:1593 +#: ../../whatsnew/3.3.rst:1595 msgid "" "To avoid race conditions like symlink attacks and issues with temporary " "files and directories, it is more reliable (and also faster) to manipulate " @@ -2646,14 +2649,14 @@ msgid "" "`4761`, :issue:`10755` and :issue:`14626`)." msgstr "" -#: ../../whatsnew/3.3.rst:1599 +#: ../../whatsnew/3.3.rst:1601 msgid "" "The :mod:`os` module has a new :func:`~os.fwalk` function similar to :func:" "`~os.walk` except that it also yields file descriptors referring to the " "directories visited. This is especially useful to avoid symlink races." msgstr "" -#: ../../whatsnew/3.3.rst:1603 +#: ../../whatsnew/3.3.rst:1605 msgid "" "The following functions get new optional *dir_fd* (:ref:`paths relative to " "directory descriptors `) and/or *follow_symlinks* (:ref:`not " @@ -2667,7 +2670,7 @@ msgid "" "`os.supports_follows_symlinks`." msgstr "" -#: ../../whatsnew/3.3.rst:1614 +#: ../../whatsnew/3.3.rst:1616 msgid "" "The following functions now support a file descriptor for their path " "argument: :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:" @@ -2676,7 +2679,7 @@ msgid "" "support for this can be checked via the :data:`os.supports_fd` set." msgstr "" -#: ../../whatsnew/3.3.rst:1620 +#: ../../whatsnew/3.3.rst:1622 msgid "" ":func:`~os.access` accepts an ``effective_ids`` keyword argument to turn on " "using the effective uid/gid rather than the real uid/gid in the access " @@ -2684,7 +2687,7 @@ msgid "" "supports_effective_ids` set." msgstr "" -#: ../../whatsnew/3.3.rst:1625 +#: ../../whatsnew/3.3.rst:1627 msgid "" "The :mod:`os` module has two new functions: :func:`~os.getpriority` and :" "func:`~os.setpriority`. They can be used to get or set process niceness/" @@ -2692,11 +2695,11 @@ msgid "" "processes instead of just the current one." msgstr "" -#: ../../whatsnew/3.3.rst:1630 +#: ../../whatsnew/3.3.rst:1632 msgid "(Patch submitted by Giampaolo Rodolà in :issue:`10784`.)" msgstr "(由 Giampaolo Rodolà 於 :issue:`10784` 提交補丁。)" -#: ../../whatsnew/3.3.rst:1632 +#: ../../whatsnew/3.3.rst:1634 msgid "" "The new :func:`os.replace` function allows cross-platform renaming of a file " "with overwriting the destination. With :func:`os.rename`, an existing " @@ -2704,7 +2707,7 @@ msgid "" "Windows. (Contributed by Antoine Pitrou in :issue:`8828`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1638 +#: ../../whatsnew/3.3.rst:1640 msgid "" "The stat family of functions (:func:`~os.stat`, :func:`~os.fstat`, and :func:" "`~os.lstat`) now support reading a file's timestamps with nanosecond " @@ -2713,7 +2716,7 @@ msgid "" "`14127`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1644 +#: ../../whatsnew/3.3.rst:1646 msgid "" "The new :func:`os.get_terminal_size` function queries the size of the " "terminal attached to a file descriptor. See also :func:`shutil." @@ -2721,14 +2724,14 @@ msgid "" "`13609`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1651 +#: ../../whatsnew/3.3.rst:1653 msgid "" "New functions to support Linux extended attributes (:issue:`12720`): :func:" "`~os.getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os." "setxattr`." msgstr "" -#: ../../whatsnew/3.3.rst:1655 +#: ../../whatsnew/3.3.rst:1657 msgid "" "New interface to the scheduler. These functions control how a process is " "allocated CPU time by the operating system. New functions: :func:`~os." @@ -2739,90 +2742,90 @@ msgid "" "sched_setscheduler`, :func:`~os.sched_yield`," msgstr "" -#: ../../whatsnew/3.3.rst:1664 +#: ../../whatsnew/3.3.rst:1666 msgid "New functions to control the file system:" msgstr "" -#: ../../whatsnew/3.3.rst:1666 +#: ../../whatsnew/3.3.rst:1668 msgid "" ":func:`~os.posix_fadvise`: Announces an intention to access data in a " "specific pattern thus allowing the kernel to make optimizations." msgstr "" -#: ../../whatsnew/3.3.rst:1668 +#: ../../whatsnew/3.3.rst:1670 msgid "" ":func:`~os.posix_fallocate`: Ensures that enough disk space is allocated for " "a file." msgstr "" -#: ../../whatsnew/3.3.rst:1670 +#: ../../whatsnew/3.3.rst:1672 msgid ":func:`~os.sync`: Force write of everything to disk." msgstr "" -#: ../../whatsnew/3.3.rst:1672 +#: ../../whatsnew/3.3.rst:1674 msgid "Additional new posix functions:" msgstr "其他新的 posix 函式:" -#: ../../whatsnew/3.3.rst:1674 +#: ../../whatsnew/3.3.rst:1676 msgid "" ":func:`~os.lockf`: Apply, test or remove a POSIX lock on an open file " "descriptor." msgstr "" -#: ../../whatsnew/3.3.rst:1675 +#: ../../whatsnew/3.3.rst:1677 msgid "" ":func:`~os.pread`: Read from a file descriptor at an offset, the file offset " "remains unchanged." msgstr "" -#: ../../whatsnew/3.3.rst:1677 +#: ../../whatsnew/3.3.rst:1679 msgid "" ":func:`~os.pwrite`: Write to a file descriptor from an offset, leaving the " "file offset unchanged." msgstr "" -#: ../../whatsnew/3.3.rst:1679 +#: ../../whatsnew/3.3.rst:1681 msgid "" ":func:`~os.readv`: Read from a file descriptor into a number of writable " "buffers." msgstr "" -#: ../../whatsnew/3.3.rst:1680 +#: ../../whatsnew/3.3.rst:1682 msgid "" ":func:`~os.truncate`: Truncate the file corresponding to *path*, so that it " "is at most *length* bytes in size." msgstr "" -#: ../../whatsnew/3.3.rst:1682 +#: ../../whatsnew/3.3.rst:1684 msgid "" ":func:`~os.waitid`: Wait for the completion of one or more child processes." msgstr "" -#: ../../whatsnew/3.3.rst:1683 +#: ../../whatsnew/3.3.rst:1685 msgid "" ":func:`~os.writev`: Write the contents of *buffers* to a file descriptor, " "where *buffers* is an arbitrary sequence of buffers." msgstr "" -#: ../../whatsnew/3.3.rst:1685 +#: ../../whatsnew/3.3.rst:1687 msgid "" ":func:`~os.getgrouplist` (:issue:`9344`): Return list of group ids that " "specified user belongs to." msgstr "" -#: ../../whatsnew/3.3.rst:1688 +#: ../../whatsnew/3.3.rst:1690 msgid "" ":func:`~os.times` and :func:`~os.uname`: Return type changed from a tuple to " "a tuple-like object with named attributes." msgstr "" -#: ../../whatsnew/3.3.rst:1691 +#: ../../whatsnew/3.3.rst:1693 msgid "" "Some platforms now support additional constants for the :func:`~os.lseek` " "function, such as ``os.SEEK_HOLE`` and ``os.SEEK_DATA``." msgstr "" -#: ../../whatsnew/3.3.rst:1694 +#: ../../whatsnew/3.3.rst:1696 msgid "" "New constants :const:`~os.RTLD_LAZY`, :const:`~os.RTLD_NOW`, :const:`~os." "RTLD_GLOBAL`, :const:`~os.RTLD_LOCAL`, :const:`~os.RTLD_NODELETE`, :const:" @@ -2832,70 +2835,70 @@ msgid "" "mod:`DLFCN`. (Contributed by Victor Stinner in :issue:`13226`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1702 +#: ../../whatsnew/3.3.rst:1704 msgid "" ":func:`os.symlink` now accepts (and ignores) the ``target_is_directory`` " "keyword argument on non-Windows platforms, to ease cross-platform support." msgstr "" -#: ../../whatsnew/3.3.rst:1707 +#: ../../whatsnew/3.3.rst:1709 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.3.rst:1709 +#: ../../whatsnew/3.3.rst:1711 msgid "" "Tab-completion is now available not only for command names, but also their " "arguments. For example, for the ``break`` command, function and file names " "are completed." msgstr "" -#: ../../whatsnew/3.3.rst:1713 +#: ../../whatsnew/3.3.rst:1715 msgid "(Contributed by Georg Brandl in :issue:`14210`)" msgstr "(由 Georg Brandl 在 :issue:`14210` 中貢獻)" -#: ../../whatsnew/3.3.rst:1717 +#: ../../whatsnew/3.3.rst:1719 msgid "pickle" msgstr "pickle" -#: ../../whatsnew/3.3.rst:1719 +#: ../../whatsnew/3.3.rst:1721 msgid "" ":class:`pickle.Pickler` objects now have an optional :attr:`~pickle.Pickler." "dispatch_table` attribute allowing per-pickler reduction functions to be set." msgstr "" -#: ../../whatsnew/3.3.rst:1723 +#: ../../whatsnew/3.3.rst:1725 msgid "(Contributed by Richard Oudkerk in :issue:`14166`.)" msgstr "(由 Richard Oudkerk 在 :issue:`14166` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1727 +#: ../../whatsnew/3.3.rst:1729 msgid "pydoc" msgstr "pydoc" -#: ../../whatsnew/3.3.rst:1729 +#: ../../whatsnew/3.3.rst:1731 msgid "" "The Tk GUI and the :func:`~pydoc.serve` function have been removed from the :" "mod:`pydoc` module: ``pydoc -g`` and :func:`~pydoc.serve` have been " "deprecated in Python 3.2." msgstr "" -#: ../../whatsnew/3.3.rst:1735 +#: ../../whatsnew/3.3.rst:1737 msgid "re" msgstr "re" -#: ../../whatsnew/3.3.rst:1737 +#: ../../whatsnew/3.3.rst:1739 msgid "" ":class:`str` regular expressions now support ``\\u`` and ``\\U`` escapes." msgstr "" -#: ../../whatsnew/3.3.rst:1739 +#: ../../whatsnew/3.3.rst:1741 msgid "(Contributed by Serhiy Storchaka in :issue:`3665`.)" msgstr "(由 Serhiy Storchaka 在 :issue:`3665` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1743 +#: ../../whatsnew/3.3.rst:1745 msgid "sched" msgstr "sched" -#: ../../whatsnew/3.3.rst:1745 +#: ../../whatsnew/3.3.rst:1747 msgid "" ":meth:`~sched.scheduler.run` now accepts a *blocking* parameter which when " "set to false makes the method execute the scheduled events due to expire " @@ -2904,21 +2907,21 @@ msgid "" "(Contributed by Giampaolo Rodolà in :issue:`13449`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1751 +#: ../../whatsnew/3.3.rst:1753 msgid "" ":class:`~sched.scheduler` class can now be safely used in multi-threaded " "environments. (Contributed by Josiah Carlson and Giampaolo Rodolà in :issue:" "`8684`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1755 +#: ../../whatsnew/3.3.rst:1757 msgid "" "*timefunc* and *delayfunct* parameters of :class:`~sched.scheduler` class " "constructor are now optional and defaults to :func:`time.time` and :func:" "`time.sleep` respectively. (Contributed by Chris Clark in :issue:`13245`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1760 +#: ../../whatsnew/3.3.rst:1762 msgid "" ":meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs` " "*argument* parameter is now optional. (Contributed by Chris Clark in :issue:" @@ -2927,7 +2930,7 @@ msgstr "" ":meth:`~sched.scheduler.enter` 和 :meth:`~sched.scheduler.enterabs` " "*argument* 參數現在是可選的。(由 Chris Clark 在 :issue:`13245` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1764 +#: ../../whatsnew/3.3.rst:1766 msgid "" ":meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs` now " "accept a *kwargs* parameter. (Contributed by Chris Clark in :issue:`13245`.)" @@ -2935,22 +2938,22 @@ msgstr "" ":meth:`~sched.scheduler.enter` 和 :meth:`~sched.scheduler.enterabs` 現在接受 " "*kwargs* 參數。(由 Chris Clark 在 :issue:`13245` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1770 +#: ../../whatsnew/3.3.rst:1772 msgid "select" msgstr "select" -#: ../../whatsnew/3.3.rst:1772 +#: ../../whatsnew/3.3.rst:1774 msgid "" "Solaris and derivative platforms have a new class :class:`select.devpoll` " "for high performance asynchronous sockets via :file:`/dev/poll`. " "(Contributed by Jesús Cea Avión in :issue:`6397`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1778 +#: ../../whatsnew/3.3.rst:1780 msgid "shlex" msgstr "shlex" -#: ../../whatsnew/3.3.rst:1780 +#: ../../whatsnew/3.3.rst:1782 msgid "" "The previously undocumented helper function ``quote`` from the :mod:`!pipes` " "modules has been moved to the :mod:`shlex` module and documented. :func:" @@ -2958,35 +2961,35 @@ msgid "" "otherwise given special meaning by the shell." msgstr "" -#: ../../whatsnew/3.3.rst:1787 +#: ../../whatsnew/3.3.rst:1789 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.3.rst:1789 +#: ../../whatsnew/3.3.rst:1791 msgid "New functions:" msgstr "新功能:" -#: ../../whatsnew/3.3.rst:1791 +#: ../../whatsnew/3.3.rst:1793 msgid "" ":func:`~shutil.disk_usage`: provides total, used and free disk space " "statistics. (Contributed by Giampaolo Rodolà in :issue:`12442`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1793 +#: ../../whatsnew/3.3.rst:1795 msgid "" ":func:`~shutil.chown`: allows one to change user and/or group of the given " "path also specifying the user/group names and not only their numeric ids. " "(Contributed by Sandro Tosi in :issue:`12191`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1796 +#: ../../whatsnew/3.3.rst:1798 msgid "" ":func:`shutil.get_terminal_size`: returns the size of the terminal window to " "which the interpreter is attached. (Contributed by Zbigniew Jędrzejewski-" "Szmek in :issue:`13609`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1800 +#: ../../whatsnew/3.3.rst:1802 msgid "" ":func:`~shutil.copy2` and :func:`~shutil.copystat` now preserve file " "timestamps with nanosecond precision on platforms that support it. They also " @@ -2994,7 +2997,7 @@ msgid "" "Hastings in :issue:`14127` and :issue:`15238`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1805 +#: ../../whatsnew/3.3.rst:1807 msgid "" "Several functions now take an optional ``symlinks`` argument: when that " "parameter is true, symlinks aren't dereferenced and the operation instead " @@ -3002,7 +3005,7 @@ msgid "" "Hynek Schlawack in :issue:`12715`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1810 +#: ../../whatsnew/3.3.rst:1812 msgid "" "When copying files to a different file system, :func:`~shutil.move` now " "handles symlinks the way the posix ``mv`` command does, recreating the " @@ -3011,7 +3014,7 @@ msgid "" "the ``dst`` argument as its result." msgstr "" -#: ../../whatsnew/3.3.rst:1816 +#: ../../whatsnew/3.3.rst:1818 msgid "" ":func:`~shutil.rmtree` is now resistant to symlink attacks on platforms " "which support the new ``dir_fd`` parameter in :func:`os.open` and :func:`os." @@ -3019,53 +3022,53 @@ msgid "" "`4489`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1823 +#: ../../whatsnew/3.3.rst:1825 msgid "signal" msgstr "signal" -#: ../../whatsnew/3.3.rst:1825 +#: ../../whatsnew/3.3.rst:1827 msgid "The :mod:`signal` module has new functions:" msgstr ":mod:`signal` 模組有了新的函式:" -#: ../../whatsnew/3.3.rst:1827 +#: ../../whatsnew/3.3.rst:1829 msgid "" ":func:`~signal.pthread_sigmask`: fetch and/or change the signal mask of the " "calling thread (Contributed by Jean-Paul Calderone in :issue:`8407`);" msgstr "" -#: ../../whatsnew/3.3.rst:1829 +#: ../../whatsnew/3.3.rst:1831 msgid ":func:`~signal.pthread_kill`: send a signal to a thread;" msgstr ":func:`~signal.pthread_kill`:向執行緒發送訊號;" -#: ../../whatsnew/3.3.rst:1830 +#: ../../whatsnew/3.3.rst:1832 msgid ":func:`~signal.sigpending`: examine pending functions;" msgstr ":func:`~signal.sigpending`:檢查未定的函式;" -#: ../../whatsnew/3.3.rst:1831 +#: ../../whatsnew/3.3.rst:1833 msgid ":func:`~signal.sigwait`: wait a signal;" msgstr ":func:`~signal.sigwait`:等待訊號;" -#: ../../whatsnew/3.3.rst:1832 +#: ../../whatsnew/3.3.rst:1834 msgid "" ":func:`~signal.sigwaitinfo`: wait for a signal, returning detailed " "information about it;" msgstr ":func:`~signal.sigwaitinfo`:等待訊號,回傳有關該訊號的詳細資訊;" -#: ../../whatsnew/3.3.rst:1834 +#: ../../whatsnew/3.3.rst:1836 msgid "" ":func:`~signal.sigtimedwait`: like :func:`~signal.sigwaitinfo` but with a " "timeout." msgstr "" ":func:`~signal.sigtimedwait`:類似於 :func:`~signal.sigwaitinfo` 但有超時。" -#: ../../whatsnew/3.3.rst:1837 +#: ../../whatsnew/3.3.rst:1839 msgid "" "The signal handler writes the signal number as a single byte instead of a " "nul byte into the wakeup file descriptor. So it is possible to wait more " "than one signal and know which signals were raised." msgstr "" -#: ../../whatsnew/3.3.rst:1841 +#: ../../whatsnew/3.3.rst:1843 msgid "" ":func:`signal.signal` and :func:`signal.siginterrupt` raise an OSError, " "instead of a RuntimeError: OSError has an errno attribute." @@ -3073,29 +3076,29 @@ msgstr "" ":func:`signal.signal` 和 :func:`signal.siginterrupt` 會引發 OSError,而不是 " "RuntimeError:OSError 有一個 errno 屬性。" -#: ../../whatsnew/3.3.rst:1846 +#: ../../whatsnew/3.3.rst:1848 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.3.rst:1848 +#: ../../whatsnew/3.3.rst:1850 msgid "" "The :mod:`!smtpd` module now supports :rfc:`5321` (extended SMTP) and :rfc:" "`1870` (size extension). Per the standard, these extensions are enabled if " "and only if the client initiates the session with an ``EHLO`` command." msgstr "" -#: ../../whatsnew/3.3.rst:1852 +#: ../../whatsnew/3.3.rst:1854 msgid "" "(Initial ``ELHO`` support by Alberto Trevino. Size extension by Juhana " "Jauhiainen. Substantial additional work on the patch contributed by Michele " "Orrù and Dan Boswell. :issue:`8739`)" msgstr "" -#: ../../whatsnew/3.3.rst:1858 +#: ../../whatsnew/3.3.rst:1860 msgid "smtplib" msgstr "smtplib" -#: ../../whatsnew/3.3.rst:1860 +#: ../../whatsnew/3.3.rst:1862 msgid "" "The :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, and :class:`~smtplib." "LMTP` classes now accept a ``source_address`` keyword argument to specify " @@ -3104,7 +3107,7 @@ msgid "" "`11281`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1866 +#: ../../whatsnew/3.3.rst:1868 msgid "" ":class:`~smtplib.SMTP` now supports the context management protocol, " "allowing an ``SMTP`` instance to be used in a ``with`` statement. " @@ -3113,7 +3116,7 @@ msgstr "" ":class:`~smtplib.SMTP` 現在支援情境管理協議,允許在 ``with`` 陳述式中使用 " "``SMTP`` 實例。(由 Giampaolo Rodolà 在 :issue:`11289` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1870 +#: ../../whatsnew/3.3.rst:1872 msgid "" "The :class:`~smtplib.SMTP_SSL` constructor and the :meth:`~smtplib.SMTP." "starttls` method now accept an SSLContext parameter to control parameters of " @@ -3123,11 +3126,11 @@ msgstr "" "接受 SSLContext 參數來控制安全通道的參數。(由 Kasun Herath 在 :issue:`8809` " "中貢獻。)" -#: ../../whatsnew/3.3.rst:1876 +#: ../../whatsnew/3.3.rst:1878 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.3.rst:1878 +#: ../../whatsnew/3.3.rst:1880 msgid "" "The :class:`~socket.socket` class now exposes additional methods to process " "ancillary data when supported by the underlying platform:" @@ -3135,26 +3138,26 @@ msgstr "" "當底層平台支援時,:class:`~socket.socket` 類現在公開了額外的方法來處理輔助資" "料:" -#: ../../whatsnew/3.3.rst:1881 +#: ../../whatsnew/3.3.rst:1883 msgid ":func:`~socket.socket.sendmsg`" msgstr ":func:`~socket.socket.sendmsg`" -#: ../../whatsnew/3.3.rst:1882 +#: ../../whatsnew/3.3.rst:1884 msgid ":func:`~socket.socket.recvmsg`" msgstr ":func:`~socket.socket.recvmsg`" -#: ../../whatsnew/3.3.rst:1883 +#: ../../whatsnew/3.3.rst:1885 msgid ":func:`~socket.socket.recvmsg_into`" msgstr ":func:`~socket.socket.recvmsg_into`" -#: ../../whatsnew/3.3.rst:1885 +#: ../../whatsnew/3.3.rst:1887 msgid "" "(Contributed by David Watson in :issue:`6560`, based on an earlier patch by " "Heiko Wundram)" msgstr "" "(由 David Watson 在 :issue:`6560` 中貢獻,其基於 Heiko Wundram 的早期補丁)" -#: ../../whatsnew/3.3.rst:1888 +#: ../../whatsnew/3.3.rst:1890 msgid "" "The :class:`~socket.socket` class now supports the PF_CAN protocol family " "(https://en.wikipedia.org/wiki/Socketcan), on Linux (https://lwn.net/" @@ -3163,14 +3166,14 @@ msgstr "" ":class:`~socket.socket` 類別現在支援 Linux (https://lwn.net/Articles/253425) " "上的 PF_CAN 協議系列 (https://en.wikipedia.org/wiki/Socketcan)。" -#: ../../whatsnew/3.3.rst:1892 +#: ../../whatsnew/3.3.rst:1894 msgid "" "(Contributed by Matthias Fuchs, updated by Tiago Gonçalves in :issue:" "`10141`.)" msgstr "" "(在 :issue:`10141` 中由 Matthias Fuchs 貢獻、並由 Tiago Gonçalves 更新。)" -#: ../../whatsnew/3.3.rst:1894 +#: ../../whatsnew/3.3.rst:1896 msgid "" "The :class:`~socket.socket` class now supports the PF_RDS protocol family " "(https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets and `https://oss." @@ -3182,7 +3185,7 @@ msgstr "" "`__\\ )。" -#: ../../whatsnew/3.3.rst:1898 +#: ../../whatsnew/3.3.rst:1900 msgid "" "The :class:`~socket.socket` class now supports the ``PF_SYSTEM`` protocol " "family on OS X. (Contributed by Michael Goderbauer in :issue:`13777`.)" @@ -3190,18 +3193,18 @@ msgstr "" ":class:`~socket.socket` 類別現在支援 OS X 上的 ``PF_SYSTEM`` 協議系列。(由 " "Michael Goderbauer 在 :issue:`13777` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1901 +#: ../../whatsnew/3.3.rst:1903 msgid "" "New function :func:`~socket.sethostname` allows the hostname to be set on " "Unix systems if the calling process has sufficient privileges. (Contributed " "by Ross Lagerwall in :issue:`10866`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1907 +#: ../../whatsnew/3.3.rst:1909 msgid "socketserver" msgstr "socketserver" -#: ../../whatsnew/3.3.rst:1909 +#: ../../whatsnew/3.3.rst:1911 msgid "" ":class:`~socketserver.BaseServer` now has an overridable method :meth:" "`~socketserver.BaseServer.service_actions` that is called by the :meth:" @@ -3210,54 +3213,54 @@ msgid "" "processes. (Contributed by Justin Warkentin in :issue:`11109`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1917 +#: ../../whatsnew/3.3.rst:1919 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.3.rst:1919 +#: ../../whatsnew/3.3.rst:1921 msgid "" "New :class:`sqlite3.Connection` method :meth:`~sqlite3.Connection." "set_trace_callback` can be used to capture a trace of all sql commands " "processed by sqlite. (Contributed by Torsten Landschoff in :issue:`11688`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1926 +#: ../../whatsnew/3.3.rst:1928 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.3.rst:1928 +#: ../../whatsnew/3.3.rst:1930 msgid "The :mod:`ssl` module has two new random generation functions:" msgstr ":mod:`ssl` 模組有兩個新的隨機生成函式:" -#: ../../whatsnew/3.3.rst:1930 +#: ../../whatsnew/3.3.rst:1932 msgid "" ":func:`~ssl.RAND_bytes`: generate cryptographically strong pseudo-random " "bytes." msgstr ":func:`~ssl.RAND_bytes`:生成加密的強偽隨機位元組。" -#: ../../whatsnew/3.3.rst:1932 +#: ../../whatsnew/3.3.rst:1934 msgid ":func:`~ssl.RAND_pseudo_bytes`: generate pseudo-random bytes." msgstr ":func:`~ssl.RAND_pseudo_bytes`:生成偽隨機位元組。" -#: ../../whatsnew/3.3.rst:1934 +#: ../../whatsnew/3.3.rst:1936 msgid "(Contributed by Victor Stinner in :issue:`12049`.)" msgstr "(由 Victor Stinner 在 :issue:`12049` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1936 +#: ../../whatsnew/3.3.rst:1938 msgid "" "The :mod:`ssl` module now exposes a finer-grained exception hierarchy in " "order to make it easier to inspect the various kinds of errors. (Contributed " "by Antoine Pitrou in :issue:`11183`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1940 +#: ../../whatsnew/3.3.rst:1942 msgid "" ":meth:`~ssl.SSLContext.load_cert_chain` now accepts a *password* argument to " "be used if the private key is encrypted. (Contributed by Adam Simpkins in :" "issue:`12803`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1944 +#: ../../whatsnew/3.3.rst:1946 msgid "" "Diffie-Hellman key exchange, both regular and Elliptic Curve-based, is now " "supported through the :meth:`~ssl.SSLContext.load_dh_params` and :meth:`~ssl." @@ -3265,14 +3268,14 @@ msgid "" "`13626` and :issue:`13627`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1949 +#: ../../whatsnew/3.3.rst:1951 msgid "" "SSL sockets have a new :meth:`~ssl.SSLSocket.get_channel_binding` method " "allowing the implementation of certain authentication mechanisms such as " "SCRAM-SHA-1-PLUS. (Contributed by Jacek Konieczny in :issue:`12551`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1953 +#: ../../whatsnew/3.3.rst:1955 msgid "" "You can query the SSL compression algorithm used by an SSL socket, thanks to " "its new :meth:`~ssl.SSLSocket.compression` method. The new attribute :const:" @@ -3280,91 +3283,91 @@ msgid "" "Antoine Pitrou in :issue:`13634`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1958 +#: ../../whatsnew/3.3.rst:1960 msgid "" "Support has been added for the Next Protocol Negotiation extension using " "the :meth:`ssl.SSLContext.set_npn_protocols` method. (Contributed by Colin " "Marc in :issue:`14204`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1962 +#: ../../whatsnew/3.3.rst:1964 msgid "" "SSL errors can now be introspected more easily thanks to :attr:`~ssl." "SSLError.library` and :attr:`~ssl.SSLError.reason` attributes. (Contributed " "by Antoine Pitrou in :issue:`14837`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1966 +#: ../../whatsnew/3.3.rst:1968 msgid "" "The :func:`~ssl.get_server_certificate` function now supports IPv6. " "(Contributed by Charles-François Natali in :issue:`11811`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1969 +#: ../../whatsnew/3.3.rst:1971 msgid "" "New attribute :const:`~ssl.OP_CIPHER_SERVER_PREFERENCE` allows setting SSLv3 " "server sockets to use the server's cipher ordering preference rather than " "the client's (:issue:`13635`)." msgstr "" -#: ../../whatsnew/3.3.rst:1975 +#: ../../whatsnew/3.3.rst:1977 msgid "stat" msgstr "stat" -#: ../../whatsnew/3.3.rst:1977 +#: ../../whatsnew/3.3.rst:1979 msgid "" "The undocumented tarfile.filemode function has been moved to :func:`stat." "filemode`. It can be used to convert a file's mode to a string of the form '-" "rwxrwxrwx'." msgstr "" -#: ../../whatsnew/3.3.rst:1981 +#: ../../whatsnew/3.3.rst:1983 msgid "(Contributed by Giampaolo Rodolà in :issue:`14807`.)" msgstr "(由 Giampaolo Rodolà 在 :issue:`14807` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1985 +#: ../../whatsnew/3.3.rst:1987 msgid "struct" msgstr "struct" -#: ../../whatsnew/3.3.rst:1987 +#: ../../whatsnew/3.3.rst:1989 msgid "" "The :mod:`struct` module now supports :c:type:`ssize_t` and :c:type:`size_t` " "via the new codes ``n`` and ``N``, respectively. (Contributed by Antoine " "Pitrou in :issue:`3163`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1993 +#: ../../whatsnew/3.3.rst:1995 msgid "subprocess" msgstr "subprocess" -#: ../../whatsnew/3.3.rst:1995 +#: ../../whatsnew/3.3.rst:1997 msgid "" "Command strings can now be bytes objects on posix platforms. (Contributed " "by Victor Stinner in :issue:`8513`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1998 +#: ../../whatsnew/3.3.rst:2000 msgid "" "A new constant :const:`~subprocess.DEVNULL` allows suppressing output in a " "platform-independent fashion. (Contributed by Ross Lagerwall in :issue:" "`5870`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2004 +#: ../../whatsnew/3.3.rst:2006 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.3.rst:2006 +#: ../../whatsnew/3.3.rst:2008 msgid "" "The :mod:`sys` module has a new :data:`~sys.thread_info` :term:`named tuple` " "holding information about the thread implementation (:issue:`11223`)." msgstr "" -#: ../../whatsnew/3.3.rst:2012 +#: ../../whatsnew/3.3.rst:2014 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.3.rst:2014 +#: ../../whatsnew/3.3.rst:2016 msgid "" ":mod:`tarfile` now supports ``lzma`` encoding via the :mod:`lzma` module. " "(Contributed by Lars Gustäbel in :issue:`5689`.)" @@ -3372,33 +3375,33 @@ msgstr "" ":mod:`tarfile` 現在透過 :mod:`lzma` 模組支援 ``lzma`` 編碼。(由 Lars " "Gustäbel 在 :issue:`5689` 中貢獻。)" -#: ../../whatsnew/3.3.rst:2019 +#: ../../whatsnew/3.3.rst:2021 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.3.rst:2021 +#: ../../whatsnew/3.3.rst:2023 msgid "" ":class:`tempfile.SpooledTemporaryFile`\\'s :meth:`~tempfile." "SpooledTemporaryFile.truncate` method now accepts a ``size`` parameter. " "(Contributed by Ryan Kelly in :issue:`9957`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2027 +#: ../../whatsnew/3.3.rst:2029 msgid "textwrap" msgstr "textwrap" -#: ../../whatsnew/3.3.rst:2029 +#: ../../whatsnew/3.3.rst:2031 msgid "" "The :mod:`textwrap` module has a new :func:`~textwrap.indent` that makes it " "straightforward to add a common prefix to selected lines in a block of text " "(:issue:`13857`)." msgstr "" -#: ../../whatsnew/3.3.rst:2035 +#: ../../whatsnew/3.3.rst:2037 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.3.rst:2037 +#: ../../whatsnew/3.3.rst:2039 msgid "" ":class:`threading.Condition`, :class:`threading.Semaphore`, :class:" "`threading.BoundedSemaphore`, :class:`threading.Event`, and :class:" @@ -3407,14 +3410,14 @@ msgid "" "Araujo in :issue:`10968`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2043 +#: ../../whatsnew/3.3.rst:2045 msgid "" "The :class:`threading.Thread` constructor now accepts a ``daemon`` keyword " "argument to override the default behavior of inheriting the ``daemon`` flag " "value from the parent thread (:issue:`6064`)." msgstr "" -#: ../../whatsnew/3.3.rst:2047 +#: ../../whatsnew/3.3.rst:2049 msgid "" "The formerly private function ``_thread.get_ident`` is now available as the " "public function :func:`threading.get_ident`. This eliminates several cases " @@ -3423,42 +3426,42 @@ msgid "" "public interface." msgstr "" -#: ../../whatsnew/3.3.rst:2055 +#: ../../whatsnew/3.3.rst:2057 msgid "time" msgstr "time" -#: ../../whatsnew/3.3.rst:2057 +#: ../../whatsnew/3.3.rst:2059 msgid "The :pep:`418` added new functions to the :mod:`time` module:" msgstr ":pep:`418` 向 :mod:`time` 模組新增了新功能:" -#: ../../whatsnew/3.3.rst:2059 +#: ../../whatsnew/3.3.rst:2061 msgid ":func:`~time.get_clock_info`: Get information on a clock." msgstr ":func:`~time.get_clock_info`:獲取時鐘資訊。" -#: ../../whatsnew/3.3.rst:2060 +#: ../../whatsnew/3.3.rst:2062 msgid "" ":func:`~time.monotonic`: Monotonic clock (cannot go backward), not affected " "by system clock updates." msgstr "" ":func:`~time.monotonic`:單調時鐘(不能倒退),不受系統時鐘更新的影響。" -#: ../../whatsnew/3.3.rst:2062 +#: ../../whatsnew/3.3.rst:2064 msgid "" ":func:`~time.perf_counter`: Performance counter with the highest available " "resolution to measure a short duration." msgstr "" -#: ../../whatsnew/3.3.rst:2064 +#: ../../whatsnew/3.3.rst:2066 msgid "" ":func:`~time.process_time`: Sum of the system and user CPU time of the " "current process." msgstr ":func:`~time.process_time`:當前行程的系統和使用者 CPU 時間總和。" -#: ../../whatsnew/3.3.rst:2067 +#: ../../whatsnew/3.3.rst:2069 msgid "Other new functions:" msgstr "其他新功能:" -#: ../../whatsnew/3.3.rst:2069 +#: ../../whatsnew/3.3.rst:2071 msgid "" ":func:`~time.clock_getres`, :func:`~time.clock_gettime` and :func:`~time." "clock_settime` functions with :samp:`CLOCK_{xxx}` constants. (Contributed by " @@ -3468,35 +3471,35 @@ msgstr "" "clock_settime` 函式帶有 :samp:`CLOCK_{xxx}` 常數。(由 Victor Stinner 在 :" "issue:`10278` 中貢獻。)" -#: ../../whatsnew/3.3.rst:2073 +#: ../../whatsnew/3.3.rst:2075 msgid "" "To improve cross platform consistency, :func:`~time.sleep` now raises a :exc:" "`ValueError` when passed a negative sleep value. Previously this was an " "error on posix, but produced an infinite sleep on Windows." msgstr "" -#: ../../whatsnew/3.3.rst:2079 +#: ../../whatsnew/3.3.rst:2081 msgid "types" msgstr "types" -#: ../../whatsnew/3.3.rst:2081 +#: ../../whatsnew/3.3.rst:2083 msgid "" "Add a new :class:`types.MappingProxyType` class: Read-only proxy of a " "mapping. (:issue:`14386`)" msgstr "" -#: ../../whatsnew/3.3.rst:2085 +#: ../../whatsnew/3.3.rst:2087 msgid "" "The new functions :func:`types.new_class` and :func:`types.prepare_class` " "provide support for :pep:`3115` compliant dynamic type creation. (:issue:" "`14588`)" msgstr "" -#: ../../whatsnew/3.3.rst:2090 +#: ../../whatsnew/3.3.rst:2092 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.3.rst:2092 +#: ../../whatsnew/3.3.rst:2094 msgid "" ":meth:`.assertRaises`, :meth:`.assertRaisesRegex`, :meth:`.assertWarns`, " "and :meth:`.assertWarnsRegex` now accept a keyword argument *msg* when used " @@ -3504,37 +3507,37 @@ msgid "" "issue:`10775`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2097 +#: ../../whatsnew/3.3.rst:2099 msgid "" ":meth:`unittest.TestCase.run` now returns the :class:`~unittest.TestResult` " "object." msgstr "" ":meth:`unittest.TestCase.run` 現在回傳 :class:`~unittest.TestResult` 物件。" -#: ../../whatsnew/3.3.rst:2102 +#: ../../whatsnew/3.3.rst:2104 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.3.rst:2104 +#: ../../whatsnew/3.3.rst:2106 msgid "" "The :class:`~urllib.request.Request` class, now accepts a *method* argument " "used by :meth:`~urllib.request.Request.get_method` to determine what HTTP " "method should be used. For example, this will send a ``'HEAD'`` request::" msgstr "" -#: ../../whatsnew/3.3.rst:2108 +#: ../../whatsnew/3.3.rst:2110 msgid ">>> urlopen(Request('https://www.python.org', method='HEAD'))" msgstr ">>> urlopen(Request('https://www.python.org', method='HEAD'))" -#: ../../whatsnew/3.3.rst:2110 +#: ../../whatsnew/3.3.rst:2112 msgid "(:issue:`1673007`)" msgstr "(:issue:`1673007`)" -#: ../../whatsnew/3.3.rst:2114 +#: ../../whatsnew/3.3.rst:2116 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.3.rst:2116 +#: ../../whatsnew/3.3.rst:2118 msgid "" "The :mod:`webbrowser` module supports more \"browsers\": Google Chrome " "(named :program:`chrome`, :program:`chromium`, :program:`chrome-browser` or :" @@ -3545,11 +3548,11 @@ msgid "" "latter by Matthias Klose in :issue:`14493`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2126 +#: ../../whatsnew/3.3.rst:2128 msgid "xml.etree.ElementTree" msgstr "xml.etree.ElementTree" -#: ../../whatsnew/3.3.rst:2128 +#: ../../whatsnew/3.3.rst:2130 msgid "" "The :mod:`xml.etree.ElementTree` module now imports its C accelerator by " "default; there is no longer a need to explicitly import :mod:`xml.etree." @@ -3560,62 +3563,62 @@ msgid "" "detailed reference." msgstr "" -#: ../../whatsnew/3.3.rst:2138 +#: ../../whatsnew/3.3.rst:2140 msgid "zlib" msgstr "zlib" -#: ../../whatsnew/3.3.rst:2140 +#: ../../whatsnew/3.3.rst:2142 msgid "" "New attribute :attr:`zlib.Decompress.eof` makes it possible to distinguish " "between a properly formed compressed stream and an incomplete or truncated " "one. (Contributed by Nadeem Vawda in :issue:`12646`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2144 +#: ../../whatsnew/3.3.rst:2146 msgid "" "New attribute :const:`zlib.ZLIB_RUNTIME_VERSION` reports the version string " "of the underlying ``zlib`` library that is loaded at runtime. (Contributed " "by Torsten Landschoff in :issue:`12306`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2150 +#: ../../whatsnew/3.3.rst:2152 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.3.rst:2152 +#: ../../whatsnew/3.3.rst:2154 msgid "Major performance enhancements have been added:" msgstr "" -#: ../../whatsnew/3.3.rst:2154 +#: ../../whatsnew/3.3.rst:2156 msgid "" "Thanks to :pep:`393`, some operations on Unicode strings have been optimized:" msgstr "" -#: ../../whatsnew/3.3.rst:2156 +#: ../../whatsnew/3.3.rst:2158 msgid "the memory footprint is divided by 2 to 4 depending on the text" msgstr "" -#: ../../whatsnew/3.3.rst:2157 +#: ../../whatsnew/3.3.rst:2159 msgid "" "encode an ASCII string to UTF-8 doesn't need to encode characters anymore, " "the UTF-8 representation is shared with the ASCII representation" msgstr "" -#: ../../whatsnew/3.3.rst:2159 +#: ../../whatsnew/3.3.rst:2161 msgid "the UTF-8 encoder has been optimized" msgstr "" -#: ../../whatsnew/3.3.rst:2160 +#: ../../whatsnew/3.3.rst:2162 msgid "" "repeating a single ASCII letter and getting a substring of an ASCII string " "is 4 times faster" msgstr "" -#: ../../whatsnew/3.3.rst:2163 +#: ../../whatsnew/3.3.rst:2165 msgid "UTF-8 is now 2x to 4x faster. UTF-16 encoding is now up to 10x faster." msgstr "" -#: ../../whatsnew/3.3.rst:2165 +#: ../../whatsnew/3.3.rst:2167 msgid "" "(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` and :issue:" "`15026`.)" @@ -3623,79 +3626,79 @@ msgstr "" "(由 Serhiy Storchaka 於 :issue:`14624`、:issue:`14738` 和 :issue:`15026` 貢" "獻。)" -#: ../../whatsnew/3.3.rst:2170 +#: ../../whatsnew/3.3.rst:2172 msgid "Build and C API Changes" msgstr "建置和 C API 更改" -#: ../../whatsnew/3.3.rst:2172 +#: ../../whatsnew/3.3.rst:2174 msgid "Changes to Python's build process and to the C API include:" msgstr "Python 建置程序和 C API 的更改包括:" -#: ../../whatsnew/3.3.rst:2174 +#: ../../whatsnew/3.3.rst:2176 msgid "New :pep:`3118` related function:" msgstr "新的 :pep:`3118` 相關功能:" -#: ../../whatsnew/3.3.rst:2176 +#: ../../whatsnew/3.3.rst:2178 msgid ":c:func:`PyMemoryView_FromMemory`" msgstr ":c:func:`PyMemoryView_FromMemory`" -#: ../../whatsnew/3.3.rst:2178 +#: ../../whatsnew/3.3.rst:2180 msgid ":pep:`393` added new Unicode types, macros and functions:" msgstr "" -#: ../../whatsnew/3.3.rst:2180 +#: ../../whatsnew/3.3.rst:2182 msgid "High-level API:" msgstr "高階 API:" -#: ../../whatsnew/3.3.rst:2182 +#: ../../whatsnew/3.3.rst:2184 msgid ":c:func:`PyUnicode_CopyCharacters`" msgstr ":c:func:`PyUnicode_CopyCharacters`" -#: ../../whatsnew/3.3.rst:2183 +#: ../../whatsnew/3.3.rst:2185 msgid ":c:func:`PyUnicode_FindChar`" msgstr ":c:func:`PyUnicode_FindChar`" -#: ../../whatsnew/3.3.rst:2184 +#: ../../whatsnew/3.3.rst:2186 msgid ":c:func:`PyUnicode_GetLength`, :c:macro:`PyUnicode_GET_LENGTH`" msgstr ":c:func:`PyUnicode_GetLength`, :c:macro:`PyUnicode_GET_LENGTH`" -#: ../../whatsnew/3.3.rst:2185 +#: ../../whatsnew/3.3.rst:2187 msgid ":c:func:`PyUnicode_New`" msgstr ":c:func:`PyUnicode_New`" -#: ../../whatsnew/3.3.rst:2186 +#: ../../whatsnew/3.3.rst:2188 msgid ":c:func:`PyUnicode_Substring`" msgstr ":c:func:`PyUnicode_Substring`" -#: ../../whatsnew/3.3.rst:2187 +#: ../../whatsnew/3.3.rst:2189 msgid ":c:func:`PyUnicode_ReadChar`, :c:func:`PyUnicode_WriteChar`" msgstr ":c:func:`PyUnicode_ReadChar`, :c:func:`PyUnicode_WriteChar`" -#: ../../whatsnew/3.3.rst:2189 +#: ../../whatsnew/3.3.rst:2191 msgid "Low-level API:" msgstr "低階 API:" -#: ../../whatsnew/3.3.rst:2191 +#: ../../whatsnew/3.3.rst:2193 msgid ":c:type:`Py_UCS1`, :c:type:`Py_UCS2`, :c:type:`Py_UCS4` types" msgstr ":c:type:`Py_UCS1`、:c:type:`Py_UCS2`、:c:type:`Py_UCS4` 型別" -#: ../../whatsnew/3.3.rst:2192 +#: ../../whatsnew/3.3.rst:2194 msgid ":c:type:`PyASCIIObject` and :c:type:`PyCompactUnicodeObject` structures" msgstr ":c:type:`PyASCIIObject` 和 :c:type:`PyCompactUnicodeObject` 結構" -#: ../../whatsnew/3.3.rst:2193 +#: ../../whatsnew/3.3.rst:2195 msgid ":c:macro:`PyUnicode_READY`" msgstr ":c:macro:`PyUnicode_READY`" -#: ../../whatsnew/3.3.rst:2194 +#: ../../whatsnew/3.3.rst:2196 msgid ":c:func:`PyUnicode_FromKindAndData`" msgstr ":c:func:`PyUnicode_FromKindAndData`" -#: ../../whatsnew/3.3.rst:2195 +#: ../../whatsnew/3.3.rst:2197 msgid ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" msgstr ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" -#: ../../whatsnew/3.3.rst:2196 +#: ../../whatsnew/3.3.rst:2198 msgid "" ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" "`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" @@ -3703,14 +3706,14 @@ msgstr "" ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" "`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" -#: ../../whatsnew/3.3.rst:2198 +#: ../../whatsnew/3.3.rst:2200 msgid "" ":c:macro:`PyUnicode_KIND` with :c:enum:`PyUnicode_Kind` enum: :c:data:`!" "PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`, :c:data:" "`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`" msgstr "" -#: ../../whatsnew/3.3.rst:2201 +#: ../../whatsnew/3.3.rst:2203 msgid "" ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" "`PyUnicode_WRITE`" @@ -3718,11 +3721,11 @@ msgstr "" ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" "`PyUnicode_WRITE`" -#: ../../whatsnew/3.3.rst:2202 +#: ../../whatsnew/3.3.rst:2204 msgid ":c:macro:`PyUnicode_MAX_CHAR_VALUE`" msgstr ":c:macro:`PyUnicode_MAX_CHAR_VALUE`" -#: ../../whatsnew/3.3.rst:2204 +#: ../../whatsnew/3.3.rst:2206 msgid "" ":c:macro:`PyArg_ParseTuple` now accepts a :class:`bytearray` for the ``c`` " "format (:issue:`12380`)." @@ -3730,46 +3733,46 @@ msgstr "" ":c:macro:`PyArg_ParseTuple` 現在接受 :class:`bytearray` 為 ``c`` 格式 (:" "issue:`12380`)。" -#: ../../whatsnew/3.3.rst:2210 +#: ../../whatsnew/3.3.rst:2212 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.3.rst:2213 +#: ../../whatsnew/3.3.rst:2215 msgid "Unsupported Operating Systems" msgstr "不支援的作業系統" -#: ../../whatsnew/3.3.rst:2215 +#: ../../whatsnew/3.3.rst:2217 msgid "OS/2 and VMS are no longer supported due to the lack of a maintainer." msgstr "由於缺乏維護者,OS/2 和 VMS 不再受支援。" -#: ../../whatsnew/3.3.rst:2217 +#: ../../whatsnew/3.3.rst:2219 msgid "" "Windows 2000 and Windows platforms which set ``COMSPEC`` to ``command.com`` " "are no longer supported due to maintenance burden." msgstr "" -#: ../../whatsnew/3.3.rst:2220 +#: ../../whatsnew/3.3.rst:2222 msgid "OSF support, which was deprecated in 3.2, has been completely removed." msgstr "OSF 支援在 3.2 中已棄用,現已完全刪除。" -#: ../../whatsnew/3.3.rst:2224 +#: ../../whatsnew/3.3.rst:2226 msgid "Deprecated Python modules, functions and methods" msgstr "已棄用的 Python 模組、函式和方法" -#: ../../whatsnew/3.3.rst:2226 +#: ../../whatsnew/3.3.rst:2228 msgid "" "Passing a non-empty string to ``object.__format__()`` is deprecated, and " "will produce a :exc:`TypeError` in Python 3.4 (:issue:`9856`)." msgstr "" -#: ../../whatsnew/3.3.rst:2228 +#: ../../whatsnew/3.3.rst:2230 msgid "" "The ``unicode_internal`` codec has been deprecated because of the :pep:" "`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-be``), or UTF-32 " "(``utf-32-le`` or ``utf-32-be``)" msgstr "" -#: ../../whatsnew/3.3.rst:2231 +#: ../../whatsnew/3.3.rst:2233 msgid "" ":meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: use :meth:`ftplib.FTP." "mlsd`" @@ -3777,7 +3780,7 @@ msgstr "" ":meth:`ftplib.FTP.nlst` 和 :meth:`ftplib.FTP.dir`:使用 :meth:`ftplib.FTP." "mlsd`" -#: ../../whatsnew/3.3.rst:2233 +#: ../../whatsnew/3.3.rst:2235 msgid "" ":func:`platform.popen`: use the :mod:`subprocess` module. Check especially " "the :ref:`subprocess-replacements` section (:issue:`11377`)." @@ -3785,39 +3788,39 @@ msgstr "" ":func:`platform.popen`:使用 :mod:`subprocess` 模組。請特別檢查 :ref:" "`subprocess-replacements` 部分 (:issue:`11377`)。" -#: ../../whatsnew/3.3.rst:2235 +#: ../../whatsnew/3.3.rst:2237 msgid "" ":issue:`13374`: The Windows bytes API has been deprecated in the :mod:`os` " "module. Use Unicode filenames, instead of bytes filenames, to not depend on " "the ANSI code page anymore and to support any filename." msgstr "" -#: ../../whatsnew/3.3.rst:2238 +#: ../../whatsnew/3.3.rst:2240 msgid "" ":issue:`13988`: The :mod:`xml.etree.cElementTree` module is deprecated. The " "accelerator is used automatically whenever available." msgstr "" -#: ../../whatsnew/3.3.rst:2240 +#: ../../whatsnew/3.3.rst:2242 msgid "" "The behaviour of :func:`time.clock` depends on the platform: use the new :" "func:`time.perf_counter` or :func:`time.process_time` function instead, " "depending on your requirements, to have a well defined behaviour." msgstr "" -#: ../../whatsnew/3.3.rst:2243 +#: ../../whatsnew/3.3.rst:2245 msgid "The :func:`os.stat_float_times` function is deprecated." msgstr ":func:`os.stat_float_times` 函式已棄用。" -#: ../../whatsnew/3.3.rst:2244 +#: ../../whatsnew/3.3.rst:2246 msgid ":mod:`abc` module:" msgstr ":mod:`abc` 模組:" -#: ../../whatsnew/3.3.rst:2253 +#: ../../whatsnew/3.3.rst:2255 msgid ":mod:`importlib` package:" msgstr ":mod:`importlib` 套件:" -#: ../../whatsnew/3.3.rst:2255 +#: ../../whatsnew/3.3.rst:2257 msgid "" ":meth:`importlib.abc.SourceLoader.path_mtime` is now deprecated in favour " "of :meth:`importlib.abc.SourceLoader.path_stats` as bytecode files now store " @@ -3825,11 +3828,11 @@ msgid "" "compiled from." msgstr "" -#: ../../whatsnew/3.3.rst:2265 +#: ../../whatsnew/3.3.rst:2267 msgid "Deprecated functions and types of the C API" msgstr "C API 中已棄用的函式和型別" -#: ../../whatsnew/3.3.rst:2267 +#: ../../whatsnew/3.3.rst:2269 msgid "" "The :c:type:`Py_UNICODE` has been deprecated by :pep:`393` and will be " "removed in Python 4. All functions using this type are deprecated:" @@ -3837,13 +3840,13 @@ msgstr "" ":c:type:`Py_UNICODE` 已被 :pep:`393` 棄用,並將在 Python 4 中刪除。所有使用此" "型別的函式均已棄用:" -#: ../../whatsnew/3.3.rst:2270 +#: ../../whatsnew/3.3.rst:2272 msgid "" "Unicode functions and methods using :c:type:`Py_UNICODE` and :c:expr:" "`Py_UNICODE*` types:" msgstr "" -#: ../../whatsnew/3.3.rst:2273 +#: ../../whatsnew/3.3.rst:2275 msgid "" ":c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` or :" "c:func:`PyUnicode_FromKindAndData`" @@ -3851,7 +3854,7 @@ msgstr "" ":c:macro:`!PyUnicode_FromUnicode`:使用 :c:func:`PyUnicode_FromWideChar` 或 :" "c:func:`PyUnicode_FromKindAndData`" -#: ../../whatsnew/3.3.rst:2275 +#: ../../whatsnew/3.3.rst:2277 msgid "" ":c:macro:`!PyUnicode_AS_UNICODE`, :c:func:`!PyUnicode_AsUnicode`, :c:func:`!" "PyUnicode_AsUnicodeAndSize`: use :c:func:`PyUnicode_AsWideCharString`" @@ -3859,7 +3862,7 @@ msgstr "" ":c:macro:`!PyUnicode_AS_UNICODE`、:c:func:`!PyUnicode_AsUnicode`、:c:func:`!" "PyUnicode_AsUnicodeAndSize`:使用 :c:func:`PyUnicode_AsWideCharString`" -#: ../../whatsnew/3.3.rst:2277 +#: ../../whatsnew/3.3.rst:2279 msgid "" ":c:macro:`!PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` with :c:macro:" "`PyUnicode_READ` and :c:macro:`PyUnicode_WRITE`" @@ -3867,7 +3870,7 @@ msgstr "" ":c:macro:`!PyUnicode_AS_DATA`:將 :c:macro:`PyUnicode_DATA` 與 :c:macro:" "`PyUnicode_READ` 和 :c:macro:`PyUnicode_WRITE` 一起使用" -#: ../../whatsnew/3.3.rst:2279 +#: ../../whatsnew/3.3.rst:2281 msgid "" ":c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!PyUnicode_GetSize`: use :c:macro:" "`PyUnicode_GET_LENGTH` or :c:func:`PyUnicode_GetLength`" @@ -3875,7 +3878,7 @@ msgstr "" ":c:macro:`!PyUnicode_GET_SIZE`、:c:func:`!PyUnicode_GetSize`:使用 :c:macro:" "`PyUnicode_GET_LENGTH` 或 :c:func:`PyUnicode_GetLength`" -#: ../../whatsnew/3.3.rst:2281 +#: ../../whatsnew/3.3.rst:2283 msgid "" ":c:macro:`!PyUnicode_GET_DATA_SIZE`: use ``PyUnicode_GET_LENGTH(str) * " "PyUnicode_KIND(str)`` (only work on ready strings)" @@ -3883,7 +3886,7 @@ msgstr "" ":c:macro:`!PyUnicode_GET_DATA_SIZE`:使用 ``PyUnicode_GET_LENGTH(str) * " "PyUnicode_KIND(str)``\\ (僅適用於準備好的字串)" -#: ../../whatsnew/3.3.rst:2284 +#: ../../whatsnew/3.3.rst:2286 msgid "" ":c:func:`!PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` or :c:" "func:`PyUnicode_AsWideCharString`" @@ -3891,15 +3894,15 @@ msgstr "" ":c:func:`!PyUnicode_AsUnicodeCopy`:使用 :c:func:`PyUnicode_AsUCS4Copy` 或 :" "c:func:`PyUnicode_AsWideCharString`" -#: ../../whatsnew/3.3.rst:2286 +#: ../../whatsnew/3.3.rst:2288 msgid ":c:func:`!PyUnicode_GetMax`" msgstr ":c:func:`!PyUnicode_GetMax`" -#: ../../whatsnew/3.3.rst:2289 +#: ../../whatsnew/3.3.rst:2291 msgid "Functions and macros manipulating Py_UNICODE* strings:" msgstr "操作 Py_UNICODE* 字串的函式和巨集:" -#: ../../whatsnew/3.3.rst:2291 +#: ../../whatsnew/3.3.rst:2293 msgid "" ":c:macro:`!Py_UNICODE_strlen()`: use :c:func:`PyUnicode_GetLength` or :c:" "macro:`PyUnicode_GET_LENGTH`" @@ -3907,7 +3910,7 @@ msgstr "" ":c:macro:`!Py_UNICODE_strlen()`:使用 :c:func:`PyUnicode_GetLength` 或 :c:" "macro:`PyUnicode_GET_LENGTH`" -#: ../../whatsnew/3.3.rst:2293 +#: ../../whatsnew/3.3.rst:2295 msgid "" ":c:macro:`!Py_UNICODE_strcat()`: use :c:func:`PyUnicode_CopyCharacters` or :" "c:func:`PyUnicode_FromFormat`" @@ -3915,7 +3918,7 @@ msgstr "" ":c:macro:`!Py_UNICODE_strcat()`:使用 :c:func:`PyUnicode_CopyCharacters` 或 :" "c:func:`PyUnicode_FromFormat`" -#: ../../whatsnew/3.3.rst:2295 +#: ../../whatsnew/3.3.rst:2297 msgid "" ":c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!Py_UNICODE_strncpy()`, :c:macro:" "`!Py_UNICODE_COPY()`: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" @@ -3925,15 +3928,15 @@ msgstr "" "`!Py_UNICODE_COPY()`:使用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:" "`PyUnicode_Substring`" -#: ../../whatsnew/3.3.rst:2298 +#: ../../whatsnew/3.3.rst:2300 msgid ":c:macro:`!Py_UNICODE_strcmp()`: use :c:func:`PyUnicode_Compare`" msgstr ":c:macro:`!Py_UNICODE_strcmp()`:使用 :c:func:`PyUnicode_Compare`" -#: ../../whatsnew/3.3.rst:2299 +#: ../../whatsnew/3.3.rst:2301 msgid ":c:macro:`!Py_UNICODE_strncmp()`: use :c:func:`PyUnicode_Tailmatch`" msgstr ":c:macro:`!Py_UNICODE_strncmp()`: 使用 :c:func:`PyUnicode_Tailmatch`" -#: ../../whatsnew/3.3.rst:2300 +#: ../../whatsnew/3.3.rst:2302 msgid "" ":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: use :c:" "func:`PyUnicode_FindChar`" @@ -3941,27 +3944,27 @@ msgstr "" ":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: 使用 :c:" "func:`PyUnicode_FindChar`" -#: ../../whatsnew/3.3.rst:2302 +#: ../../whatsnew/3.3.rst:2304 msgid ":c:macro:`!Py_UNICODE_FILL()`: use :c:func:`PyUnicode_Fill`" msgstr ":c:macro:`!Py_UNICODE_FILL()`: 使用 :c:func:`PyUnicode_Fill`" -#: ../../whatsnew/3.3.rst:2303 +#: ../../whatsnew/3.3.rst:2305 msgid ":c:macro:`!Py_UNICODE_MATCH`" msgstr ":c:macro:`!Py_UNICODE_MATCH`" -#: ../../whatsnew/3.3.rst:2305 +#: ../../whatsnew/3.3.rst:2307 msgid "Encoders:" msgstr "編碼器:" -#: ../../whatsnew/3.3.rst:2307 +#: ../../whatsnew/3.3.rst:2309 msgid ":c:func:`!PyUnicode_Encode`: use :c:func:`!PyUnicode_AsEncodedObject`" msgstr ":c:func:`!PyUnicode_Encode`:使用 :c:func:`!PyUnicode_AsEncodedObject`" -#: ../../whatsnew/3.3.rst:2308 +#: ../../whatsnew/3.3.rst:2310 msgid ":c:func:`!PyUnicode_EncodeUTF7`" msgstr ":c:func:`!PyUnicode_EncodeUTF7`" -#: ../../whatsnew/3.3.rst:2309 +#: ../../whatsnew/3.3.rst:2311 msgid "" ":c:func:`!PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` or :c:func:" "`PyUnicode_AsUTF8String`" @@ -3969,15 +3972,15 @@ msgstr "" ":c:func:`!PyUnicode_EncodeUTF8`:使用 :c:func:`PyUnicode_AsUTF8` 或 :c:func:" "`PyUnicode_AsUTF8String`" -#: ../../whatsnew/3.3.rst:2311 +#: ../../whatsnew/3.3.rst:2313 msgid ":c:func:`!PyUnicode_EncodeUTF32`" msgstr ":c:func:`!PyUnicode_EncodeUTF32`" -#: ../../whatsnew/3.3.rst:2312 +#: ../../whatsnew/3.3.rst:2314 msgid ":c:func:`!PyUnicode_EncodeUTF16`" msgstr ":c:func:`!PyUnicode_EncodeUTF16`" -#: ../../whatsnew/3.3.rst:2313 +#: ../../whatsnew/3.3.rst:2315 msgid "" ":c:func:`!PyUnicode_EncodeUnicodeEscape` use :c:func:" "`PyUnicode_AsUnicodeEscapeString`" @@ -3985,7 +3988,7 @@ msgstr "" ":c:func:`!PyUnicode_EncodeUnicodeEscape` 使用 :c:func:" "`PyUnicode_AsUnicodeEscapeString`" -#: ../../whatsnew/3.3.rst:2315 +#: ../../whatsnew/3.3.rst:2317 msgid "" ":c:func:`!PyUnicode_EncodeRawUnicodeEscape` use :c:func:" "`PyUnicode_AsRawUnicodeEscapeString`" @@ -3993,26 +3996,26 @@ msgstr "" ":c:func:`!PyUnicode_EncodeRawUnicodeEscape` 使用 :c:func:" "`PyUnicode_AsRawUnicodeEscapeString`" -#: ../../whatsnew/3.3.rst:2317 +#: ../../whatsnew/3.3.rst:2319 msgid "" ":c:func:`!PyUnicode_EncodeLatin1`: use :c:func:`PyUnicode_AsLatin1String`" msgstr "" ":c:func:`!PyUnicode_EncodeLatin1`: 使用 :c:func:`PyUnicode_AsLatin1String`" -#: ../../whatsnew/3.3.rst:2318 +#: ../../whatsnew/3.3.rst:2320 msgid ":c:func:`!PyUnicode_EncodeASCII`: use :c:func:`PyUnicode_AsASCIIString`" msgstr "" ":c:func:`!PyUnicode_EncodeASCII`:使用 :c:func:`PyUnicode_AsASCIIString`" -#: ../../whatsnew/3.3.rst:2319 +#: ../../whatsnew/3.3.rst:2321 msgid ":c:func:`!PyUnicode_EncodeCharmap`" msgstr ":c:func:`!PyUnicode_EncodeCharmap`" -#: ../../whatsnew/3.3.rst:2320 +#: ../../whatsnew/3.3.rst:2322 msgid ":c:func:`!PyUnicode_TranslateCharmap`" msgstr ":c:func:`!PyUnicode_TranslateCharmap`" -#: ../../whatsnew/3.3.rst:2321 +#: ../../whatsnew/3.3.rst:2323 msgid "" ":c:func:`!PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` or :c:" "func:`PyUnicode_EncodeCodePage` (with ``CP_ACP`` code_page)" @@ -4020,7 +4023,7 @@ msgstr "" ":c:func:`!PyUnicode_EncodeMBCS`:使用 :c:func:`PyUnicode_AsMBCSString` 或 :c:" "func:`PyUnicode_EncodeCodePage` (帶有 ``CP_ACP`` code_page)" -#: ../../whatsnew/3.3.rst:2323 +#: ../../whatsnew/3.3.rst:2325 msgid "" ":c:func:`!PyUnicode_EncodeDecimal`, :c:func:`!" "PyUnicode_TransformDecimalToASCII`" @@ -4028,38 +4031,38 @@ msgstr "" ":c:func:`!PyUnicode_EncodeDecimal`、:c:func:`!" "PyUnicode_TransformDecimalToASCII`" -#: ../../whatsnew/3.3.rst:2328 +#: ../../whatsnew/3.3.rst:2330 msgid "Deprecated features" msgstr "已棄用的功能" -#: ../../whatsnew/3.3.rst:2330 +#: ../../whatsnew/3.3.rst:2332 msgid "" "The :mod:`array` module's ``'u'`` format code is now deprecated and will be " "removed in Python 4 together with the rest of the (:c:type:`Py_UNICODE`) API." msgstr "" -#: ../../whatsnew/3.3.rst:2335 +#: ../../whatsnew/3.3.rst:2337 msgid "Porting to Python 3.3" msgstr "移植到 Python 3.3" -#: ../../whatsnew/3.3.rst:2337 +#: ../../whatsnew/3.3.rst:2339 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "本節列出了前面描述的更改以及可能需要你更改程式碼的其他錯誤修復。" -#: ../../whatsnew/3.3.rst:2343 +#: ../../whatsnew/3.3.rst:2345 msgid "Porting Python code" msgstr "移植 Python 程式碼" -#: ../../whatsnew/3.3.rst:2345 +#: ../../whatsnew/3.3.rst:2347 msgid "" "Hash randomization is enabled by default. Set the :envvar:`PYTHONHASHSEED` " "environment variable to ``0`` to disable hash randomization. See also the :" "meth:`object.__hash__` method." msgstr "" -#: ../../whatsnew/3.3.rst:2349 +#: ../../whatsnew/3.3.rst:2351 msgid "" ":issue:`12326`: On Linux, sys.platform doesn't contain the major version " "anymore. It is now always 'linux', instead of 'linux2' or 'linux3' depending " @@ -4068,7 +4071,7 @@ msgid "" "if you don't need to support older Python versions." msgstr "" -#: ../../whatsnew/3.3.rst:2355 +#: ../../whatsnew/3.3.rst:2357 msgid "" ":issue:`13847`, :issue:`14180`: :mod:`time` and :mod:`datetime`: :exc:" "`OverflowError` is now raised instead of :exc:`ValueError` if a timestamp is " @@ -4076,7 +4079,7 @@ msgid "" "or :c:func:`localtime` failed." msgstr "" -#: ../../whatsnew/3.3.rst:2360 +#: ../../whatsnew/3.3.rst:2362 msgid "" "The default finders used by import now utilize a cache of what is contained " "within a specific directory. If you create a Python source file or " @@ -4085,7 +4088,7 @@ msgid "" "file." msgstr "" -#: ../../whatsnew/3.3.rst:2365 +#: ../../whatsnew/3.3.rst:2367 msgid "" ":exc:`ImportError` now uses the full name of the module that was attempted " "to be imported. Doctests that check ImportErrors' message will need to be " @@ -4093,7 +4096,7 @@ msgid "" "name." msgstr "" -#: ../../whatsnew/3.3.rst:2370 +#: ../../whatsnew/3.3.rst:2372 msgid "" "The *index* argument to :func:`__import__` now defaults to 0 instead of -1 " "and no longer support negative values. It was an oversight when :pep:`328` " @@ -4104,20 +4107,20 @@ msgid "" "import_module` rather than call :func:`__import__` directly." msgstr "" -#: ../../whatsnew/3.3.rst:2378 +#: ../../whatsnew/3.3.rst:2380 msgid "" ":func:`__import__` no longer allows one to use an index value other than 0 " "for top-level modules. E.g. ``__import__('sys', level=1)`` is now an error." msgstr "" -#: ../../whatsnew/3.3.rst:2381 +#: ../../whatsnew/3.3.rst:2383 msgid "" "Because :data:`sys.meta_path` and :data:`sys.path_hooks` now have finders on " "them by default, you will most likely want to use :meth:`list.insert` " "instead of :meth:`list.append` to add to those lists." msgstr "" -#: ../../whatsnew/3.3.rst:2385 +#: ../../whatsnew/3.3.rst:2387 msgid "" "Because ``None`` is now inserted into :data:`sys.path_importer_cache`, if " "you are clearing out entries in the dictionary of paths that do not have a " @@ -4128,7 +4131,7 @@ msgid "" "finders, but semantically it should not change anything." msgstr "" -#: ../../whatsnew/3.3.rst:2393 +#: ../../whatsnew/3.3.rst:2395 msgid "" ":class:`!importlib.abc.Finder` no longer specifies a ``find_module()`` " "abstract method that must be implemented. If you were relying on subclasses " @@ -4137,7 +4140,7 @@ msgid "" "in the case of working with :term:`path entry finders `." msgstr "" -#: ../../whatsnew/3.3.rst:2399 +#: ../../whatsnew/3.3.rst:2401 msgid "" ":mod:`pkgutil` has been converted to use :mod:`importlib` internally. This " "eliminates many edge cases where the old behaviour of the :pep:`302` import " @@ -4148,7 +4151,7 @@ msgid "" "do not provide the non-standard ``iter_modules()`` method." msgstr "" -#: ../../whatsnew/3.3.rst:2407 +#: ../../whatsnew/3.3.rst:2409 msgid "" "A longstanding RFC-compliance bug (:issue:`1079`) in the parsing done by :" "func:`email.header.decode_header` has been fixed. Code that uses the " @@ -4162,7 +4165,7 @@ msgid "" "already present in the input strings." msgstr "" -#: ../../whatsnew/3.3.rst:2418 +#: ../../whatsnew/3.3.rst:2420 msgid "" ":func:`email.utils.formataddr` now does the correct content transfer " "encoding when passed non-``ASCII`` display names. Any code that depended on " @@ -4170,7 +4173,7 @@ msgid "" "formatted output string will need to be changed (:issue:`1690608`)." msgstr "" -#: ../../whatsnew/3.3.rst:2423 +#: ../../whatsnew/3.3.rst:2425 msgid "" ":meth:`poplib.POP3.quit` may now raise protocol errors like all other " "``poplib`` methods. Code that assumes ``quit`` does not raise :exc:`poplib." @@ -4178,7 +4181,7 @@ msgid "" "encountered by a particular application (:issue:`11291`)." msgstr "" -#: ../../whatsnew/3.3.rst:2428 +#: ../../whatsnew/3.3.rst:2430 msgid "" "The ``strict`` argument to :class:`email.parser.Parser`, deprecated since " "Python 2.4, has finally been removed." @@ -4186,51 +4189,51 @@ msgstr "" "自 Python 2.4 以來已棄用的 :class:`email.parser.Parser` 的 ``strict`` 引數終" "於被刪除了。" -#: ../../whatsnew/3.3.rst:2431 +#: ../../whatsnew/3.3.rst:2433 msgid "" "The deprecated method ``unittest.TestCase.assertSameElements`` has been " "removed." msgstr "已棄用的方法 ``unittest.TestCase.assertSameElements`` 已被刪除。" -#: ../../whatsnew/3.3.rst:2434 +#: ../../whatsnew/3.3.rst:2436 msgid "The deprecated variable ``time.accept2dyear`` has been removed." msgstr "已棄用的變數 ``time.accept2dyear`` 已被刪除。" -#: ../../whatsnew/3.3.rst:2436 +#: ../../whatsnew/3.3.rst:2438 msgid "" "The deprecated ``Context._clamp`` attribute has been removed from the :mod:" "`decimal` module. It was previously replaced by the public attribute :attr:" "`~decimal.Context.clamp`. (See :issue:`8540`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2440 +#: ../../whatsnew/3.3.rst:2442 msgid "" "The undocumented internal helper class ``SSLFakeFile`` has been removed " "from :mod:`smtplib`, since its functionality has long been provided directly " "by :meth:`socket.socket.makefile`." msgstr "" -#: ../../whatsnew/3.3.rst:2444 +#: ../../whatsnew/3.3.rst:2446 msgid "" "Passing a negative value to :func:`time.sleep` on Windows now raises an " "error instead of sleeping forever. It has always raised an error on posix." msgstr "" -#: ../../whatsnew/3.3.rst:2447 +#: ../../whatsnew/3.3.rst:2449 msgid "" "The ``ast.__version__`` constant has been removed. If you need to make " "decisions affected by the AST version, use :data:`sys.version_info` to make " "the decision." msgstr "" -#: ../../whatsnew/3.3.rst:2451 +#: ../../whatsnew/3.3.rst:2453 msgid "" "Code that used to work around the fact that the :mod:`threading` module used " "factory functions by subclassing the private classes will need to change to " "subclass the now-public classes." msgstr "" -#: ../../whatsnew/3.3.rst:2455 +#: ../../whatsnew/3.3.rst:2457 msgid "" "The undocumented debugging machinery in the threading module has been " "removed, simplifying the code. This should have no effect on production " @@ -4238,24 +4241,24 @@ msgid "" "interacting with it (:issue:`13550`)." msgstr "" -#: ../../whatsnew/3.3.rst:2462 +#: ../../whatsnew/3.3.rst:2464 msgid "Porting C code" msgstr "" -#: ../../whatsnew/3.3.rst:2464 +#: ../../whatsnew/3.3.rst:2466 msgid "" "In the course of changes to the buffer API the undocumented :c:member:`!" "smalltable` member of the :c:type:`Py_buffer` structure has been removed and " "the layout of the :c:type:`PyMemoryViewObject` has changed." msgstr "" -#: ../../whatsnew/3.3.rst:2469 +#: ../../whatsnew/3.3.rst:2471 msgid "" "All extensions relying on the relevant parts in ``memoryobject.h`` or " "``object.h`` must be rebuilt." msgstr "" -#: ../../whatsnew/3.3.rst:2472 +#: ../../whatsnew/3.3.rst:2474 msgid "" "Due to :ref:`PEP 393 `, the :c:type:`Py_UNICODE` type and all " "functions using this type are deprecated (but will stay available for at " @@ -4265,7 +4268,7 @@ msgid "" "doc:`Unicode API <../c-api/unicode>`." msgstr "" -#: ../../whatsnew/3.3.rst:2479 +#: ../../whatsnew/3.3.rst:2481 msgid "" "However, if you only have been using high-level functions such as :c:func:" "`PyUnicode_Concat()`, :c:func:`PyUnicode_Join` or :c:func:" @@ -4273,11 +4276,11 @@ msgid "" "new unicode representations." msgstr "" -#: ../../whatsnew/3.3.rst:2484 +#: ../../whatsnew/3.3.rst:2486 msgid ":c:func:`PyImport_GetMagicNumber` now returns ``-1`` upon failure." msgstr ":c:func:`PyImport_GetMagicNumber` 現在在失敗時回傳 ``-1``。" -#: ../../whatsnew/3.3.rst:2486 +#: ../../whatsnew/3.3.rst:2488 msgid "" "As a negative value for the *level* argument to :func:`__import__` is no " "longer valid, the same now holds for :c:func:`PyImport_ImportModuleLevel`. " @@ -4285,11 +4288,11 @@ msgid "" "`PyImport_ImportModuleEx` is now ``0`` instead of ``-1``." msgstr "" -#: ../../whatsnew/3.3.rst:2493 +#: ../../whatsnew/3.3.rst:2495 msgid "Building C extensions" msgstr "" -#: ../../whatsnew/3.3.rst:2495 +#: ../../whatsnew/3.3.rst:2497 msgid "" "The range of possible file names for C extensions has been narrowed. Very " "rarely used spellings have been suppressed: under POSIX, files named " @@ -4299,32 +4302,32 @@ msgid "" "remove the ``module`` string from the file names)." msgstr "" -#: ../../whatsnew/3.3.rst:2503 +#: ../../whatsnew/3.3.rst:2505 msgid "(implemented in :issue:`14040`.)" msgstr "(於 :issue:`14040` 中實作。)" -#: ../../whatsnew/3.3.rst:2507 +#: ../../whatsnew/3.3.rst:2509 msgid "Command Line Switch Changes" msgstr "命令列開關更改" -#: ../../whatsnew/3.3.rst:2509 +#: ../../whatsnew/3.3.rst:2511 msgid "" "The -Q command-line flag and related artifacts have been removed. Code " "checking sys.flags.division_warning will need updating." msgstr "" -#: ../../whatsnew/3.3.rst:2512 +#: ../../whatsnew/3.3.rst:2514 msgid "(:issue:`10998`, contributed by Éric Araujo.)" msgstr "(由 Éric Araujo 於 :issue:`10998` 中實作。)" -#: ../../whatsnew/3.3.rst:2514 +#: ../../whatsnew/3.3.rst:2516 msgid "" "When :program:`python` is started with :option:`-S`, ``import site`` will no " "longer add site-specific paths to the module search paths. In previous " "versions, it did." msgstr "" -#: ../../whatsnew/3.3.rst:2518 +#: ../../whatsnew/3.3.rst:2520 msgid "" "(:issue:`11591`, contributed by Carl Meyer with editions by Éric Araujo.)" msgstr "(:issue:`11591`,由 Carl Meyer 貢獻並由 Éric Araujo 修訂。)" diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 49ff4555d8..8323096a63 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -35,14 +35,17 @@ msgid "" "Python 3.4 was released on March 16, 2014. For full details, see the " "`changelog `_." msgstr "" +"本文介紹了 Python 3.4 與 3.3 相比多了哪些新功能。Python 3.1 已於 2014 年 3 " +"月 16 日發布。完整詳情請見 `changelog `_。" #: ../../whatsnew/3.4.rst:70 msgid ":pep:`429` -- Python 3.4 Release Schedule" -msgstr "" +msgstr ":pep:`429` - Python 3.4 發佈時程" #: ../../whatsnew/3.4.rst:75 msgid "Summary -- Release Highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.4.rst:80 msgid "New syntax features:" @@ -279,7 +282,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:175 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.4.rst:180 msgid "PEP 453: Explicit Bootstrapping of PIP in Python Installations" @@ -3216,7 +3219,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:2239 msgid "Porting to Python 3.4" -msgstr "" +msgstr "移植至 Python 3.4" #: ../../whatsnew/3.4.rst:2241 msgid "" diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 00e2e09a2f..43c8937a1d 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,14 +37,17 @@ msgid "" "Python 3.5 was released on September 13, 2015.  See the `changelog `_ for a full list of changes." msgstr "" +"本文介紹了 Python 3.5 與 3.4 相比多了哪些新功能。Python 3.1 已於 2015 年 9 " +"月 13 日發布。完整詳情請見 `changelog `_。" #: ../../whatsnew/3.5.rst:54 msgid ":pep:`478` - Python 3.5 Release Schedule" -msgstr "" +msgstr ":pep:`478` - Python 3.5 發佈時程" #: ../../whatsnew/3.5.rst:58 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.5.rst:60 msgid "New syntax features:" @@ -143,7 +146,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:110 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.5.rst:112 msgid "" @@ -223,7 +226,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:163 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.5.rst:168 msgid "PEP 492 - Coroutines with async and await syntax" @@ -3694,7 +3697,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:2377 msgid "Porting to Python 3.5" -msgstr "" +msgstr "移植至 Python 3.5" #: ../../whatsnew/3.5.rst:2379 msgid "" @@ -3927,10 +3930,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:2529 msgid "" -"Because the lack of the :attr:`__module__` attribute breaks pickling and " -"introspection, a deprecation warning is now raised for builtin types without " -"the :attr:`__module__` attribute. This would be an AttributeError in the " -"future. (Contributed by Serhiy Storchaka in :issue:`20204`.)" +"Because the lack of the :attr:`~type.__module__` attribute breaks pickling " +"and introspection, a deprecation warning is now raised for builtin types " +"without the :attr:`~type.__module__` attribute. This will be an :exc:" +"`AttributeError` in the future. (Contributed by Serhiy Storchaka in :issue:" +"`20204`.)" msgstr "" #: ../../whatsnew/3.5.rst:2535 diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index e3ad5e1ef2..53d989f8b5 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -32,14 +32,17 @@ msgid "" "Python 3.6 was released on December 23, 2016.  See the `changelog `_ for a full list of changes." msgstr "" +"本文介紹了 Python 3.6 與 3.5 相比多了哪些新功能。Python 3.6 已於 2016 年 12 " +"月 23 日發布。完整詳情請見 `changelog `_。" #: ../../whatsnew/3.6.rst:54 msgid ":pep:`494` - Python 3.6 Release Schedule" -msgstr "" +msgstr ":pep:`494` - Python 3.6 發佈時程" #: ../../whatsnew/3.6.rst:58 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.6.rst:60 msgid "New syntax features:" @@ -121,7 +124,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:105 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.6.rst:107 msgid "" @@ -234,7 +237,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:176 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.6.rst:181 msgid "PEP 498: Formatted string literals" @@ -771,7 +774,7 @@ msgstr "" msgid "" "Attributes in a class definition body have a natural ordering: the same " "order in which the names appear in the source. This order is now preserved " -"in the new class's :attr:`~object.__dict__` attribute." +"in the new class's :attr:`~type.__dict__` attribute." msgstr "" #: ../../whatsnew/3.6.rst:554 @@ -1368,9 +1371,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:935 msgid "" "The :func:`~collections.namedtuple` function now accepts an optional keyword " -"argument *module*, which, when specified, is used for the ``__module__`` " -"attribute of the returned named tuple class. (Contributed by Raymond " -"Hettinger in :issue:`17941`.)" +"argument *module*, which, when specified, is used for the :attr:`~type." +"__module__` attribute of the returned named tuple class. (Contributed by " +"Raymond Hettinger in :issue:`17941`.)" msgstr "" #: ../../whatsnew/3.6.rst:940 ../../whatsnew/3.6.rst:2295 @@ -3130,7 +3133,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:2142 msgid "Porting to Python 3.6" -msgstr "" +msgstr "移植至 Python 3.6" #: ../../whatsnew/3.6.rst:2144 msgid "" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 2d895c796f..c9c6896a50 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -32,10 +32,12 @@ msgid "" "Python 3.7 was released on June 27, 2018. For full details, see the :ref:" "`changelog `." msgstr "" +"本文介紹了 Python 3.7 與 3.6 相比多了哪些新功能。Python 3.7 已於 2018 年 6 " +"月 27 日發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" #: ../../whatsnew/3.7.rst:53 msgid "Summary -- Release Highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.7.rst:58 msgid "New syntax features:" @@ -73,7 +75,7 @@ msgstr ":ref:`whatsnew37_importlib_resources`" #: ../../whatsnew/3.7.rst:72 msgid "New built-in features:" -msgstr "" +msgstr "新的內建功能:" #: ../../whatsnew/3.7.rst:74 msgid "" @@ -82,7 +84,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:76 msgid "Python data model improvements:" -msgstr "" +msgstr "Python 資料模型改進:" #: ../../whatsnew/3.7.rst:78 msgid "" @@ -105,7 +107,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:90 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.7.rst:92 msgid "" @@ -186,7 +188,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:128 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.7.rst:133 msgid "PEP 563: Postponed Evaluation of Annotations" @@ -3181,7 +3183,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:2230 msgid "Porting to Python 3.7" -msgstr "" +msgstr "移植至 Python 3.7" #: ../../whatsnew/3.7.rst:2232 msgid "" diff --git a/whatsnew/3.8.po b/whatsnew/3.8.po index 5603747792..ca437cad1c 100644 --- a/whatsnew/3.8.po +++ b/whatsnew/3.8.po @@ -35,14 +35,16 @@ msgid "" "Python 3.8 was released on October 14, 2019. For full details, see the :ref:" "`changelog `." msgstr "" +"本文介紹了 Python 3.8 與 3.7 相比多了哪些新功能。Python 3.8 已於 2019 年 10 " +"月 14 日發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" #: ../../whatsnew/3.8.rst:61 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.8.rst:72 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.8.rst:75 msgid "Assignment expressions" @@ -2869,7 +2871,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:1809 msgid "Porting to Python 3.8" -msgstr "" +msgstr "移植至 Python 3.8" #: ../../whatsnew/3.8.rst:1811 msgid "" diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index 96ce53c7f5..4c88343623 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,14 +35,16 @@ msgid "" "Python 3.9 was released on October 5, 2020. For full details, see the :ref:" "`changelog `." msgstr "" +"本文介紹了 Python 3.9 與 3.8 相比多了哪些新功能。Python 3.9 已於 2020 年 10 " +"月 5 日發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" #: ../../whatsnew/3.9.rst:51 msgid ":pep:`596` - Python 3.9 Release Schedule" -msgstr "" +msgstr ":pep:`596` - Python 3.9 發佈時程" #: ../../whatsnew/3.9.rst:55 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.9.rst:60 msgid "New syntax features:" @@ -62,7 +64,7 @@ msgstr "" #: ../../whatsnew/3.9.rst:66 msgid "New built-in features:" -msgstr "" +msgstr "新的內建功能:" #: ../../whatsnew/3.9.rst:68 msgid ":pep:`616`, string methods to remove prefixes and suffixes." @@ -198,9 +200,9 @@ msgid "" "Python as well. Consult the :ref:`removed-in-python-39` section." msgstr "" -#: ../../whatsnew/3.9.rst:140 ../../whatsnew/3.9.rst:1270 +#: ../../whatsnew/3.9.rst:140 ../../whatsnew/3.9.rst:1271 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.9.rst:143 msgid "Dictionary Merge & Update Operators" @@ -266,7 +268,7 @@ msgid "" "for example ``queue.Queue``." msgstr "" -#: ../../whatsnew/3.9.rst:180 ../../whatsnew/3.9.rst:1158 +#: ../../whatsnew/3.9.rst:180 ../../whatsnew/3.9.rst:1159 msgid "Example:" msgstr "範例:" @@ -985,36 +987,36 @@ msgstr "pydoc" #: ../../whatsnew/3.9.rst:639 msgid "" "The documentation string is now shown not only for class, function, method " -"etc, but for any object that has its own ``__doc__`` attribute. (Contributed " -"by Serhiy Storchaka in :issue:`40257`.)" +"etc, but for any object that has its own :attr:`~definition.__doc__` " +"attribute. (Contributed by Serhiy Storchaka in :issue:`40257`.)" msgstr "" -#: ../../whatsnew/3.9.rst:644 +#: ../../whatsnew/3.9.rst:645 msgid "random" msgstr "random" -#: ../../whatsnew/3.9.rst:646 +#: ../../whatsnew/3.9.rst:647 msgid "" "Added a new :attr:`random.Random.randbytes` method: generate random bytes. " "(Contributed by Victor Stinner in :issue:`40286`.)" msgstr "" -#: ../../whatsnew/3.9.rst:650 +#: ../../whatsnew/3.9.rst:651 msgid "signal" msgstr "signal" -#: ../../whatsnew/3.9.rst:652 +#: ../../whatsnew/3.9.rst:653 msgid "" "Exposed the Linux-specific :func:`signal.pidfd_send_signal` for sending to " "signals to a process using a file descriptor instead of a pid. (:issue:" "`38712`)" msgstr "" -#: ../../whatsnew/3.9.rst:656 +#: ../../whatsnew/3.9.rst:657 msgid "smtplib" msgstr "smtplib" -#: ../../whatsnew/3.9.rst:658 +#: ../../whatsnew/3.9.rst:659 msgid "" ":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise a :class:" "`ValueError` if the given timeout for their constructor is zero to prevent " @@ -1022,41 +1024,41 @@ msgid "" "`39259`.)" msgstr "" -#: ../../whatsnew/3.9.rst:662 +#: ../../whatsnew/3.9.rst:663 msgid "" ":class:`~smtplib.LMTP` constructor now has an optional *timeout* parameter. " "(Contributed by Donghee Na in :issue:`39329`.)" msgstr "" -#: ../../whatsnew/3.9.rst:666 +#: ../../whatsnew/3.9.rst:667 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.9.rst:668 +#: ../../whatsnew/3.9.rst:669 msgid "" "The :mod:`socket` module now exports the :const:`~socket." "CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. (Contributed by " "Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" msgstr "" -#: ../../whatsnew/3.9.rst:672 +#: ../../whatsnew/3.9.rst:673 msgid "" "The socket module now supports the :const:`~socket.CAN_J1939` protocol on " "platforms that support it. (Contributed by Karl Ding in :issue:`40291`.)" msgstr "" -#: ../../whatsnew/3.9.rst:675 +#: ../../whatsnew/3.9.rst:676 msgid "" "The socket module now has the :func:`socket.send_fds` and :func:`socket." "recv_fds` functions. (Contributed by Joannah Nanjekye, Shinya Okano and " "Victor Stinner in :issue:`28724`.)" msgstr "" -#: ../../whatsnew/3.9.rst:681 +#: ../../whatsnew/3.9.rst:682 msgid "time" msgstr "time" -#: ../../whatsnew/3.9.rst:683 +#: ../../whatsnew/3.9.rst:684 msgid "" "On AIX, :func:`~time.thread_time` is now implemented with " "``thread_cputime()`` which has nanosecond resolution, rather than " @@ -1064,11 +1066,11 @@ msgid "" "milliseconds. (Contributed by Batuhan Taskaya in :issue:`40192`)" msgstr "" -#: ../../whatsnew/3.9.rst:689 +#: ../../whatsnew/3.9.rst:690 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.9.rst:691 +#: ../../whatsnew/3.9.rst:692 msgid "" "Added a new :data:`sys.platlibdir` attribute: name of the platform-specific " "library directory. It is used to build the path of standard library and the " @@ -1078,29 +1080,29 @@ msgid "" "and Victor Stinner in :issue:`1294959`.)" msgstr "" -#: ../../whatsnew/3.9.rst:697 +#: ../../whatsnew/3.9.rst:698 msgid "" "Previously, :data:`sys.stderr` was block-buffered when non-interactive. Now " "``stderr`` defaults to always being line-buffered. (Contributed by Jendrik " "Seipp in :issue:`13601`.)" msgstr "" -#: ../../whatsnew/3.9.rst:702 +#: ../../whatsnew/3.9.rst:703 msgid "tracemalloc" msgstr "tracemalloc" -#: ../../whatsnew/3.9.rst:704 +#: ../../whatsnew/3.9.rst:705 msgid "" "Added :func:`tracemalloc.reset_peak` to set the peak size of traced memory " "blocks to the current size, to measure the peak of specific pieces of code. " "(Contributed by Huon Wilson in :issue:`40630`.)" msgstr "" -#: ../../whatsnew/3.9.rst:709 ../../whatsnew/3.9.rst:1492 +#: ../../whatsnew/3.9.rst:710 ../../whatsnew/3.9.rst:1493 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.9.rst:711 +#: ../../whatsnew/3.9.rst:712 msgid "" ":pep:`593` introduced an :data:`typing.Annotated` type to decorate existing " "types with context-specific metadata and new ``include_extras`` parameter " @@ -1108,20 +1110,20 @@ msgid "" "(Contributed by Till Varoquaux and Konstantin Kashin.)" msgstr "" -#: ../../whatsnew/3.9.rst:717 +#: ../../whatsnew/3.9.rst:718 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.9.rst:719 +#: ../../whatsnew/3.9.rst:720 msgid "" "The Unicode database has been updated to version 13.0.0. (:issue:`39926`)." msgstr "" -#: ../../whatsnew/3.9.rst:722 +#: ../../whatsnew/3.9.rst:723 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.9.rst:724 +#: ../../whatsnew/3.9.rst:725 msgid "" "The activation scripts provided by :mod:`venv` now all specify their prompt " "customization consistently by always using the value specified by " @@ -1131,11 +1133,11 @@ msgid "" "Cannon in :issue:`37663`.)" msgstr "" -#: ../../whatsnew/3.9.rst:732 +#: ../../whatsnew/3.9.rst:733 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.9.rst:734 +#: ../../whatsnew/3.9.rst:735 msgid "" "White space characters within attributes are now preserved when serializing :" "mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer normalized to " @@ -1143,32 +1145,32 @@ msgid "" "2.11 of XML spec. (Contributed by Mefistotelis in :issue:`39011`.)" msgstr "" -#: ../../whatsnew/3.9.rst:742 +#: ../../whatsnew/3.9.rst:743 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.9.rst:744 +#: ../../whatsnew/3.9.rst:745 msgid "" "Optimized the idiom for assignment a temporary variable in comprehensions. " "Now ``for y in [expr]`` in comprehensions is as fast as a simple assignment " "``y = expr``. For example:" msgstr "" -#: ../../whatsnew/3.9.rst:748 +#: ../../whatsnew/3.9.rst:749 msgid "sums = [s for s in [0] for x in data for s in [s + x]]" msgstr "sums = [s for s in [0] for x in data for s in [s + x]]" -#: ../../whatsnew/3.9.rst:750 +#: ../../whatsnew/3.9.rst:751 msgid "" "Unlike the ``:=`` operator this idiom does not leak a variable to the outer " "scope." msgstr "" -#: ../../whatsnew/3.9.rst:753 +#: ../../whatsnew/3.9.rst:754 msgid "(Contributed by Serhiy Storchaka in :issue:`32856`.)" msgstr "(由 Serhiy Storchaka 在 :issue:`32856` 中貢獻。)" -#: ../../whatsnew/3.9.rst:755 +#: ../../whatsnew/3.9.rst:756 msgid "" "Optimized signal handling in multithreaded applications. If a thread " "different than the main thread gets a signal, the bytecode evaluation loop " @@ -1177,27 +1179,27 @@ msgid "" "interpreter can handle signals." msgstr "" -#: ../../whatsnew/3.9.rst:761 +#: ../../whatsnew/3.9.rst:762 msgid "" "Previously, the bytecode evaluation loop was interrupted at each instruction " "until the main thread handles signals. (Contributed by Victor Stinner in :" "issue:`40010`.)" msgstr "" -#: ../../whatsnew/3.9.rst:765 +#: ../../whatsnew/3.9.rst:766 msgid "" "Optimized the :mod:`subprocess` module on FreeBSD using ``closefrom()``. " "(Contributed by Ed Maste, Conrad Meyer, Kyle Evans, Kubilay Kocak and Victor " "Stinner in :issue:`38061`.)" msgstr "" -#: ../../whatsnew/3.9.rst:769 +#: ../../whatsnew/3.9.rst:770 msgid "" ":c:func:`PyLong_FromDouble` is now up to 1.87x faster for values that fit " "into :c:expr:`long`. (Contributed by Sergey Fedoseev in :issue:`37986`.)" msgstr "" -#: ../../whatsnew/3.9.rst:773 +#: ../../whatsnew/3.9.rst:774 msgid "" "A number of Python builtins (:class:`range`, :class:`tuple`, :class:`set`, :" "class:`frozenset`, :class:`list`, :class:`dict`) are now sped up by using :" @@ -1205,14 +1207,14 @@ msgid "" "Jeroen Demeyer and Petr Viktorin in :issue:`37207`.)" msgstr "" -#: ../../whatsnew/3.9.rst:778 +#: ../../whatsnew/3.9.rst:779 msgid "" "Optimized :func:`~set.difference_update` for the case when the other set is " "much larger than the base set. (Suggested by Evgeny Kapun with code " "contributed by Michele Orrù in :issue:`8425`.)" msgstr "" -#: ../../whatsnew/3.9.rst:782 +#: ../../whatsnew/3.9.rst:783 msgid "" "Python's small object allocator (``obmalloc.c``) now allows (no more than) " "one empty arena to remain available for immediate reuse, without returning " @@ -1221,26 +1223,26 @@ msgid "" "in :issue:`37257`.)" msgstr "" -#: ../../whatsnew/3.9.rst:788 +#: ../../whatsnew/3.9.rst:789 msgid "" ":term:`floor division` of float operation now has a better performance. Also " "the message of :exc:`ZeroDivisionError` for this operation is updated. " "(Contributed by Donghee Na in :issue:`39434`.)" msgstr "" -#: ../../whatsnew/3.9.rst:792 +#: ../../whatsnew/3.9.rst:793 msgid "" "Decoding short ASCII strings with UTF-8 and ascii codecs is now about 15% " "faster. (Contributed by Inada Naoki in :issue:`37348`.)" msgstr "" -#: ../../whatsnew/3.9.rst:795 +#: ../../whatsnew/3.9.rst:796 msgid "" "Here's a summary of performance improvements from Python 3.4 through Python " "3.9:" msgstr "" -#: ../../whatsnew/3.9.rst:797 +#: ../../whatsnew/3.9.rst:798 msgid "" "Python version 3.4 3.5 3.6 3.7 3.8 " "3.9\n" @@ -1388,7 +1390,7 @@ msgstr "" " loop_overhead 0.5 0.6 0.4 0.3 0.3 " "0.3" -#: ../../whatsnew/3.9.rst:842 +#: ../../whatsnew/3.9.rst:843 msgid "" "These results were generated from the variable access benchmark script at: " "``Tools/scripts/var_access_benchmark.py``. The benchmark script displays " @@ -1399,18 +1401,18 @@ msgid "" "python.org/downloads/macos/>`_." msgstr "" -#: ../../whatsnew/3.9.rst:852 +#: ../../whatsnew/3.9.rst:853 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.9.rst:854 +#: ../../whatsnew/3.9.rst:855 msgid "" "The distutils ``bdist_msi`` command is now deprecated, use ``bdist_wheel`` " "(wheel packages) instead. (Contributed by Hugo van Kemenade in :issue:" "`39586`.)" msgstr "" -#: ../../whatsnew/3.9.rst:858 +#: ../../whatsnew/3.9.rst:859 msgid "" "Currently :func:`math.factorial` accepts :class:`float` instances with non-" "negative integer values (like ``5.0``). It raises a :exc:`ValueError` for " @@ -1419,7 +1421,7 @@ msgid "" "Serhiy Storchaka in :issue:`37315`.)" msgstr "" -#: ../../whatsnew/3.9.rst:864 +#: ../../whatsnew/3.9.rst:865 msgid "" "The :mod:`!parser` and :mod:`!symbol` modules are deprecated and will be " "removed in future versions of Python. For the majority of use cases, users " @@ -1427,7 +1429,7 @@ msgid "" "stage, using the :mod:`ast` module." msgstr "" -#: ../../whatsnew/3.9.rst:869 +#: ../../whatsnew/3.9.rst:870 msgid "" "The Public C API functions :c:func:`!PyParser_SimpleParseStringFlags`, :c:" "func:`!PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" @@ -1435,7 +1437,7 @@ msgid "" "and will be removed in Python 3.10 together with the old parser." msgstr "" -#: ../../whatsnew/3.9.rst:874 +#: ../../whatsnew/3.9.rst:875 msgid "" "Using :data:`NotImplemented` in a boolean context has been deprecated, as it " "is almost exclusively the result of incorrect rich comparator " @@ -1443,7 +1445,7 @@ msgid "" "Python. (Contributed by Josh Rosenberg in :issue:`35712`.)" msgstr "" -#: ../../whatsnew/3.9.rst:880 +#: ../../whatsnew/3.9.rst:881 msgid "" "The :mod:`random` module currently accepts any hashable type as a possible " "seed value. Unfortunately, some of those types are not guaranteed to have a " @@ -1452,7 +1454,7 @@ msgid "" "`bytes`, and :class:`bytearray`." msgstr "" -#: ../../whatsnew/3.9.rst:886 +#: ../../whatsnew/3.9.rst:887 msgid "" "Opening the :class:`~gzip.GzipFile` file for writing without specifying the " "*mode* argument is deprecated. In future Python versions it will always be " @@ -1461,39 +1463,39 @@ msgid "" "issue:`28286`.)" msgstr "" -#: ../../whatsnew/3.9.rst:892 +#: ../../whatsnew/3.9.rst:893 msgid "" "Deprecated the ``split()`` method of :class:`!_tkinter.TkappType` in favour " "of the ``splitlist()`` method which has more consistent and predictable " "behavior. (Contributed by Serhiy Storchaka in :issue:`38371`.)" msgstr "" -#: ../../whatsnew/3.9.rst:897 +#: ../../whatsnew/3.9.rst:898 msgid "" "The explicit passing of coroutine objects to :func:`asyncio.wait` has been " "deprecated and will be removed in version 3.11. (Contributed by Yury " "Selivanov and Kyle Stanley in :issue:`34790`.)" msgstr "" -#: ../../whatsnew/3.9.rst:901 +#: ../../whatsnew/3.9.rst:902 msgid "" "binhex4 and hexbin4 standards are now deprecated. The :mod:`!binhex` module " "and the following :mod:`binascii` functions are now deprecated:" msgstr "" -#: ../../whatsnew/3.9.rst:904 +#: ../../whatsnew/3.9.rst:905 msgid ":func:`!b2a_hqx`, :func:`!a2b_hqx`" msgstr ":func:`!b2a_hqx`、:func:`!a2b_hqx`" -#: ../../whatsnew/3.9.rst:905 +#: ../../whatsnew/3.9.rst:906 msgid ":func:`!rlecode_hqx`, :func:`!rledecode_hqx`" msgstr ":func:`!rlecode_hqx`、:func:`!rledecode_hqx`" -#: ../../whatsnew/3.9.rst:907 +#: ../../whatsnew/3.9.rst:908 msgid "(Contributed by Victor Stinner in :issue:`39353`.)" msgstr "(由 Victor Stinner 在 :issue:`39353` 中貢獻。)" -#: ../../whatsnew/3.9.rst:909 +#: ../../whatsnew/3.9.rst:910 msgid "" ":mod:`ast` classes ``slice``, ``Index`` and ``ExtSlice`` are considered " "deprecated and will be removed in future Python versions. ``value`` itself " @@ -1502,7 +1504,7 @@ msgid "" "Storchaka in :issue:`34822`.)" msgstr "" -#: ../../whatsnew/3.9.rst:915 +#: ../../whatsnew/3.9.rst:916 msgid "" ":mod:`ast` classes ``Suite``, ``Param``, ``AugLoad`` and ``AugStore`` are " "considered deprecated and will be removed in future Python versions. They " @@ -1511,7 +1513,7 @@ msgid "" "`39969` and Serhiy Storchaka in :issue:`39988`.)" msgstr "" -#: ../../whatsnew/3.9.rst:922 +#: ../../whatsnew/3.9.rst:923 msgid "" "The :c:func:`!PyEval_InitThreads` and :c:func:`!PyEval_ThreadsInitialized` " "functions are now deprecated and will be removed in Python 3.11. Calling :c:" @@ -1520,20 +1522,20 @@ msgid "" "in :issue:`39877`.)" msgstr "" -#: ../../whatsnew/3.9.rst:928 +#: ../../whatsnew/3.9.rst:929 msgid "" "Passing ``None`` as the first argument to the :func:`shlex.split` function " "has been deprecated. (Contributed by Zackery Spytz in :issue:`33262`.)" msgstr "" -#: ../../whatsnew/3.9.rst:931 +#: ../../whatsnew/3.9.rst:932 msgid "" ":func:`!smtpd.MailmanProxy` is now deprecated as it is unusable without an " "external module, ``mailman``. (Contributed by Samuel Colvin in :issue:" "`35800`.)" msgstr "" -#: ../../whatsnew/3.9.rst:934 +#: ../../whatsnew/3.9.rst:935 msgid "" "The :mod:`!lib2to3` module now emits a :exc:`PendingDeprecationWarning`. " "Python 3.9 switched to a PEG parser (see :pep:`617`), and Python 3.10 may " @@ -1543,22 +1545,22 @@ msgid "" "or `parso`_. (Contributed by Carl Meyer in :issue:`40360`.)" msgstr "" -#: ../../whatsnew/3.9.rst:942 +#: ../../whatsnew/3.9.rst:943 msgid "" "The *random* parameter of :func:`random.shuffle` has been deprecated. " "(Contributed by Raymond Hettinger in :issue:`40465`)" msgstr "" -#: ../../whatsnew/3.9.rst:951 ../../whatsnew/3.9.rst:1406 +#: ../../whatsnew/3.9.rst:952 ../../whatsnew/3.9.rst:1407 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.9.rst:953 +#: ../../whatsnew/3.9.rst:954 msgid "" "The erroneous version at :data:`!unittest.mock.__version__` has been removed." msgstr "" -#: ../../whatsnew/3.9.rst:955 +#: ../../whatsnew/3.9.rst:956 msgid "" ":class:`!nntplib.NNTP`: ``xpath()`` and ``xgtitle()`` methods have been " "removed. These methods are deprecated since Python 3.3. Generally, these " @@ -1568,14 +1570,14 @@ msgid "" "`39366`.)" msgstr "" -#: ../../whatsnew/3.9.rst:962 +#: ../../whatsnew/3.9.rst:963 msgid "" ":class:`array.array`: ``tostring()`` and ``fromstring()`` methods have been " "removed. They were aliases to ``tobytes()`` and ``frombytes()``, deprecated " "since Python 3.2. (Contributed by Victor Stinner in :issue:`38916`.)" msgstr "" -#: ../../whatsnew/3.9.rst:967 +#: ../../whatsnew/3.9.rst:968 msgid "" "The undocumented ``sys.callstats()`` function has been removed. Since Python " "3.7, it was deprecated and always returned :const:`None`. It required a " @@ -1583,7 +1585,7 @@ msgid "" "3.7. (Contributed by Victor Stinner in :issue:`37414`.)" msgstr "" -#: ../../whatsnew/3.9.rst:972 +#: ../../whatsnew/3.9.rst:973 msgid "" "The ``sys.getcheckinterval()`` and ``sys.setcheckinterval()`` functions have " "been removed. They were deprecated since Python 3.2. Use :func:`sys." @@ -1591,21 +1593,21 @@ msgid "" "by Victor Stinner in :issue:`37392`.)" msgstr "" -#: ../../whatsnew/3.9.rst:977 +#: ../../whatsnew/3.9.rst:978 msgid "" "The C function ``PyImport_Cleanup()`` has been removed. It was documented " "as: \"Empty the module table. For internal use only.\" (Contributed by " "Victor Stinner in :issue:`36710`.)" msgstr "" -#: ../../whatsnew/3.9.rst:981 +#: ../../whatsnew/3.9.rst:982 msgid "" "``_dummy_thread`` and ``dummy_threading`` modules have been removed. These " "modules were deprecated since Python 3.7 which requires threading support. " "(Contributed by Victor Stinner in :issue:`37312`.)" msgstr "" -#: ../../whatsnew/3.9.rst:985 +#: ../../whatsnew/3.9.rst:986 msgid "" "``aifc.openfp()`` alias to ``aifc.open()``, ``sunau.openfp()`` alias to " "``sunau.open()``, and ``wave.openfp()`` alias to :func:`wave.open` have been " @@ -1613,14 +1615,14 @@ msgid "" "Stinner in :issue:`37320`.)" msgstr "" -#: ../../whatsnew/3.9.rst:990 +#: ../../whatsnew/3.9.rst:991 msgid "" "The :meth:`!isAlive` method of :class:`threading.Thread` has been removed. " "It was deprecated since Python 3.8. Use :meth:`~threading.Thread.is_alive` " "instead. (Contributed by Donghee Na in :issue:`37804`.)" msgstr "" -#: ../../whatsnew/3.9.rst:995 +#: ../../whatsnew/3.9.rst:996 msgid "" "Methods ``getchildren()`` and ``getiterator()`` of classes :class:`~xml." "etree.ElementTree.ElementTree` and :class:`~xml.etree.ElementTree.Element` " @@ -1630,7 +1632,7 @@ msgid "" "getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1003 +#: ../../whatsnew/3.9.rst:1004 msgid "" "The old :mod:`plistlib` API has been removed, it was deprecated since Python " "3.4. Use the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:" @@ -1639,7 +1641,7 @@ msgid "" "are always used instead. (Contributed by Jon Janzen in :issue:`36409`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1009 +#: ../../whatsnew/3.9.rst:1010 msgid "" "The C function ``PyGen_NeedsFinalizing`` has been removed. It was not " "documented, tested, or used anywhere within CPython after the implementation " @@ -1647,7 +1649,7 @@ msgid "" "in :issue:`15088`)" msgstr "" -#: ../../whatsnew/3.9.rst:1014 +#: ../../whatsnew/3.9.rst:1015 msgid "" "``base64.encodestring()`` and ``base64.decodestring()``, aliases deprecated " "since Python 3.1, have been removed: use :func:`base64.encodebytes` and :" @@ -1655,14 +1657,14 @@ msgid "" "`39351`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1019 +#: ../../whatsnew/3.9.rst:1020 msgid "" "``fractions.gcd()`` function has been removed, it was deprecated since " "Python 3.5 (:issue:`22486`): use :func:`math.gcd` instead. (Contributed by " "Victor Stinner in :issue:`39350`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1023 +#: ../../whatsnew/3.9.rst:1024 msgid "" "The *buffering* parameter of :class:`bz2.BZ2File` has been removed. Since " "Python 3.0, it was ignored and using it emitted a :exc:`DeprecationWarning`. " @@ -1670,7 +1672,7 @@ msgid "" "Victor Stinner in :issue:`39357`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1028 +#: ../../whatsnew/3.9.rst:1029 msgid "" "The *encoding* parameter of :func:`json.loads` has been removed. As of " "Python 3.1, it was deprecated and ignored; using it has emitted a :exc:" @@ -1678,7 +1680,7 @@ msgid "" "`39377`)" msgstr "" -#: ../../whatsnew/3.9.rst:1033 +#: ../../whatsnew/3.9.rst:1034 msgid "" "``with (await asyncio.lock):`` and ``with (yield from asyncio.lock):`` " "statements are not longer supported, use ``async with lock`` instead. The " @@ -1686,7 +1688,7 @@ msgid "" "(Contributed by Andrew Svetlov in :issue:`34793`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1038 +#: ../../whatsnew/3.9.rst:1039 msgid "" "The :func:`!sys.getcounts` function, the ``-X showalloccount`` command line " "option and the ``show_alloc_count`` field of the C structure :c:type:" @@ -1695,7 +1697,7 @@ msgid "" "`39489`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1044 +#: ../../whatsnew/3.9.rst:1045 msgid "" "The ``_field_types`` attribute of the :class:`typing.NamedTuple` class has " "been removed. It was deprecated since Python 3.8. Use the " @@ -1703,14 +1705,14 @@ msgid "" "issue:`40182`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1049 +#: ../../whatsnew/3.9.rst:1050 msgid "" "The :meth:`!symtable.SymbolTable.has_exec` method has been removed. It was " "deprecated since 2006, and only returning ``False`` when it's called. " "(Contributed by Batuhan Taskaya in :issue:`40208`)" msgstr "" -#: ../../whatsnew/3.9.rst:1053 +#: ../../whatsnew/3.9.rst:1054 msgid "" "The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " "have been removed. They were deprecated since Python 3.7 and you can use :" @@ -1718,7 +1720,7 @@ msgid "" "(Contributed by Rémi Lapeyre in :issue:`40967`)" msgstr "" -#: ../../whatsnew/3.9.rst:1058 +#: ../../whatsnew/3.9.rst:1059 msgid "" "The ``unescape()`` method in the :class:`html.parser.HTMLParser` class has " "been removed (it was deprecated since Python 3.4). :func:`html.unescape` " @@ -1726,21 +1728,21 @@ msgid "" "unicode characters." msgstr "" -#: ../../whatsnew/3.9.rst:1065 ../../whatsnew/3.9.rst:1332 +#: ../../whatsnew/3.9.rst:1066 ../../whatsnew/3.9.rst:1333 msgid "Porting to Python 3.9" -msgstr "" +msgstr "移植至 Python 3.9" -#: ../../whatsnew/3.9.rst:1067 +#: ../../whatsnew/3.9.rst:1068 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.9.rst:1072 +#: ../../whatsnew/3.9.rst:1073 msgid "Changes in the Python API" msgstr "" -#: ../../whatsnew/3.9.rst:1074 +#: ../../whatsnew/3.9.rst:1075 msgid "" ":func:`__import__` and :func:`importlib.util.resolve_name` now raise :exc:" "`ImportError` where it previously raised :exc:`ValueError`. Callers catching " @@ -1748,26 +1750,26 @@ msgid "" "versions will need to catch both using ``except (ImportError, ValueError):``." msgstr "" -#: ../../whatsnew/3.9.rst:1079 +#: ../../whatsnew/3.9.rst:1080 msgid "" "The :mod:`venv` activation scripts no longer special-case when " "``__VENV_PROMPT__`` is set to ``\"\"``." msgstr "" -#: ../../whatsnew/3.9.rst:1082 +#: ../../whatsnew/3.9.rst:1083 msgid "" "The :meth:`select.epoll.unregister` method no longer ignores the :const:" "`~errno.EBADF` error. (Contributed by Victor Stinner in :issue:`39239`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1086 +#: ../../whatsnew/3.9.rst:1087 msgid "" "The *compresslevel* parameter of :class:`bz2.BZ2File` became keyword-only, " "since the *buffering* parameter has been removed. (Contributed by Victor " "Stinner in :issue:`39357`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1090 +#: ../../whatsnew/3.9.rst:1091 msgid "" "Simplified AST for subscription. Simple indices will be represented by their " "value, extended slices will be represented as tuples. ``Index(value)`` will " @@ -1775,21 +1777,21 @@ msgid "" "Load())``. (Contributed by Serhiy Storchaka in :issue:`34822`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1096 +#: ../../whatsnew/3.9.rst:1097 msgid "" "The :mod:`importlib` module now ignores the :envvar:`PYTHONCASEOK` " "environment variable when the :option:`-E` or :option:`-I` command line " "options are being used." msgstr "" -#: ../../whatsnew/3.9.rst:1100 +#: ../../whatsnew/3.9.rst:1101 msgid "" "The *encoding* parameter has been added to the classes :class:`ftplib.FTP` " "and :class:`ftplib.FTP_TLS` as a keyword-only parameter, and the default " "encoding is changed from Latin-1 to UTF-8 to follow :rfc:`2640`." msgstr "" -#: ../../whatsnew/3.9.rst:1104 +#: ../../whatsnew/3.9.rst:1105 msgid "" ":meth:`asyncio.loop.shutdown_default_executor` has been added to :class:" "`~asyncio.AbstractEventLoop`, meaning alternative event loops that inherit " @@ -1797,7 +1799,7 @@ msgid "" "issue:`34037`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1109 +#: ../../whatsnew/3.9.rst:1110 msgid "" "The constant values of future flags in the :mod:`__future__` module is " "updated in order to prevent collision with compiler flags. Previously " @@ -1805,7 +1807,7 @@ msgid "" "(Contributed by Batuhan Taskaya in :issue:`39562`)" msgstr "" -#: ../../whatsnew/3.9.rst:1114 +#: ../../whatsnew/3.9.rst:1115 msgid "" "``array('u')`` now uses :c:type:`wchar_t` as C type instead of " "``Py_UNICODE``. This change doesn't affect to its behavior because " @@ -1813,7 +1815,7 @@ msgid "" "by Inada Naoki in :issue:`34538`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1119 +#: ../../whatsnew/3.9.rst:1120 msgid "" "The :func:`logging.getLogger` API now returns the root logger when passed " "the name ``'root'``, whereas previously it returned a non-root logger named " @@ -1823,7 +1825,7 @@ msgid "" "(Contributed by Vinay Sajip in :issue:`37742`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1126 +#: ../../whatsnew/3.9.rst:1127 msgid "" "Division handling of :class:`~pathlib.PurePath` now returns :data:" "`NotImplemented` instead of raising a :exc:`TypeError` when passed something " @@ -1832,7 +1834,7 @@ msgid "" "types. (Contributed by Roger Aiudi in :issue:`34775`)." msgstr "" -#: ../../whatsnew/3.9.rst:1132 +#: ../../whatsnew/3.9.rst:1133 msgid "" "Starting with Python 3.9.5 the :mod:`ipaddress` module no longer accepts any " "leading zeros in IPv4 address strings. Leading zeros are ambiguous and " @@ -1842,7 +1844,7 @@ msgid "" "leading zeros. (Contributed by Christian Heimes in :issue:`36384`)." msgstr "" -#: ../../whatsnew/3.9.rst:1140 +#: ../../whatsnew/3.9.rst:1141 msgid "" ":func:`codecs.lookup` now normalizes the encoding name the same way as :func:" "`encodings.normalize_encoding`, except that :func:`codecs.lookup` also " @@ -1851,11 +1853,11 @@ msgid "" "in :issue:`37751`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1148 +#: ../../whatsnew/3.9.rst:1149 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.9.rst:1150 +#: ../../whatsnew/3.9.rst:1151 msgid "" "Instances of :ref:`heap-allocated types ` (such as those created " "with :c:func:`PyType_FromSpec` and similar APIs) hold a reference to their " @@ -1866,7 +1868,7 @@ msgid "" "heap-allocated types visit the object's type." msgstr "" -#: ../../whatsnew/3.9.rst:1160 +#: ../../whatsnew/3.9.rst:1161 msgid "" "int\n" "foo_traverse(foo_struct *self, visitproc visit, void *arg) {\n" @@ -1878,7 +1880,7 @@ msgid "" "}" msgstr "" -#: ../../whatsnew/3.9.rst:1171 +#: ../../whatsnew/3.9.rst:1172 msgid "" "If your traverse function delegates to ``tp_traverse`` of its base class (or " "another type), ensure that ``Py_TYPE(self)`` is visited only once. Note that " @@ -1886,19 +1888,19 @@ msgid "" "``tp_traverse``." msgstr "" -#: ../../whatsnew/3.9.rst:1176 +#: ../../whatsnew/3.9.rst:1177 msgid "For example, if your ``tp_traverse`` function includes:" msgstr "" -#: ../../whatsnew/3.9.rst:1178 +#: ../../whatsnew/3.9.rst:1179 msgid "base->tp_traverse(self, visit, arg)" msgstr "base->tp_traverse(self, visit, arg)" -#: ../../whatsnew/3.9.rst:1182 +#: ../../whatsnew/3.9.rst:1183 msgid "then add:" msgstr "" -#: ../../whatsnew/3.9.rst:1184 +#: ../../whatsnew/3.9.rst:1185 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)\n" @@ -1910,11 +1912,11 @@ msgid "" "#else" msgstr "" -#: ../../whatsnew/3.9.rst:1195 +#: ../../whatsnew/3.9.rst:1196 msgid "(See :issue:`35810` and :issue:`40217` for more information.)" msgstr "(更多資訊請見 :issue:`35810` 與 :issue:`40217`。)" -#: ../../whatsnew/3.9.rst:1197 +#: ../../whatsnew/3.9.rst:1198 msgid "" "The functions ``PyEval_CallObject``, ``PyEval_CallFunction``, " "``PyEval_CallMethod`` and ``PyEval_CallObjectWithKeywords`` are deprecated. " @@ -1922,11 +1924,11 @@ msgid "" "issue:`29548`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1203 +#: ../../whatsnew/3.9.rst:1204 msgid "CPython bytecode changes" msgstr "CPython 位元組碼變更" -#: ../../whatsnew/3.9.rst:1205 +#: ../../whatsnew/3.9.rst:1206 msgid "" "The :opcode:`LOAD_ASSERTION_ERROR` opcode was added for handling the :" "keyword:`assert` statement. Previously, the assert statement would not work " @@ -1934,37 +1936,37 @@ msgid "" "(Contributed by Zackery Spytz in :issue:`34880`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1210 +#: ../../whatsnew/3.9.rst:1211 msgid "" "The :opcode:`COMPARE_OP` opcode was split into four distinct instructions:" msgstr "" -#: ../../whatsnew/3.9.rst:1212 +#: ../../whatsnew/3.9.rst:1213 msgid "``COMPARE_OP`` for rich comparisons" msgstr "" -#: ../../whatsnew/3.9.rst:1213 +#: ../../whatsnew/3.9.rst:1214 msgid "``IS_OP`` for 'is' and 'is not' tests" msgstr "" -#: ../../whatsnew/3.9.rst:1214 +#: ../../whatsnew/3.9.rst:1215 msgid "``CONTAINS_OP`` for 'in' and 'not in' tests" msgstr "" -#: ../../whatsnew/3.9.rst:1215 +#: ../../whatsnew/3.9.rst:1216 msgid "" "``JUMP_IF_NOT_EXC_MATCH`` for checking exceptions in 'try-except' statements." msgstr "" -#: ../../whatsnew/3.9.rst:1218 +#: ../../whatsnew/3.9.rst:1219 msgid "(Contributed by Mark Shannon in :issue:`39156`.)" msgstr "(由 Mark Shannon 在 :issue:`39156` 中貢獻。)" -#: ../../whatsnew/3.9.rst:1222 +#: ../../whatsnew/3.9.rst:1223 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.9.rst:1224 +#: ../../whatsnew/3.9.rst:1225 msgid "" "Added ``--with-platlibdir`` option to the ``configure`` script: name of the " "platform-specific library directory, stored in the new :data:`sys." @@ -1973,26 +1975,26 @@ msgid "" "and Victor Stinner in :issue:`1294959`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1230 +#: ../../whatsnew/3.9.rst:1231 msgid "" "The ``COUNT_ALLOCS`` special build macro has been removed. (Contributed by " "Victor Stinner in :issue:`39489`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1233 +#: ../../whatsnew/3.9.rst:1234 msgid "" "On non-Windows platforms, the :c:func:`!setenv` and :c:func:`!unsetenv` " "functions are now required to build Python. (Contributed by Victor Stinner " "in :issue:`39395`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1237 +#: ../../whatsnew/3.9.rst:1238 msgid "" "On non-Windows platforms, creating ``bdist_wininst`` installers is now " "officially unsupported. (See :issue:`10945` for more details.)" msgstr "" -#: ../../whatsnew/3.9.rst:1240 +#: ../../whatsnew/3.9.rst:1241 msgid "" "When building Python on macOS from source, ``_tkinter`` now links with non-" "system Tcl and Tk frameworks if they are installed in ``/Library/" @@ -2003,13 +2005,13 @@ msgid "" "(Contributed by Ned Deily in :issue:`34956`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1249 +#: ../../whatsnew/3.9.rst:1250 msgid "" "Python can now be built for Windows 10 ARM64. (Contributed by Steve Dower " "in :issue:`33125`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1252 +#: ../../whatsnew/3.9.rst:1253 msgid "" "Some individual tests are now skipped when ``--pgo`` is used. The tests in " "question increased the PGO task time significantly and likely didn't help " @@ -2025,11 +2027,11 @@ msgid "" "details.)" msgstr "" -#: ../../whatsnew/3.9.rst:1267 +#: ../../whatsnew/3.9.rst:1268 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.9.rst:1272 +#: ../../whatsnew/3.9.rst:1273 msgid "" ":pep:`573`: Added :c:func:`PyType_FromModuleAndSpec` to associate a module " "with a class; :c:func:`PyType_GetModule` and :c:func:`PyType_GetModuleState` " @@ -2038,20 +2040,20 @@ msgid "" "(Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1279 +#: ../../whatsnew/3.9.rst:1280 msgid "" "Added :c:func:`PyFrame_GetCode` function: get a frame code. Added :c:func:" "`PyFrame_GetBack` function: get the frame next outer frame. (Contributed by " "Victor Stinner in :issue:`40421`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1283 +#: ../../whatsnew/3.9.rst:1284 msgid "" "Added :c:func:`PyFrame_GetLineNumber` to the limited C API. (Contributed by " "Victor Stinner in :issue:`40421`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1286 +#: ../../whatsnew/3.9.rst:1287 msgid "" "Added :c:func:`PyThreadState_GetInterpreter` and :c:func:" "`PyInterpreterState_Get` functions to get the interpreter. Added :c:func:" @@ -2061,7 +2063,7 @@ msgid "" "issue:`39947`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1294 +#: ../../whatsnew/3.9.rst:1295 msgid "" "Added a new public :c:func:`PyObject_CallNoArgs` function to the C API, " "which calls a callable Python object without any arguments. It is the most " @@ -2069,11 +2071,11 @@ msgid "" "(Contributed by Victor Stinner in :issue:`37194`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1299 ../../whatsnew/3.9.rst:1417 +#: ../../whatsnew/3.9.rst:1300 ../../whatsnew/3.9.rst:1418 msgid "Changes in the limited C API (if ``Py_LIMITED_API`` macro is defined):" msgstr "" -#: ../../whatsnew/3.9.rst:1301 +#: ../../whatsnew/3.9.rst:1302 msgid "" "Provide :c:func:`Py_EnterRecursiveCall` and :c:func:`Py_LeaveRecursiveCall` " "as regular functions for the limited API. Previously, there were defined as " @@ -2082,23 +2084,23 @@ msgid "" "the limited C API)." msgstr "" -#: ../../whatsnew/3.9.rst:1307 +#: ../../whatsnew/3.9.rst:1308 msgid "" "``PyObject_INIT()`` and ``PyObject_INIT_VAR()`` become regular \"opaque\" " "function to hide implementation details." msgstr "" -#: ../../whatsnew/3.9.rst:1310 ../../whatsnew/3.9.rst:1444 +#: ../../whatsnew/3.9.rst:1311 ../../whatsnew/3.9.rst:1445 msgid "(Contributed by Victor Stinner in :issue:`38644` and :issue:`39542`.)" msgstr "(由 Victor Stinner 在 38644 和 39542 中貢獻。)" -#: ../../whatsnew/3.9.rst:1312 +#: ../../whatsnew/3.9.rst:1313 msgid "" "The :c:func:`PyModule_AddType` function is added to help adding a type to a " "module. (Contributed by Donghee Na in :issue:`40024`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1316 +#: ../../whatsnew/3.9.rst:1317 msgid "" "Added the functions :c:func:`PyObject_GC_IsTracked` and :c:func:" "`PyObject_GC_IsFinalized` to the public API to allow to query if Python " @@ -2107,27 +2109,27 @@ msgid "" "issue:`40241`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1322 +#: ../../whatsnew/3.9.rst:1323 msgid "" "Added :c:func:`!_PyObject_FunctionStr` to get a user-friendly string " "representation of a function-like object. (Patch by Jeroen Demeyer in :issue:" "`37645`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1326 +#: ../../whatsnew/3.9.rst:1327 msgid "" "Added :c:func:`PyObject_CallOneArg` for calling an object with one " "positional argument (Patch by Jeroen Demeyer in :issue:`37483`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1334 +#: ../../whatsnew/3.9.rst:1335 msgid "" "``PyInterpreterState.eval_frame`` (:pep:`523`) now requires a new mandatory " "*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner in :" "issue:`38500`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1338 +#: ../../whatsnew/3.9.rst:1339 msgid "" "Extension modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:" "`~PyModuleDef.m_clear` and :c:member:`~PyModuleDef.m_free` functions of :c:" @@ -2139,12 +2141,12 @@ msgid "" "`PyModule_GetState`) is ``NULL``." msgstr "" -#: ../../whatsnew/3.9.rst:1347 +#: ../../whatsnew/3.9.rst:1348 msgid "" "Extension modules without module state (``m_size <= 0``) are not affected." msgstr "" -#: ../../whatsnew/3.9.rst:1349 +#: ../../whatsnew/3.9.rst:1350 msgid "" "If :c:func:`Py_AddPendingCall` is called in a subinterpreter, the function " "is now scheduled to be called from the subinterpreter, rather than being " @@ -2152,7 +2154,7 @@ msgid "" "of scheduled calls. (Contributed by Victor Stinner in :issue:`39984`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1355 +#: ../../whatsnew/3.9.rst:1356 msgid "" "The Windows registry is no longer used to initialize :data:`sys.path` when " "the ``-E`` option is used (if :c:member:`PyConfig.use_environment` is set to " @@ -2160,21 +2162,21 @@ msgid "" "by Zackery Spytz in :issue:`8901`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1360 +#: ../../whatsnew/3.9.rst:1361 msgid "" "The global variable :c:data:`PyStructSequence_UnnamedField` is now a " "constant and refers to a constant string. (Contributed by Serhiy Storchaka " "in :issue:`38650`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1364 +#: ../../whatsnew/3.9.rst:1365 msgid "" "The :c:type:`!PyGC_Head` structure is now opaque. It is only defined in the " "internal C API (``pycore_gc.h``). (Contributed by Victor Stinner in :issue:" "`40241`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1368 +#: ../../whatsnew/3.9.rst:1369 msgid "" "The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``, :c:" "func:`!PyUnicode_FromUnicode`, :c:func:`!PyUnicode_AsUnicode`, " @@ -2183,7 +2185,7 @@ msgid "" "Python 3.3. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1375 +#: ../../whatsnew/3.9.rst:1376 msgid "" "The :c:func:`Py_FatalError` function is replaced with a macro which logs " "automatically the name of the current function, unless the " @@ -2191,22 +2193,22 @@ msgid "" "issue:`39882`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1380 +#: ../../whatsnew/3.9.rst:1381 msgid "" "The vectorcall protocol now requires that the caller passes only strings as " "keyword names. (See :issue:`37540` for more information.)" msgstr "" -#: ../../whatsnew/3.9.rst:1383 +#: ../../whatsnew/3.9.rst:1384 msgid "" "Implementation details of a number of macros and functions are now hidden:" msgstr "" -#: ../../whatsnew/3.9.rst:1385 +#: ../../whatsnew/3.9.rst:1386 msgid ":c:func:`PyObject_IS_GC` macro was converted to a function." msgstr "" -#: ../../whatsnew/3.9.rst:1387 +#: ../../whatsnew/3.9.rst:1388 msgid "" "The :c:func:`!PyObject_NEW` macro becomes an alias to the :c:macro:" "`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro becomes an " @@ -2214,38 +2216,38 @@ msgid "" "directly the :c:member:`PyTypeObject.tp_basicsize` member." msgstr "" -#: ../../whatsnew/3.9.rst:1392 +#: ../../whatsnew/3.9.rst:1393 msgid "" ":c:func:`!PyObject_GET_WEAKREFS_LISTPTR` macro was converted to a function: " "the macro accessed directly the :c:member:`PyTypeObject.tp_weaklistoffset` " "member." msgstr "" -#: ../../whatsnew/3.9.rst:1396 +#: ../../whatsnew/3.9.rst:1397 msgid "" ":c:func:`PyObject_CheckBuffer` macro was converted to a function: the macro " "accessed directly the :c:member:`PyTypeObject.tp_as_buffer` member." msgstr "" -#: ../../whatsnew/3.9.rst:1399 +#: ../../whatsnew/3.9.rst:1400 msgid "" ":c:func:`PyIndex_Check` is now always declared as an opaque function to hide " "implementation details: removed the ``PyIndex_Check()`` macro. The macro " "accessed directly the :c:member:`PyTypeObject.tp_as_number` member." msgstr "" -#: ../../whatsnew/3.9.rst:1403 +#: ../../whatsnew/3.9.rst:1404 msgid "(See :issue:`40170` for more details.)" msgstr "(更多資訊請見 :issue:`40170`。)" -#: ../../whatsnew/3.9.rst:1408 +#: ../../whatsnew/3.9.rst:1409 msgid "" "Excluded ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of " "``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner in :issue:" "`38835`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1412 +#: ../../whatsnew/3.9.rst:1413 msgid "" "The ``tp_print`` slot of :ref:`PyTypeObject ` has been " "removed. It was used for printing objects to files in Python 2.7 and before. " @@ -2253,89 +2255,89 @@ msgid "" "Demeyer in :issue:`36974`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1419 +#: ../../whatsnew/3.9.rst:1420 msgid "Excluded the following functions from the limited C API:" msgstr "" -#: ../../whatsnew/3.9.rst:1421 +#: ../../whatsnew/3.9.rst:1422 msgid "" "``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye in :issue:" "`37878`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1423 +#: ../../whatsnew/3.9.rst:1424 msgid "``_Py_CheckRecursionLimit``" msgstr "``_Py_CheckRecursionLimit``" -#: ../../whatsnew/3.9.rst:1424 +#: ../../whatsnew/3.9.rst:1425 msgid "``_Py_NewReference()``" msgstr "``_Py_NewReference()``" -#: ../../whatsnew/3.9.rst:1425 +#: ../../whatsnew/3.9.rst:1426 msgid "``_Py_ForgetReference()``" msgstr "``_Py_ForgetReference()``" -#: ../../whatsnew/3.9.rst:1426 +#: ../../whatsnew/3.9.rst:1427 msgid "``_PyTraceMalloc_NewReference()``" msgstr "``_PyTraceMalloc_NewReference()``" -#: ../../whatsnew/3.9.rst:1427 +#: ../../whatsnew/3.9.rst:1428 msgid "``_Py_GetRefTotal()``" msgstr "``_Py_GetRefTotal()``" -#: ../../whatsnew/3.9.rst:1428 +#: ../../whatsnew/3.9.rst:1429 msgid "The trashcan mechanism which never worked in the limited C API." msgstr "" -#: ../../whatsnew/3.9.rst:1429 +#: ../../whatsnew/3.9.rst:1430 msgid "``PyTrash_UNWIND_LEVEL``" msgstr "``PyTrash_UNWIND_LEVEL``" -#: ../../whatsnew/3.9.rst:1430 +#: ../../whatsnew/3.9.rst:1431 msgid "``Py_TRASHCAN_BEGIN_CONDITION``" msgstr "``Py_TRASHCAN_BEGIN_CONDITION``" -#: ../../whatsnew/3.9.rst:1431 +#: ../../whatsnew/3.9.rst:1432 msgid "``Py_TRASHCAN_BEGIN``" msgstr "``Py_TRASHCAN_BEGIN``" -#: ../../whatsnew/3.9.rst:1432 +#: ../../whatsnew/3.9.rst:1433 msgid "``Py_TRASHCAN_END``" msgstr "``Py_TRASHCAN_END``" -#: ../../whatsnew/3.9.rst:1433 +#: ../../whatsnew/3.9.rst:1434 msgid "``Py_TRASHCAN_SAFE_BEGIN``" msgstr "``Py_TRASHCAN_SAFE_BEGIN``" -#: ../../whatsnew/3.9.rst:1434 +#: ../../whatsnew/3.9.rst:1435 msgid "``Py_TRASHCAN_SAFE_END``" msgstr "``Py_TRASHCAN_SAFE_END``" -#: ../../whatsnew/3.9.rst:1436 +#: ../../whatsnew/3.9.rst:1437 msgid "Moved following functions and definitions to the internal C API:" msgstr "" -#: ../../whatsnew/3.9.rst:1438 +#: ../../whatsnew/3.9.rst:1439 msgid "``_PyDebug_PrintTotalRefs()``" msgstr "``_PyDebug_PrintTotalRefs()``" -#: ../../whatsnew/3.9.rst:1439 +#: ../../whatsnew/3.9.rst:1440 msgid "``_Py_PrintReferences()``" msgstr "``_Py_PrintReferences()``" -#: ../../whatsnew/3.9.rst:1440 +#: ../../whatsnew/3.9.rst:1441 msgid "``_Py_PrintReferenceAddresses()``" msgstr "``_Py_PrintReferenceAddresses()``" -#: ../../whatsnew/3.9.rst:1441 +#: ../../whatsnew/3.9.rst:1442 msgid "``_Py_tracemalloc_config``" msgstr "``_Py_tracemalloc_config``" -#: ../../whatsnew/3.9.rst:1442 +#: ../../whatsnew/3.9.rst:1443 msgid "``_Py_AddToAllObjects()`` (specific to ``Py_TRACE_REFS`` build)" msgstr "" -#: ../../whatsnew/3.9.rst:1446 +#: ../../whatsnew/3.9.rst:1447 msgid "" "Removed ``_PyRuntime.getframe`` hook and removed ``_PyThreadState_GetFrame`` " "macro which was an alias to ``_PyRuntime.getframe``. They were only exposed " @@ -2343,72 +2345,72 @@ msgid "" "(Contributed by Victor Stinner in :issue:`39946`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1451 +#: ../../whatsnew/3.9.rst:1452 msgid "" "Removed the following functions from the C API. Call :c:func:`PyGC_Collect` " "explicitly to clear all free lists. (Contributed by Inada Naoki and Victor " "Stinner in :issue:`37340`, :issue:`38896` and :issue:`40428`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1456 +#: ../../whatsnew/3.9.rst:1457 msgid "``PyAsyncGen_ClearFreeLists()``" msgstr "``PyAsyncGen_ClearFreeLists()``" -#: ../../whatsnew/3.9.rst:1457 +#: ../../whatsnew/3.9.rst:1458 msgid "``PyContext_ClearFreeList()``" msgstr "``PyContext_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1458 +#: ../../whatsnew/3.9.rst:1459 msgid "``PyDict_ClearFreeList()``" msgstr "``PyDict_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1459 +#: ../../whatsnew/3.9.rst:1460 msgid "``PyFloat_ClearFreeList()``" msgstr "``PyFloat_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1460 +#: ../../whatsnew/3.9.rst:1461 msgid "``PyFrame_ClearFreeList()``" msgstr "``PyFrame_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1461 +#: ../../whatsnew/3.9.rst:1462 msgid "``PyList_ClearFreeList()``" msgstr "``PyList_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1462 +#: ../../whatsnew/3.9.rst:1463 msgid "" "``PyMethod_ClearFreeList()`` and ``PyCFunction_ClearFreeList()``: the free " "lists of bound method objects have been removed." msgstr "" -#: ../../whatsnew/3.9.rst:1464 +#: ../../whatsnew/3.9.rst:1465 msgid "" "``PySet_ClearFreeList()``: the set free list has been removed in Python 3.4." msgstr "" -#: ../../whatsnew/3.9.rst:1466 +#: ../../whatsnew/3.9.rst:1467 msgid "``PyTuple_ClearFreeList()``" msgstr "``PyTuple_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1467 +#: ../../whatsnew/3.9.rst:1468 msgid "" "``PyUnicode_ClearFreeList()``: the Unicode free list has been removed in " "Python 3.3." msgstr "" -#: ../../whatsnew/3.9.rst:1470 +#: ../../whatsnew/3.9.rst:1471 msgid "" "Removed ``_PyUnicode_ClearStaticStrings()`` function. (Contributed by Victor " "Stinner in :issue:`39465`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1473 +#: ../../whatsnew/3.9.rst:1474 msgid "" "Removed ``Py_UNICODE_MATCH``. It has been deprecated by :pep:`393`, and " "broken since Python 3.3. The :c:func:`PyUnicode_Tailmatch` function can be " "used instead. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1478 +#: ../../whatsnew/3.9.rst:1479 msgid "" "Cleaned header files of interfaces defined but with no implementation. The " "public API symbols being removed are: " @@ -2421,26 +2423,26 @@ msgid "" "`39372`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1489 +#: ../../whatsnew/3.9.rst:1490 msgid "Notable changes in Python 3.9.1" msgstr "Python 3.9.1 中顯著的變更" -#: ../../whatsnew/3.9.rst:1494 +#: ../../whatsnew/3.9.rst:1495 msgid "" "The behavior of :class:`typing.Literal` was changed to conform with :pep:" "`586` and to match the behavior of static type checkers specified in the PEP." msgstr "" -#: ../../whatsnew/3.9.rst:1497 +#: ../../whatsnew/3.9.rst:1498 msgid "``Literal`` now de-duplicates parameters." msgstr "" -#: ../../whatsnew/3.9.rst:1498 +#: ../../whatsnew/3.9.rst:1499 msgid "" "Equality comparisons between ``Literal`` objects are now order independent." msgstr "" -#: ../../whatsnew/3.9.rst:1499 +#: ../../whatsnew/3.9.rst:1500 msgid "" "``Literal`` comparisons now respect types. For example, ``Literal[0] == " "Literal[False]`` previously evaluated to ``True``. It is now ``False``. To " @@ -2448,7 +2450,7 @@ msgid "" "differentiating types." msgstr "" -#: ../../whatsnew/3.9.rst:1503 +#: ../../whatsnew/3.9.rst:1504 msgid "" "``Literal`` objects will now raise a :exc:`TypeError` exception during " "equality comparisons if any of their parameters are not :term:`hashable`. " @@ -2456,7 +2458,7 @@ msgid "" "error::" msgstr "" -#: ../../whatsnew/3.9.rst:1508 +#: ../../whatsnew/3.9.rst:1509 msgid "" ">>> from typing import Literal\n" ">>> Literal[{0}]\n" @@ -2472,15 +2474,15 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: unhashable type: 'set'" -#: ../../whatsnew/3.9.rst:1515 +#: ../../whatsnew/3.9.rst:1516 msgid "(Contributed by Yurii Karabas in :issue:`42345`.)" msgstr "(由 Yurii Karabas 在 :issue:`42345` 中貢獻。)" -#: ../../whatsnew/3.9.rst:1518 +#: ../../whatsnew/3.9.rst:1519 msgid "macOS 11.0 (Big Sur) and Apple Silicon Mac support" msgstr "" -#: ../../whatsnew/3.9.rst:1520 +#: ../../whatsnew/3.9.rst:1521 msgid "" "As of 3.9.1, Python now fully supports building and running on macOS 11.0 " "(Big Sur) and on Apple Silicon Macs (based on the ``ARM64`` architecture). A " @@ -2492,19 +2494,19 @@ msgid "" "version in use at runtime (\"weaklinking\")." msgstr "" -#: ../../whatsnew/3.9.rst:1529 +#: ../../whatsnew/3.9.rst:1530 msgid "(Contributed by Ronald Oussoren and Lawrence D'Anna in :issue:`41100`.)" msgstr "(由 Ronald Oussoren 和 Lawrence D'Anna 在 :issue:`41100` 中貢獻。)" -#: ../../whatsnew/3.9.rst:1532 +#: ../../whatsnew/3.9.rst:1533 msgid "Notable changes in Python 3.9.2" msgstr "Python 3.9.2 中顯著的變更" -#: ../../whatsnew/3.9.rst:1535 +#: ../../whatsnew/3.9.rst:1536 msgid "collections.abc" msgstr "collections.abc" -#: ../../whatsnew/3.9.rst:1537 +#: ../../whatsnew/3.9.rst:1538 msgid "" ":class:`collections.abc.Callable` generic now flattens type parameters, " "similar to what :data:`typing.Callable` currently does. This means that " @@ -2520,11 +2522,11 @@ msgid "" "Python 3.10. (Contributed by Ken Jin in :issue:`42195`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1551 ../../whatsnew/3.9.rst:1576 +#: ../../whatsnew/3.9.rst:1552 ../../whatsnew/3.9.rst:1577 msgid "urllib.parse" msgstr "urllib.parse" -#: ../../whatsnew/3.9.rst:1553 +#: ../../whatsnew/3.9.rst:1554 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " "parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." @@ -2536,11 +2538,11 @@ msgid "" "Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1564 +#: ../../whatsnew/3.9.rst:1565 msgid "Notable changes in Python 3.9.3" msgstr "Python 3.9.3 中顯著的變更" -#: ../../whatsnew/3.9.rst:1566 +#: ../../whatsnew/3.9.rst:1567 msgid "" "A security fix alters the :class:`ftplib.FTP` behavior to not trust the IPv4 " "address sent from the remote server when setting up a passive data channel. " @@ -2549,11 +2551,11 @@ msgid "" "instance to ``True``. (See :gh:`87451`)" msgstr "" -#: ../../whatsnew/3.9.rst:1573 +#: ../../whatsnew/3.9.rst:1574 msgid "Notable changes in Python 3.9.5" msgstr "Python 3.9.5 中顯著的變更" -#: ../../whatsnew/3.9.rst:1578 +#: ../../whatsnew/3.9.rst:1579 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " "forms of attacks. Following the WHATWG specification that updates :rfc:" @@ -2563,11 +2565,11 @@ msgid "" "variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" -#: ../../whatsnew/3.9.rst:1586 +#: ../../whatsnew/3.9.rst:1587 msgid "Notable security feature in 3.9.14" msgstr "" -#: ../../whatsnew/3.9.rst:1588 +#: ../../whatsnew/3.9.rst:1589 msgid "" "Converting between :class:`int` and :class:`str` in bases other than 2 " "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " @@ -2580,15 +2582,15 @@ msgid "" "digits in string form." msgstr "" -#: ../../whatsnew/3.9.rst:1599 +#: ../../whatsnew/3.9.rst:1600 msgid "Notable changes in 3.9.17" msgstr "" -#: ../../whatsnew/3.9.rst:1602 +#: ../../whatsnew/3.9.rst:1603 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.9.rst:1604 +#: ../../whatsnew/3.9.rst:1605 msgid "" "The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`, " "have a new a *filter* argument that allows limiting tar features than may be "