From 7650db510fb786d7a56c3fc2e7764870b7e10ecb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Dec 2025 07:24:05 +0000 Subject: [PATCH 1/2] sync with cpython 7308015d --- c-api/set.po | 8 +- library/stdtypes.po | 2046 +++++++++++++++++---------------- reference/datamodel.po | 4 +- reference/lexical_analysis.po | 1078 +++++++++-------- whatsnew/2.3.po | 442 ++++--- 5 files changed, 1889 insertions(+), 1689 deletions(-) diff --git a/c-api/set.po b/c-api/set.po index 2bdbc213493..2fbd3280b8e 100644 --- a/c-api/set.po +++ b/c-api/set.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-27 00:03+0000\n" +"POT-Creation-Date: 2025-12-08 07:22+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -167,9 +167,9 @@ msgid "" "Return ``1`` if found and removed, ``0`` if not found (no action taken), and " "``-1`` if an error is encountered. Does not raise :exc:`KeyError` for " "missing keys. Raise a :exc:`TypeError` if the *key* is unhashable. Unlike " -"the Python :meth:`~frozenset.discard` method, this function does not " -"automatically convert unhashable sets into temporary frozensets. Raise :exc:" -"`SystemError` if *set* is not an instance of :class:`set` or its subtype." +"the Python :meth:`~set.discard` method, this function does not automatically " +"convert unhashable sets into temporary frozensets. Raise :exc:`SystemError` " +"if *set* is not an instance of :class:`set` or its subtype." msgstr "" #: ../../c-api/set.rst:158 diff --git a/library/stdtypes.po b/library/stdtypes.po index 65d42784ffd..d6283eaf900 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2025-12-08 07:22+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -135,8 +135,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:282 #: ../../library/stdtypes.rst:422 ../../library/stdtypes.rst:1005 -#: ../../library/stdtypes.rst:1224 ../../library/stdtypes.rst:2901 -#: ../../library/stdtypes.rst:4161 +#: ../../library/stdtypes.rst:1224 ../../library/stdtypes.rst:2927 +#: ../../library/stdtypes.rst:4187 msgid "Notes" msgstr "註解" @@ -150,7 +150,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:1007 #: ../../library/stdtypes.rst:1010 ../../library/stdtypes.rst:1239 -#: ../../library/stdtypes.rst:2907 ../../library/stdtypes.rst:4167 +#: ../../library/stdtypes.rst:2933 ../../library/stdtypes.rst:4193 msgid "\\(1)" msgstr "\\(1)" @@ -164,8 +164,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:295 #: ../../library/stdtypes.rst:315 ../../library/stdtypes.rst:1250 -#: ../../library/stdtypes.rst:2911 ../../library/stdtypes.rst:2913 -#: ../../library/stdtypes.rst:4171 ../../library/stdtypes.rst:4173 +#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:2939 +#: ../../library/stdtypes.rst:4197 ../../library/stdtypes.rst:4199 msgid "\\(2)" msgstr "\\(2)" @@ -177,18 +177,18 @@ msgstr "``not x``" msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" -#: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:2915 -#: ../../library/stdtypes.rst:2917 ../../library/stdtypes.rst:2919 -#: ../../library/stdtypes.rst:2921 ../../library/stdtypes.rst:4175 -#: ../../library/stdtypes.rst:4177 ../../library/stdtypes.rst:4179 -#: ../../library/stdtypes.rst:4181 +#: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:2941 +#: ../../library/stdtypes.rst:2943 ../../library/stdtypes.rst:2945 +#: ../../library/stdtypes.rst:2947 ../../library/stdtypes.rst:4201 +#: ../../library/stdtypes.rst:4203 ../../library/stdtypes.rst:4205 +#: ../../library/stdtypes.rst:4207 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:326 #: ../../library/stdtypes.rst:440 ../../library/stdtypes.rst:1049 -#: ../../library/stdtypes.rst:1254 ../../library/stdtypes.rst:2947 -#: ../../library/stdtypes.rst:4211 +#: ../../library/stdtypes.rst:1254 ../../library/stdtypes.rst:2973 +#: ../../library/stdtypes.rst:4237 msgid "Notes:" msgstr "註解:" @@ -235,9 +235,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2732 -#: ../../library/stdtypes.rst:2878 ../../library/stdtypes.rst:2901 -#: ../../library/stdtypes.rst:4138 ../../library/stdtypes.rst:4161 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2904 +#: ../../library/stdtypes.rst:2927 ../../library/stdtypes.rst:4164 +#: ../../library/stdtypes.rst:4187 msgid "Meaning" msgstr "含義" @@ -570,8 +570,8 @@ msgid "" "zero." msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" -#: ../../library/stdtypes.rst:308 ../../library/stdtypes.rst:2909 -#: ../../library/stdtypes.rst:4198 +#: ../../library/stdtypes.rst:308 ../../library/stdtypes.rst:2935 +#: ../../library/stdtypes.rst:4224 msgid "\\(6)" msgstr "\\(6)" @@ -608,9 +608,9 @@ msgid "*x* to the power *y*" msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:317 ../../library/stdtypes.rst:319 -#: ../../library/stdtypes.rst:2934 ../../library/stdtypes.rst:2937 -#: ../../library/stdtypes.rst:2940 ../../library/stdtypes.rst:4194 -#: ../../library/stdtypes.rst:4201 +#: ../../library/stdtypes.rst:2960 ../../library/stdtypes.rst:2963 +#: ../../library/stdtypes.rst:2966 ../../library/stdtypes.rst:4220 +#: ../../library/stdtypes.rst:4227 msgid "\\(5)" msgstr "\\(5)" @@ -768,9 +768,9 @@ msgid "bitwise :dfn:`or` of *x* and *y*" msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:427 -#: ../../library/stdtypes.rst:430 ../../library/stdtypes.rst:2923 -#: ../../library/stdtypes.rst:2927 ../../library/stdtypes.rst:4183 -#: ../../library/stdtypes.rst:4187 +#: ../../library/stdtypes.rst:430 ../../library/stdtypes.rst:2949 +#: ../../library/stdtypes.rst:2953 ../../library/stdtypes.rst:4209 +#: ../../library/stdtypes.rst:4213 msgid "\\(4)" msgstr "\\(4)" @@ -3085,7 +3085,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1891 ../../library/stdtypes.rst:3337 +#: ../../library/stdtypes.rst:1891 ../../library/stdtypes.rst:3363 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -3121,11 +3121,11 @@ msgstr "" ">>> encoded_str_to_bytes\n" "b'Python'" -#: ../../library/stdtypes.rst:1914 ../../library/stdtypes.rst:3356 +#: ../../library/stdtypes.rst:1914 ../../library/stdtypes.rst:3382 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1917 ../../library/stdtypes.rst:3359 +#: ../../library/stdtypes.rst:1917 ../../library/stdtypes.rst:3385 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." @@ -3468,7 +3468,7 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:2194 ../../library/stdtypes.rst:2739 +#: ../../library/stdtypes.rst:2194 msgid "For example:" msgstr "舉例來說:" @@ -3754,13 +3754,14 @@ msgstr "" #: ../../library/stdtypes.rst:2415 ../../library/stdtypes.rst:2433 #: ../../library/stdtypes.rst:2445 ../../library/stdtypes.rst:2499 #: ../../library/stdtypes.rst:2567 ../../library/stdtypes.rst:2637 -#: ../../library/stdtypes.rst:3672 ../../library/stdtypes.rst:3690 -#: ../../library/stdtypes.rst:3780 ../../library/stdtypes.rst:3796 -#: ../../library/stdtypes.rst:3821 ../../library/stdtypes.rst:3835 -#: ../../library/stdtypes.rst:3863 ../../library/stdtypes.rst:3877 -#: ../../library/stdtypes.rst:3895 ../../library/stdtypes.rst:3922 -#: ../../library/stdtypes.rst:3945 ../../library/stdtypes.rst:3972 -#: ../../library/stdtypes.rst:4014 ../../library/stdtypes.rst:4038 +#: ../../library/stdtypes.rst:2732 ../../library/stdtypes.rst:3698 +#: ../../library/stdtypes.rst:3716 ../../library/stdtypes.rst:3806 +#: ../../library/stdtypes.rst:3822 ../../library/stdtypes.rst:3847 +#: ../../library/stdtypes.rst:3861 ../../library/stdtypes.rst:3889 +#: ../../library/stdtypes.rst:3903 ../../library/stdtypes.rst:3921 +#: ../../library/stdtypes.rst:3948 ../../library/stdtypes.rst:3971 +#: ../../library/stdtypes.rst:3998 ../../library/stdtypes.rst:4040 +#: ../../library/stdtypes.rst:4064 msgid "For example::" msgstr "舉例來說: ::" @@ -4064,7 +4065,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2572 ../../library/stdtypes.rst:3982 +#: ../../library/stdtypes.rst:2572 ../../library/stdtypes.rst:4008 msgid "" "The algorithm uses a simple language-independent definition of a word as " "groups of consecutive letters. The definition works in many contexts but it " @@ -4176,240 +4177,251 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2660 +#: ../../library/stdtypes.rst:2662 msgid "Formatted String Literals (f-strings)" msgstr "" -#: ../../library/stdtypes.rst:2663 +#: ../../library/stdtypes.rst:2665 msgid "" "The :keyword:`await` and :keyword:`async for` can be used in expressions " "within f-strings." msgstr "" -#: ../../library/stdtypes.rst:2666 -msgid "Added the debugging operator (``=``)" +#: ../../library/stdtypes.rst:2668 +msgid "Added the debug specifier (``=``)" msgstr "" -#: ../../library/stdtypes.rst:2668 +#: ../../library/stdtypes.rst:2670 msgid "" "Many restrictions on expressions within f-strings have been removed. " "Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../library/stdtypes.rst:2672 +#: ../../library/stdtypes.rst:2674 msgid "" "An :dfn:`f-string` (formally a :dfn:`formatted string literal`) is a string " "literal that is prefixed with ``f`` or ``F``. This type of string literal " -"allows embedding arbitrary Python expressions within *replacement fields*, " -"which are delimited by curly brackets (``{}``). These expressions are " -"evaluated at runtime, similarly to :meth:`str.format`, and are converted " -"into regular :class:`str` objects. For example:" +"allows embedding the results of arbitrary Python expressions within " +"*replacement fields*, which are delimited by curly brackets (``{}``). Each " +"replacement field must contain an expression, optionally followed by:" msgstr "" -#: ../../library/stdtypes.rst:2680 -msgid "" -">>> who = 'nobody'\n" -">>> nationality = 'Spanish'\n" -">>> f'{who.title()} expects the {nationality} Inquisition!'\n" -"'Nobody expects the Spanish Inquisition!'" +#: ../../library/stdtypes.rst:2681 +msgid "a *debug specifier* -- an equal sign (``=``);" msgstr "" -">>> who = 'nobody'\n" -">>> nationality = 'Spanish'\n" -">>> f'{who.title()} expects the {nationality} Inquisition!'\n" -"'Nobody expects the Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2687 -msgid "It is also possible to use a multi line f-string:" +#: ../../library/stdtypes.rst:2682 +msgid "a *conversion specifier* -- ``!s``, ``!r`` or ``!a``; and/or" msgstr "" -#: ../../library/stdtypes.rst:2689 -msgid "" -">>> f'''This is a string\n" -"... on two lines'''\n" -"'This is a string\\non two lines'" +#: ../../library/stdtypes.rst:2683 +msgid "a *format specifier* prefixed with a colon (``:``)." msgstr "" -">>> f'''This is a string\n" -"... on two lines'''\n" -"'This is a string\\non two lines'" -#: ../../library/stdtypes.rst:2695 +#: ../../library/stdtypes.rst:2685 msgid "" -"A single opening curly bracket, ``'{'``, marks a *replacement field* that " -"can contain any Python expression:" +"See the :ref:`Lexical Analysis section on f-strings ` for details " +"on the syntax of these fields." msgstr "" -#: ../../library/stdtypes.rst:2698 -msgid "" -">>> nationality = 'Spanish'\n" -">>> f'The {nationality} Inquisition!'\n" -"'The Spanish Inquisition!'" +#: ../../library/stdtypes.rst:2689 +msgid "Debug specifier" msgstr "" -">>> nationality = 'Spanish'\n" -">>> f'The {nationality} Inquisition!'\n" -"'The Spanish Inquisition!'" -#: ../../library/stdtypes.rst:2704 -msgid "To include a literal ``{`` or ``}``, use a double bracket:" +#: ../../library/stdtypes.rst:2693 +msgid "" +"If a debug specifier -- an equal sign (``=``) -- appears after the " +"replacement field expression, the resulting f-string will contain the " +"expression's source, the equal sign, and the value of the expression. This " +"is often useful for debugging::" msgstr "" -#: ../../library/stdtypes.rst:2706 +#: ../../library/stdtypes.rst:2698 msgid "" -">>> x = 42\n" -">>> f'{{x}} is {x}'\n" -"'{x} is 42'" +">>> number = 14.3\n" +">>> f'{number=}'\n" +"'number=14.3'" msgstr "" -">>> x = 42\n" -">>> f'{{x}} is {x}'\n" -"'{x} is 42'" -#: ../../library/stdtypes.rst:2712 +#: ../../library/stdtypes.rst:2702 msgid "" -"Functions can also be used, and :ref:`format specifiers `:" +"Whitespace before, inside and after the expression, as well as whitespace " +"after the equal sign, is significant --- it is retained in the result::" msgstr "" -#: ../../library/stdtypes.rst:2714 +#: ../../library/stdtypes.rst:2705 msgid "" -">>> from math import sqrt\n" -">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" -"'√2 ≈ 1.41421'" +">>> f'{ number - 4 = }'\n" +"' number - 4 = 10.3'" msgstr "" -">>> from math import sqrt\n" -">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" -"'√2 ≈ 1.41421'" -#: ../../library/stdtypes.rst:2720 -msgid "Any non-string expression is converted using :func:`str`, by default:" +#: ../../library/stdtypes.rst:2710 +#, fuzzy +msgid "Conversion specifier" +msgstr "conversions(轉換)" + +#: ../../library/stdtypes.rst:2712 +msgid "" +"By default, the value of a replacement field expression is converted to a " +"string using :func:`str`::" msgstr "" -#: ../../library/stdtypes.rst:2722 +#: ../../library/stdtypes.rst:2715 +#, fuzzy msgid "" ">>> from fractions import Fraction\n" -">>> f'{Fraction(1, 3)}'\n" +">>> one_third = Fraction(1, 3)\n" +">>> f'{one_third}'\n" "'1/3'" msgstr "" ">>> from fractions import Fraction\n" ">>> f'{Fraction(1, 3)}'\n" "'1/3'" -#: ../../library/stdtypes.rst:2728 +#: ../../library/stdtypes.rst:2720 msgid "" -"To use an explicit conversion, use the ``!`` (exclamation mark) operator, " -"followed by any of the valid formats, which are:" +"When a debug specifier but no format specifier is used, the default " +"conversion instead uses :func:`repr`::" msgstr "" -#: ../../library/stdtypes.rst:2732 ../../library/stdtypes.rst:2901 -#: ../../library/stdtypes.rst:4161 -msgid "Conversion" +#: ../../library/stdtypes.rst:2723 +msgid "" +">>> f'{one_third = }'\n" +"'one_third = Fraction(1, 3)'" msgstr "" -#: ../../library/stdtypes.rst:2734 -msgid "``!a``" -msgstr "``!a``" - -#: ../../library/stdtypes.rst:2734 -msgid ":func:`ascii`" -msgstr ":func:`ascii`" +#: ../../library/stdtypes.rst:2726 +msgid "" +"The conversion can be specified explicitly using one of these specifiers:" +msgstr "" -#: ../../library/stdtypes.rst:2735 -msgid "``!r``" -msgstr "``!r``" +#: ../../library/stdtypes.rst:2728 +#, fuzzy +msgid "``!s`` for :func:`str`" +msgstr ":func:`str`" -#: ../../library/stdtypes.rst:2735 -msgid ":func:`repr`" +#: ../../library/stdtypes.rst:2729 +#, fuzzy +msgid "``!r`` for :func:`repr`" msgstr ":func:`repr`" -#: ../../library/stdtypes.rst:2736 -msgid "``!s``" -msgstr "``!s``" - -#: ../../library/stdtypes.rst:2736 -msgid ":func:`str`" -msgstr ":func:`str`" +#: ../../library/stdtypes.rst:2730 +#, fuzzy +msgid "``!a`` for :func:`ascii`" +msgstr ":func:`ascii`" -#: ../../library/stdtypes.rst:2741 +#: ../../library/stdtypes.rst:2734 msgid "" -">>> from fractions import Fraction\n" -">>> f'{Fraction(1, 3)!s}'\n" +">>> str(one_third)\n" "'1/3'\n" -">>> f'{Fraction(1, 3)!r}'\n" +">>> repr(one_third)\n" "'Fraction(1, 3)'\n" -">>> question = '¿Dónde está el Presidente?'\n" -">>> print(f'{question!a}')\n" -"'\\xbfD\\xf3nde est\\xe1 el Presidente?'" +"\n" +">>> f'{one_third!s} is {one_third!r}'\n" +"'1/3 is Fraction(1, 3)'\n" +"\n" +">>> string = \"¡kočka 😸!\"\n" +">>> ascii(string)\n" +"\"'\\\\xa1ko\\\\u010dka \\\\U0001f638!'\"\n" +"\n" +">>> f'{string = !a}'\n" +"\"string = '\\\\xa1ko\\\\u010dka \\\\U0001f638!'\"" +msgstr "" + +#: ../../library/stdtypes.rst:2751 +msgid "Format specifier" msgstr "" -">>> from fractions import Fraction\n" -">>> f'{Fraction(1, 3)!s}'\n" -"'1/3'\n" -">>> f'{Fraction(1, 3)!r}'\n" -"'Fraction(1, 3)'\n" -">>> question = '¿Dónde está el Presidente?'\n" -">>> print(f'{question!a}')\n" -"'\\xbfD\\xf3nde est\\xe1 el Presidente?'" -#: ../../library/stdtypes.rst:2752 +#: ../../library/stdtypes.rst:2753 msgid "" -"While debugging it may be helpful to see both the expression and its value, " -"by using the equals sign (``=``) after the expression. This preserves spaces " -"within the brackets, and can be used with a converter. By default, the " -"debugging operator uses the :func:`repr` (``!r``) conversion. For example:" +"After the expression has been evaluated, and possibly converted using an " +"explicit conversion specifier, it is formatted using the :func:`format` " +"function. If the replacement field includes a *format specifier* introduced " +"by a colon (``:``), the specifier is passed to :func:`!format` as the second " +"argument. The result of :func:`!format` is then used as the final value for " +"the replacement field. For example::" msgstr "" -#: ../../library/stdtypes.rst:2758 +#: ../../library/stdtypes.rst:2760 msgid "" ">>> from fractions import Fraction\n" -">>> calculation = Fraction(1, 3)\n" -">>> f'{calculation=}'\n" -"'calculation=Fraction(1, 3)'\n" -">>> f'{calculation = }'\n" -"'calculation = Fraction(1, 3)'\n" -">>> f'{calculation = !s}'\n" -"'calculation = 1/3'" +">>> one_third = Fraction(1, 3)\n" +">>> f'{one_third:.6f}'\n" +"'0.333333'\n" +">>> f'{one_third:_^+10}'\n" +"'___+1/3___'\n" +">>> >>> f'{one_third!r:_^20}'\n" +"'___Fraction(1, 3)___'\n" +">>> f'{one_third = :~>10}~'\n" +"'one_third = ~~~~~~~1/3~'" +msgstr "" + +#: ../../library/stdtypes.rst:2774 +#, fuzzy +msgid "Template String Literals (t-strings)" +msgstr "interpolated string literal(插值字串常數)" + +#: ../../library/stdtypes.rst:2776 +msgid "" +"An :dfn:`t-string` (formally a :dfn:`template string literal`) is a string " +"literal that is prefixed with ``t`` or ``T``." msgstr "" -">>> from fractions import Fraction\n" -">>> calculation = Fraction(1, 3)\n" -">>> f'{calculation=}'\n" -"'calculation=Fraction(1, 3)'\n" -">>> f'{calculation = }'\n" -"'calculation = Fraction(1, 3)'\n" -">>> f'{calculation = !s}'\n" -"'calculation = 1/3'" -#: ../../library/stdtypes.rst:2769 +#: ../../library/stdtypes.rst:2779 msgid "" -"Once the output has been evaluated, it can be formatted using a :ref:`format " -"specifier ` following a colon (``':'``). After the expression " -"has been evaluated, and possibly converted to a string, the :meth:`!" -"__format__` method of the result is called with the format specifier, or the " -"empty string if no format specifier is given. The formatted result is then " -"used as the final value for the replacement field. For example:" +"These strings follow the same syntax and evaluation rules as :ref:`formatted " +"string literals `, with for the following differences:" msgstr "" -#: ../../library/stdtypes.rst:2777 +#: ../../library/stdtypes.rst:2783 msgid "" -">>> from fractions import Fraction\n" -">>> f'{Fraction(1, 7):.6f}'\n" -"'0.142857'\n" -">>> f'{Fraction(1, 7):_^+10}'\n" -"'___+1/7___'" +"Rather than evaluating to a ``str`` object, template string literals " +"evaluate to a :class:`string.templatelib.Template` object." +msgstr "" + +#: ../../library/stdtypes.rst:2786 +msgid "" +"The :func:`format` protocol is not used. Instead, the format specifier and " +"conversions (if any) are passed to a new :class:`~string.templatelib." +"Interpolation` object that is created for each evaluated expression. It is " +"up to code that processes the resulting :class:`~string.templatelib." +"Template` object to decide how to handle format specifiers and conversions." +msgstr "" + +#: ../../library/stdtypes.rst:2793 +msgid "" +"Format specifiers containing nested replacement fields are evaluated " +"eagerly, prior to being passed to the :class:`~string.templatelib." +"Interpolation` object. For instance, an interpolation of the form ``{amount:." +"{precision}f}`` will evaluate the inner expression ``{precision}`` to " +"determine the value of the ``format_spec`` attribute. If ``precision`` were " +"to be ``2``, the resulting format specifier would be ``'.2f'``." msgstr "" -">>> from fractions import Fraction\n" -">>> f'{Fraction(1, 7):.6f}'\n" -"'0.142857'\n" -">>> f'{Fraction(1, 7):_^+10}'\n" -"'___+1/7___'" -#: ../../library/stdtypes.rst:2789 +#: ../../library/stdtypes.rst:2801 +msgid "" +"When the equals sign ``'='`` is provided in an interpolation expression, the " +"text of the expression is appended to the literal string that precedes the " +"relevant interpolation. This includes the equals sign and any surrounding " +"whitespace. The :class:`!Interpolation` instance for the expression will be " +"created as normal, except that :attr:`~string.templatelib.Interpolation." +"conversion` will be set to '``r``' (:func:`repr`) by default. If an explicit " +"conversion or format specifier are provided, this will override the default " +"behaviour." +msgstr "" + +#: ../../library/stdtypes.rst:2815 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2802 +#: ../../library/stdtypes.rst:2828 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " "dictionaries correctly)." msgstr "" -#: ../../library/stdtypes.rst:2806 +#: ../../library/stdtypes.rst:2832 msgid "" "Using :ref:`formatted string literals `, the :meth:`str.format` " "interface, or :class:`string.Template` may help avoid these errors. Each of " @@ -4417,7 +4429,7 @@ msgid "" "flexibility, and/or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2811 +#: ../../library/stdtypes.rst:2837 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -4427,7 +4439,7 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:2818 +#: ../../library/stdtypes.rst:2844 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." @@ -4435,7 +4447,7 @@ msgstr "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." -#: ../../library/stdtypes.rst:2823 +#: ../../library/stdtypes.rst:2849 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -4443,36 +4455,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2833 ../../library/stdtypes.rst:4093 +#: ../../library/stdtypes.rst:2859 ../../library/stdtypes.rst:4119 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2836 ../../library/stdtypes.rst:4096 +#: ../../library/stdtypes.rst:2862 ../../library/stdtypes.rst:4122 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2838 ../../library/stdtypes.rst:4098 +#: ../../library/stdtypes.rst:2864 ../../library/stdtypes.rst:4124 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2841 ../../library/stdtypes.rst:4101 +#: ../../library/stdtypes.rst:2867 ../../library/stdtypes.rst:4127 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2844 ../../library/stdtypes.rst:4104 +#: ../../library/stdtypes.rst:2870 ../../library/stdtypes.rst:4130 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is read from the next element of the tuple in *values*, and the " "object to convert comes after the minimum field width and optional precision." msgstr "" -#: ../../library/stdtypes.rst:2848 ../../library/stdtypes.rst:4108 +#: ../../library/stdtypes.rst:2874 ../../library/stdtypes.rst:4134 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -4480,15 +4492,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2853 ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:2879 ../../library/stdtypes.rst:4139 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2855 ../../library/stdtypes.rst:4115 +#: ../../library/stdtypes.rst:2881 ../../library/stdtypes.rst:4141 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2857 +#: ../../library/stdtypes.rst:2883 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the string *must* include a parenthesised mapping key into that " @@ -4496,275 +4508,279 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2866 ../../library/stdtypes.rst:4126 +#: ../../library/stdtypes.rst:2892 ../../library/stdtypes.rst:4152 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2869 ../../library/stdtypes.rst:4129 +#: ../../library/stdtypes.rst:2895 ../../library/stdtypes.rst:4155 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2878 ../../library/stdtypes.rst:4138 +#: ../../library/stdtypes.rst:2904 ../../library/stdtypes.rst:4164 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2880 ../../library/stdtypes.rst:4140 +#: ../../library/stdtypes.rst:2906 ../../library/stdtypes.rst:4166 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2880 ../../library/stdtypes.rst:4140 +#: ../../library/stdtypes.rst:2906 ../../library/stdtypes.rst:4166 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2883 ../../library/stdtypes.rst:4143 +#: ../../library/stdtypes.rst:2909 ../../library/stdtypes.rst:4169 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2883 ../../library/stdtypes.rst:4143 +#: ../../library/stdtypes.rst:2909 ../../library/stdtypes.rst:4169 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2885 ../../library/stdtypes.rst:4145 +#: ../../library/stdtypes.rst:2911 ../../library/stdtypes.rst:4171 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2885 ../../library/stdtypes.rst:4145 +#: ../../library/stdtypes.rst:2911 ../../library/stdtypes.rst:4171 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2888 ../../library/stdtypes.rst:4148 +#: ../../library/stdtypes.rst:2914 ../../library/stdtypes.rst:4174 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2888 ../../library/stdtypes.rst:4148 +#: ../../library/stdtypes.rst:2914 ../../library/stdtypes.rst:4174 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2891 ../../library/stdtypes.rst:4151 +#: ../../library/stdtypes.rst:2917 ../../library/stdtypes.rst:4177 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2891 ../../library/stdtypes.rst:4151 +#: ../../library/stdtypes.rst:2917 ../../library/stdtypes.rst:4177 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2895 ../../library/stdtypes.rst:4155 +#: ../../library/stdtypes.rst:2921 ../../library/stdtypes.rst:4181 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" -#: ../../library/stdtypes.rst:2898 ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:2924 ../../library/stdtypes.rst:4184 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2903 ../../library/stdtypes.rst:4163 +#: ../../library/stdtypes.rst:2927 ../../library/stdtypes.rst:4187 +msgid "Conversion" +msgstr "" + +#: ../../library/stdtypes.rst:2929 ../../library/stdtypes.rst:4189 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2903 ../../library/stdtypes.rst:2905 -#: ../../library/stdtypes.rst:4163 ../../library/stdtypes.rst:4165 +#: ../../library/stdtypes.rst:2929 ../../library/stdtypes.rst:2931 +#: ../../library/stdtypes.rst:4189 ../../library/stdtypes.rst:4191 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2905 ../../library/stdtypes.rst:4165 +#: ../../library/stdtypes.rst:2931 ../../library/stdtypes.rst:4191 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2907 ../../library/stdtypes.rst:4167 +#: ../../library/stdtypes.rst:2933 ../../library/stdtypes.rst:4193 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2907 ../../library/stdtypes.rst:4167 +#: ../../library/stdtypes.rst:2933 ../../library/stdtypes.rst:4193 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2909 ../../library/stdtypes.rst:4169 +#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:4195 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2909 ../../library/stdtypes.rst:4169 +#: ../../library/stdtypes.rst:2935 ../../library/stdtypes.rst:4195 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2911 ../../library/stdtypes.rst:4171 +#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:4197 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2911 ../../library/stdtypes.rst:4171 +#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:4197 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2913 ../../library/stdtypes.rst:4173 +#: ../../library/stdtypes.rst:2939 ../../library/stdtypes.rst:4199 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2913 ../../library/stdtypes.rst:4173 +#: ../../library/stdtypes.rst:2939 ../../library/stdtypes.rst:4199 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2915 ../../library/stdtypes.rst:4175 +#: ../../library/stdtypes.rst:2941 ../../library/stdtypes.rst:4201 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2915 ../../library/stdtypes.rst:4175 +#: ../../library/stdtypes.rst:2941 ../../library/stdtypes.rst:4201 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2917 ../../library/stdtypes.rst:4177 +#: ../../library/stdtypes.rst:2943 ../../library/stdtypes.rst:4203 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2917 ../../library/stdtypes.rst:4177 +#: ../../library/stdtypes.rst:2943 ../../library/stdtypes.rst:4203 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2919 ../../library/stdtypes.rst:4179 +#: ../../library/stdtypes.rst:2945 ../../library/stdtypes.rst:4205 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2919 ../../library/stdtypes.rst:2921 -#: ../../library/stdtypes.rst:4179 ../../library/stdtypes.rst:4181 +#: ../../library/stdtypes.rst:2945 ../../library/stdtypes.rst:2947 +#: ../../library/stdtypes.rst:4205 ../../library/stdtypes.rst:4207 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2921 ../../library/stdtypes.rst:4181 +#: ../../library/stdtypes.rst:2947 ../../library/stdtypes.rst:4207 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2923 ../../library/stdtypes.rst:4183 +#: ../../library/stdtypes.rst:2949 ../../library/stdtypes.rst:4209 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2923 ../../library/stdtypes.rst:4183 +#: ../../library/stdtypes.rst:2949 ../../library/stdtypes.rst:4209 msgid "" "Floating-point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2927 ../../library/stdtypes.rst:4187 +#: ../../library/stdtypes.rst:2953 ../../library/stdtypes.rst:4213 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2927 ../../library/stdtypes.rst:4187 +#: ../../library/stdtypes.rst:2953 ../../library/stdtypes.rst:4213 msgid "" "Floating-point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2931 ../../library/stdtypes.rst:4191 +#: ../../library/stdtypes.rst:2957 ../../library/stdtypes.rst:4217 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2931 +#: ../../library/stdtypes.rst:2957 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2934 ../../library/stdtypes.rst:4204 +#: ../../library/stdtypes.rst:2960 ../../library/stdtypes.rst:4230 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2934 +#: ../../library/stdtypes.rst:2960 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:4198 +#: ../../library/stdtypes.rst:2963 ../../library/stdtypes.rst:4224 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2937 +#: ../../library/stdtypes.rst:2963 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2940 ../../library/stdtypes.rst:4201 +#: ../../library/stdtypes.rst:2966 ../../library/stdtypes.rst:4227 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2940 +#: ../../library/stdtypes.rst:2966 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2943 ../../library/stdtypes.rst:4207 +#: ../../library/stdtypes.rst:2969 ../../library/stdtypes.rst:4233 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2943 ../../library/stdtypes.rst:4207 +#: ../../library/stdtypes.rst:2969 ../../library/stdtypes.rst:4233 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2950 ../../library/stdtypes.rst:4214 +#: ../../library/stdtypes.rst:2976 ../../library/stdtypes.rst:4240 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2954 ../../library/stdtypes.rst:4218 +#: ../../library/stdtypes.rst:2980 ../../library/stdtypes.rst:4244 msgid "" "The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on " "whether the ``'x'`` or ``'X'`` format was used) to be inserted before the " "first digit." msgstr "" -#: ../../library/stdtypes.rst:2958 ../../library/stdtypes.rst:4222 +#: ../../library/stdtypes.rst:2984 ../../library/stdtypes.rst:4248 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2961 ../../library/stdtypes.rst:4225 +#: ../../library/stdtypes.rst:2987 ../../library/stdtypes.rst:4251 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2965 ../../library/stdtypes.rst:4229 +#: ../../library/stdtypes.rst:2991 ../../library/stdtypes.rst:4255 msgid "" "The alternate form causes the result to always contain a decimal point, and " "trailing zeroes are not removed as they would otherwise be." msgstr "" -#: ../../library/stdtypes.rst:2968 ../../library/stdtypes.rst:4232 +#: ../../library/stdtypes.rst:2994 ../../library/stdtypes.rst:4258 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2972 ../../library/stdtypes.rst:4236 +#: ../../library/stdtypes.rst:2998 ../../library/stdtypes.rst:4262 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2975 ../../library/stdtypes.rst:4245 +#: ../../library/stdtypes.rst:3001 ../../library/stdtypes.rst:4271 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2977 +#: ../../library/stdtypes.rst:3003 msgid "" "Since Python strings have an explicit length, ``%s`` conversions do not " "assume that ``'\\0'`` is the end of the string." msgstr "" -#: ../../library/stdtypes.rst:2982 +#: ../../library/stdtypes.rst:3008 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2993 +#: ../../library/stdtypes.rst:3019 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:3001 +#: ../../library/stdtypes.rst:3027 msgid "" "The core built-in types for manipulating binary data are :class:`bytes` and :" "class:`bytearray`. They are supported by :class:`memoryview` which uses the :" @@ -4772,17 +4788,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:3006 +#: ../../library/stdtypes.rst:3032 msgid "" "The :mod:`array` module supports efficient storage of basic data types like " "32-bit integers and IEEE754 double-precision floating values." msgstr "" -#: ../../library/stdtypes.rst:3012 +#: ../../library/stdtypes.rst:3038 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:3016 +#: ../../library/stdtypes.rst:3042 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -4790,40 +4806,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:3024 +#: ../../library/stdtypes.rst:3050 msgid "" "Firstly, the syntax for bytes literals is largely the same as that for " "string literals, except that a ``b`` prefix is added:" msgstr "" -#: ../../library/stdtypes.rst:3027 +#: ../../library/stdtypes.rst:3053 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:3028 +#: ../../library/stdtypes.rst:3054 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:3029 +#: ../../library/stdtypes.rst:3055 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:3031 +#: ../../library/stdtypes.rst:3057 msgid "" "Only ASCII characters are permitted in bytes literals (regardless of the " "declared source code encoding). Any binary values over 127 must be entered " "into bytes literals using the appropriate escape sequence." msgstr "" -#: ../../library/stdtypes.rst:3035 +#: ../../library/stdtypes.rst:3061 msgid "" "As with string literals, bytes literals may also use a ``r`` prefix to " "disable processing of escape sequences. See :ref:`strings` for more about " "the various forms of bytes literal, including supported escape sequences." msgstr "" -#: ../../library/stdtypes.rst:3039 +#: ../../library/stdtypes.rst:3065 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -4836,29 +4852,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:3049 +#: ../../library/stdtypes.rst:3075 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:3052 +#: ../../library/stdtypes.rst:3078 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:3053 +#: ../../library/stdtypes.rst:3079 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:3054 +#: ../../library/stdtypes.rst:3080 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:3056 +#: ../../library/stdtypes.rst:3082 msgid "Also see the :ref:`bytes ` built-in." msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:3058 +#: ../../library/stdtypes.rst:3084 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4866,38 +4882,38 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:3064 +#: ../../library/stdtypes.rst:3090 msgid "" "This :class:`bytes` class method returns a bytes object, decoding the given " "string object. The string must contain two hexadecimal digits per byte, " "with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:3071 +#: ../../library/stdtypes.rst:3097 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:3075 +#: ../../library/stdtypes.rst:3101 msgid "" ":meth:`bytes.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-like " "objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3079 +#: ../../library/stdtypes.rst:3105 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3085 ../../library/stdtypes.rst:3176 +#: ../../library/stdtypes.rst:3111 ../../library/stdtypes.rst:3202 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:3091 +#: ../../library/stdtypes.rst:3117 msgid "" "If you want to make the hex string easier to read, you can specify a single " "character separator *sep* parameter to include in the output. By default, " @@ -4906,13 +4922,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:3108 +#: ../../library/stdtypes.rst:3134 msgid "" ":meth:`bytes.hex` now supports optional *sep* and *bytes_per_sep* parameters " "to insert separators between bytes in the hex output." msgstr "" -#: ../../library/stdtypes.rst:3112 +#: ../../library/stdtypes.rst:3138 msgid "" "Since bytes objects are sequences of integers (akin to a tuple), for a bytes " "object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes " @@ -4920,58 +4936,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3117 +#: ../../library/stdtypes.rst:3143 msgid "" "The representation of bytes objects uses the literal format (``b'...'``) " "since it is often more useful than e.g. ``bytes([46, 46, 46])``. You can " "always convert a bytes object into a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:3125 +#: ../../library/stdtypes.rst:3151 msgid "Bytearray Objects" msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:3129 +#: ../../library/stdtypes.rst:3155 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:3135 +#: ../../library/stdtypes.rst:3161 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:3138 +#: ../../library/stdtypes.rst:3164 msgid "Creating an empty instance: ``bytearray()``" msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:3139 +#: ../../library/stdtypes.rst:3165 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:3140 +#: ../../library/stdtypes.rst:3166 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:3141 +#: ../../library/stdtypes.rst:3167 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:3143 +#: ../../library/stdtypes.rst:3169 msgid "" "As bytearray objects are mutable, they support the :ref:`mutable ` sequence operations in addition to the common bytes and bytearray " "operations described in :ref:`bytes-methods`." msgstr "" -#: ../../library/stdtypes.rst:3147 +#: ../../library/stdtypes.rst:3173 msgid "Also see the :ref:`bytearray ` built-in." msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:3149 +#: ../../library/stdtypes.rst:3175 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4979,64 +4995,64 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:3155 +#: ../../library/stdtypes.rst:3181 msgid "" "This :class:`bytearray` class method returns bytearray object, decoding the " "given string object. The string must contain two hexadecimal digits per " "byte, with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:3162 +#: ../../library/stdtypes.rst:3188 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:3166 +#: ../../library/stdtypes.rst:3192 msgid "" ":meth:`bytearray.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-" "like objects ` as input." msgstr "" -#: ../../library/stdtypes.rst:3170 +#: ../../library/stdtypes.rst:3196 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:3184 +#: ../../library/stdtypes.rst:3210 msgid "" "Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:3191 +#: ../../library/stdtypes.rst:3217 msgid "" "Resize the :class:`bytearray` to contain *size* bytes. *size* must be " "greater than or equal to 0." msgstr "" -#: ../../library/stdtypes.rst:3194 +#: ../../library/stdtypes.rst:3220 msgid "" "If the :class:`bytearray` needs to shrink, bytes beyond *size* are truncated." msgstr "" -#: ../../library/stdtypes.rst:3196 +#: ../../library/stdtypes.rst:3222 msgid "" "If the :class:`bytearray` needs to grow, all new bytes, those beyond *size*, " "will be set to null bytes." msgstr "" -#: ../../library/stdtypes.rst:3200 +#: ../../library/stdtypes.rst:3226 msgid "This is equivalent to:" msgstr "等同於:" -#: ../../library/stdtypes.rst:3208 +#: ../../library/stdtypes.rst:3234 msgid "Examples:" msgstr "範例:" -#: ../../library/stdtypes.rst:3221 +#: ../../library/stdtypes.rst:3247 msgid "" "Since bytearray objects are sequences of integers (akin to a list), for a " "bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be " @@ -5044,7 +5060,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:3226 +#: ../../library/stdtypes.rst:3252 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -5052,11 +5068,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:3235 +#: ../../library/stdtypes.rst:3261 msgid "Bytes and Bytearray Operations" msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:3240 +#: ../../library/stdtypes.rst:3266 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -5065,14 +5081,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:3248 +#: ../../library/stdtypes.rst:3274 msgid "" "The methods on bytes and bytearray objects don't accept strings as their " "arguments, just as the methods on strings don't accept bytes as their " "arguments. For example, you have to write::" msgstr "" -#: ../../library/stdtypes.rst:3252 +#: ../../library/stdtypes.rst:3278 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -5080,11 +5096,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:3255 +#: ../../library/stdtypes.rst:3281 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:3257 +#: ../../library/stdtypes.rst:3283 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -5092,60 +5108,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:3260 +#: ../../library/stdtypes.rst:3286 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" -#: ../../library/stdtypes.rst:3265 +#: ../../library/stdtypes.rst:3291 msgid "" "Using these ASCII based operations to manipulate binary data that is not " "stored in an ASCII based format may lead to data corruption." msgstr "" -#: ../../library/stdtypes.rst:3268 +#: ../../library/stdtypes.rst:3294 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:3274 +#: ../../library/stdtypes.rst:3300 msgid "" "Return the number of non-overlapping occurrences of subsequence *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:3278 ../../library/stdtypes.rst:3383 -#: ../../library/stdtypes.rst:3405 ../../library/stdtypes.rst:3471 -#: ../../library/stdtypes.rst:3484 +#: ../../library/stdtypes.rst:3304 ../../library/stdtypes.rst:3409 +#: ../../library/stdtypes.rst:3431 ../../library/stdtypes.rst:3497 +#: ../../library/stdtypes.rst:3510 msgid "" "The subsequence to search for may be any :term:`bytes-like object` or an " "integer in the range 0 to 255." msgstr "" -#: ../../library/stdtypes.rst:3281 +#: ../../library/stdtypes.rst:3307 msgid "" "If *sub* is empty, returns the number of empty slices between characters " "which is the length of the bytes object plus one." msgstr "" -#: ../../library/stdtypes.rst:3284 ../../library/stdtypes.rst:3395 -#: ../../library/stdtypes.rst:3408 ../../library/stdtypes.rst:3474 -#: ../../library/stdtypes.rst:3487 +#: ../../library/stdtypes.rst:3310 ../../library/stdtypes.rst:3421 +#: ../../library/stdtypes.rst:3434 ../../library/stdtypes.rst:3500 +#: ../../library/stdtypes.rst:3513 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:3291 +#: ../../library/stdtypes.rst:3317 msgid "" "If the binary data starts with the *prefix* string, return " "``bytes[len(prefix):]``. Otherwise, return a copy of the original binary " "data::" msgstr "" -#: ../../library/stdtypes.rst:3295 +#: ../../library/stdtypes.rst:3321 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -5157,32 +5173,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:3300 +#: ../../library/stdtypes.rst:3326 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" -#: ../../library/stdtypes.rst:3304 ../../library/stdtypes.rst:3326 -#: ../../library/stdtypes.rst:3459 ../../library/stdtypes.rst:3552 -#: ../../library/stdtypes.rst:3566 ../../library/stdtypes.rst:3596 -#: ../../library/stdtypes.rst:3610 ../../library/stdtypes.rst:3651 -#: ../../library/stdtypes.rst:3721 ../../library/stdtypes.rst:3739 -#: ../../library/stdtypes.rst:3767 ../../library/stdtypes.rst:3906 -#: ../../library/stdtypes.rst:3961 ../../library/stdtypes.rst:4004 -#: ../../library/stdtypes.rst:4025 ../../library/stdtypes.rst:4047 -#: ../../library/stdtypes.rst:4249 +#: ../../library/stdtypes.rst:3330 ../../library/stdtypes.rst:3352 +#: ../../library/stdtypes.rst:3485 ../../library/stdtypes.rst:3578 +#: ../../library/stdtypes.rst:3592 ../../library/stdtypes.rst:3622 +#: ../../library/stdtypes.rst:3636 ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:3747 ../../library/stdtypes.rst:3765 +#: ../../library/stdtypes.rst:3793 ../../library/stdtypes.rst:3932 +#: ../../library/stdtypes.rst:3987 ../../library/stdtypes.rst:4030 +#: ../../library/stdtypes.rst:4051 ../../library/stdtypes.rst:4073 +#: ../../library/stdtypes.rst:4275 msgid "" "The bytearray version of this method does *not* operate in place - it always " "produces a new object, even if no changes were made." msgstr "" -#: ../../library/stdtypes.rst:3313 +#: ../../library/stdtypes.rst:3339 msgid "" "If the binary data ends with the *suffix* string and that *suffix* is not " "empty, return ``bytes[:-len(suffix)]``. Otherwise, return a copy of the " "original binary data::" msgstr "" -#: ../../library/stdtypes.rst:3317 +#: ../../library/stdtypes.rst:3343 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -5194,15 +5210,15 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:3322 +#: ../../library/stdtypes.rst:3348 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3335 +#: ../../library/stdtypes.rst:3361 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:3340 +#: ../../library/stdtypes.rst:3366 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -5210,21 +5226,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:3346 +#: ../../library/stdtypes.rst:3372 msgid "" "For performance reasons, the value of *errors* is not checked for validity " "unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" "`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:3352 +#: ../../library/stdtypes.rst:3378 msgid "" "Passing the *encoding* argument to :class:`str` allows decoding any :term:" "`bytes-like object` directly, without needing to make a temporary :class:`!" "bytes` or :class:`!bytearray` object." msgstr "" -#: ../../library/stdtypes.rst:3367 +#: ../../library/stdtypes.rst:3393 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -5232,11 +5248,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3372 +#: ../../library/stdtypes.rst:3398 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3378 +#: ../../library/stdtypes.rst:3404 msgid "" "Return the lowest index in the data where the subsequence *sub* is found, " "such that *sub* is contained in the slice ``s[start:end]``. Optional " @@ -5244,14 +5260,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3388 +#: ../../library/stdtypes.rst:3414 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:3392 +#: ../../library/stdtypes.rst:3418 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -5259,13 +5275,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:3402 +#: ../../library/stdtypes.rst:3428 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:3415 +#: ../../library/stdtypes.rst:3441 msgid "" "Return a bytes or bytearray object which is the concatenation of the binary " "data sequences in *iterable*. A :exc:`TypeError` will be raised if there " @@ -5275,7 +5291,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:3426 +#: ../../library/stdtypes.rst:3452 msgid "" "This static method returns a translation table usable for :meth:`bytes." "translate` that will map each character in *from* into the character at the " @@ -5283,7 +5299,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:3437 +#: ../../library/stdtypes.rst:3463 msgid "" "Split the sequence at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -5292,24 +5308,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:3444 ../../library/stdtypes.rst:3501 +#: ../../library/stdtypes.rst:3470 ../../library/stdtypes.rst:3527 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3450 +#: ../../library/stdtypes.rst:3476 msgid "" "Return a copy of the sequence with all occurrences of subsequence *old* " "replaced by *new*. If the optional argument *count* is given, only the " "first *count* occurrences are replaced." msgstr "" -#: ../../library/stdtypes.rst:3454 +#: ../../library/stdtypes.rst:3480 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3466 +#: ../../library/stdtypes.rst:3492 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -5317,13 +5333,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:3481 +#: ../../library/stdtypes.rst:3507 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:3494 +#: ../../library/stdtypes.rst:3520 msgid "" "Split the sequence at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -5332,7 +5348,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:3507 +#: ../../library/stdtypes.rst:3533 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -5340,11 +5356,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:3512 +#: ../../library/stdtypes.rst:3538 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3518 +#: ../../library/stdtypes.rst:3544 msgid "" "Return a copy of the bytes or bytearray object where all bytes occurring in " "the optional argument *delete* are removed, and the remaining bytes have " @@ -5352,18 +5368,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3523 +#: ../../library/stdtypes.rst:3549 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3526 +#: ../../library/stdtypes.rst:3552 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3529 +#: ../../library/stdtypes.rst:3555 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -5371,11 +5387,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3532 +#: ../../library/stdtypes.rst:3558 msgid "*delete* is now supported as a keyword argument." msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3536 +#: ../../library/stdtypes.rst:3562 msgid "" "The following methods on bytes and bytearray objects have default behaviours " "that assume the use of ASCII compatible binary formats, but can still be " @@ -5384,7 +5400,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3545 +#: ../../library/stdtypes.rst:3571 msgid "" "Return a copy of the object centered in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -5392,7 +5408,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3559 +#: ../../library/stdtypes.rst:3585 msgid "" "Return a copy of the object left justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -5400,7 +5416,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3573 +#: ../../library/stdtypes.rst:3599 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -5409,7 +5425,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3579 +#: ../../library/stdtypes.rst:3605 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -5421,14 +5437,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3584 +#: ../../library/stdtypes.rst:3610 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removeprefix` for a method that will remove a " "single prefix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3589 +#: ../../library/stdtypes.rst:3615 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -5440,7 +5456,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3603 +#: ../../library/stdtypes.rst:3629 msgid "" "Return a copy of the object right justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -5448,7 +5464,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3617 +#: ../../library/stdtypes.rst:3643 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are " @@ -5458,7 +5474,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3628 +#: ../../library/stdtypes.rst:3654 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*bytes* argument is a binary sequence specifying the set of byte values to " @@ -5467,7 +5483,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3634 +#: ../../library/stdtypes.rst:3660 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -5479,14 +5495,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3639 +#: ../../library/stdtypes.rst:3665 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removesuffix` for a method that will remove a " "single suffix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3644 +#: ../../library/stdtypes.rst:3670 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -5498,7 +5514,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3658 +#: ../../library/stdtypes.rst:3684 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given and non-negative, at most " @@ -5507,7 +5523,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3664 +#: ../../library/stdtypes.rst:3690 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " @@ -5518,7 +5534,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3674 +#: ../../library/stdtypes.rst:3700 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -5538,7 +5554,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3683 +#: ../../library/stdtypes.rst:3709 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive ASCII whitespace are regarded as a single " @@ -5548,7 +5564,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3693 +#: ../../library/stdtypes.rst:3719 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -5564,7 +5580,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:3730 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *bytes* argument is a binary sequence specifying the set of " @@ -5573,7 +5589,7 @@ msgid "" "or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3711 +#: ../../library/stdtypes.rst:3737 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -5585,13 +5601,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3716 +#: ../../library/stdtypes.rst:3742 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3725 +#: ../../library/stdtypes.rst:3751 msgid "" "The following methods on bytes and bytearray objects assume the use of ASCII " "compatible binary formats and should not be applied to arbitrary binary " @@ -5599,14 +5615,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3733 +#: ../../library/stdtypes.rst:3759 msgid "" "Return a copy of the sequence with each byte interpreted as an ASCII " "character, and the first byte capitalized and the rest lowercased. Non-ASCII " "byte values are passed through unchanged." msgstr "" -#: ../../library/stdtypes.rst:3746 +#: ../../library/stdtypes.rst:3772 msgid "" "Return a copy of the sequence where all ASCII tab characters are replaced by " "one or more ASCII spaces, depending on the current column and the given tab " @@ -5622,7 +5638,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3760 +#: ../../library/stdtypes.rst:3786 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -5634,7 +5650,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3774 +#: ../../library/stdtypes.rst:3800 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -5643,7 +5659,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3782 +#: ../../library/stdtypes.rst:3808 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -5655,7 +5671,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3791 +#: ../../library/stdtypes.rst:3817 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -5663,7 +5679,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3798 +#: ../../library/stdtypes.rst:3824 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -5675,20 +5691,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3807 +#: ../../library/stdtypes.rst:3833 msgid "" "Return ``True`` if the sequence is empty or all bytes in the sequence are " "ASCII, ``False`` otherwise. ASCII bytes are in the range 0-0x7F." msgstr "" -#: ../../library/stdtypes.rst:3817 +#: ../../library/stdtypes.rst:3843 msgid "" "Return ``True`` if all bytes in the sequence are ASCII decimal digits and " "the sequence is not empty, ``False`` otherwise. ASCII decimal digits are " "those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3823 +#: ../../library/stdtypes.rst:3849 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -5700,13 +5716,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3832 +#: ../../library/stdtypes.rst:3858 msgid "" "Return ``True`` if there is at least one lowercase ASCII character in the " "sequence and no uppercase ASCII characters, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:3863 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -5718,16 +5734,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3842 ../../library/stdtypes.rst:3884 -#: ../../library/stdtypes.rst:3900 ../../library/stdtypes.rst:3950 -#: ../../library/stdtypes.rst:4019 +#: ../../library/stdtypes.rst:3868 ../../library/stdtypes.rst:3910 +#: ../../library/stdtypes.rst:3926 ../../library/stdtypes.rst:3976 +#: ../../library/stdtypes.rst:4045 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3850 +#: ../../library/stdtypes.rst:3876 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -5735,14 +5751,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3859 +#: ../../library/stdtypes.rst:3885 msgid "" "Return ``True`` if the sequence is ASCII titlecase and the sequence is not " "empty, ``False`` otherwise. See :meth:`bytes.title` for more details on the " "definition of \"titlecase\"." msgstr "" -#: ../../library/stdtypes.rst:3865 +#: ../../library/stdtypes.rst:3891 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -5754,14 +5770,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3874 +#: ../../library/stdtypes.rst:3900 msgid "" "Return ``True`` if there is at least one uppercase alphabetic ASCII " "character in the sequence and no lowercase ASCII characters, ``False`` " "otherwise." msgstr "" -#: ../../library/stdtypes.rst:3879 +#: ../../library/stdtypes.rst:3905 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -5773,13 +5789,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3892 +#: ../../library/stdtypes.rst:3918 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3897 +#: ../../library/stdtypes.rst:3923 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -5787,7 +5803,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3917 +#: ../../library/stdtypes.rst:3943 msgid "" "Return a list of the lines in the binary sequence, breaking at ASCII line " "boundaries. This method uses the :term:`universal newlines` approach to " @@ -5795,7 +5811,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3924 +#: ../../library/stdtypes.rst:3950 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -5807,14 +5823,14 @@ msgstr "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: ../../library/stdtypes.rst:3929 +#: ../../library/stdtypes.rst:3955 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:3933 +#: ../../library/stdtypes.rst:3959 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -5826,13 +5842,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3942 +#: ../../library/stdtypes.rst:3968 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" -#: ../../library/stdtypes.rst:3947 +#: ../../library/stdtypes.rst:3973 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -5840,7 +5856,7 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3954 +#: ../../library/stdtypes.rst:3980 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -5848,14 +5864,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3968 +#: ../../library/stdtypes.rst:3994 msgid "" "Return a titlecased version of the binary sequence where words start with an " "uppercase ASCII character and the remaining characters are lowercase. " "Uncased byte values are left unmodified." msgstr "" -#: ../../library/stdtypes.rst:3974 +#: ../../library/stdtypes.rst:4000 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -5863,7 +5879,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3977 +#: ../../library/stdtypes.rst:4003 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -5871,7 +5887,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3987 +#: ../../library/stdtypes.rst:4013 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -5879,12 +5895,12 @@ msgstr "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:3990 +#: ../../library/stdtypes.rst:4016 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3992 +#: ../../library/stdtypes.rst:4018 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -5906,13 +5922,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:4011 +#: ../../library/stdtypes.rst:4037 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:4016 +#: ../../library/stdtypes.rst:4042 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -5920,7 +5936,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:4032 +#: ../../library/stdtypes.rst:4058 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -5929,7 +5945,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:4040 +#: ../../library/stdtypes.rst:4066 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5941,11 +5957,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:4054 +#: ../../library/stdtypes.rst:4080 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:4071 +#: ../../library/stdtypes.rst:4097 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -5953,7 +5969,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:4076 +#: ../../library/stdtypes.rst:4102 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -5963,7 +5979,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:4083 +#: ../../library/stdtypes.rst:4109 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -5971,7 +5987,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:4117 +#: ../../library/stdtypes.rst:4143 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the bytes object *must* include a parenthesised mapping key into " @@ -5979,77 +5995,77 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:4169 +#: ../../library/stdtypes.rst:4195 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/stdtypes.rst:4191 +#: ../../library/stdtypes.rst:4217 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:4194 +#: ../../library/stdtypes.rst:4220 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:4194 +#: ../../library/stdtypes.rst:4220 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:4198 +#: ../../library/stdtypes.rst:4224 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4201 +#: ../../library/stdtypes.rst:4227 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:4204 +#: ../../library/stdtypes.rst:4230 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:4204 +#: ../../library/stdtypes.rst:4230 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:4239 +#: ../../library/stdtypes.rst:4265 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4242 +#: ../../library/stdtypes.rst:4268 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:4254 +#: ../../library/stdtypes.rst:4280 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:4261 +#: ../../library/stdtypes.rst:4287 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:4263 +#: ../../library/stdtypes.rst:4289 msgid "" ":class:`memoryview` objects allow Python code to access the internal data of " "an object that supports the :ref:`buffer protocol ` without " "copying." msgstr "" -#: ../../library/stdtypes.rst:4269 +#: ../../library/stdtypes.rst:4295 msgid "" "Create a :class:`memoryview` that references *object*. *object* must " "support the buffer protocol. Built-in objects that support the buffer " "protocol include :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/stdtypes.rst:4273 +#: ../../library/stdtypes.rst:4299 msgid "" "A :class:`memoryview` has the notion of an *element*, which is the atomic " "memory unit handled by the originating *object*. For many simple types such " @@ -6057,32 +6073,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:4278 +#: ../../library/stdtypes.rst:4304 msgid "" "``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which " "is the nested list representation of the view. If ``view.ndim = 1``, this is " "equal to the number of elements in the view." msgstr "" -#: ../../library/stdtypes.rst:4282 +#: ../../library/stdtypes.rst:4308 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:4285 +#: ../../library/stdtypes.rst:4311 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:4288 +#: ../../library/stdtypes.rst:4314 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:4291 +#: ../../library/stdtypes.rst:4317 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -6104,7 +6120,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:4301 +#: ../../library/stdtypes.rst:4327 msgid "" "If :class:`~memoryview.format` is one of the native format specifiers from " "the :mod:`struct` module, indexing with an integer or a tuple of integers is " @@ -6115,11 +6131,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:4310 +#: ../../library/stdtypes.rst:4336 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:4312 +#: ../../library/stdtypes.rst:4338 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -6141,13 +6157,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:4322 +#: ../../library/stdtypes.rst:4348 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:4325 +#: ../../library/stdtypes.rst:4351 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -6187,14 +6203,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:4343 +#: ../../library/stdtypes.rst:4369 msgid "" "One-dimensional memoryviews of :term:`hashable` (read-only) types with " "formats 'B', 'b' or 'c' are also hashable. The hash is defined as ``hash(m) " "== hash(m.tobytes())``::" msgstr "" -#: ../../library/stdtypes.rst:4347 +#: ../../library/stdtypes.rst:4373 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -6212,44 +6228,44 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:4355 +#: ../../library/stdtypes.rst:4381 msgid "" "One-dimensional memoryviews can now be sliced. One-dimensional memoryviews " "with formats 'B', 'b' or 'c' are now :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4359 +#: ../../library/stdtypes.rst:4385 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:4363 +#: ../../library/stdtypes.rst:4389 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:4366 +#: ../../library/stdtypes.rst:4392 msgid "memoryview is now a :term:`generic type`." msgstr "" -#: ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:4395 msgid ":class:`memoryview` has several methods:" msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:4373 +#: ../../library/stdtypes.rst:4399 msgid "" "A memoryview and a :pep:`3118` exporter are equal if their shapes are " "equivalent and if all corresponding values are equal when the operands' " "respective format codes are interpreted using :mod:`struct` syntax." msgstr "" -#: ../../library/stdtypes.rst:4377 +#: ../../library/stdtypes.rst:4403 msgid "" "For the subset of :mod:`struct` format strings currently supported by :meth:" "`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" msgstr "" -#: ../../library/stdtypes.rst:4380 +#: ../../library/stdtypes.rst:4406 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -6283,14 +6299,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:4396 +#: ../../library/stdtypes.rst:4422 msgid "" "If either format string is not supported by the :mod:`struct` module, then " "the objects will always compare as unequal (even if the format strings and " "buffer contents are identical)::" msgstr "" -#: ../../library/stdtypes.rst:4400 +#: ../../library/stdtypes.rst:4426 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -6316,25 +6332,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:4412 +#: ../../library/stdtypes.rst:4438 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:4415 +#: ../../library/stdtypes.rst:4441 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:4421 +#: ../../library/stdtypes.rst:4447 msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" -#: ../../library/stdtypes.rst:4424 +#: ../../library/stdtypes.rst:4450 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -6348,7 +6364,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:4430 +#: ../../library/stdtypes.rst:4456 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -6356,7 +6372,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4461 msgid "" "*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the " "original array is converted to C or Fortran order. For contiguous views, 'A' " @@ -6365,13 +6381,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:4445 +#: ../../library/stdtypes.rst:4471 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:4448 +#: ../../library/stdtypes.rst:4474 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -6381,18 +6397,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:4454 +#: ../../library/stdtypes.rst:4480 msgid "" "Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:4461 +#: ../../library/stdtypes.rst:4487 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:4463 +#: ../../library/stdtypes.rst:4489 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -6410,19 +6426,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:4471 +#: ../../library/stdtypes.rst:4497 msgid "" ":meth:`tolist` now supports all single character native formats in :mod:" "`struct` module syntax as well as multi-dimensional representations." msgstr "" -#: ../../library/stdtypes.rst:4478 +#: ../../library/stdtypes.rst:4504 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:4481 +#: ../../library/stdtypes.rst:4507 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -6448,7 +6464,7 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:4497 +#: ../../library/stdtypes.rst:4523 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " "objects take special actions when a view is held on them (for example, a :" @@ -6457,14 +6473,14 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:4503 +#: ../../library/stdtypes.rst:4529 msgid "" "After this method has been called, any further operation on the view raises " "a :class:`ValueError` (except :meth:`release` itself which can be called " "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:4507 +#: ../../library/stdtypes.rst:4533 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -6480,13 +6496,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4514 +#: ../../library/stdtypes.rst:4540 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4517 +#: ../../library/stdtypes.rst:4543 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -6506,7 +6522,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4531 +#: ../../library/stdtypes.rst:4557 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -6515,7 +6531,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4537 +#: ../../library/stdtypes.rst:4563 msgid "" "The destination format is restricted to a single element native format in :" "mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " @@ -6523,11 +6539,11 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4543 +#: ../../library/stdtypes.rst:4569 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4545 +#: ../../library/stdtypes.rst:4571 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -6571,11 +6587,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4566 +#: ../../library/stdtypes.rst:4592 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4568 +#: ../../library/stdtypes.rst:4594 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -6599,11 +6615,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4579 +#: ../../library/stdtypes.rst:4605 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:4607 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -6653,11 +6669,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4605 +#: ../../library/stdtypes.rst:4631 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4607 +#: ../../library/stdtypes.rst:4633 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -6679,33 +6695,33 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4619 +#: ../../library/stdtypes.rst:4645 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4624 +#: ../../library/stdtypes.rst:4650 msgid "Count the number of occurrences of *value*." msgstr "計算 *value* 的出現次數" -#: ../../library/stdtypes.rst:4630 +#: ../../library/stdtypes.rst:4656 msgid "" "Return the index of the first occurrence of *value* (at or after index " "*start* and before index *stop*)." msgstr "" -#: ../../library/stdtypes.rst:4633 +#: ../../library/stdtypes.rst:4659 msgid "Raises a :exc:`ValueError` if *value* cannot be found." msgstr "在找不到 *value* 時引發 :exc:`ValueError`。" -#: ../../library/stdtypes.rst:4637 +#: ../../library/stdtypes.rst:4663 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4641 +#: ../../library/stdtypes.rst:4667 msgid "The underlying object of the memoryview::" msgstr "memoryview 的底層物件: ::" -#: ../../library/stdtypes.rst:4643 +#: ../../library/stdtypes.rst:4669 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -6717,14 +6733,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4652 +#: ../../library/stdtypes.rst:4678 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" -#: ../../library/stdtypes.rst:4656 +#: ../../library/stdtypes.rst:4682 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -6756,11 +6772,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4671 +#: ../../library/stdtypes.rst:4697 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4673 +#: ../../library/stdtypes.rst:4699 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -6784,11 +6800,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4688 +#: ../../library/stdtypes.rst:4714 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4692 +#: ../../library/stdtypes.rst:4718 msgid "" "A string containing the format (in :mod:`struct` module style) for each " "element in the view. A memoryview can be created from exporters with " @@ -6796,17 +6812,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4697 +#: ../../library/stdtypes.rst:4723 msgid "" "format ``'B'`` is now handled according to the struct module syntax. This " "means that ``memoryview(b'abc')[0] == b'abc'[0] == 97``." msgstr "" -#: ../../library/stdtypes.rst:4703 +#: ../../library/stdtypes.rst:4729 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4705 +#: ../../library/stdtypes.rst:4731 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -6826,49 +6842,49 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4716 +#: ../../library/stdtypes.rst:4742 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4721 +#: ../../library/stdtypes.rst:4747 msgid "" "A tuple of integers the length of :attr:`ndim` giving the shape of the " "memory as an N-dimensional array." msgstr "" -#: ../../library/stdtypes.rst:4724 ../../library/stdtypes.rst:4732 +#: ../../library/stdtypes.rst:4750 ../../library/stdtypes.rst:4758 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4729 +#: ../../library/stdtypes.rst:4755 msgid "" "A tuple of integers the length of :attr:`ndim` giving the size in bytes to " "access each element for each dimension of the array." msgstr "" -#: ../../library/stdtypes.rst:4737 +#: ../../library/stdtypes.rst:4763 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4741 +#: ../../library/stdtypes.rst:4767 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4747 +#: ../../library/stdtypes.rst:4773 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4753 +#: ../../library/stdtypes.rst:4779 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4761 +#: ../../library/stdtypes.rst:4787 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4765 +#: ../../library/stdtypes.rst:4791 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -6878,7 +6894,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4772 +#: ../../library/stdtypes.rst:4798 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " @@ -6886,30 +6902,30 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4777 +#: ../../library/stdtypes.rst:4803 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " -"changed using methods like :meth:`add ` and :meth:`remove " -"`. Since it is mutable, it has no hash value and cannot be " -"used as either a dictionary key or as an element of another set. The :class:" -"`frozenset` type is immutable and :term:`hashable` --- its contents cannot " -"be altered after it is created; it can therefore be used as a dictionary key " -"or as an element of another set." +"changed using methods like :meth:`~set.add` and :meth:`~set.remove`. Since " +"it is mutable, it has no hash value and cannot be used as either a " +"dictionary key or as an element of another set. The :class:`frozenset` type " +"is immutable and :term:`hashable` --- its contents cannot be altered after " +"it is created; it can therefore be used as a dictionary key or as an element " +"of another set." msgstr "" -#: ../../library/stdtypes.rst:4786 +#: ../../library/stdtypes.rst:4812 msgid "" "Non-empty sets (not frozensets) can be created by placing a comma-separated " "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" -#: ../../library/stdtypes.rst:4790 +#: ../../library/stdtypes.rst:4816 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4795 +#: ../../library/stdtypes.rst:4821 msgid "" "Return a new set or frozenset object whose elements are taken from " "*iterable*. The elements of a set must be :term:`hashable`. To represent " @@ -6917,102 +6933,103 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4801 +#: ../../library/stdtypes.rst:4827 msgid "Sets can be created by several means:" msgstr "集合可以以多種方式建立:" -#: ../../library/stdtypes.rst:4803 +#: ../../library/stdtypes.rst:4829 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4804 +#: ../../library/stdtypes.rst:4830 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4805 +#: ../../library/stdtypes.rst:4831 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4807 +#: ../../library/stdtypes.rst:4833 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4812 +#: ../../library/stdtypes.rst:4838 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4816 +#: ../../library/stdtypes.rst:4842 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4820 +#: ../../library/stdtypes.rst:4846 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4824 +#: ../../library/stdtypes.rst:4851 msgid "" "Return ``True`` if the set has no elements in common with *other*. Sets are " "disjoint if and only if their intersection is the empty set." msgstr "" -#: ../../library/stdtypes.rst:4830 +#: ../../library/stdtypes.rst:4858 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4834 +#: ../../library/stdtypes.rst:4862 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4840 +#: ../../library/stdtypes.rst:4869 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4844 +#: ../../library/stdtypes.rst:4873 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4850 +#: ../../library/stdtypes.rst:4880 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4855 +#: ../../library/stdtypes.rst:4886 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4860 +#: ../../library/stdtypes.rst:4892 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4865 +#: ../../library/stdtypes.rst:4898 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4869 +#: ../../library/stdtypes.rst:4903 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4872 +#: ../../library/stdtypes.rst:4906 msgid "" -"Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" -"meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" -"`issuperset` methods will accept any iterable as an argument. In contrast, " +"Note, the non-operator versions of :meth:`~frozenset.union`, :meth:" +"`~frozenset.intersection`, :meth:`~frozenset.difference`, :meth:`~frozenset." +"symmetric_difference`, :meth:`~frozenset.issubset`, and :meth:`~frozenset." +"issuperset` methods will accept any iterable as an argument. In contrast, " "their operator based counterparts require their arguments to be sets. This " "precludes error-prone constructions like ``set('abc') & 'cbs'`` in favor of " "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4879 +#: ../../library/stdtypes.rst:4913 msgid "" "Both :class:`set` and :class:`frozenset` support set to set comparisons. Two " "sets are equal if and only if every element of each set is contained in the " @@ -7022,14 +7039,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4886 +#: ../../library/stdtypes.rst:4920 msgid "" "Instances of :class:`set` are compared to instances of :class:`frozenset` " "based on their members. For example, ``set('abc') == frozenset('abc')`` " "returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``." msgstr "" -#: ../../library/stdtypes.rst:4890 +#: ../../library/stdtypes.rst:4924 msgid "" "The subset and equality comparisons do not generalize to a total ordering " "function. For example, any two nonempty disjoint sets are not equal and are " @@ -7037,90 +7054,90 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4895 +#: ../../library/stdtypes.rst:4929 msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" -#: ../../library/stdtypes.rst:4898 +#: ../../library/stdtypes.rst:4932 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4900 +#: ../../library/stdtypes.rst:4934 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" -#: ../../library/stdtypes.rst:4904 +#: ../../library/stdtypes.rst:4938 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4910 +#: ../../library/stdtypes.rst:4944 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4915 +#: ../../library/stdtypes.rst:4949 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4920 +#: ../../library/stdtypes.rst:4954 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4925 +#: ../../library/stdtypes.rst:4959 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4929 +#: ../../library/stdtypes.rst:4963 msgid "Add element *elem* to the set." msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:4933 +#: ../../library/stdtypes.rst:4967 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4938 +#: ../../library/stdtypes.rst:4972 msgid "Remove element *elem* from the set if it is present." msgstr "如果 *elem* 存在於集合中則將其移除。" -#: ../../library/stdtypes.rst:4942 +#: ../../library/stdtypes.rst:4976 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4947 +#: ../../library/stdtypes.rst:4981 msgid "Remove all elements from the set." msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:4950 +#: ../../library/stdtypes.rst:4984 msgid "" -"Note, the non-operator versions of the :meth:`update`, :meth:" -"`intersection_update`, :meth:`difference_update`, and :meth:" -"`symmetric_difference_update` methods will accept any iterable as an " -"argument." +"Note, the non-operator versions of the :meth:`~set.update`, :meth:`~set." +"intersection_update`, :meth:`~set.difference_update`, and :meth:`~set." +"symmetric_difference_update` methods will accept any iterable as an argument." msgstr "" -#: ../../library/stdtypes.rst:4955 +#: ../../library/stdtypes.rst:4989 msgid "" -"Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" -"`remove`, and :meth:`discard` methods may be a set. To support searching " -"for an equivalent frozenset, a temporary one is created from *elem*." +"Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:`~set." +"remove`, and :meth:`~set.discard` methods may be a set. To support " +"searching for an equivalent frozenset, a temporary one is created from " +"*elem*." msgstr "" -#: ../../library/stdtypes.rst:4964 +#: ../../library/stdtypes.rst:4998 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4974 +#: ../../library/stdtypes.rst:5008 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -7129,7 +7146,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:4980 +#: ../../library/stdtypes.rst:5014 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -7138,33 +7155,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4991 +#: ../../library/stdtypes.rst:5025 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4994 +#: ../../library/stdtypes.rst:5028 msgid "Dictionaries can be created by several means:" msgstr "字典可以用數種方式建立:" -#: ../../library/stdtypes.rst:4996 +#: ../../library/stdtypes.rst:5030 msgid "" "Use a comma-separated list of ``key: value`` pairs within braces: ``{'jack': " "4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4998 +#: ../../library/stdtypes.rst:5032 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4999 +#: ../../library/stdtypes.rst:5033 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:5002 +#: ../../library/stdtypes.rst:5036 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it defines a ``keys()`` method, a " @@ -7177,7 +7194,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:5012 +#: ../../library/stdtypes.rst:5046 msgid "" "If keyword arguments are given, the keyword arguments and their values are " "added to the dictionary created from the positional argument. If a key " @@ -7185,13 +7202,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:5017 ../../library/stdtypes.rst:5035 +#: ../../library/stdtypes.rst:5051 ../../library/stdtypes.rst:5069 msgid "" "Providing keyword arguments as in the first example only works for keys that " "are valid Python identifiers. Otherwise, any valid keys can be used." msgstr "" -#: ../../library/stdtypes.rst:5020 +#: ../../library/stdtypes.rst:5054 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " @@ -7200,7 +7217,7 @@ msgid "" "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:5026 +#: ../../library/stdtypes.rst:5060 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -7220,13 +7237,13 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:5038 +#: ../../library/stdtypes.rst:5072 msgid "" "Dictionaries preserve insertion order. Note that updating a key does not " "affect the order. Keys added after deletion are inserted at the end. ::" msgstr "" -#: ../../library/stdtypes.rst:5041 +#: ../../library/stdtypes.rst:5075 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7258,33 +7275,33 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5090 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5094 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5099 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5069 +#: ../../library/stdtypes.rst:5103 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5107 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:5078 +#: ../../library/stdtypes.rst:5112 msgid "" "If a subclass of dict defines a method :meth:`~object.__missing__` and *key* " "is not present, the ``d[key]`` operation calls that method with the key " @@ -7295,7 +7312,7 @@ msgid "" "__missing__` must be a method; it cannot be an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:5086 +#: ../../library/stdtypes.rst:5120 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -7319,51 +7336,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:5097 +#: ../../library/stdtypes.rst:5131 msgid "" "The example above shows part of the implementation of :class:`collections." "Counter`. A different :meth:`!__missing__` method is used by :class:" "`collections.defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:5104 +#: ../../library/stdtypes.rst:5138 msgid "Set ``d[key]`` to *value*." msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:5108 +#: ../../library/stdtypes.rst:5142 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "從 *d* 中移除 ``d[key]``。若 *key* 不在對映中則引發 :exc:`KeyError`。" -#: ../../library/stdtypes.rst:5113 +#: ../../library/stdtypes.rst:5147 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:5117 +#: ../../library/stdtypes.rst:5151 msgid "Equivalent to ``not key in d``." msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:5121 +#: ../../library/stdtypes.rst:5155 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5126 +#: ../../library/stdtypes.rst:5160 msgid "Remove all items from the dictionary." msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:5130 +#: ../../library/stdtypes.rst:5164 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5134 +#: ../../library/stdtypes.rst:5168 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:5136 +#: ../../library/stdtypes.rst:5170 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -7372,70 +7389,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:5144 +#: ../../library/stdtypes.rst:5178 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:5150 +#: ../../library/stdtypes.rst:5184 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5155 +#: ../../library/stdtypes.rst:5189 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:5161 +#: ../../library/stdtypes.rst:5195 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " "*default*. If *default* is not given and *key* is not in the dictionary, a :" "exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:5167 +#: ../../library/stdtypes.rst:5201 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -#: ../../library/stdtypes.rst:5170 +#: ../../library/stdtypes.rst:5204 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " "often used in set algorithms. If the dictionary is empty, calling :meth:" "`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:5174 +#: ../../library/stdtypes.rst:5208 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:5180 +#: ../../library/stdtypes.rst:5214 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:5187 +#: ../../library/stdtypes.rst:5221 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" -#: ../../library/stdtypes.rst:5195 +#: ../../library/stdtypes.rst:5229 msgid "" "Update the dictionary with the key/value pairs from *mapping* or *iterable* " "and *kwargs*, overwriting existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:5198 +#: ../../library/stdtypes.rst:5232 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -7444,20 +7461,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:5206 +#: ../../library/stdtypes.rst:5240 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:5209 +#: ../../library/stdtypes.rst:5243 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:5213 +#: ../../library/stdtypes.rst:5247 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -7467,25 +7484,25 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:5219 +#: ../../library/stdtypes.rst:5253 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:5227 +#: ../../library/stdtypes.rst:5261 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:5233 +#: ../../library/stdtypes.rst:5267 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:5235 +#: ../../library/stdtypes.rst:5269 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7507,21 +7524,21 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:5245 +#: ../../library/stdtypes.rst:5279 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5250 +#: ../../library/stdtypes.rst:5284 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:5257 +#: ../../library/stdtypes.rst:5291 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:5259 +#: ../../library/stdtypes.rst:5293 msgid "" "The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" "`dict.items` are *view objects*. They provide a dynamic view on the " @@ -7529,23 +7546,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:5264 +#: ../../library/stdtypes.rst:5298 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:5269 +#: ../../library/stdtypes.rst:5303 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5273 +#: ../../library/stdtypes.rst:5307 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:5276 +#: ../../library/stdtypes.rst:5310 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -7553,39 +7570,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:5281 +#: ../../library/stdtypes.rst:5315 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:5284 +#: ../../library/stdtypes.rst:5318 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:5289 +#: ../../library/stdtypes.rst:5323 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:5294 +#: ../../library/stdtypes.rst:5328 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:5297 +#: ../../library/stdtypes.rst:5331 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:5302 +#: ../../library/stdtypes.rst:5336 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:5307 +#: ../../library/stdtypes.rst:5341 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -7599,11 +7616,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:5319 +#: ../../library/stdtypes.rst:5353 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:5321 +#: ../../library/stdtypes.rst:5355 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -7644,11 +7661,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:5363 +#: ../../library/stdtypes.rst:5397 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:5370 +#: ../../library/stdtypes.rst:5404 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -7659,7 +7676,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:5378 +#: ../../library/stdtypes.rst:5412 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -7670,7 +7687,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:5383 +#: ../../library/stdtypes.rst:5417 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -7679,7 +7696,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:5387 +#: ../../library/stdtypes.rst:5421 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -7693,7 +7710,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:5397 +#: ../../library/stdtypes.rst:5431 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -7705,7 +7722,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:5402 +#: ../../library/stdtypes.rst:5436 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -7720,7 +7737,7 @@ msgstr "" "(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" "的任何例外。" -#: ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:5443 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -7729,10 +7746,10 @@ msgid "" "__exit__` method has actually failed." msgstr "" "傳入的例外不應明確重新引發 - 取而代之的是,此方法應回傳 false 值以指示該方法" -"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:`~object." -"__exit__` 方法是否曾實際失敗過。" +"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" +"`~object.__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:5415 +#: ../../library/stdtypes.rst:5449 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -7744,7 +7761,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:5421 +#: ../../library/stdtypes.rst:5455 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -7759,7 +7776,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:5428 +#: ../../library/stdtypes.rst:5462 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -7771,7 +7788,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:5436 +#: ../../library/stdtypes.rst:5470 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -7779,7 +7796,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:5441 +#: ../../library/stdtypes.rst:5475 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -7787,11 +7804,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:5448 +#: ../../library/stdtypes.rst:5482 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:5454 +#: ../../library/stdtypes.rst:5488 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -7807,7 +7824,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:5464 +#: ../../library/stdtypes.rst:5498 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -7815,7 +7832,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:5467 +#: ../../library/stdtypes.rst:5501 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -7823,7 +7840,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:5470 +#: ../../library/stdtypes.rst:5504 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " @@ -7835,7 +7852,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:5476 +#: ../../library/stdtypes.rst:5510 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -7847,7 +7864,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:5482 +#: ../../library/stdtypes.rst:5516 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -7859,7 +7876,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:5488 +#: ../../library/stdtypes.rst:5522 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " "``y`` will also be an instance of ``re.Match``, but the return values of ``y." @@ -7872,7 +7889,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:5494 +#: ../../library/stdtypes.rst:5528 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -7881,7 +7898,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:5500 +#: ../../library/stdtypes.rst:5534 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -7891,7 +7908,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:5505 +#: ../../library/stdtypes.rst:5539 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -7899,7 +7916,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:5508 +#: ../../library/stdtypes.rst:5542 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -7910,7 +7927,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:5513 +#: ../../library/stdtypes.rst:5547 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -7918,7 +7935,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:5516 +#: ../../library/stdtypes.rst:5550 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -7926,7 +7943,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:5519 +#: ../../library/stdtypes.rst:5553 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -7938,7 +7955,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5524 +#: ../../library/stdtypes.rst:5558 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7950,7 +7967,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:5530 +#: ../../library/stdtypes.rst:5564 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7960,13 +7977,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:5534 +#: ../../library/stdtypes.rst:5568 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5537 +#: ../../library/stdtypes.rst:5571 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7984,13 +8001,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5545 +#: ../../library/stdtypes.rst:5579 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5547 +#: ../../library/stdtypes.rst:5581 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -8004,7 +8021,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5553 +#: ../../library/stdtypes.rst:5587 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -8012,7 +8029,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5556 +#: ../../library/stdtypes.rst:5590 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -8024,7 +8041,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5561 +#: ../../library/stdtypes.rst:5595 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -8034,7 +8051,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5565 +#: ../../library/stdtypes.rst:5599 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -8046,253 +8063,253 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5572 +#: ../../library/stdtypes.rst:5606 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5574 +#: ../../library/stdtypes.rst:5608 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5577 +#: ../../library/stdtypes.rst:5611 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5578 +#: ../../library/stdtypes.rst:5612 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5579 +#: ../../library/stdtypes.rst:5613 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5580 +#: ../../library/stdtypes.rst:5614 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5581 +#: ../../library/stdtypes.rst:5615 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5582 +#: ../../library/stdtypes.rst:5616 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5583 +#: ../../library/stdtypes.rst:5617 msgid ":class:`asyncio.Future`" msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5584 +#: ../../library/stdtypes.rst:5618 msgid ":class:`asyncio.Task`" msgstr ":class:`asyncio.Task`" -#: ../../library/stdtypes.rst:5585 +#: ../../library/stdtypes.rst:5619 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5586 +#: ../../library/stdtypes.rst:5620 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5587 +#: ../../library/stdtypes.rst:5621 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5588 +#: ../../library/stdtypes.rst:5622 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5589 +#: ../../library/stdtypes.rst:5623 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5590 +#: ../../library/stdtypes.rst:5624 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5591 +#: ../../library/stdtypes.rst:5625 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5592 +#: ../../library/stdtypes.rst:5626 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5593 +#: ../../library/stdtypes.rst:5627 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5594 +#: ../../library/stdtypes.rst:5628 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5595 +#: ../../library/stdtypes.rst:5629 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5596 +#: ../../library/stdtypes.rst:5630 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5597 +#: ../../library/stdtypes.rst:5631 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5598 +#: ../../library/stdtypes.rst:5632 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5599 +#: ../../library/stdtypes.rst:5633 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5600 +#: ../../library/stdtypes.rst:5634 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5601 +#: ../../library/stdtypes.rst:5635 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5602 +#: ../../library/stdtypes.rst:5636 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5603 +#: ../../library/stdtypes.rst:5637 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5638 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5605 +#: ../../library/stdtypes.rst:5639 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5606 +#: ../../library/stdtypes.rst:5640 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5607 +#: ../../library/stdtypes.rst:5641 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5608 +#: ../../library/stdtypes.rst:5642 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5609 +#: ../../library/stdtypes.rst:5643 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5610 +#: ../../library/stdtypes.rst:5644 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5611 +#: ../../library/stdtypes.rst:5645 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5612 +#: ../../library/stdtypes.rst:5646 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5613 +#: ../../library/stdtypes.rst:5647 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5614 +#: ../../library/stdtypes.rst:5648 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5615 +#: ../../library/stdtypes.rst:5649 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5616 +#: ../../library/stdtypes.rst:5650 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5617 +#: ../../library/stdtypes.rst:5651 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5618 +#: ../../library/stdtypes.rst:5652 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5619 +#: ../../library/stdtypes.rst:5653 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5620 +#: ../../library/stdtypes.rst:5654 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5621 +#: ../../library/stdtypes.rst:5655 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5622 +#: ../../library/stdtypes.rst:5656 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5623 +#: ../../library/stdtypes.rst:5657 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5624 +#: ../../library/stdtypes.rst:5658 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5625 +#: ../../library/stdtypes.rst:5659 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5626 +#: ../../library/stdtypes.rst:5660 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5627 +#: ../../library/stdtypes.rst:5661 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5628 +#: ../../library/stdtypes.rst:5662 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5629 +#: ../../library/stdtypes.rst:5663 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5630 +#: ../../library/stdtypes.rst:5664 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5631 +#: ../../library/stdtypes.rst:5665 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5632 +#: ../../library/stdtypes.rst:5666 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5637 +#: ../../library/stdtypes.rst:5671 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5639 +#: ../../library/stdtypes.rst:5673 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5643 +#: ../../library/stdtypes.rst:5677 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5645 +#: ../../library/stdtypes.rst:5679 msgid "" ">>> list[int].__origin__\n" "" @@ -8300,7 +8317,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5651 +#: ../../library/stdtypes.rst:5685 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " @@ -8309,7 +8326,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5655 +#: ../../library/stdtypes.rst:5689 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -8317,7 +8334,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5661 +#: ../../library/stdtypes.rst:5695 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -8325,7 +8342,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5664 +#: ../../library/stdtypes.rst:5698 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -8339,7 +8356,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5672 +#: ../../library/stdtypes.rst:5706 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -8349,7 +8366,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5679 +#: ../../library/stdtypes.rst:5713 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -8357,19 +8374,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5687 +#: ../../library/stdtypes.rst:5721 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5688 +#: ../../library/stdtypes.rst:5722 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5690 +#: ../../library/stdtypes.rst:5724 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5725 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -8378,7 +8395,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5695 +#: ../../library/stdtypes.rst:5729 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -8386,18 +8403,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:5696 +#: ../../library/stdtypes.rst:5730 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5705 +#: ../../library/stdtypes.rst:5739 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5711 +#: ../../library/stdtypes.rst:5745 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -8410,7 +8427,7 @@ msgstr "" "釋 (type annotation) `。與下標 :data:`typing.Union` 相比,聯合型" "別運算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5718 +#: ../../library/stdtypes.rst:5752 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " @@ -8421,7 +8438,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5723 +#: ../../library/stdtypes.rst:5757 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -8429,7 +8446,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5728 +#: ../../library/stdtypes.rst:5762 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -8442,40 +8459,40 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5736 +#: ../../library/stdtypes.rst:5770 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5738 +#: ../../library/stdtypes.rst:5772 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5740 +#: ../../library/stdtypes.rst:5774 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5742 +#: ../../library/stdtypes.rst:5776 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5744 +#: ../../library/stdtypes.rst:5778 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5746 +#: ../../library/stdtypes.rst:5780 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5748 +#: ../../library/stdtypes.rst:5782 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5750 +#: ../../library/stdtypes.rst:5784 msgid "It creates instances of :class:`typing.Union`::" msgstr "它會建立 :class:`typing.Union` 的實例: ::" -#: ../../library/stdtypes.rst:5752 +#: ../../library/stdtypes.rst:5786 msgid "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" @@ -8483,21 +8500,21 @@ msgstr "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" -#: ../../library/stdtypes.rst:5755 +#: ../../library/stdtypes.rst:5789 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5757 +#: ../../library/stdtypes.rst:5791 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5762 +#: ../../library/stdtypes.rst:5796 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5765 +#: ../../library/stdtypes.rst:5799 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -8505,14 +8522,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5768 +#: ../../library/stdtypes.rst:5802 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5771 +#: ../../library/stdtypes.rst:5805 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -8522,7 +8539,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5778 +#: ../../library/stdtypes.rst:5812 msgid "" "The user-exposed type for the union object can be accessed from :class:" "`typing.Union` and used for :func:`isinstance` checks::" @@ -8530,7 +8547,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`typing." "Union` 存取並用於 :func:`isinstance` 檢查: ::" -#: ../../library/stdtypes.rst:5781 +#: ../../library/stdtypes.rst:5815 msgid "" ">>> import typing\n" ">>> isinstance(int | str, typing.Union)\n" @@ -8548,7 +8565,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'typing.Union' instances" -#: ../../library/stdtypes.rst:5790 +#: ../../library/stdtypes.rst:5824 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -8557,7 +8574,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5794 +#: ../../library/stdtypes.rst:5828 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -8583,32 +8600,32 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5810 +#: ../../library/stdtypes.rst:5844 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5816 +#: ../../library/stdtypes.rst:5850 msgid "" "Union objects are now instances of :class:`typing.Union`. Previously, they " "were instances of :class:`types.UnionType`, which remains an alias for :" "class:`typing.Union`." msgstr "" -#: ../../library/stdtypes.rst:5823 +#: ../../library/stdtypes.rst:5857 msgid "Other Built-in Types" msgstr "其他內建型別" -#: ../../library/stdtypes.rst:5825 +#: ../../library/stdtypes.rst:5859 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5832 +#: ../../library/stdtypes.rst:5866 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5834 +#: ../../library/stdtypes.rst:5868 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " @@ -8619,7 +8636,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5841 +#: ../../library/stdtypes.rst:5875 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -8630,32 +8647,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5849 +#: ../../library/stdtypes.rst:5883 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5857 +#: ../../library/stdtypes.rst:5891 msgid "Classes and Class Instances" msgstr "類別與類別實例" -#: ../../library/stdtypes.rst:5859 +#: ../../library/stdtypes.rst:5893 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "請見 :ref:`objects` 和 :ref:`class`。" -#: ../../library/stdtypes.rst:5865 +#: ../../library/stdtypes.rst:5899 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5867 +#: ../../library/stdtypes.rst:5901 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5870 +#: ../../library/stdtypes.rst:5904 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -8663,15 +8680,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5874 +#: ../../library/stdtypes.rst:5908 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5880 +#: ../../library/stdtypes.rst:5914 msgid "Methods" msgstr "方法" -#: ../../library/stdtypes.rst:5884 +#: ../../library/stdtypes.rst:5918 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -8679,7 +8696,7 @@ msgid "" "methods>`. Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5890 +#: ../../library/stdtypes.rst:5924 msgid "" "If you access a method (a function defined in a class namespace) through an " "instance, you get a special object: a :dfn:`bound method` (also called :ref:" @@ -8692,7 +8709,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5901 +#: ../../library/stdtypes.rst:5935 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -8703,7 +8720,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5909 +#: ../../library/stdtypes.rst:5943 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -8731,15 +8748,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5924 +#: ../../library/stdtypes.rst:5958 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5932 +#: ../../library/stdtypes.rst:5966 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5938 +#: ../../library/stdtypes.rst:5972 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -8749,7 +8766,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5945 +#: ../../library/stdtypes.rst:5979 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -8758,21 +8775,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5952 +#: ../../library/stdtypes.rst:5986 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5955 +#: ../../library/stdtypes.rst:5989 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5961 +#: ../../library/stdtypes.rst:5995 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5967 +#: ../../library/stdtypes.rst:6001 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -8780,30 +8797,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5972 +#: ../../library/stdtypes.rst:6006 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5978 +#: ../../library/stdtypes.rst:6012 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5980 +#: ../../library/stdtypes.rst:6014 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5984 +#: ../../library/stdtypes.rst:6018 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5991 +#: ../../library/stdtypes.rst:6025 msgid "The Ellipsis Object" msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:5993 +#: ../../library/stdtypes.rst:6027 msgid "" "This object is commonly used to indicate that something is omitted. It " "supports no special operations. There is exactly one ellipsis object, " @@ -8811,63 +8828,63 @@ msgid "" "the :const:`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5998 +#: ../../library/stdtypes.rst:6032 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:6000 +#: ../../library/stdtypes.rst:6034 msgid "" "In typical use, ``...`` as the ``Ellipsis`` object appears in a few " "different places, for instance:" msgstr "" -#: ../../library/stdtypes.rst:6003 +#: ../../library/stdtypes.rst:6037 msgid "" "In type annotations, such as :ref:`callable arguments ` or :ref:`tuple elements `." msgstr "" -#: ../../library/stdtypes.rst:6006 +#: ../../library/stdtypes.rst:6040 msgid "" "As the body of a function instead of a :ref:`pass statement `." msgstr "" -#: ../../library/stdtypes.rst:6008 +#: ../../library/stdtypes.rst:6042 msgid "" "In third-party libraries, such as `Numpy's slicing and striding `_." msgstr "" -#: ../../library/stdtypes.rst:6011 +#: ../../library/stdtypes.rst:6045 msgid "" "Python also uses three dots in ways that are not ``Ellipsis`` objects, for " "instance:" msgstr "" -#: ../../library/stdtypes.rst:6013 +#: ../../library/stdtypes.rst:6047 msgid "" "Doctest's :const:`ELLIPSIS `, as a pattern for missing " "content." msgstr "" -#: ../../library/stdtypes.rst:6015 +#: ../../library/stdtypes.rst:6049 msgid "" "The default Python prompt of the :term:`interactive` shell when partial " "input is incomplete." msgstr "" -#: ../../library/stdtypes.rst:6017 +#: ../../library/stdtypes.rst:6051 msgid "" "Lastly, the Python documentation often uses three dots in conventional " "English usage to mean omitted content, even in code examples that also use " "them as the ``Ellipsis``." msgstr "" -#: ../../library/stdtypes.rst:6025 +#: ../../library/stdtypes.rst:6059 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:6027 +#: ../../library/stdtypes.rst:6061 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " @@ -8875,64 +8892,64 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:6032 +#: ../../library/stdtypes.rst:6066 msgid "It is written as :code:`NotImplemented`." msgstr "它被寫為 :code:`NotImplemented`。" -#: ../../library/stdtypes.rst:6038 +#: ../../library/stdtypes.rst:6072 msgid "Internal Objects" msgstr "內部物件" -#: ../../library/stdtypes.rst:6040 +#: ../../library/stdtypes.rst:6074 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:6048 +#: ../../library/stdtypes.rst:6082 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:6050 +#: ../../library/stdtypes.rst:6084 msgid "" "The implementation adds a few special read-only attributes to several object " "types, where they are relevant. Some of these are not reported by the :func:" "`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:6057 +#: ../../library/stdtypes.rst:6091 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:6063 +#: ../../library/stdtypes.rst:6097 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:6071 +#: ../../library/stdtypes.rst:6105 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:6076 +#: ../../library/stdtypes.rst:6110 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:6081 +#: ../../library/stdtypes.rst:6115 msgid "" "The :ref:`type parameters ` of generic classes, functions, and :" "ref:`type aliases `. For classes and functions that are not " "generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:6091 +#: ../../library/stdtypes.rst:6125 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:6093 +#: ../../library/stdtypes.rst:6127 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 " @@ -8940,7 +8957,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:6098 +#: ../../library/stdtypes.rst:6132 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 " @@ -8950,24 +8967,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:6105 +#: ../../library/stdtypes.rst:6139 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:6107 +#: ../../library/stdtypes.rst:6141 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:6111 +#: ../../library/stdtypes.rst:6145 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:6113 +#: ../../library/stdtypes.rst:6147 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8991,7 +9008,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:6133 +#: ../../library/stdtypes.rst:6167 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -8999,11 +9016,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:6138 +#: ../../library/stdtypes.rst:6172 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:6140 +#: ../../library/stdtypes.rst:6174 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -9021,84 +9038,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:6153 +#: ../../library/stdtypes.rst:6187 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:6155 +#: ../../library/stdtypes.rst:6189 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:6158 +#: ../../library/stdtypes.rst:6192 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:6159 +#: ../../library/stdtypes.rst:6193 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:6160 +#: ../../library/stdtypes.rst:6194 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:6161 +#: ../../library/stdtypes.rst:6195 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:6162 +#: ../../library/stdtypes.rst:6196 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:6165 +#: ../../library/stdtypes.rst:6199 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:6167 +#: ../../library/stdtypes.rst:6201 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:6168 +#: ../../library/stdtypes.rst:6202 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:6169 +#: ../../library/stdtypes.rst:6203 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:6170 +#: ../../library/stdtypes.rst:6204 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:6171 +#: ../../library/stdtypes.rst:6205 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:6172 +#: ../../library/stdtypes.rst:6206 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:6175 +#: ../../library/stdtypes.rst:6209 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:6177 +#: ../../library/stdtypes.rst:6211 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:6180 +#: ../../library/stdtypes.rst:6214 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:6183 +#: ../../library/stdtypes.rst:6217 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -9106,7 +9123,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:6185 +#: ../../library/stdtypes.rst:6219 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 " @@ -9115,38 +9132,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:6191 +#: ../../library/stdtypes.rst:6225 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:6194 +#: ../../library/stdtypes.rst:6228 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:6198 +#: ../../library/stdtypes.rst:6232 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:6200 +#: ../../library/stdtypes.rst:6234 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:6202 +#: ../../library/stdtypes.rst:6236 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:6209 +#: ../../library/stdtypes.rst:6243 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 " @@ -9158,7 +9175,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:6218 +#: ../../library/stdtypes.rst:6252 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 " @@ -9166,11 +9183,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:6224 +#: ../../library/stdtypes.rst:6258 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:6226 +#: ../../library/stdtypes.rst:6260 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 " @@ -9178,11 +9195,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:6231 +#: ../../library/stdtypes.rst:6265 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:6233 +#: ../../library/stdtypes.rst:6267 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -9204,38 +9221,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:6243 +#: ../../library/stdtypes.rst:6277 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:6247 +#: ../../library/stdtypes.rst:6281 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:6248 +#: ../../library/stdtypes.rst:6282 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:6251 +#: ../../library/stdtypes.rst:6285 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:6254 +#: ../../library/stdtypes.rst:6288 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:6256 +#: ../../library/stdtypes.rst:6290 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:6259 +#: ../../library/stdtypes.rst:6293 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -9248,13 +9265,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:322 #: ../../library/stdtypes.rst:399 ../../library/stdtypes.rst:992 #: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:1201 -#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4966 -#: ../../library/stdtypes.rst:5963 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:5000 +#: ../../library/stdtypes.rst:5997 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:5000 msgid "statement" msgstr "statement(陳述式)" @@ -9376,11 +9393,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:1366 #: ../../library/stdtypes.rst:1445 ../../library/stdtypes.rst:1489 #: ../../library/stdtypes.rst:1610 ../../library/stdtypes.rst:1740 -#: ../../library/stdtypes.rst:2995 ../../library/stdtypes.rst:3014 -#: ../../library/stdtypes.rst:3127 ../../library/stdtypes.rst:4763 -#: ../../library/stdtypes.rst:4966 ../../library/stdtypes.rst:5450 -#: ../../library/stdtypes.rst:5707 ../../library/stdtypes.rst:5882 -#: ../../library/stdtypes.rst:5927 +#: ../../library/stdtypes.rst:3021 ../../library/stdtypes.rst:3040 +#: ../../library/stdtypes.rst:3153 ../../library/stdtypes.rst:4789 +#: ../../library/stdtypes.rst:5000 ../../library/stdtypes.rst:5484 +#: ../../library/stdtypes.rst:5741 ../../library/stdtypes.rst:5916 +#: ../../library/stdtypes.rst:5961 msgid "object" msgstr "object(物件)" @@ -9472,9 +9489,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:992 -#: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:4966 -#: ../../library/stdtypes.rst:5934 ../../library/stdtypes.rst:5948 -#: ../../library/stdtypes.rst:5963 +#: ../../library/stdtypes.rst:1179 ../../library/stdtypes.rst:5000 +#: ../../library/stdtypes.rst:5968 ../../library/stdtypes.rst:5982 +#: ../../library/stdtypes.rst:5997 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -9490,8 +9507,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2871 -#: ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2897 +#: ../../library/stdtypes.rst:4157 msgid "+ (plus)" msgstr "+ (加號)" @@ -9503,13 +9520,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2871 -#: ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2897 +#: ../../library/stdtypes.rst:4157 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2828 -#: ../../library/stdtypes.rst:4088 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2854 +#: ../../library/stdtypes.rst:4114 msgid "* (asterisk)" msgstr "* (星號)" @@ -9521,8 +9538,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2791 -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:249 ../../library/stdtypes.rst:2817 +#: ../../library/stdtypes.rst:4082 msgid "% (percent)" msgstr "% (百分號)" @@ -9532,7 +9549,7 @@ msgstr "**" #: ../../library/stdtypes.rst:322 ../../library/stdtypes.rst:399 #: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:5000 msgid "operations on" msgstr "operations on(操作於)" @@ -9541,7 +9558,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:341 ../../library/stdtypes.rst:1808 -#: ../../library/stdtypes.rst:2995 ../../library/stdtypes.rst:5963 +#: ../../library/stdtypes.rst:3021 ../../library/stdtypes.rst:5997 msgid "module" msgstr "模組" @@ -9609,7 +9626,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:889 ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:889 ../../library/stdtypes.rst:5399 msgid "protocol" msgstr "protocol(協定)" @@ -9635,7 +9652,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:5000 msgid "len" msgstr "len" @@ -9704,14 +9721,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:2995 -#: ../../library/stdtypes.rst:3127 ../../library/stdtypes.rst:3237 -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:1201 ../../library/stdtypes.rst:3021 +#: ../../library/stdtypes.rst:3153 ../../library/stdtypes.rst:3263 +#: ../../library/stdtypes.rst:4082 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4966 -#: ../../library/stdtypes.rst:5707 ../../library/stdtypes.rst:5963 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:5000 +#: ../../library/stdtypes.rst:5741 ../../library/stdtypes.rst:5997 msgid "type" msgstr "type(型別)" @@ -9719,7 +9736,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:1216 ../../library/stdtypes.rst:5000 msgid "del" msgstr "del" @@ -9729,7 +9746,7 @@ msgstr "range" #: ../../library/stdtypes.rst:1610 ../../library/stdtypes.rst:1753 #: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:2645 -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2817 msgid "string" msgstr "string(字串)" @@ -9750,17 +9767,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2987 +#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:3013 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:2995 -#: ../../library/stdtypes.rst:3014 ../../library/stdtypes.rst:3237 -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:1773 ../../library/stdtypes.rst:3021 +#: ../../library/stdtypes.rst:3040 ../../library/stdtypes.rst:3263 +#: ../../library/stdtypes.rst:4082 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:3237 +#: ../../library/stdtypes.rst:1800 ../../library/stdtypes.rst:3263 msgid "methods" msgstr "methods(方法)" @@ -9768,7 +9785,7 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2457 ../../library/stdtypes.rst:3910 +#: ../../library/stdtypes.rst:2457 ../../library/stdtypes.rst:3936 msgid "universal newlines" msgstr "universal newlines" @@ -9832,175 +9849,282 @@ msgstr "= (等號)" msgid "for help in debugging using string literals" msgstr "" -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2817 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2817 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2817 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2817 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2791 ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:2817 ../../library/stdtypes.rst:4082 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2791 ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:2817 ../../library/stdtypes.rst:4082 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2828 ../../library/stdtypes.rst:4088 +#: ../../library/stdtypes.rst:2854 ../../library/stdtypes.rst:4114 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2828 ../../library/stdtypes.rst:2871 -#: ../../library/stdtypes.rst:4088 ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:2854 ../../library/stdtypes.rst:2897 +#: ../../library/stdtypes.rst:4114 ../../library/stdtypes.rst:4157 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2828 ../../library/stdtypes.rst:4088 +#: ../../library/stdtypes.rst:2854 ../../library/stdtypes.rst:4114 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2871 ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:2897 ../../library/stdtypes.rst:4157 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2871 ../../library/stdtypes.rst:4131 +#: ../../library/stdtypes.rst:2897 ../../library/stdtypes.rst:4157 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2987 +#: ../../library/stdtypes.rst:3013 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2995 +#: ../../library/stdtypes.rst:3021 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2995 +#: ../../library/stdtypes.rst:3021 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3910 +#: ../../library/stdtypes.rst:3936 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3910 +#: ../../library/stdtypes.rst:3936 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:4082 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:4082 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:4082 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:4056 +#: ../../library/stdtypes.rst:4082 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4763 +#: ../../library/stdtypes.rst:4789 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:5000 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4966 +#: ../../library/stdtypes.rst:5000 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:5076 +#: ../../library/stdtypes.rst:5110 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5399 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5399 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5399 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:5438 +#: ../../library/stdtypes.rst:5472 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:5438 +#: ../../library/stdtypes.rst:5472 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:5450 +#: ../../library/stdtypes.rst:5484 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:5450 +#: ../../library/stdtypes.rst:5484 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:5450 +#: ../../library/stdtypes.rst:5484 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5707 +#: ../../library/stdtypes.rst:5741 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5707 +#: ../../library/stdtypes.rst:5741 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5882 +#: ../../library/stdtypes.rst:5916 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5927 +#: ../../library/stdtypes.rst:5961 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5927 +#: ../../library/stdtypes.rst:5961 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5934 +#: ../../library/stdtypes.rst:5968 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5934 +#: ../../library/stdtypes.rst:5968 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5948 +#: ../../library/stdtypes.rst:5982 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5948 +#: ../../library/stdtypes.rst:5982 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5987 +#: ../../library/stdtypes.rst:6021 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5987 +#: ../../library/stdtypes.rst:6021 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號字面值)" + +#~ msgid "" +#~ ">>> who = 'nobody'\n" +#~ ">>> nationality = 'Spanish'\n" +#~ ">>> f'{who.title()} expects the {nationality} Inquisition!'\n" +#~ "'Nobody expects the Spanish Inquisition!'" +#~ msgstr "" +#~ ">>> who = 'nobody'\n" +#~ ">>> nationality = 'Spanish'\n" +#~ ">>> f'{who.title()} expects the {nationality} Inquisition!'\n" +#~ "'Nobody expects the Spanish Inquisition!'" + +#~ msgid "" +#~ ">>> f'''This is a string\n" +#~ "... on two lines'''\n" +#~ "'This is a string\\non two lines'" +#~ msgstr "" +#~ ">>> f'''This is a string\n" +#~ "... on two lines'''\n" +#~ "'This is a string\\non two lines'" + +#~ msgid "" +#~ ">>> nationality = 'Spanish'\n" +#~ ">>> f'The {nationality} Inquisition!'\n" +#~ "'The Spanish Inquisition!'" +#~ msgstr "" +#~ ">>> nationality = 'Spanish'\n" +#~ ">>> f'The {nationality} Inquisition!'\n" +#~ "'The Spanish Inquisition!'" + +#~ msgid "" +#~ ">>> x = 42\n" +#~ ">>> f'{{x}} is {x}'\n" +#~ "'{x} is 42'" +#~ msgstr "" +#~ ">>> x = 42\n" +#~ ">>> f'{{x}} is {x}'\n" +#~ "'{x} is 42'" + +#~ msgid "" +#~ ">>> from math import sqrt\n" +#~ ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" +#~ "'√2 ≈ 1.41421'" +#~ msgstr "" +#~ ">>> from math import sqrt\n" +#~ ">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" +#~ "'√2 ≈ 1.41421'" + +#~ msgid "``!a``" +#~ msgstr "``!a``" + +#~ msgid "``!r``" +#~ msgstr "``!r``" + +#~ msgid "``!s``" +#~ msgstr "``!s``" + +#~ msgid "" +#~ ">>> from fractions import Fraction\n" +#~ ">>> f'{Fraction(1, 3)!s}'\n" +#~ "'1/3'\n" +#~ ">>> f'{Fraction(1, 3)!r}'\n" +#~ "'Fraction(1, 3)'\n" +#~ ">>> question = '¿Dónde está el Presidente?'\n" +#~ ">>> print(f'{question!a}')\n" +#~ "'\\xbfD\\xf3nde est\\xe1 el Presidente?'" +#~ msgstr "" +#~ ">>> from fractions import Fraction\n" +#~ ">>> f'{Fraction(1, 3)!s}'\n" +#~ "'1/3'\n" +#~ ">>> f'{Fraction(1, 3)!r}'\n" +#~ "'Fraction(1, 3)'\n" +#~ ">>> question = '¿Dónde está el Presidente?'\n" +#~ ">>> print(f'{question!a}')\n" +#~ "'\\xbfD\\xf3nde est\\xe1 el Presidente?'" + +#~ msgid "" +#~ ">>> from fractions import Fraction\n" +#~ ">>> calculation = Fraction(1, 3)\n" +#~ ">>> f'{calculation=}'\n" +#~ "'calculation=Fraction(1, 3)'\n" +#~ ">>> f'{calculation = }'\n" +#~ "'calculation = Fraction(1, 3)'\n" +#~ ">>> f'{calculation = !s}'\n" +#~ "'calculation = 1/3'" +#~ msgstr "" +#~ ">>> from fractions import Fraction\n" +#~ ">>> calculation = Fraction(1, 3)\n" +#~ ">>> f'{calculation=}'\n" +#~ "'calculation=Fraction(1, 3)'\n" +#~ ">>> f'{calculation = }'\n" +#~ "'calculation = Fraction(1, 3)'\n" +#~ ">>> f'{calculation = !s}'\n" +#~ "'calculation = 1/3'" + +#~ msgid "" +#~ ">>> from fractions import Fraction\n" +#~ ">>> f'{Fraction(1, 7):.6f}'\n" +#~ "'0.142857'\n" +#~ ">>> f'{Fraction(1, 7):_^+10}'\n" +#~ "'___+1/7___'" +#~ msgstr "" +#~ ">>> from fractions import Fraction\n" +#~ ">>> f'{Fraction(1, 7):.6f}'\n" +#~ "'0.142857'\n" +#~ ">>> f'{Fraction(1, 7):_^+10}'\n" +#~ "'___+1/7___'" diff --git a/reference/datamodel.po b/reference/datamodel.po index d55c173a7f7..110fd9fc4ae 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-06 00:14+0000\n" +"POT-Creation-Date: 2025-12-08 07:22+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-" @@ -575,7 +575,7 @@ msgstr "Set(集合)" msgid "" "These represent a mutable set. They are created by the built-in :func:`set` " "constructor and can be modified afterwards by several methods, such as :meth:" -"`add `." +"`~set.add`." msgstr "" #: ../../reference/datamodel.rst:455 diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index 25fe4cdb65a..44338dc094b 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-04 00:14+0000\n" +"POT-Creation-Date: 2025-12-08 07:22+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-" @@ -516,28 +516,32 @@ msgstr "" msgid "" "Except at the beginning of a logical line or in string literals, the " "whitespace characters space, tab and formfeed can be used interchangeably to " -"separate tokens. Whitespace is needed between two tokens only if their " -"concatenation could otherwise be interpreted as a different token. For " -"example, ``ab`` is one token, but ``a b`` is two tokens. However, ``+a`` and " -"``+ a`` both produce two tokens, ``+`` and ``a``, as ``+a`` is not a valid " -"token." +"separate tokens:" msgstr "" -#: ../../reference/lexical_analysis.rst:357 +#: ../../reference/lexical_analysis.rst:356 +msgid "" +"Whitespace is needed between two tokens only if their concatenation could " +"otherwise be interpreted as a different token. For example, ``ab`` is one " +"token, but ``a b`` is two tokens. However, ``+a`` and ``+ a`` both produce " +"two tokens, ``+`` and ``a``, as ``+a`` is not a valid token." +msgstr "" + +#: ../../reference/lexical_analysis.rst:365 msgid "End marker" msgstr "" -#: ../../reference/lexical_analysis.rst:359 +#: ../../reference/lexical_analysis.rst:367 msgid "" "At the end of non-interactive input, the lexical analyzer generates an :data:" "`~token.ENDMARKER` token." msgstr "" -#: ../../reference/lexical_analysis.rst:366 +#: ../../reference/lexical_analysis.rst:374 msgid "Other tokens" msgstr "" -#: ../../reference/lexical_analysis.rst:368 +#: ../../reference/lexical_analysis.rst:376 msgid "" "Besides :data:`~token.NEWLINE`, :data:`~token.INDENT` and :data:`~token." "DEDENT`, the following categories of tokens exist: *identifiers* and " @@ -549,67 +553,67 @@ msgid "" "string that forms a legal token, when read from left to right." msgstr "" -#: ../../reference/lexical_analysis.rst:382 +#: ../../reference/lexical_analysis.rst:390 msgid "Names (identifiers and keywords)" msgstr "" -#: ../../reference/lexical_analysis.rst:386 +#: ../../reference/lexical_analysis.rst:394 msgid "" ":data:`~token.NAME` tokens represent *identifiers*, *keywords*, and *soft " "keywords*." msgstr "" -#: ../../reference/lexical_analysis.rst:389 +#: ../../reference/lexical_analysis.rst:397 msgid "Names are composed of the following characters:" msgstr "" -#: ../../reference/lexical_analysis.rst:391 +#: ../../reference/lexical_analysis.rst:399 msgid "uppercase and lowercase letters (``A-Z`` and ``a-z``)," msgstr "" -#: ../../reference/lexical_analysis.rst:392 +#: ../../reference/lexical_analysis.rst:400 msgid "the underscore (``_``)," msgstr "底線 (``_``)," -#: ../../reference/lexical_analysis.rst:393 +#: ../../reference/lexical_analysis.rst:401 msgid "" "digits (``0`` through ``9``), which cannot appear as the first character, and" msgstr "" -#: ../../reference/lexical_analysis.rst:394 +#: ../../reference/lexical_analysis.rst:402 msgid "" "non-ASCII characters. Valid names may only contain \"letter-like\" and " "\"digit-like\" characters; see :ref:`lexical-names-nonascii` for details." msgstr "" -#: ../../reference/lexical_analysis.rst:397 +#: ../../reference/lexical_analysis.rst:405 msgid "" "Names must contain at least one character, but have no upper length limit. " "Case is significant." msgstr "" -#: ../../reference/lexical_analysis.rst:400 +#: ../../reference/lexical_analysis.rst:408 msgid "Formally, names are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:410 +#: ../../reference/lexical_analysis.rst:418 msgid "" "Note that not all names matched by this grammar are valid; see :ref:`lexical-" "names-nonascii` for details." msgstr "" -#: ../../reference/lexical_analysis.rst:417 +#: ../../reference/lexical_analysis.rst:425 msgid "Keywords" msgstr "關鍵字" -#: ../../reference/lexical_analysis.rst:423 +#: ../../reference/lexical_analysis.rst:431 msgid "" "The following names are used as reserved words, or *keywords* of the " "language, and cannot be used as ordinary identifiers. They must be spelled " "exactly as written here:" msgstr "" -#: ../../reference/lexical_analysis.rst:427 +#: ../../reference/lexical_analysis.rst:435 msgid "" "False await else import pass\n" "None break except in raise\n" @@ -627,101 +631,101 @@ msgstr "" "assert del global not with\n" "async elif if or yield" -#: ../../reference/lexical_analysis.rst:441 +#: ../../reference/lexical_analysis.rst:449 msgid "Soft Keywords" msgstr "軟關鍵字" -#: ../../reference/lexical_analysis.rst:447 +#: ../../reference/lexical_analysis.rst:455 msgid "" "Some names are only reserved under specific contexts. These are known as " "*soft keywords*:" msgstr "" -#: ../../reference/lexical_analysis.rst:450 +#: ../../reference/lexical_analysis.rst:458 msgid "" "``match``, ``case``, and ``_``, when used in the :keyword:`match` statement." msgstr "" -#: ../../reference/lexical_analysis.rst:451 +#: ../../reference/lexical_analysis.rst:459 msgid "``type``, when used in the :keyword:`type` statement." msgstr "" -#: ../../reference/lexical_analysis.rst:453 +#: ../../reference/lexical_analysis.rst:461 msgid "" "These syntactically act as keywords in their specific contexts, but this " "distinction is done at the parser level, not when tokenizing." msgstr "" -#: ../../reference/lexical_analysis.rst:456 +#: ../../reference/lexical_analysis.rst:464 msgid "" "As soft keywords, their use in the grammar is possible while still " "preserving compatibility with existing code that uses these names as " "identifier names." msgstr "" -#: ../../reference/lexical_analysis.rst:460 +#: ../../reference/lexical_analysis.rst:468 msgid "``type`` is now a soft keyword." msgstr "``type`` 現在是軟關鍵字。" -#: ../../reference/lexical_analysis.rst:469 +#: ../../reference/lexical_analysis.rst:477 msgid "Reserved classes of identifiers" msgstr "" -#: ../../reference/lexical_analysis.rst:471 +#: ../../reference/lexical_analysis.rst:479 msgid "" "Certain classes of identifiers (besides keywords) have special meanings. " "These classes are identified by the patterns of leading and trailing " "underscore characters:" msgstr "" -#: ../../reference/lexical_analysis.rst:475 +#: ../../reference/lexical_analysis.rst:483 msgid "``_*``" msgstr "``_*``" -#: ../../reference/lexical_analysis.rst:476 +#: ../../reference/lexical_analysis.rst:484 msgid "Not imported by ``from module import *``." msgstr "" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:486 msgid "``_``" msgstr "``_``" -#: ../../reference/lexical_analysis.rst:479 +#: ../../reference/lexical_analysis.rst:487 msgid "" "In a ``case`` pattern within a :keyword:`match` statement, ``_`` is a :ref:" "`soft keyword ` that denotes a :ref:`wildcard `." msgstr "" -#: ../../reference/lexical_analysis.rst:483 +#: ../../reference/lexical_analysis.rst:491 msgid "" "Separately, the interactive interpreter makes the result of the last " "evaluation available in the variable ``_``. (It is stored in the :mod:" "`builtins` module, alongside built-in functions like ``print``.)" msgstr "" -#: ../../reference/lexical_analysis.rst:488 +#: ../../reference/lexical_analysis.rst:496 msgid "" "Elsewhere, ``_`` is a regular identifier. It is often used to name " "\"special\" items, but it is not special to Python itself." msgstr "" -#: ../../reference/lexical_analysis.rst:493 +#: ../../reference/lexical_analysis.rst:501 msgid "" "The name ``_`` is often used in conjunction with internationalization; refer " "to the documentation for the :mod:`gettext` module for more information on " "this convention." msgstr "" -#: ../../reference/lexical_analysis.rst:497 +#: ../../reference/lexical_analysis.rst:505 msgid "It is also commonly used for unused variables." msgstr "" -#: ../../reference/lexical_analysis.rst:499 +#: ../../reference/lexical_analysis.rst:507 msgid "``__*__``" msgstr "``__*__``" -#: ../../reference/lexical_analysis.rst:500 +#: ../../reference/lexical_analysis.rst:508 msgid "" "System-defined names, informally known as \"dunder\" names. These names are " "defined by the interpreter and its implementation (including the standard " @@ -731,11 +735,11 @@ msgid "" "explicitly documented use, is subject to breakage without warning." msgstr "" -#: ../../reference/lexical_analysis.rst:507 +#: ../../reference/lexical_analysis.rst:515 msgid "``__*``" msgstr "``__*``" -#: ../../reference/lexical_analysis.rst:508 +#: ../../reference/lexical_analysis.rst:516 msgid "" "Class-private names. Names in this category, when used within the context " "of a class definition, are re-written to use a mangled form to help avoid " @@ -743,11 +747,11 @@ msgid "" "section :ref:`atom-identifiers`." msgstr "" -#: ../../reference/lexical_analysis.rst:517 +#: ../../reference/lexical_analysis.rst:525 msgid "Non-ASCII characters in names" msgstr "名稱中的非 ASCII 字元" -#: ../../reference/lexical_analysis.rst:519 +#: ../../reference/lexical_analysis.rst:527 msgid "" "Names that contain non-ASCII characters need additional normalization and " "validation beyond the rules and grammar explained :ref:`above " @@ -755,11 +759,11 @@ msgid "" "but ``r〰2``, ``€``, or ``🐍`` are not." msgstr "" -#: ../../reference/lexical_analysis.rst:525 +#: ../../reference/lexical_analysis.rst:533 msgid "This section explains the exact rules." msgstr "" -#: ../../reference/lexical_analysis.rst:527 +#: ../../reference/lexical_analysis.rst:535 msgid "" "All names are converted into the `normalization form`_ NFKC while parsing. " "This means that, for example, some typographic variants of characters are " @@ -767,14 +771,14 @@ msgid "" "to ``finalization``, so Python treats them as the same name::" msgstr "" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:540 msgid "" ">>> fiⁿₐˡᵢᶻₐᵗᵢᵒₙ = 3\n" ">>> finalization\n" "3" msgstr "" -#: ../../reference/lexical_analysis.rst:538 +#: ../../reference/lexical_analysis.rst:546 msgid "" "Normalization is done at the lexical level only. Run-time functions that " "take names as *strings* generally do not normalize their arguments. For " @@ -783,7 +787,7 @@ msgid "" "[\"fiⁿₐˡᵢᶻₐᵗᵢᵒₙ\"]``." msgstr "" -#: ../../reference/lexical_analysis.rst:545 +#: ../../reference/lexical_analysis.rst:553 msgid "" "Similarly to how ASCII-only names must contain only letters, digits and the " "underscore, and cannot start with a digit, a valid name must start with a " @@ -791,7 +795,7 @@ msgid "" "characters must be in the \"letter- and digit-like\" set ``xid_continue``." msgstr "" -#: ../../reference/lexical_analysis.rst:551 +#: ../../reference/lexical_analysis.rst:559 msgid "" "These sets based on the *XID_Start* and *XID_Continue* sets as defined by " "the Unicode standard annex `UAX-31`_. Python's ``xid_start`` additionally " @@ -799,7 +803,7 @@ msgid "" "conform to `UAX-31`_." msgstr "" -#: ../../reference/lexical_analysis.rst:556 +#: ../../reference/lexical_analysis.rst:564 msgid "" "A non-normative listing of characters in the *XID_Start* and *XID_Continue* " "sets as defined by Unicode is available in the `DerivedCoreProperties.txt`_ " @@ -807,131 +811,131 @@ msgid "" "rules for the ``xid_*`` sets are given below." msgstr "" -#: ../../reference/lexical_analysis.rst:561 +#: ../../reference/lexical_analysis.rst:569 msgid "The set ``id_start`` is defined as the union of:" msgstr "" -#: ../../reference/lexical_analysis.rst:563 +#: ../../reference/lexical_analysis.rst:571 msgid "Unicode category ```` - uppercase letters (includes ``A`` to ``Z``)" msgstr "" -#: ../../reference/lexical_analysis.rst:564 +#: ../../reference/lexical_analysis.rst:572 msgid "Unicode category ```` - lowercase letters (includes ``a`` to ``z``)" msgstr "" -#: ../../reference/lexical_analysis.rst:565 +#: ../../reference/lexical_analysis.rst:573 msgid "Unicode category ```` - titlecase letters" msgstr "" -#: ../../reference/lexical_analysis.rst:566 +#: ../../reference/lexical_analysis.rst:574 msgid "Unicode category ```` - modifier letters" msgstr "" -#: ../../reference/lexical_analysis.rst:567 +#: ../../reference/lexical_analysis.rst:575 msgid "Unicode category ```` - other letters" msgstr "" -#: ../../reference/lexical_analysis.rst:568 +#: ../../reference/lexical_analysis.rst:576 msgid "Unicode category ```` - letter numbers" msgstr "" -#: ../../reference/lexical_analysis.rst:569 +#: ../../reference/lexical_analysis.rst:577 msgid "{``\"_\"``} - the underscore" msgstr "{``\"_\"``} - 底線" -#: ../../reference/lexical_analysis.rst:570 +#: ../../reference/lexical_analysis.rst:578 msgid "" "```` - an explicit set of characters in `PropList.txt`_ to " "support backwards compatibility" msgstr "" -#: ../../reference/lexical_analysis.rst:573 +#: ../../reference/lexical_analysis.rst:581 msgid "" "The set ``xid_start`` then closes this set under NFKC normalization, by " "removing all characters whose normalization is not of the form ``id_start " "id_continue*``." msgstr "" -#: ../../reference/lexical_analysis.rst:577 +#: ../../reference/lexical_analysis.rst:585 msgid "The set ``id_continue`` is defined as the union of:" msgstr "" -#: ../../reference/lexical_analysis.rst:579 +#: ../../reference/lexical_analysis.rst:587 msgid "``id_start`` (see above)" msgstr "" -#: ../../reference/lexical_analysis.rst:580 +#: ../../reference/lexical_analysis.rst:588 msgid "Unicode category ```` - decimal numbers (includes ``0`` to ``9``)" msgstr "" -#: ../../reference/lexical_analysis.rst:581 +#: ../../reference/lexical_analysis.rst:589 msgid "Unicode category ```` - connector punctuations" msgstr "" -#: ../../reference/lexical_analysis.rst:582 +#: ../../reference/lexical_analysis.rst:590 msgid "Unicode category ```` - nonspacing marks" msgstr "" -#: ../../reference/lexical_analysis.rst:583 +#: ../../reference/lexical_analysis.rst:591 msgid "Unicode category ```` - spacing combining marks" msgstr "" -#: ../../reference/lexical_analysis.rst:584 +#: ../../reference/lexical_analysis.rst:592 msgid "" "```` - another explicit set of characters in `PropList." "txt`_ to support backwards compatibility" msgstr "" -#: ../../reference/lexical_analysis.rst:587 +#: ../../reference/lexical_analysis.rst:595 msgid "Again, ``xid_continue`` closes this set under NFKC normalization." msgstr "" -#: ../../reference/lexical_analysis.rst:589 +#: ../../reference/lexical_analysis.rst:597 msgid "" "Unicode categories use the version of the Unicode Character Database as " "included in the :mod:`unicodedata` module." msgstr "" -#: ../../reference/lexical_analysis.rst:599 +#: ../../reference/lexical_analysis.rst:607 msgid ":pep:`3131` -- Supporting Non-ASCII Identifiers" msgstr "" -#: ../../reference/lexical_analysis.rst:600 +#: ../../reference/lexical_analysis.rst:608 msgid ":pep:`672` -- Unicode-related Security Considerations for Python" msgstr "" -#: ../../reference/lexical_analysis.rst:606 +#: ../../reference/lexical_analysis.rst:614 msgid "Literals" msgstr "" -#: ../../reference/lexical_analysis.rst:610 +#: ../../reference/lexical_analysis.rst:618 msgid "Literals are notations for constant values of some built-in types." msgstr "" -#: ../../reference/lexical_analysis.rst:612 +#: ../../reference/lexical_analysis.rst:620 msgid "" "In terms of lexical analysis, Python has :ref:`string, bytes ` and :" "ref:`numeric ` literals." msgstr "" -#: ../../reference/lexical_analysis.rst:615 +#: ../../reference/lexical_analysis.rst:623 msgid "" "Other \"literals\" are lexically denoted using :ref:`keywords ` " "(``None``, ``True``, ``False``) and the special :ref:`ellipsis token " "` (``...``)." msgstr "" -#: ../../reference/lexical_analysis.rst:626 +#: ../../reference/lexical_analysis.rst:634 msgid "String and Bytes literals" msgstr "" -#: ../../reference/lexical_analysis.rst:628 +#: ../../reference/lexical_analysis.rst:636 msgid "" "String literals are text enclosed in single quotes (``'``) or double quotes " "(``\"``). For example:" msgstr "" -#: ../../reference/lexical_analysis.rst:631 +#: ../../reference/lexical_analysis.rst:639 msgid "" "\"spam\"\n" "'eggs'" @@ -939,14 +943,14 @@ msgstr "" "\"spam\"\n" "'eggs'" -#: ../../reference/lexical_analysis.rst:636 +#: ../../reference/lexical_analysis.rst:644 msgid "" "The quote used to start the literal also terminates it, so a string literal " "can only contain the other quote (except with escape sequences, see below). " "For example:" msgstr "" -#: ../../reference/lexical_analysis.rst:640 +#: ../../reference/lexical_analysis.rst:648 msgid "" "'Say \"Hello\", please.'\n" "\"Don't do that!\"" @@ -954,13 +958,13 @@ msgstr "" "'Say \"Hello\", please.'\n" "\"Don't do that!\"" -#: ../../reference/lexical_analysis.rst:645 +#: ../../reference/lexical_analysis.rst:653 msgid "" "Except for this limitation, the choice of quote character (``'`` or ``\"``) " "does not affect how the literal is parsed." msgstr "" -#: ../../reference/lexical_analysis.rst:648 +#: ../../reference/lexical_analysis.rst:656 msgid "" "Inside a string literal, the backslash (``\\``) character introduces an :dfn:" "`escape sequence`, which has special meaning depending on the character " @@ -968,7 +972,7 @@ msgid "" "character, and does *not* end the string:" msgstr "" -#: ../../reference/lexical_analysis.rst:654 +#: ../../reference/lexical_analysis.rst:662 msgid "" ">>> print(\"Say \\\"Hello\\\" to everyone!\")\n" "Say \"Hello\" to everyone!" @@ -976,58 +980,58 @@ msgstr "" ">>> print(\"Say \\\"Hello\\\" to everyone!\")\n" "Say \"Hello\" to everyone!" -#: ../../reference/lexical_analysis.rst:659 +#: ../../reference/lexical_analysis.rst:667 msgid "" "See :ref:`escape sequences ` below for a full list of such " "sequences, and more details." msgstr "" -#: ../../reference/lexical_analysis.rst:668 +#: ../../reference/lexical_analysis.rst:676 msgid "Triple-quoted strings" msgstr "三引號字串" -#: ../../reference/lexical_analysis.rst:670 +#: ../../reference/lexical_analysis.rst:678 msgid "" "Strings can also be enclosed in matching groups of three single or double " "quotes. These are generally referred to as :dfn:`triple-quoted strings`::" msgstr "" -#: ../../reference/lexical_analysis.rst:674 +#: ../../reference/lexical_analysis.rst:682 msgid "\"\"\"This is a triple-quoted string.\"\"\"" msgstr "\"\"\"這是一個三引號字串。\"\"\"" -#: ../../reference/lexical_analysis.rst:676 +#: ../../reference/lexical_analysis.rst:684 msgid "" "In triple-quoted literals, unescaped quotes are allowed (and are retained), " "except that three unescaped quotes in a row terminate the literal, if they " "are of the same kind (``'`` or ``\"``) used at the start::" msgstr "" -#: ../../reference/lexical_analysis.rst:680 +#: ../../reference/lexical_analysis.rst:688 msgid "\"\"\"This string has \"quotes\" inside.\"\"\"" msgstr "\"\"\"這個字串裡面有 \"引號\"。\"\"\"" -#: ../../reference/lexical_analysis.rst:682 +#: ../../reference/lexical_analysis.rst:690 msgid "Unescaped newlines are also allowed and retained::" msgstr "" -#: ../../reference/lexical_analysis.rst:684 +#: ../../reference/lexical_analysis.rst:692 msgid "" "'''This triple-quoted string\n" "continues on the next line.'''" msgstr "" -#: ../../reference/lexical_analysis.rst:693 +#: ../../reference/lexical_analysis.rst:701 msgid "String prefixes" msgstr "" -#: ../../reference/lexical_analysis.rst:695 +#: ../../reference/lexical_analysis.rst:703 msgid "" "String literals can have an optional :dfn:`prefix` that influences how the " "content of the literal is parsed, for example:" msgstr "" -#: ../../reference/lexical_analysis.rst:698 +#: ../../reference/lexical_analysis.rst:706 msgid "" "b\"data\"\n" "f'{result=}'" @@ -1035,35 +1039,35 @@ msgstr "" "b\"data\"\n" "f'{result=}'" -#: ../../reference/lexical_analysis.rst:703 +#: ../../reference/lexical_analysis.rst:711 msgid "The allowed prefixes are:" msgstr "" -#: ../../reference/lexical_analysis.rst:705 +#: ../../reference/lexical_analysis.rst:713 msgid "``b``: :ref:`Bytes literal `" msgstr "" -#: ../../reference/lexical_analysis.rst:706 +#: ../../reference/lexical_analysis.rst:714 msgid "``r``: :ref:`Raw string `" msgstr "" -#: ../../reference/lexical_analysis.rst:707 +#: ../../reference/lexical_analysis.rst:715 msgid "``f``: :ref:`Formatted string literal ` (\"f-string\")" msgstr "" -#: ../../reference/lexical_analysis.rst:708 +#: ../../reference/lexical_analysis.rst:716 msgid "``t``: :ref:`Template string literal ` (\"t-string\")" msgstr "" -#: ../../reference/lexical_analysis.rst:709 +#: ../../reference/lexical_analysis.rst:717 msgid "``u``: No effect (allowed for backwards compatibility)" msgstr "" -#: ../../reference/lexical_analysis.rst:711 +#: ../../reference/lexical_analysis.rst:719 msgid "See the linked sections for details on each type." msgstr "" -#: ../../reference/lexical_analysis.rst:713 +#: ../../reference/lexical_analysis.rst:721 msgid "" "Prefixes are case-insensitive (for example, '``B``' works the same as " "'``b``'). The '``r``' prefix can be combined with '``f``', '``t``' or " @@ -1071,220 +1075,220 @@ msgid "" "are also valid prefixes." msgstr "" -#: ../../reference/lexical_analysis.rst:717 +#: ../../reference/lexical_analysis.rst:725 msgid "" "The ``'rb'`` prefix of raw bytes literals has been added as a synonym of " "``'br'``." msgstr "" -#: ../../reference/lexical_analysis.rst:721 +#: ../../reference/lexical_analysis.rst:729 msgid "" "Support for the unicode legacy literal (``u'value'``) was reintroduced to " "simplify the maintenance of dual Python 2.x and 3.x codebases. See :pep:" "`414` for more information." msgstr "" -#: ../../reference/lexical_analysis.rst:727 +#: ../../reference/lexical_analysis.rst:735 msgid "Formal grammar" msgstr "" -#: ../../reference/lexical_analysis.rst:729 +#: ../../reference/lexical_analysis.rst:737 msgid "" "String literals, except :ref:`\"f-strings\" ` and :ref:`\"t-" "strings\" `, are described by the following lexical definitions." msgstr "" -#: ../../reference/lexical_analysis.rst:733 +#: ../../reference/lexical_analysis.rst:741 msgid "" "These definitions use :ref:`negative lookaheads ` (``!" "``) to indicate that an ending quote ends the literal." msgstr "" -#: ../../reference/lexical_analysis.rst:751 +#: ../../reference/lexical_analysis.rst:759 msgid "" "Note that as in all lexical definitions, whitespace is significant. In " "particular, the prefix (if any) must be immediately followed by the starting " "quote." msgstr "" -#: ../../reference/lexical_analysis.rst:773 +#: ../../reference/lexical_analysis.rst:781 msgid "Escape sequences" msgstr "跳脫序列" -#: ../../reference/lexical_analysis.rst:775 +#: ../../reference/lexical_analysis.rst:783 msgid "" "Unless an '``r``' or '``R``' prefix is present, escape sequences in string " "and bytes literals are interpreted according to rules similar to those used " "by Standard C. The recognized escape sequences are:" msgstr "" -#: ../../reference/lexical_analysis.rst:783 +#: ../../reference/lexical_analysis.rst:791 msgid "Escape Sequence" msgstr "" -#: ../../reference/lexical_analysis.rst:784 +#: ../../reference/lexical_analysis.rst:792 msgid "Meaning" msgstr "含義" -#: ../../reference/lexical_analysis.rst:785 +#: ../../reference/lexical_analysis.rst:793 msgid "``\\``\\ " msgstr "``\\``\\ " -#: ../../reference/lexical_analysis.rst:786 +#: ../../reference/lexical_analysis.rst:794 msgid ":ref:`string-escape-ignore`" msgstr ":ref:`string-escape-ignore`" -#: ../../reference/lexical_analysis.rst:787 +#: ../../reference/lexical_analysis.rst:795 msgid "``\\\\``" msgstr "``\\\\``" -#: ../../reference/lexical_analysis.rst:788 +#: ../../reference/lexical_analysis.rst:796 msgid ":ref:`Backslash `" msgstr "" -#: ../../reference/lexical_analysis.rst:789 +#: ../../reference/lexical_analysis.rst:797 msgid "``\\'``" msgstr "``\\'``" -#: ../../reference/lexical_analysis.rst:790 +#: ../../reference/lexical_analysis.rst:798 msgid ":ref:`Single quote `" msgstr "" -#: ../../reference/lexical_analysis.rst:791 +#: ../../reference/lexical_analysis.rst:799 msgid "``\\\"``" msgstr "``\\\"``" -#: ../../reference/lexical_analysis.rst:792 +#: ../../reference/lexical_analysis.rst:800 msgid ":ref:`Double quote `" msgstr "" -#: ../../reference/lexical_analysis.rst:793 +#: ../../reference/lexical_analysis.rst:801 msgid "``\\a``" msgstr "``\\a``" -#: ../../reference/lexical_analysis.rst:794 +#: ../../reference/lexical_analysis.rst:802 msgid "ASCII Bell (BEL)" msgstr "" -#: ../../reference/lexical_analysis.rst:795 +#: ../../reference/lexical_analysis.rst:803 msgid "``\\b``" msgstr "``\\b``" -#: ../../reference/lexical_analysis.rst:796 +#: ../../reference/lexical_analysis.rst:804 msgid "ASCII Backspace (BS)" msgstr "" -#: ../../reference/lexical_analysis.rst:797 +#: ../../reference/lexical_analysis.rst:805 msgid "``\\f``" msgstr "``\\f``" -#: ../../reference/lexical_analysis.rst:798 +#: ../../reference/lexical_analysis.rst:806 msgid "ASCII Formfeed (FF)" msgstr "" -#: ../../reference/lexical_analysis.rst:799 +#: ../../reference/lexical_analysis.rst:807 msgid "``\\n``" msgstr "``\\n``" -#: ../../reference/lexical_analysis.rst:800 +#: ../../reference/lexical_analysis.rst:808 msgid "ASCII Linefeed (LF)" msgstr "" -#: ../../reference/lexical_analysis.rst:801 +#: ../../reference/lexical_analysis.rst:809 msgid "``\\r``" msgstr "``\\r``" -#: ../../reference/lexical_analysis.rst:802 +#: ../../reference/lexical_analysis.rst:810 msgid "ASCII Carriage Return (CR)" msgstr "" -#: ../../reference/lexical_analysis.rst:803 +#: ../../reference/lexical_analysis.rst:811 msgid "``\\t``" msgstr "``\\t``" -#: ../../reference/lexical_analysis.rst:804 +#: ../../reference/lexical_analysis.rst:812 msgid "ASCII Horizontal Tab (TAB)" msgstr "" -#: ../../reference/lexical_analysis.rst:805 +#: ../../reference/lexical_analysis.rst:813 msgid "``\\v``" msgstr "``\\v``" -#: ../../reference/lexical_analysis.rst:806 +#: ../../reference/lexical_analysis.rst:814 msgid "ASCII Vertical Tab (VT)" msgstr "" -#: ../../reference/lexical_analysis.rst:807 +#: ../../reference/lexical_analysis.rst:815 msgid ":samp:`\\\\\\\\{ooo}`" msgstr ":samp:`\\\\\\\\{ooo}`" -#: ../../reference/lexical_analysis.rst:808 +#: ../../reference/lexical_analysis.rst:816 msgid ":ref:`string-escape-oct`" msgstr ":ref:`string-escape-oct`" -#: ../../reference/lexical_analysis.rst:809 +#: ../../reference/lexical_analysis.rst:817 msgid ":samp:`\\\\x{hh}`" msgstr ":samp:`\\\\x{hh}`" -#: ../../reference/lexical_analysis.rst:810 +#: ../../reference/lexical_analysis.rst:818 msgid ":ref:`string-escape-hex`" msgstr ":ref:`string-escape-hex`" -#: ../../reference/lexical_analysis.rst:811 +#: ../../reference/lexical_analysis.rst:819 msgid ":samp:`\\\\N\\\\{{name}\\\\}`" msgstr ":samp:`\\\\N\\\\{{name}\\\\}`" -#: ../../reference/lexical_analysis.rst:812 +#: ../../reference/lexical_analysis.rst:820 msgid ":ref:`string-escape-named`" msgstr ":ref:`string-escape-named`" -#: ../../reference/lexical_analysis.rst:813 +#: ../../reference/lexical_analysis.rst:821 msgid ":samp:`\\\\u{xxxx}`" msgstr ":samp:`\\\\u{xxxx}`" -#: ../../reference/lexical_analysis.rst:814 -#: ../../reference/lexical_analysis.rst:816 +#: ../../reference/lexical_analysis.rst:822 +#: ../../reference/lexical_analysis.rst:824 msgid ":ref:`Hexadecimal Unicode character `" msgstr "" -#: ../../reference/lexical_analysis.rst:815 +#: ../../reference/lexical_analysis.rst:823 msgid ":samp:`\\\\U{xxxxxxxx}`" msgstr ":samp:`\\\\U{xxxxxxxx}`" -#: ../../reference/lexical_analysis.rst:821 +#: ../../reference/lexical_analysis.rst:829 msgid "Ignored end of line" msgstr "" -#: ../../reference/lexical_analysis.rst:823 +#: ../../reference/lexical_analysis.rst:831 msgid "A backslash can be added at the end of a line to ignore the newline::" msgstr "" -#: ../../reference/lexical_analysis.rst:825 +#: ../../reference/lexical_analysis.rst:833 msgid "" ">>> 'This string will not include \\\n" "... backslashes or newline characters.'\n" "'This string will not include backslashes or newline characters.'" msgstr "" -#: ../../reference/lexical_analysis.rst:829 +#: ../../reference/lexical_analysis.rst:837 msgid "" "The same result can be achieved using :ref:`triple-quoted strings " "`, or parentheses and :ref:`string literal concatenation `." msgstr "" -#: ../../reference/lexical_analysis.rst:835 +#: ../../reference/lexical_analysis.rst:843 msgid "Escaped characters" msgstr "跳脫字元" -#: ../../reference/lexical_analysis.rst:837 +#: ../../reference/lexical_analysis.rst:845 msgid "" "To include a backslash in a non-:ref:`raw ` Python string " "literal, it must be doubled. The ``\\\\`` escape sequence denotes a single " "backslash character::" msgstr "" -#: ../../reference/lexical_analysis.rst:841 +#: ../../reference/lexical_analysis.rst:849 msgid "" ">>> print('C:\\\\Program Files')\n" "C:\\Program Files" @@ -1292,13 +1296,13 @@ msgstr "" ">>> print('C:\\\\Program Files')\n" "C:\\Program Files" -#: ../../reference/lexical_analysis.rst:844 +#: ../../reference/lexical_analysis.rst:852 msgid "" "Similarly, the ``\\'`` and ``\\\"`` sequences denote the single and double " "quote character, respectively::" msgstr "" -#: ../../reference/lexical_analysis.rst:847 +#: ../../reference/lexical_analysis.rst:855 msgid "" ">>> print('\\' and \\\"')\n" "' and \"" @@ -1306,17 +1310,17 @@ msgstr "" ">>> print('\\' and \\\"')\n" "' and \"" -#: ../../reference/lexical_analysis.rst:853 +#: ../../reference/lexical_analysis.rst:861 msgid "Octal character" msgstr "八進位字元" -#: ../../reference/lexical_analysis.rst:855 +#: ../../reference/lexical_analysis.rst:863 msgid "" "The sequence :samp:`\\\\\\\\{ooo}` denotes a *character* with the octal " "(base 8) value *ooo*::" msgstr "" -#: ../../reference/lexical_analysis.rst:858 +#: ../../reference/lexical_analysis.rst:866 msgid "" ">>> '\\120'\n" "'P'" @@ -1324,41 +1328,41 @@ msgstr "" ">>> '\\120'\n" "'P'" -#: ../../reference/lexical_analysis.rst:861 +#: ../../reference/lexical_analysis.rst:869 msgid "Up to three octal digits (0 through 7) are accepted." msgstr "" -#: ../../reference/lexical_analysis.rst:863 -#: ../../reference/lexical_analysis.rst:888 +#: ../../reference/lexical_analysis.rst:871 +#: ../../reference/lexical_analysis.rst:896 msgid "" "In a bytes literal, *character* means a *byte* with the given value. In a " "string literal, it means a Unicode character with the given value." msgstr "" -#: ../../reference/lexical_analysis.rst:866 +#: ../../reference/lexical_analysis.rst:874 msgid "" "Octal escapes with value larger than ``0o377`` (255) produce a :exc:" "`DeprecationWarning`." msgstr "" -#: ../../reference/lexical_analysis.rst:870 +#: ../../reference/lexical_analysis.rst:878 msgid "" "Octal escapes with value larger than ``0o377`` (255) produce a :exc:" "`SyntaxWarning`. In a future Python version they will raise a :exc:" "`SyntaxError`." msgstr "" -#: ../../reference/lexical_analysis.rst:878 +#: ../../reference/lexical_analysis.rst:886 msgid "Hexadecimal character" msgstr "十六進位字元" -#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:888 msgid "" "The sequence :samp:`\\\\x{hh}` denotes a *character* with the hex (base 16) " "value *hh*::" msgstr "" -#: ../../reference/lexical_analysis.rst:883 +#: ../../reference/lexical_analysis.rst:891 msgid "" ">>> '\\x50'\n" "'P'" @@ -1366,21 +1370,21 @@ msgstr "" ">>> '\\x50'\n" "'P'" -#: ../../reference/lexical_analysis.rst:886 +#: ../../reference/lexical_analysis.rst:894 msgid "Unlike in Standard C, exactly two hex digits are required." msgstr "與標準 C 不同,這裡需要剛好兩個十六進位數字。" -#: ../../reference/lexical_analysis.rst:894 +#: ../../reference/lexical_analysis.rst:902 msgid "Named Unicode character" msgstr "" -#: ../../reference/lexical_analysis.rst:896 +#: ../../reference/lexical_analysis.rst:904 msgid "" "The sequence :samp:`\\\\N\\\\{{name}\\\\}` denotes a Unicode character with " "the given *name*::" msgstr "" -#: ../../reference/lexical_analysis.rst:899 +#: ../../reference/lexical_analysis.rst:907 msgid "" ">>> '\\N{LATIN CAPITAL LETTER P}'\n" "'P'\n" @@ -1392,11 +1396,11 @@ msgstr "" ">>> '\\N{SNAKE}'\n" "'🐍'" -#: ../../reference/lexical_analysis.rst:904 +#: ../../reference/lexical_analysis.rst:912 msgid "This sequence cannot appear in :ref:`bytes literals `." msgstr "" -#: ../../reference/lexical_analysis.rst:906 +#: ../../reference/lexical_analysis.rst:914 msgid "" "Support for `name aliases `__ has been added." @@ -1404,11 +1408,11 @@ msgstr "" "已新增對\\ `名稱別名 (name alias) `__\\ 的支援。" -#: ../../reference/lexical_analysis.rst:913 +#: ../../reference/lexical_analysis.rst:921 msgid "Hexadecimal Unicode characters" msgstr "十六進位 Unicode 字元" -#: ../../reference/lexical_analysis.rst:915 +#: ../../reference/lexical_analysis.rst:923 msgid "" "These sequences :samp:`\\\\u{xxxx}` and :samp:`\\\\U{xxxxxxxx}` denote the " "Unicode character with the given hex (base 16) value. Exactly four digits " @@ -1416,7 +1420,7 @@ msgid "" "latter can encode any Unicode character." msgstr "" -#: ../../reference/lexical_analysis.rst:921 +#: ../../reference/lexical_analysis.rst:929 msgid "" ">>> '\\u1234'\n" "'ሴ'\n" @@ -1428,21 +1432,21 @@ msgstr "" ">>> '\\U0001f40d'\n" "'🐍'" -#: ../../reference/lexical_analysis.rst:928 +#: ../../reference/lexical_analysis.rst:936 msgid "These sequences cannot appear in :ref:`bytes literals `." msgstr "" -#: ../../reference/lexical_analysis.rst:934 +#: ../../reference/lexical_analysis.rst:942 msgid "Unrecognized escape sequences" msgstr "無法辨識的跳脫序列" -#: ../../reference/lexical_analysis.rst:936 +#: ../../reference/lexical_analysis.rst:944 msgid "" "Unlike in Standard C, all unrecognized escape sequences are left in the " "string unchanged, that is, *the backslash is left in the result*::" msgstr "" -#: ../../reference/lexical_analysis.rst:939 +#: ../../reference/lexical_analysis.rst:947 msgid "" ">>> print('\\q')\n" "\\q\n" @@ -1454,28 +1458,28 @@ msgstr "" ">>> list('\\q')\n" "['\\\\', 'q']" -#: ../../reference/lexical_analysis.rst:944 +#: ../../reference/lexical_analysis.rst:952 msgid "" "Note that for bytes literals, the escape sequences only recognized in string " "literals (``\\N...``, ``\\u...``, ``\\U...``) fall into the category of " "unrecognized escapes." msgstr "" -#: ../../reference/lexical_analysis.rst:948 +#: ../../reference/lexical_analysis.rst:956 msgid "Unrecognized escape sequences produce a :exc:`DeprecationWarning`." msgstr "" -#: ../../reference/lexical_analysis.rst:951 +#: ../../reference/lexical_analysis.rst:959 msgid "" "Unrecognized escape sequences produce a :exc:`SyntaxWarning`. In a future " "Python version they will raise a :exc:`SyntaxError`." msgstr "" -#: ../../reference/lexical_analysis.rst:964 +#: ../../reference/lexical_analysis.rst:972 msgid "Bytes literals" msgstr "位元組常數" -#: ../../reference/lexical_analysis.rst:966 +#: ../../reference/lexical_analysis.rst:974 msgid "" ":dfn:`Bytes literals` are always prefixed with '``b``' or '``B``'; they " "produce an instance of the :class:`bytes` type instead of the :class:`str` " @@ -1484,7 +1488,7 @@ msgid "" "`string-escape-hex` or :ref:`string-escape-oct`):" msgstr "" -#: ../../reference/lexical_analysis.rst:972 +#: ../../reference/lexical_analysis.rst:980 msgid "" ">>> b'\\x89PNG\\r\\n\\x1a\\n'\n" "b'\\x89PNG\\r\\n\\x1a\\n'\n" @@ -1496,17 +1500,17 @@ msgstr "" ">>> list(b'\\x89PNG\\r\\n\\x1a\\n')\n" "[137, 80, 78, 71, 13, 10, 26, 10]" -#: ../../reference/lexical_analysis.rst:979 +#: ../../reference/lexical_analysis.rst:987 msgid "" "Similarly, a zero byte must be expressed using an escape sequence (typically " "``\\0`` or ``\\x00``)." msgstr "" -#: ../../reference/lexical_analysis.rst:990 +#: ../../reference/lexical_analysis.rst:998 msgid "Raw string literals" msgstr "原始字串常數" -#: ../../reference/lexical_analysis.rst:992 +#: ../../reference/lexical_analysis.rst:1000 msgid "" "Both string and bytes literals may optionally be prefixed with a letter " "'``r``' or '``R``'; such constructs are called :dfn:`raw string literals` " @@ -1515,7 +1519,7 @@ msgid "" "` are not treated specially:" msgstr "" -#: ../../reference/lexical_analysis.rst:999 +#: ../../reference/lexical_analysis.rst:1007 msgid "" ">>> r'\\d{4}-\\d{2}-\\d{2}'\n" "'\\\\d{4}-\\\\d{2}-\\\\d{2}'" @@ -1523,7 +1527,7 @@ msgstr "" ">>> r'\\d{4}-\\d{2}-\\d{2}'\n" "'\\\\d{4}-\\\\d{2}-\\\\d{2}'" -#: ../../reference/lexical_analysis.rst:1004 +#: ../../reference/lexical_analysis.rst:1012 msgid "" "Even in a raw literal, quotes can be escaped with a backslash, but the " "backslash remains in the result; for example, ``r\"\\\"\"`` is a valid " @@ -1536,165 +1540,99 @@ msgid "" "continuation." msgstr "" -#: ../../reference/lexical_analysis.rst:1032 +#: ../../reference/lexical_analysis.rst:1040 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../reference/lexical_analysis.rst:1036 -msgid "" -"A :dfn:`formatted string literal` or :dfn:`f-string` is a string literal " -"that is prefixed with '``f``' or '``F``'. These strings may contain " -"replacement fields, which are expressions delimited by curly braces ``{}``. " -"While other string literals always have a constant value, formatted strings " -"are really expressions evaluated at run time." -msgstr "" - -#: ../../reference/lexical_analysis.rst:1042 +#: ../../reference/lexical_analysis.rst:1043 msgid "" -"Escape sequences are decoded like in ordinary string literals (except when a " -"literal is also marked as a raw string). After decoding, the grammar for " -"the contents of the string is:" +"The :keyword:`await` and :keyword:`async for` can be used in expressions " +"within f-strings." msgstr "" -#: ../../reference/lexical_analysis.rst:1056 -msgid "" -"The parts of the string outside curly braces are treated literally, except " -"that any doubled curly braces ``'{{'`` or ``'}}'`` are replaced with the " -"corresponding single curly brace. A single opening curly bracket ``'{'`` " -"marks a replacement field, which starts with a Python expression. To display " -"both the expression text and its value after evaluation, (useful in " -"debugging), an equal sign ``'='`` may be added after the expression. A " -"conversion field, introduced by an exclamation point ``'!'`` may follow. A " -"format specifier may also be appended, introduced by a colon ``':'``. A " -"replacement field ends with a closing curly bracket ``'}'``." +#: ../../reference/lexical_analysis.rst:1046 +msgid "Added the debug specifier (``=``)" msgstr "" -#: ../../reference/lexical_analysis.rst:1066 +#: ../../reference/lexical_analysis.rst:1048 msgid "" -"Expressions in formatted string literals are treated like regular Python " -"expressions surrounded by parentheses, with a few exceptions. An empty " -"expression is not allowed, and both :keyword:`lambda` and assignment " -"expressions ``:=`` must be surrounded by explicit parentheses. Each " -"expression is evaluated in the context where the formatted string literal " -"appears, in order from left to right. Replacement expressions can contain " -"newlines in both single-quoted and triple-quoted f-strings and they can " -"contain comments. Everything that comes after a ``#`` inside a replacement " -"field is a comment (even closing braces and quotes). In that case, " -"replacement fields must be closed in a different line." +"Many restrictions on expressions within f-strings have been removed. " +"Notably, nested strings, comments, and backslashes are now permitted." msgstr "" -#: ../../reference/lexical_analysis.rst:1077 +#: ../../reference/lexical_analysis.rst:1052 msgid "" -">>> f\"abc{a # This is a comment }\"\n" -"... + 3}\"\n" -"'abc5'" +"A :dfn:`formatted string literal` or :dfn:`f-string` is a string literal " +"that is prefixed with '``f``' or '``F``'. Unlike other string literals, f-" +"strings do not have a constant value. They may contain *replacement fields* " +"delimited by curly braces ``{}``. Replacement fields contain expressions " +"which are evaluated at run time. For example::" msgstr "" -">>> f\"abc{a # This is a comment }\"\n" -"... + 3}\"\n" -"'abc5'" -#: ../../reference/lexical_analysis.rst:1083 +#: ../../reference/lexical_analysis.rst:1059 msgid "" -"Prior to Python 3.7, an :keyword:`await` expression and comprehensions " -"containing an :keyword:`async for` clause were illegal in the expressions in " -"formatted string literals due to a problem with the implementation." +">>> who = 'nobody'\n" +">>> nationality = 'Spanish'\n" +">>> f'{who.title()} expects the {nationality} Inquisition!'\n" +"'Nobody expects the Spanish Inquisition!'" msgstr "" -#: ../../reference/lexical_analysis.rst:1088 +#: ../../reference/lexical_analysis.rst:1064 msgid "" -"Prior to Python 3.12, comments were not allowed inside f-string replacement " -"fields." +"Any doubled curly braces (``{{`` or ``}}``) outside replacement fields are " +"replaced with the corresponding single curly brace::" msgstr "" -#: ../../reference/lexical_analysis.rst:1092 +#: ../../reference/lexical_analysis.rst:1067 msgid "" -"When the equal sign ``'='`` is provided, the output will have the expression " -"text, the ``'='`` and the evaluated value. Spaces after the opening brace " -"``'{'``, within the expression and after the ``'='`` are all retained in the " -"output. By default, the ``'='`` causes the :func:`repr` of the expression to " -"be provided, unless there is a format specified. When a format is specified " -"it defaults to the :func:`str` of the expression unless a conversion ``'!" -"r'`` is declared." +">>> print(f'{{...}}')\n" +"{...}" msgstr "" -#: ../../reference/lexical_analysis.rst:1100 -msgid "The equal sign ``'='``." -msgstr "等號 ``'='``。" - -#: ../../reference/lexical_analysis.rst:1103 +#: ../../reference/lexical_analysis.rst:1070 msgid "" -"If a conversion is specified, the result of evaluating the expression is " -"converted before formatting. Conversion ``'!s'`` calls :func:`str` on the " -"result, ``'!r'`` calls :func:`repr`, and ``'!a'`` calls :func:`ascii`." +"Other characters outside replacement fields are treated like in ordinary " +"string literals. This means that escape sequences are decoded (except when a " +"literal is also marked as a raw string), and newlines are possible in triple-" +"quoted f-strings::" msgstr "" -#: ../../reference/lexical_analysis.rst:1107 +#: ../../reference/lexical_analysis.rst:1076 msgid "" -"The result is then formatted using the :func:`format` protocol. The format " -"specifier is passed to the :meth:`~object.__format__` method of the " -"expression or conversion result. An empty string is passed when the format " -"specifier is omitted. The formatted result is then included in the final " -"value of the whole string." +">>> name = 'Galahad'\n" +">>> favorite_color = 'blue'\n" +">>> print(f'{name}:\\t{favorite_color}')\n" +"Galahad: blue\n" +">>> print(rf\"C:\\Users\\{name}\")\n" +"C:\\Users\\Galahad\n" +">>> print(f'''Three shall be the number of the counting\n" +"... and the number of the counting shall be three.''')\n" +"Three shall be the number of the counting\n" +"and the number of the counting shall be three." msgstr "" -#: ../../reference/lexical_analysis.rst:1113 +#: ../../reference/lexical_analysis.rst:1087 msgid "" -"Top-level format specifiers may include nested replacement fields. These " -"nested fields may include their own conversion fields and :ref:`format " -"specifiers `, but may not include more deeply nested replacement " -"fields. The :ref:`format specifier mini-language ` is the same " -"as that used by the :meth:`str.format` method." +"Expressions in formatted string literals are treated like regular Python " +"expressions. Each expression is evaluated in the context where the formatted " +"string literal appears, in order from left to right. An empty expression is " +"not allowed, and both :keyword:`lambda` and assignment expressions ``:=`` " +"must be surrounded by explicit parentheses::" msgstr "" -#: ../../reference/lexical_analysis.rst:1119 +#: ../../reference/lexical_analysis.rst:1094 msgid "" -"Formatted string literals may be concatenated, but replacement fields cannot " -"be split across literals." -msgstr "" - -#: ../../reference/lexical_analysis.rst:1122 -msgid "Some examples of formatted string literals::" +">>> f'{(half := 1/2)}, {half * 42}'\n" +"'0.5, 21.0'" msgstr "" -#: ../../reference/lexical_analysis.rst:1124 -msgid "" -">>> name = \"Fred\"\n" -">>> f\"He said his name is {name!r}.\"\n" -"\"He said his name is 'Fred'.\"\n" -">>> f\"He said his name is {repr(name)}.\" # repr() is equivalent to !r\n" -"\"He said his name is 'Fred'.\"\n" -">>> width = 10\n" -">>> precision = 4\n" -">>> value = decimal.Decimal(\"12.34567\")\n" -">>> f\"result: {value:{width}.{precision}}\" # nested fields\n" -"'result: 12.35'\n" -">>> today = datetime(year=2017, month=1, day=27)\n" -">>> f\"{today:%B %d, %Y}\" # using date format specifier\n" -"'January 27, 2017'\n" -">>> f\"{today=:%B %d, %Y}\" # using date format specifier and debugging\n" -"'today=January 27, 2017'\n" -">>> number = 1024\n" -">>> f\"{number:#0x}\" # using integer format specifier\n" -"'0x400'\n" -">>> foo = \"bar\"\n" -">>> f\"{ foo = }\" # preserves whitespace\n" -"\" foo = 'bar'\"\n" -">>> line = \"The mill's closed\"\n" -">>> f\"{line = }\"\n" -"'line = \"The mill\\'s closed\"'\n" -">>> f\"{line = :20}\"\n" -"\"line = The mill's closed \"\n" -">>> f\"{line = !r:20}\"\n" -"'line = \"The mill\\'s closed\" '" -msgstr "" - -#: ../../reference/lexical_analysis.rst:1154 +#: ../../reference/lexical_analysis.rst:1097 msgid "" "Reusing the outer f-string quoting type inside a replacement field is " "permitted::" msgstr "" -#: ../../reference/lexical_analysis.rst:1157 +#: ../../reference/lexical_analysis.rst:1100 msgid "" ">>> a = dict(x=2)\n" ">>> f\"abc {a[\"x\"]} def\"\n" @@ -1704,19 +1642,13 @@ msgstr "" ">>> f\"abc {a[\"x\"]} def\"\n" "'abc 2 def'" -#: ../../reference/lexical_analysis.rst:1161 -msgid "" -"Prior to Python 3.12, reuse of the same quoting type of the outer f-string " -"inside a replacement field was not possible." -msgstr "" - -#: ../../reference/lexical_analysis.rst:1165 +#: ../../reference/lexical_analysis.rst:1104 msgid "" "Backslashes are also allowed in replacement fields and are evaluated the " "same way as in any other context::" msgstr "" -#: ../../reference/lexical_analysis.rst:1168 +#: ../../reference/lexical_analysis.rst:1107 msgid "" ">>> a = [\"a\", \"b\", \"c\"]\n" ">>> print(f\"List a contains:\\n{\"\\n\".join(a)}\")\n" @@ -1732,25 +1664,132 @@ msgstr "" "b\n" "c" +#: ../../reference/lexical_analysis.rst:1114 +msgid "It is possible to nest f-strings::" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1116 +msgid "" +">>> name = 'world'\n" +">>> f'Repeated:{f' hello {name}' * 3}'\n" +"'Repeated: hello world hello world hello world'" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1120 +msgid "Portable Python programs should not use more than 5 levels of nesting." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1124 +msgid "CPython does not limit nesting of f-strings." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1126 +msgid "" +"Replacement expressions can contain newlines in both single-quoted and " +"triple-quoted f-strings and they can contain comments. Everything that comes " +"after a ``#`` inside a replacement field is a comment (even closing braces " +"and quotes). This means that replacement fields with comments must be closed " +"in a different line:" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1133 +#, fuzzy +msgid "" +">>> a = 2\n" +">>> f\"abc{a # This comment }\" continues until the end of the line\n" +"... + 3}\"\n" +"'abc5'" +msgstr "" +">>> f\"abc{a # This is a comment }\"\n" +"... + 3}\"\n" +"'abc5'" + +#: ../../reference/lexical_analysis.rst:1140 +msgid "After the expression, replacement fields may optionally contain:" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1142 +msgid "" +"a *debug specifier* -- an equal sign (``=``), optionally surrounded by " +"whitespace on one or both sides;" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1144 +msgid "a *conversion specifier* -- ``!s``, ``!r`` or ``!a``; and/or" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1145 +msgid "a *format specifier* prefixed with a colon (``:``)." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1147 +msgid "" +"See the :ref:`Standard Library section on f-strings ` for " +"details on how these fields are evaluated." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1150 +msgid "" +"As that section explains, *format specifiers* are passed as the second " +"argument to the :func:`format` function to format a replacement field value. " +"For example, they can be used to specify a field width and padding " +"characters using the :ref:`Format Specification Mini-Language `::" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1155 +msgid "" +">>> number = 14.3\n" +">>> f'{number:20.7f}'\n" +"' 14.3000000'" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1159 +msgid "Top-level format specifiers may include nested replacement fields::" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1161 +msgid "" +">>> field_size = 20\n" +">>> precision = 7\n" +">>> f'{number:{field_size}.{precision}f}'\n" +"' 14.3000000'" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1166 +msgid "" +"These nested fields may include their own conversion fields and :ref:`format " +"specifiers `::" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1169 +msgid "" +">>> number = 3\n" +">>> f'{number:{field_size}}'\n" +"' 3'\n" +">>> f'{number:{field_size:05}}'\n" +"'00000000000000000003'" +msgstr "" + #: ../../reference/lexical_analysis.rst:1175 msgid "" -"Prior to Python 3.12, backslashes were not permitted inside an f-string " -"replacement field." +"However, these nested fields may not include more deeply nested replacement " +"fields." msgstr "" -#: ../../reference/lexical_analysis.rst:1179 +#: ../../reference/lexical_analysis.rst:1178 msgid "" -"Formatted string literals cannot be used as docstrings, even if they do not " -"include expressions." +"Formatted string literals cannot be used as :term:`docstrings `, " +"even if they do not include expressions::" msgstr "" -#: ../../reference/lexical_analysis.rst:1184 +#: ../../reference/lexical_analysis.rst:1181 +#, fuzzy msgid "" ">>> def foo():\n" "... f\"Not a docstring\"\n" "...\n" -">>> foo.__doc__ is None\n" -"True" +">>> print(foo.__doc__)\n" +"None" msgstr "" ">>> def foo():\n" "... f\"Not a docstring\"\n" @@ -1758,10 +1797,16 @@ msgstr "" ">>> foo.__doc__ is None\n" "True" +#: ../../reference/lexical_analysis.rst:1189 +msgid ":pep:`498` -- Literal String Interpolation" +msgstr "" + #: ../../reference/lexical_analysis.rst:1190 -msgid "" -"See also :pep:`498` for the proposal that added formatted string literals, " -"and :meth:`str.format`, which uses a related format string mechanism." +msgid ":pep:`701` -- Syntactic formalization of f-strings" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1191 +msgid ":meth:`str.format`, which uses a related format string mechanism." msgstr "" #: ../../reference/lexical_analysis.rst:1198 @@ -1772,58 +1817,98 @@ msgstr "t-string(t 字串)" msgid "" "A :dfn:`template string literal` or :dfn:`t-string` is a string literal that " "is prefixed with '``t``' or '``T``'. These strings follow the same syntax " -"and evaluation rules as :ref:`formatted string literals `, with " -"the following differences:" +"rules as :ref:`formatted string literals `. For differences in " +"evaluation rules, see the :ref:`Standard Library section on t-strings " +"`" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1211 +msgid "Formal grammar for f-strings" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1213 +msgid "" +"F-strings are handled partly by the :term:`lexical analyzer`, which produces " +"the tokens :py:data:`~token.FSTRING_START`, :py:data:`~token.FSTRING_MIDDLE` " +"and :py:data:`~token.FSTRING_END`, and partly by the parser, which handles " +"expressions in the replacement field. The exact way the work is split is a " +"CPython implementation detail." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1219 +msgid "" +"Correspondingly, the f-string grammar is a mix of :ref:`lexical and " +"syntactic definitions `." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1222 +msgid "Whitespace is significant in these situations:" +msgstr "" + +#: ../../reference/lexical_analysis.rst:1224 +msgid "" +"There may be no whitespace in :py:data:`~token.FSTRING_START` (between the " +"prefix and quote)." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1226 +msgid "" +"Whitespace in :py:data:`~token.FSTRING_MIDDLE` is part of the literal string " +"contents." msgstr "" -#: ../../reference/lexical_analysis.rst:1207 +#: ../../reference/lexical_analysis.rst:1228 msgid "" -"Rather than evaluating to a ``str`` object, template string literals " -"evaluate to a :class:`string.templatelib.Template` object." +"In ``fstring_replacement_field``, if ``f_debug_specifier`` is present, all " +"whitespace after the opening brace until the ``f_debug_specifier``, as well " +"as whitespace immediatelly following ``f_debug_specifier``, is retained as " +"part of the expression." msgstr "" -#: ../../reference/lexical_analysis.rst:1210 +#: ../../reference/lexical_analysis.rst:1235 msgid "" -"The :func:`format` protocol is not used. Instead, the format specifier and " -"conversions (if any) are passed to a new :class:`~string.templatelib." -"Interpolation` object that is created for each evaluated expression. It is " -"up to code that processes the resulting :class:`~string.templatelib." -"Template` object to decide how to handle format specifiers and conversions." +"The expression is not handled in the tokenization phase; it is retrieved " +"from the source code using locations of the ``{`` token and the token after " +"``=``." msgstr "" -#: ../../reference/lexical_analysis.rst:1217 +#: ../../reference/lexical_analysis.rst:1240 msgid "" -"Format specifiers containing nested replacement fields are evaluated " -"eagerly, prior to being passed to the :class:`~string.templatelib." -"Interpolation` object. For instance, an interpolation of the form ``{amount:." -"{precision}f}`` will evaluate the inner expression ``{precision}`` to " -"determine the value of the ``format_spec`` attribute. If ``precision`` were " -"to be ``2``, the resulting format specifier would be ``'.2f'``." +"The ``FSTRING_MIDDLE`` definition uses :ref:`negative lookaheads ` (``!``) to indicate special characters (backslash, newline, " +"``{``, ``}``) and sequences (``f_quote``)." msgstr "" -#: ../../reference/lexical_analysis.rst:1225 +#: ../../reference/lexical_analysis.rst:1281 msgid "" -"When the equals sign ``'='`` is provided in an interpolation expression, the " -"text of the expression is appended to the literal string that precedes the " -"relevant interpolation. This includes the equals sign and any surrounding " -"whitespace. The :class:`!Interpolation` instance for the expression will be " -"created as normal, except that :attr:`~string.templatelib.Interpolation." -"conversion` will be set to '``r``' (:func:`repr`) by default. If an explicit " -"conversion or format specifier are provided, this will override the default " -"behaviour." +"In the above grammar snippet, the ``f_quote`` and ``FSTRING_MIDDLE`` rules " +"are context-sensitive -- they depend on the contents of ``FSTRING_START`` of " +"the nearest enclosing ``fstring``." msgstr "" -#: ../../reference/lexical_analysis.rst:1239 +#: ../../reference/lexical_analysis.rst:1285 +msgid "" +"Constructing a more traditional formal grammar from this template is left as " +"an exercise for the reader." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1288 +msgid "" +"The grammar for t-strings is identical to the one for f-strings, with *t* " +"instead of *f* at the beginning of rule and token names and in the prefix." +msgstr "" + +#: ../../reference/lexical_analysis.rst:1302 msgid "Numeric literals" msgstr "" -#: ../../reference/lexical_analysis.rst:1245 +#: ../../reference/lexical_analysis.rst:1308 msgid "" ":data:`~token.NUMBER` tokens represent numeric literals, of which there are " "three types: integers, floating-point numbers, and imaginary numbers." msgstr "" -#: ../../reference/lexical_analysis.rst:1253 +#: ../../reference/lexical_analysis.rst:1316 msgid "" "The numeric value of a numeric literal is the same as if it were passed as a " "string to the :class:`int`, :class:`float` or :class:`complex` class " @@ -1831,21 +1916,21 @@ msgid "" "constructors are also valid literals." msgstr "" -#: ../../reference/lexical_analysis.rst:1258 +#: ../../reference/lexical_analysis.rst:1321 msgid "" "Numeric literals do not include a sign; a phrase like ``-1`` is actually an " "expression composed of the unary operator '``-``' and the literal ``1``." msgstr "" -#: ../../reference/lexical_analysis.rst:1272 +#: ../../reference/lexical_analysis.rst:1335 msgid "Integer literals" msgstr "" -#: ../../reference/lexical_analysis.rst:1274 +#: ../../reference/lexical_analysis.rst:1337 msgid "Integer literals denote whole numbers. For example::" msgstr "" -#: ../../reference/lexical_analysis.rst:1276 +#: ../../reference/lexical_analysis.rst:1339 msgid "" "7\n" "3\n" @@ -1855,24 +1940,24 @@ msgstr "" "3\n" "2147483647" -#: ../../reference/lexical_analysis.rst:1280 +#: ../../reference/lexical_analysis.rst:1343 msgid "" "There is no limit for the length of integer literals apart from what can be " "stored in available memory::" msgstr "" -#: ../../reference/lexical_analysis.rst:1283 +#: ../../reference/lexical_analysis.rst:1346 msgid "7922816251426433759354395033679228162514264337593543950336" msgstr "7922816251426433759354395033679228162514264337593543950336" -#: ../../reference/lexical_analysis.rst:1285 +#: ../../reference/lexical_analysis.rst:1348 msgid "" "Underscores can be used to group digits for enhanced readability, and are " "ignored for determining the numeric value of the literal. For example, the " "following literals are equivalent::" msgstr "" -#: ../../reference/lexical_analysis.rst:1289 +#: ../../reference/lexical_analysis.rst:1352 msgid "" "100_000_000_000\n" "100000000000\n" @@ -1882,13 +1967,13 @@ msgstr "" "100000000000\n" "1_00_00_00_00_000" -#: ../../reference/lexical_analysis.rst:1293 +#: ../../reference/lexical_analysis.rst:1356 msgid "" "Underscores can only occur between digits. For example, ``_123``, ``321_``, " "and ``123__321`` are *not* valid literals." msgstr "" -#: ../../reference/lexical_analysis.rst:1296 +#: ../../reference/lexical_analysis.rst:1359 msgid "" "Integers can be specified in binary (base 2), octal (base 8), or hexadecimal " "(base 16) using the prefixes ``0b``, ``0o`` and ``0x``, respectively. " @@ -1896,7 +1981,7 @@ msgid "" "case-insensitive. For example::" msgstr "" -#: ../../reference/lexical_analysis.rst:1301 +#: ../../reference/lexical_analysis.rst:1364 msgid "" "0b100110111\n" "0b_1110_0101\n" @@ -1912,47 +1997,47 @@ msgstr "" "0xdeadbeef\n" "0xDead_Beef" -#: ../../reference/lexical_analysis.rst:1308 +#: ../../reference/lexical_analysis.rst:1371 msgid "" "An underscore can follow the base specifier. For example, ``0x_1f`` is a " "valid literal, but ``0_x1f`` and ``0x__1f`` are not." msgstr "" -#: ../../reference/lexical_analysis.rst:1312 +#: ../../reference/lexical_analysis.rst:1375 msgid "" "Leading zeros in a non-zero decimal number are not allowed. For example, " "``0123`` is not a valid literal. This is for disambiguation with C-style " "octal literals, which Python used before version 3.0." msgstr "" -#: ../../reference/lexical_analysis.rst:1317 +#: ../../reference/lexical_analysis.rst:1380 msgid "" "Formally, integer literals are described by the following lexical " "definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:1334 -#: ../../reference/lexical_analysis.rst:1398 +#: ../../reference/lexical_analysis.rst:1397 +#: ../../reference/lexical_analysis.rst:1461 msgid "Underscores are now allowed for grouping purposes in literals." msgstr "" -#: ../../reference/lexical_analysis.rst:1345 +#: ../../reference/lexical_analysis.rst:1408 msgid "Floating-point literals" msgstr "浮點數常數 (Floating-point literals)" -#: ../../reference/lexical_analysis.rst:1347 +#: ../../reference/lexical_analysis.rst:1410 msgid "" "Floating-point (float) literals, such as ``3.14`` or ``1.5``, denote :ref:" "`approximations of real numbers `." msgstr "" -#: ../../reference/lexical_analysis.rst:1350 +#: ../../reference/lexical_analysis.rst:1413 msgid "" "They consist of *integer* and *fraction* parts, each composed of decimal " "digits. The parts are separated by a decimal point, ``.``::" msgstr "" -#: ../../reference/lexical_analysis.rst:1353 +#: ../../reference/lexical_analysis.rst:1416 msgid "" "2.71828\n" "4.0" @@ -1960,19 +2045,19 @@ msgstr "" "2.71828\n" "4.0" -#: ../../reference/lexical_analysis.rst:1356 +#: ../../reference/lexical_analysis.rst:1419 msgid "" "Unlike in integer literals, leading zeros are allowed. For example, " "``077.010`` is legal, and denotes the same number as ``77.01``." msgstr "" -#: ../../reference/lexical_analysis.rst:1359 +#: ../../reference/lexical_analysis.rst:1422 msgid "" "As in integer literals, single underscores may occur between digits to help " "readability::" msgstr "" -#: ../../reference/lexical_analysis.rst:1362 +#: ../../reference/lexical_analysis.rst:1425 msgid "" "96_485.332_123\n" "3.14_15_93" @@ -1980,11 +2065,11 @@ msgstr "" "96_485.332_123\n" "3.14_15_93" -#: ../../reference/lexical_analysis.rst:1365 +#: ../../reference/lexical_analysis.rst:1428 msgid "Either of these parts, but not both, can be empty. For example::" msgstr "" -#: ../../reference/lexical_analysis.rst:1367 +#: ../../reference/lexical_analysis.rst:1430 msgid "" "10. # (equivalent to 10.0)\n" ".001 # (equivalent to 0.001)" @@ -1992,7 +2077,7 @@ msgstr "" "10. # (相當於 10.0)\n" ".001 # (相當於 0.001)" -#: ../../reference/lexical_analysis.rst:1370 +#: ../../reference/lexical_analysis.rst:1433 msgid "" "Optionally, the integer and fraction may be followed by an *exponent*: the " "letter ``e`` or ``E``, followed by an optional sign, ``+`` or ``-``, and a " @@ -2000,20 +2085,20 @@ msgid "" "``E`` represents \"times ten raised to the power of\"::" msgstr "" -#: ../../reference/lexical_analysis.rst:1375 +#: ../../reference/lexical_analysis.rst:1438 msgid "" "1.0e3 # (represents 1.0×10³, or 1000.0)\n" "1.166e-5 # (represents 1.166×10⁻⁵, or 0.00001166)\n" "6.02214076e+23 # (represents 6.02214076×10²³, or 602214076000000000000000.)" msgstr "" -#: ../../reference/lexical_analysis.rst:1379 +#: ../../reference/lexical_analysis.rst:1442 msgid "" "In floats with only integer and exponent parts, the decimal point may be " "omitted::" msgstr "" -#: ../../reference/lexical_analysis.rst:1382 +#: ../../reference/lexical_analysis.rst:1445 msgid "" "1e3 # (equivalent to 1.e3 and 1.0e3)\n" "0e0 # (equivalent to 0.)" @@ -2021,35 +2106,35 @@ msgstr "" "1e3 # (相當於 1.e3 和 1.0e3)\n" "0e0 # (相當於 0.)" -#: ../../reference/lexical_analysis.rst:1385 +#: ../../reference/lexical_analysis.rst:1448 msgid "" "Formally, floating-point literals are described by the following lexical " "definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:1407 +#: ../../reference/lexical_analysis.rst:1470 msgid "Imaginary literals" msgstr "" -#: ../../reference/lexical_analysis.rst:1409 +#: ../../reference/lexical_analysis.rst:1472 msgid "" "Python has :ref:`complex number ` objects, but no complex " "literals. Instead, *imaginary literals* denote complex numbers with a zero " "real part." msgstr "" -#: ../../reference/lexical_analysis.rst:1414 +#: ../../reference/lexical_analysis.rst:1477 msgid "" "For example, in math, the complex number 3+4.2\\ *i* is written as the real " "number 3 added to the imaginary number 4.2\\ *i*. Python uses a similar " "syntax, except the imaginary unit is written as ``j`` rather than *i*::" msgstr "" -#: ../../reference/lexical_analysis.rst:1419 +#: ../../reference/lexical_analysis.rst:1482 msgid "3+4.2j" msgstr "3+4.2j" -#: ../../reference/lexical_analysis.rst:1421 +#: ../../reference/lexical_analysis.rst:1484 msgid "" "This is an expression composed of the :ref:`integer literal ` " "``3``, the :ref:`operator ` '``+``', and the :ref:`imaginary " @@ -2057,23 +2142,23 @@ msgid "" "whitespace is allowed between them::" msgstr "" -#: ../../reference/lexical_analysis.rst:1427 +#: ../../reference/lexical_analysis.rst:1490 msgid "3 + 4.2j" msgstr "3 + 4.2j" -#: ../../reference/lexical_analysis.rst:1429 +#: ../../reference/lexical_analysis.rst:1492 msgid "" "No whitespace is allowed *within* each token. In particular, the ``j`` " "suffix, may not be separated from the number before it." msgstr "" -#: ../../reference/lexical_analysis.rst:1433 +#: ../../reference/lexical_analysis.rst:1496 msgid "" "The number before the ``j`` has the same syntax as a floating-point literal. " "Thus, the following are valid imaginary literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:1436 +#: ../../reference/lexical_analysis.rst:1499 msgid "" "4.2j\n" "3.14j\n" @@ -2091,14 +2176,14 @@ msgstr "" "3.14e-10j\n" "3.14_15_93j" -#: ../../reference/lexical_analysis.rst:1444 +#: ../../reference/lexical_analysis.rst:1507 msgid "" "Unlike in a floating-point literal the decimal point can be omitted if the " "imaginary number only has an integer part. The number is still evaluated as " "a floating-point number, not an integer::" msgstr "" -#: ../../reference/lexical_analysis.rst:1448 +#: ../../reference/lexical_analysis.rst:1511 msgid "" "10j\n" "0j\n" @@ -2108,26 +2193,26 @@ msgstr "" "0j\n" "1000000000000000000000000j # 相當於 1e+24j" -#: ../../reference/lexical_analysis.rst:1452 +#: ../../reference/lexical_analysis.rst:1515 msgid "" "The ``j`` suffix is case-insensitive. That means you can use ``J`` instead::" msgstr "" -#: ../../reference/lexical_analysis.rst:1455 +#: ../../reference/lexical_analysis.rst:1518 msgid "3.14J # equivalent to 3.14j" msgstr "" -#: ../../reference/lexical_analysis.rst:1457 +#: ../../reference/lexical_analysis.rst:1520 msgid "" "Formally, imaginary literals are described by the following lexical " "definition:" msgstr "" -#: ../../reference/lexical_analysis.rst:1470 +#: ../../reference/lexical_analysis.rst:1533 msgid "Operators and delimiters" msgstr "" -#: ../../reference/lexical_analysis.rst:1476 +#: ../../reference/lexical_analysis.rst:1539 msgid "" "The following grammar defines :dfn:`operator` and :dfn:`delimiter` tokens, " "that is, the generic :data:`~token.OP` token type. A :ref:`list of these " @@ -2135,14 +2220,14 @@ msgid "" "the :mod:`!token` module documentation." msgstr "" -#: ../../reference/lexical_analysis.rst:1505 +#: ../../reference/lexical_analysis.rst:1568 msgid "" "Generally, *operators* are used to combine :ref:`expressions `, " "while *delimiters* serve other purposes. However, there is no clear, formal " "distinction between the two categories." msgstr "" -#: ../../reference/lexical_analysis.rst:1509 +#: ../../reference/lexical_analysis.rst:1572 msgid "" "Some tokens can serve as either operators or delimiters, depending on usage. " "For example, ``*`` is both the multiplication operator and a delimiter used " @@ -2150,20 +2235,20 @@ msgid "" "delimiter that introduces decorators." msgstr "" -#: ../../reference/lexical_analysis.rst:1514 +#: ../../reference/lexical_analysis.rst:1577 msgid "" "For some tokens, the distinction is unclear. For example, some people " "consider ``.``, ``(``, and ``)`` to be delimiters, while others see the :py:" "func:`getattr` operator and the function call operator(s)." msgstr "" -#: ../../reference/lexical_analysis.rst:1518 +#: ../../reference/lexical_analysis.rst:1581 msgid "" "Some of Python's operators, like ``and``, ``or``, and ``not in``, use :ref:" "`keyword ` tokens rather than \"symbols\" (operator tokens)." msgstr "" -#: ../../reference/lexical_analysis.rst:1521 +#: ../../reference/lexical_analysis.rst:1584 msgid "" "A sequence of three consecutive periods (``...``) has a special meaning as " "an :py:data:`Ellipsis` literal." @@ -2191,7 +2276,7 @@ msgstr "logical line(邏輯列)" #: ../../reference/lexical_analysis.rst:100 #: ../../reference/lexical_analysis.rst:205 -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "physical line" msgstr "physical line(物理列)" @@ -2265,314 +2350,317 @@ msgstr "INDENT token(縮排標誌)" msgid "DEDENT token" msgstr "DEDENT token(縮排標誌)" -#: ../../reference/lexical_analysis.rst:384 +#: ../../reference/lexical_analysis.rst:392 msgid "identifier" msgstr "identifier(識別器)" -#: ../../reference/lexical_analysis.rst:384 +#: ../../reference/lexical_analysis.rst:392 msgid "name" msgstr "name(名稱)" -#: ../../reference/lexical_analysis.rst:419 -#: ../../reference/lexical_analysis.rst:443 +#: ../../reference/lexical_analysis.rst:427 +#: ../../reference/lexical_analysis.rst:451 msgid "keyword" msgstr "keyword(關鍵字)" -#: ../../reference/lexical_analysis.rst:419 +#: ../../reference/lexical_analysis.rst:427 msgid "reserved word" msgstr "reserved word(保留字)" -#: ../../reference/lexical_analysis.rst:443 +#: ../../reference/lexical_analysis.rst:451 msgid "soft keyword" msgstr "soft keyword(軟關鍵字)" -#: ../../reference/lexical_analysis.rst:463 +#: ../../reference/lexical_analysis.rst:471 msgid "_, identifiers" msgstr "_, identifiers(識別器)" -#: ../../reference/lexical_analysis.rst:463 +#: ../../reference/lexical_analysis.rst:471 msgid "__, identifiers" msgstr "__, identifiers(識別器)" -#: ../../reference/lexical_analysis.rst:608 +#: ../../reference/lexical_analysis.rst:616 msgid "literal" msgstr "literal(常數)" -#: ../../reference/lexical_analysis.rst:608 +#: ../../reference/lexical_analysis.rst:616 msgid "constant" msgstr "constant(常數)" -#: ../../reference/lexical_analysis.rst:620 -#: ../../reference/lexical_analysis.rst:663 -#: ../../reference/lexical_analysis.rst:688 +#: ../../reference/lexical_analysis.rst:628 +#: ../../reference/lexical_analysis.rst:671 +#: ../../reference/lexical_analysis.rst:696 msgid "string literal" msgstr "string literal(字串常數)" -#: ../../reference/lexical_analysis.rst:620 -#: ../../reference/lexical_analysis.rst:956 +#: ../../reference/lexical_analysis.rst:628 +#: ../../reference/lexical_analysis.rst:964 msgid "bytes literal" msgstr "bytes literal(位元組常數)" -#: ../../reference/lexical_analysis.rst:620 +#: ../../reference/lexical_analysis.rst:628 msgid "ASCII" msgstr "ASCII" -#: ../../reference/lexical_analysis.rst:620 +#: ../../reference/lexical_analysis.rst:628 msgid "' (single quote)" msgstr "' (單引號)" -#: ../../reference/lexical_analysis.rst:620 +#: ../../reference/lexical_analysis.rst:628 msgid "\" (double quote)" msgstr "\" (雙引號)" -#: ../../reference/lexical_analysis.rst:663 +#: ../../reference/lexical_analysis.rst:671 msgid "triple-quoted string" msgstr "triple-quoted string(三引號字串)" -#: ../../reference/lexical_analysis.rst:663 +#: ../../reference/lexical_analysis.rst:671 msgid "\"\"\"" msgstr "\"\"\"" -#: ../../reference/lexical_analysis.rst:663 +#: ../../reference/lexical_analysis.rst:671 msgid "'''" msgstr "'''" -#: ../../reference/lexical_analysis.rst:688 +#: ../../reference/lexical_analysis.rst:696 msgid "u'" msgstr "u'" -#: ../../reference/lexical_analysis.rst:688 +#: ../../reference/lexical_analysis.rst:696 msgid "u\"" msgstr "u\"" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "escape sequence" msgstr "escape sequence(跳脫序列)" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "Standard C" msgstr "Standard C(標準 C)" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "C" msgstr "C" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\\\" msgstr "\\\\" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\a" msgstr "\\a" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\b" msgstr "\\b" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\f" msgstr "\\f" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\n" msgstr "\\n" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\r" msgstr "\\r" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\t" msgstr "\\t" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\v" msgstr "\\v" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\x" msgstr "\\x" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\N" msgstr "\\N" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\u" msgstr "\\u" -#: ../../reference/lexical_analysis.rst:755 +#: ../../reference/lexical_analysis.rst:763 msgid "\\U" msgstr "\\U" -#: ../../reference/lexical_analysis.rst:931 +#: ../../reference/lexical_analysis.rst:939 msgid "unrecognized escape sequence" msgstr "unrecognized escape sequence(無法辨識的跳脫序列)" -#: ../../reference/lexical_analysis.rst:956 +#: ../../reference/lexical_analysis.rst:964 msgid "b'" msgstr "b'" -#: ../../reference/lexical_analysis.rst:956 +#: ../../reference/lexical_analysis.rst:964 msgid "b\"" msgstr "b\"" -#: ../../reference/lexical_analysis.rst:983 +#: ../../reference/lexical_analysis.rst:991 msgid "r'" msgstr "r'" -#: ../../reference/lexical_analysis.rst:983 +#: ../../reference/lexical_analysis.rst:991 msgid "raw string literal" msgstr "raw string literal(原始字串常數)" -#: ../../reference/lexical_analysis.rst:983 +#: ../../reference/lexical_analysis.rst:991 msgid "r\"" msgstr "r\"" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "formatted string literal" msgstr "formatted string literal(格式化字串常數)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "string" msgstr "string(字串)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "f'" msgstr "f'" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "f\"" msgstr "f\"" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "! (exclamation)" msgstr "! (驚嘆號)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid ": (colon)" msgstr ": (冒號)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "= (equals)" msgstr "= (等號)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1022 msgid "for help in debugging using string literals" msgstr "for help in debugging using string literals(使用字串常數進行除錯)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "number" msgstr "number(數字)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "numeric literal" msgstr "numeric literal(數值常數)" -#: ../../reference/lexical_analysis.rst:1241 -#: ../../reference/lexical_analysis.rst:1263 +#: ../../reference/lexical_analysis.rst:1304 +#: ../../reference/lexical_analysis.rst:1326 msgid "integer literal" msgstr "integer literal(整數常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "floating-point literal" msgstr "floating-point literal(浮點數常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "hexadecimal literal" msgstr "hexadecimal literal(十六進位常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "octal literal" msgstr "octal literal(八進位常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "binary literal" msgstr "binary literal(二進位常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "decimal literal" msgstr "decimal literal(十進位常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "imaginary literal" msgstr "imaginary literal(虛數常數)" -#: ../../reference/lexical_analysis.rst:1241 +#: ../../reference/lexical_analysis.rst:1304 msgid "complex literal" msgstr "complex literal(複數常數)" -#: ../../reference/lexical_analysis.rst:1263 +#: ../../reference/lexical_analysis.rst:1326 msgid "0b" msgstr "0b" -#: ../../reference/lexical_analysis.rst:1263 +#: ../../reference/lexical_analysis.rst:1326 msgid "0o" msgstr "0o" -#: ../../reference/lexical_analysis.rst:1263 +#: ../../reference/lexical_analysis.rst:1326 msgid "0x" msgstr "0x" -#: ../../reference/lexical_analysis.rst:1263 -#: ../../reference/lexical_analysis.rst:1338 +#: ../../reference/lexical_analysis.rst:1326 +#: ../../reference/lexical_analysis.rst:1401 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../reference/lexical_analysis.rst:1263 -#: ../../reference/lexical_analysis.rst:1338 -#: ../../reference/lexical_analysis.rst:1402 +#: ../../reference/lexical_analysis.rst:1326 +#: ../../reference/lexical_analysis.rst:1401 +#: ../../reference/lexical_analysis.rst:1465 msgid "in numeric literal" msgstr "於數值常數中" -#: ../../reference/lexical_analysis.rst:1338 +#: ../../reference/lexical_analysis.rst:1401 msgid ". (dot)" msgstr ". (點)" -#: ../../reference/lexical_analysis.rst:1338 +#: ../../reference/lexical_analysis.rst:1401 msgid "e" msgstr "e" -#: ../../reference/lexical_analysis.rst:1402 +#: ../../reference/lexical_analysis.rst:1465 msgid "j" msgstr "j" -#: ../../reference/lexical_analysis.rst:1472 +#: ../../reference/lexical_analysis.rst:1535 msgid "operators" msgstr "operators(運算子)" -#: ../../reference/lexical_analysis.rst:1472 +#: ../../reference/lexical_analysis.rst:1535 msgid "delimiters" msgstr "delimiters(分隔符號)" + +#~ msgid "The equal sign ``'='``." +#~ msgstr "等號 ``'='``。" diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index 4093dc22838..89d874a27c8 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-12-08 07:22+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-" @@ -117,11 +117,11 @@ msgstr "" #: ../../whatsnew/2.3.rst:66 msgid "" -"The union and intersection of sets can be computed with " -"the :meth:`~frozenset.union` and :meth:`~frozenset.intersection` methods; an " +"The union and intersection of sets can be computed with the :meth:" +"`~frozenset.union` and :meth:`~frozenset.intersection` methods; an " "alternative notation uses the bitwise operators ``&`` and ``|``. Mutable " "sets also have in-place versions of these methods, :meth:`!union_update` " -"and :meth:`~frozenset.intersection_update`. ::" +"and :meth:`~set.intersection_update`. ::" msgstr "" #: ../../whatsnew/2.3.rst:71 @@ -162,8 +162,8 @@ msgid "" "the set of all elements in the union that aren't in the intersection. " "Another way of putting it is that the symmetric difference contains all " "elements that are in exactly one set. Again, there's an alternative " -"notation (``^``), and an in-place version with the ungainly " -"name :meth:`~frozenset.symmetric_difference_update`. ::" +"notation (``^``), and an in-place version with the ungainly name :meth:`~set." +"symmetric_difference_update`. ::" msgstr "" #: ../../whatsnew/2.3.rst:92 @@ -280,13 +280,12 @@ msgid "" "of ``i``, similar to a :keyword:`return` statement. The big difference " "between :keyword:`!yield` and a :keyword:`!return` statement is that on " "reaching a :keyword:`!yield` the generator's state of execution is suspended " -"and local variables are preserved. On the next call to the generator's " -"``.next()`` method, the function will resume executing immediately after " -"the :keyword:`!yield` statement. (For complicated reasons, the :keyword:`!" -"yield` statement isn't allowed inside the :keyword:`try` block of " -"a :keyword:`!try`...\\ :keyword:`!finally` statement; read :pep:`255` for a " -"full explanation of the interaction between :keyword:`!yield` and " -"exceptions.)" +"and local variables are preserved. On the next call to the generator's ``." +"next()`` method, the function will resume executing immediately after the :" +"keyword:`!yield` statement. (For complicated reasons, the :keyword:`!yield` " +"statement isn't allowed inside the :keyword:`try` block of a :keyword:`!" +"try`...\\ :keyword:`!finally` statement; read :pep:`255` for a full " +"explanation of the interaction between :keyword:`!yield` and exceptions.)" msgstr "" #: ../../whatsnew/2.3.rst:169 @@ -448,9 +447,9 @@ msgstr "" msgid "" "Without such an encoding declaration, the default encoding used is 7-bit " "ASCII. Executing or importing modules that contain string literals with 8-" -"bit characters and have no encoding declaration will result in " -"a :exc:`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will " -"be a syntax error." +"bit characters and have no encoding declaration will result in a :exc:" +"`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will be a " +"syntax error." msgstr "" #: ../../whatsnew/2.3.rst:273 @@ -479,8 +478,8 @@ msgstr "" msgid "" "The new :mod:`zipimport` module adds support for importing modules from a " "ZIP-format archive. You don't need to import the module explicitly; it will " -"be automatically imported if a ZIP archive's filename is added to " -"``sys.path``. For example:" +"be automatically imported if a ZIP archive's filename is added to ``sys." +"path``. For example:" msgstr "" #: ../../whatsnew/2.3.rst:296 @@ -506,12 +505,11 @@ msgstr "" #: ../../whatsnew/2.3.rst:314 msgid "" "An entry in ``sys.path`` can now be the filename of a ZIP archive. The ZIP " -"archive can contain any kind of files, but only files " -"named :file:`\\*.py`, :file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. " -"If an archive only contains :file:`\\*.py` files, Python will not attempt to " -"modify the archive by adding the corresponding :file:`\\*.pyc` file, meaning " -"that if a ZIP archive doesn't contain :file:`\\*.pyc` files, importing may " -"be rather slow." +"archive can contain any kind of files, but only files named :file:`\\*.py`, :" +"file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. If an archive only " +"contains :file:`\\*.py` files, Python will not attempt to modify the archive " +"by adding the corresponding :file:`\\*.pyc` file, meaning that if a ZIP " +"archive doesn't contain :file:`\\*.pyc` files, importing may be rather slow." msgstr "" #: ../../whatsnew/2.3.rst:321 @@ -529,9 +527,9 @@ msgstr "" msgid "" "Written by James C. Ahlstrom, who also provided an implementation. Python " "2.3 follows the specification in :pep:`273`, but uses an implementation " -"written by Just van Rossum that uses the import hooks described " -"in :pep:`302`. See section :ref:`section-pep302` for a description of the " -"new import hooks." +"written by Just van Rossum that uses the import hooks described in :pep:" +"`302`. See section :ref:`section-pep302` for a description of the new import " +"hooks." msgstr "" #: ../../whatsnew/2.3.rst:338 @@ -548,11 +546,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:344 msgid "" "Python now allows using arbitrary Unicode strings (within the limitations of " -"the file system) for all functions that expect file names, most notably " -"the :func:`open` built-in function. If a Unicode string is passed " -"to :func:`os.listdir`, Python now returns a list of Unicode strings. A new " -"function, :func:`!os.getcwdu`, returns the current directory as a Unicode " -"string." +"the file system) for all functions that expect file names, most notably the :" +"func:`open` built-in function. If a Unicode string is passed to :func:`os." +"listdir`, Python now returns a list of Unicode strings. A new function, :" +"func:`!os.getcwdu`, returns the current directory as a Unicode string." msgstr "" #: ../../whatsnew/2.3.rst:350 @@ -564,10 +561,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:353 msgid "" "Other systems also allow Unicode strings as file names but convert them to " -"byte strings before passing them to the system, which can cause " -"a :exc:`UnicodeError` to be raised. Applications can test whether arbitrary " -"Unicode strings are supported as file names by " -"checking :const:`os.path.supports_unicode_filenames`, a Boolean value." +"byte strings before passing them to the system, which can cause a :exc:" +"`UnicodeError` to be raised. Applications can test whether arbitrary Unicode " +"strings are supported as file names by checking :const:`os.path." +"supports_unicode_filenames`, a Boolean value." msgstr "" #: ../../whatsnew/2.3.rst:359 @@ -602,9 +599,9 @@ msgstr "" msgid "" "Python's file objects can now support end of line conventions other than the " "one followed by the platform on which Python is running. Opening a file with " -"the mode ``'U'`` or ``'rU'`` will open a file for reading " -"in :term:`universal newlines` mode. All three line ending conventions will " -"be translated to a ``'\\n'`` in the strings returned by the various file " +"the mode ``'U'`` or ``'rU'`` will open a file for reading in :term:" +"`universal newlines` mode. All three line ending conventions will be " +"translated to a ``'\\n'`` in the strings returned by the various file " "methods such as :meth:`!read` and :meth:`!readline`." msgstr "" @@ -618,9 +615,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:396 msgid "" -"This feature can be disabled when compiling Python by specifying " -"the :option:`!--without-universal-newlines` switch when running " -"Python's :program:`configure` script." +"This feature can be disabled when compiling Python by specifying the :option:" +"`!--without-universal-newlines` switch when running Python's :program:" +"`configure` script." msgstr "" #: ../../whatsnew/2.3.rst:403 @@ -694,16 +691,15 @@ msgstr "" msgid "" "The :class:`~logging.Logger` class is the primary class. Most application " "code will deal with one or more :class:`~logging.Logger` objects, each one " -"used by a particular subsystem of the application. " -"Each :class:`~logging.Logger` is identified by a name, and names are " -"organized into a hierarchy using ``.`` as the component separator. For " -"example, you might have :class:`~logging.Logger` instances named ``server``, " -"``server.auth`` and ``server.network``. The latter two instances are below " -"``server`` in the hierarchy. This means that if you turn up the verbosity " -"for ``server`` or direct ``server`` messages to a different handler, the " -"changes will also apply to records logged to ``server.auth`` and " -"``server.network``. There's also a root :class:`~logging.Logger` that's the " -"parent of all other loggers." +"used by a particular subsystem of the application. Each :class:`~logging." +"Logger` is identified by a name, and names are organized into a hierarchy " +"using ``.`` as the component separator. For example, you might have :class:" +"`~logging.Logger` instances named ``server``, ``server.auth`` and ``server." +"network``. The latter two instances are below ``server`` in the hierarchy. " +"This means that if you turn up the verbosity for ``server`` or direct " +"``server`` messages to a different handler, the changes will also apply to " +"records logged to ``server.auth`` and ``server.network``. There's also a " +"root :class:`~logging.Logger` that's the parent of all other loggers." msgstr "" #: ../../whatsnew/2.3.rst:464 @@ -745,8 +741,8 @@ msgstr "" msgid "" "In the default configuration, informational and debugging messages are " "suppressed and the output is sent to standard error. You can enable the " -"display of informational and debugging messages by calling " -"the :meth:`~logging.Logger.setLevel` method on the root logger." +"display of informational and debugging messages by calling the :meth:" +"`~logging.Logger.setLevel` method on the root logger." msgstr "" #: ../../whatsnew/2.3.rst:486 @@ -819,9 +815,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:519 msgid "" "Log records are usually propagated up the hierarchy, so a message logged to " -"``server.auth`` is also seen by ``server`` and ``root``, but " -"a :class:`~logging.Logger` can prevent this by setting " -"its :attr:`~logging.Logger.propagate` attribute to :const:`False`." +"``server.auth`` is also seen by ``server`` and ``root``, but a :class:" +"`~logging.Logger` can prevent this by setting its :attr:`~logging.Logger." +"propagate` attribute to :const:`False`." msgstr "" #: ../../whatsnew/2.3.rst:523 @@ -832,10 +828,10 @@ msgid "" "any number of different :class:`~logging.Handler` instances. Loggers and " "handlers can also have an attached list of filters, and each filter can " "cause the :class:`~logging.LogRecord` to be ignored or can modify the record " -"before passing it along. When they're finally " -"output, :class:`~logging.LogRecord` instances are converted to text by " -"a :class:`~logging.Formatter` class. All of these classes can be replaced " -"by your own specially written classes." +"before passing it along. When they're finally output, :class:`~logging." +"LogRecord` instances are converted to text by a :class:`~logging.Formatter` " +"class. All of these classes can be replaced by your own specially written " +"classes." msgstr "" #: ../../whatsnew/2.3.rst:533 @@ -862,17 +858,17 @@ msgstr "PEP 285:布林型別" #: ../../whatsnew/2.3.rst:552 msgid "" "A Boolean type was added to Python 2.3. Two new constants were added to " -"the :mod:`!__builtin__` module, :const:`True` and :const:`False`. " -"(:const:`True` and :const:`False` constants were added to the built-ins in " -"Python 2.2.1, but the 2.2.1 versions are simply set to integer values of 1 " -"and 0 and aren't a different type.)" +"the :mod:`!__builtin__` module, :const:`True` and :const:`False`. (:const:" +"`True` and :const:`False` constants were added to the built-ins in Python " +"2.2.1, but the 2.2.1 versions are simply set to integer values of 1 and 0 " +"and aren't a different type.)" msgstr "" #: ../../whatsnew/2.3.rst:558 msgid "" "The type object for this new type is named :class:`bool`; the constructor " -"for it takes any Python value and converts it to :const:`True` " -"or :const:`False`. ::" +"for it takes any Python value and converts it to :const:`True` or :const:" +"`False`. ::" msgstr "" #: ../../whatsnew/2.3.rst:561 @@ -933,13 +929,13 @@ msgstr "" msgid "" "Python's Booleans were *not* added for the sake of strict type-checking. A " "very strict language such as Pascal would also prevent you performing " -"arithmetic with Booleans, and would require that the expression in " -"an :keyword:`if` statement always evaluate to a Boolean result. Python is " -"not this strict and never will be, as :pep:`285` explicitly says. This " -"means you can still use any expression in an :keyword:`!if` statement, even " -"ones that evaluate to a list or tuple or some random object. The Boolean " -"type is a subclass of the :class:`int` class so that arithmetic using a " -"Boolean still works. ::" +"arithmetic with Booleans, and would require that the expression in an :" +"keyword:`if` statement always evaluate to a Boolean result. Python is not " +"this strict and never will be, as :pep:`285` explicitly says. This means " +"you can still use any expression in an :keyword:`!if` statement, even ones " +"that evaluate to a list or tuple or some random object. The Boolean type is " +"a subclass of the :class:`int` class so that arithmetic using a Boolean " +"still works. ::" msgstr "" #: ../../whatsnew/2.3.rst:596 @@ -986,9 +982,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." @@ -1112,14 +1108,14 @@ msgstr "" msgid "" "``sys.path_hooks`` is a list of callable objects; most often they'll be " "classes. Each callable takes a string containing a path and either returns " -"an importer object that will handle imports from this path or raises " -"an :exc:`ImportError` exception if it can't handle this path." +"an importer object that will handle imports from this path or raises an :exc:" +"`ImportError` exception if it can't handle this path." msgstr "" #: ../../whatsnew/2.3.rst:721 msgid "" -"``sys.path_importer_cache`` caches importer objects for each path, so " -"``sys.path_hooks`` will only need to be traversed once for each path." +"``sys.path_importer_cache`` caches importer objects for each path, so ``sys." +"path_hooks`` will only need to be traversed once for each path." msgstr "" #: ../../whatsnew/2.3.rst:724 @@ -1237,9 +1233,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:797 msgid "" "Different dialects of comma-separated files can be defined and registered; " -"currently there are two dialects, both used by Microsoft Excel. A " -"separate :class:`csv.writer` class will generate comma-separated files from " -"a succession of tuples or lists, quoting strings that contain the delimiter." +"currently there are two dialects, both used by Microsoft Excel. A separate :" +"class:`csv.writer` class will generate comma-separated files from a " +"succession of tuples or lists, quoting strings that contain the delimiter." msgstr "" #: ../../whatsnew/2.3.rst:805 @@ -1287,10 +1283,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:836 msgid "" "To reduce the pickling overhead for new-style classes, a new interface for " -"customizing pickling was added using three special " -"methods: :meth:`~object.__getstate__`, :meth:`~object.__setstate__`, " -"and :meth:`~object.__getnewargs__`. Consult :pep:`307` for the full " -"semantics of these methods." +"customizing pickling was added using three special methods: :meth:`~object." +"__getstate__`, :meth:`~object.__setstate__`, and :meth:`~object." +"__getnewargs__`. Consult :pep:`307` for the full semantics of these " +"methods." msgstr "" #: ../../whatsnew/2.3.rst:841 @@ -1674,10 +1670,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:1044 msgid "" "Most type objects are now callable, so you can use them to create new " -"objects such as functions, classes, and modules. (This means that " -"the :mod:`!new` module can be deprecated in a future Python version, because " -"you can now use the type objects available in the :mod:`types` module.) For " -"example, you can create a new module object with the following code:" +"objects such as functions, classes, and modules. (This means that the :mod:" +"`!new` module can be deprecated in a future Python version, because you can " +"now use the type objects available in the :mod:`types` module.) For example, " +"you can create a new module object with the following code:" msgstr "" #: ../../whatsnew/2.3.rst:1052 @@ -1701,16 +1697,16 @@ msgid "" "A new warning, :exc:`PendingDeprecationWarning` was added to indicate " "features which are in the process of being deprecated. The warning will " "*not* be printed by default. To check for use of features that will be " -"deprecated in the future, supply :option:`-" -"Walways::PendingDeprecationWarning:: <-W>` on the command line or " -"use :func:`warnings.filterwarnings`." +"deprecated in the future, supply :option:`-Walways::" +"PendingDeprecationWarning:: <-W>` on the command line or use :func:`warnings." +"filterwarnings`." msgstr "" #: ../../whatsnew/2.3.rst:1065 msgid "" "The process of deprecating string-based exceptions, as in ``raise \"Error " -"occurred\"``, has begun. Raising a string will now " -"trigger :exc:`PendingDeprecationWarning`." +"occurred\"``, has begun. Raising a string will now trigger :exc:" +"`PendingDeprecationWarning`." msgstr "" #: ../../whatsnew/2.3.rst:1069 @@ -1790,8 +1786,8 @@ 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:`~type.__name__` " -"and :attr:`~type.__bases__` attributes of new-style classes. There are some " +"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." @@ -1942,9 +1938,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1202 msgid "" "The ``SET_LINENO`` opcode is now gone. This may provide a small speed " -"increase, depending on your compiler's idiosyncrasies. See " -"section :ref:`23section-other` for a longer explanation. (Removed by Michael " -"Hudson.)" +"increase, depending on your compiler's idiosyncrasies. See section :ref:" +"`23section-other` for a longer explanation. (Removed by Michael Hudson.)" msgstr "" #: ../../whatsnew/2.3.rst:1206 @@ -2005,19 +2000,18 @@ msgid "" "incompatibilities. When upgrading to Python 2.3, if the new interpreter is " "compiled with a new version of the underlying BerkeleyDB library, you will " "almost certainly have to convert your database files to the new version. " -"You can do this fairly easily with the new scripts :file:`db2pickle.py` " -"and :file:`pickle2db.py` which you will find in the " -"distribution's :file:`Tools/scripts` directory. If you've already been " -"using the PyBSDDB package and importing it as :mod:`!bsddb3`, you will have " -"to change your ``import`` statements to import it as :mod:`!bsddb`." +"You can do this fairly easily with the new scripts :file:`db2pickle.py` and :" +"file:`pickle2db.py` which you will find in the distribution's :file:`Tools/" +"scripts` directory. If you've already been using the PyBSDDB package and " +"importing it as :mod:`!bsddb3`, you will have to change your ``import`` " +"statements to import it as :mod:`!bsddb`." msgstr "" #: ../../whatsnew/2.3.rst:1249 msgid "" "The new :mod:`bz2` module is an interface to the bz2 data compression " -"library. bz2-compressed data is usually smaller than " -"corresponding :mod:`zlib`\\ -compressed data. (Contributed by Gustavo " -"Niemeyer.)" +"library. bz2-compressed data is usually smaller than corresponding :mod:" +"`zlib`\\ -compressed data. (Contributed by Gustavo Niemeyer.)" msgstr "" #: ../../whatsnew/2.3.rst:1253 @@ -2051,18 +2045,18 @@ msgstr "" #: ../../whatsnew/2.3.rst:1270 msgid "" -"Other minor changes to Distutils: it now checks for " -"the :envvar:`CC`, :envvar:`CFLAGS`, :envvar:`!CPP`, :envvar:`LDFLAGS`, " -"and :envvar:`CPPFLAGS` environment variables, using them to override the " -"settings in Python's configuration (contributed by Robert Weber)." +"Other minor changes to Distutils: it now checks for the :envvar:`CC`, :" +"envvar:`CFLAGS`, :envvar:`!CPP`, :envvar:`LDFLAGS`, and :envvar:`CPPFLAGS` " +"environment variables, using them to override the settings in Python's " +"configuration (contributed by Robert Weber)." msgstr "" #: ../../whatsnew/2.3.rst:1275 msgid "" "Previously the :mod:`doctest` module would only search the docstrings of " "public methods and functions for test cases, but it now also examines " -"private ones as well. The :func:`~doctest.DocTestSuite` function creates " -"a :class:`unittest.TestSuite` object from a set of :mod:`doctest` tests." +"private ones as well. The :func:`~doctest.DocTestSuite` function creates a :" +"class:`unittest.TestSuite` object from a set of :mod:`doctest` tests." msgstr "" #: ../../whatsnew/2.3.rst:1280 @@ -2075,10 +2069,10 @@ msgstr "" msgid "" "The :mod:`getopt` module gained a new function, :func:`~getopt.gnu_getopt`, " "that supports the same arguments as the existing :func:`~getopt.getopt` " -"function but uses GNU-style scanning mode. The " -"existing :func:`~getopt.getopt` stops processing options as soon as a non-" -"option argument is encountered, but in GNU-style mode processing continues, " -"meaning that options and arguments can be mixed. For example::" +"function but uses GNU-style scanning mode. The existing :func:`~getopt." +"getopt` stops processing options as soon as a non-option argument is " +"encountered, but in GNU-style mode processing continues, meaning that " +"options and arguments can be mixed. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1289 @@ -2133,10 +2127,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:1314 msgid "" -"The :mod:`heapq` module provides :func:`~heapq.heappush` " -"and :func:`~heapq.heappop` functions for adding and removing items while " -"maintaining the heap property on top of some other mutable Python sequence " -"type. Here's an example that uses a Python list::" +"The :mod:`heapq` module provides :func:`~heapq.heappush` and :func:`~heapq." +"heappop` functions for adding and removing items while maintaining the heap " +"property on top of some other mutable Python sequence type. Here's an " +"example that uses a Python list::" msgstr "" #: ../../whatsnew/2.3.rst:1318 @@ -2234,8 +2228,8 @@ msgid "" "stamps are floats. For compatibility, when using the tuple interface of " "the :class:`~os.stat_result` time stamps will be represented as integers. " "When using named fields (a feature first introduced in Python 2.2), time " -"stamps are still represented as integers, unless :func:`!" -"os.stat_float_times` is invoked to enable float return values::" +"stamps are still represented as integers, unless :func:`!os." +"stat_float_times` is invoked to enable float return values::" msgstr "" #: ../../whatsnew/2.3.rst:1376 @@ -2294,8 +2288,8 @@ msgid "" "The parser objects provided by the :mod:`pyexpat ` module " "can now optionally buffer character data, resulting in fewer calls to your " "character data handler and therefore faster performance. Setting the parser " -"object's :attr:`~xml.parsers.expat.xmlparser.buffer_text` attribute " -"to :const:`True` will enable buffering." +"object's :attr:`~xml.parsers.expat.xmlparser.buffer_text` attribute to :" +"const:`True` will enable buffering." msgstr "" #: ../../whatsnew/2.3.rst:1410 @@ -2340,8 +2334,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1438 msgid "" -"The :mod:`readline` module also gained a number of new " -"functions: :func:`~readline.get_history_item`, :func:`~readline.get_current_history_length`, " +"The :mod:`readline` module also gained a number of new functions: :func:" +"`~readline.get_history_item`, :func:`~readline.get_current_history_length`, " "and :func:`~readline.redisplay`." msgstr "" @@ -2377,9 +2371,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1459 msgid "" -"Support for more advanced POSIX signal handling was added to " -"the :mod:`signal` but then removed again as it proved impossible to make it " -"work reliably across platforms." +"Support for more advanced POSIX signal handling was added to the :mod:" +"`signal` but then removed again as it proved impossible to make it work " +"reliably across platforms." msgstr "" #: ../../whatsnew/2.3.rst:1463 @@ -2414,8 +2408,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1481 msgid "" -"The new :mod:`tarfile` module allows reading from and writing " -"to :program:`tar`\\ -format archive files. (Contributed by Lars Gustäbel.)" +"The new :mod:`tarfile` module allows reading from and writing to :program:" +"`tar`\\ -format archive files. (Contributed by Lars Gustäbel.)" msgstr "" #: ../../whatsnew/2.3.rst:1484 @@ -2425,8 +2419,8 @@ msgid "" "string and returns a list containing the text split into lines of no more " "than the chosen width. The ``fill(text, width)`` function returns a single " "string, reformatted to fit into lines no longer than the chosen width. (As " -"you can guess, :func:`~textwrap.fill` is built on top " -"of :func:`~textwrap.wrap`. For example::" +"you can guess, :func:`~textwrap.fill` is built on top of :func:`~textwrap." +"wrap`. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1491 @@ -2464,21 +2458,21 @@ msgstr "" #: ../../whatsnew/2.3.rst:1506 msgid "" "The module also contains a :class:`~textwrap.TextWrapper` class that " -"actually implements the text wrapping strategy. Both " -"the :class:`~textwrap.TextWrapper` class and the :func:`~textwrap.wrap` " -"and :func:`~textwrap.fill` functions support a number of additional keyword " -"arguments for fine-tuning the formatting; consult the module's documentation " -"for details. (Contributed by Greg Ward.)" +"actually implements the text wrapping strategy. Both the :class:`~textwrap." +"TextWrapper` class and the :func:`~textwrap.wrap` and :func:`~textwrap.fill` " +"functions support a number of additional keyword arguments for fine-tuning " +"the formatting; consult the module's documentation for details. (Contributed " +"by Greg Ward.)" msgstr "" #: ../../whatsnew/2.3.rst:1512 msgid "" -"The :mod:`!thread` and :mod:`threading` modules now have companion " -"modules, :mod:`!dummy_thread` and :mod:`!dummy_threading`, that provide a do-" -"nothing implementation of the :mod:`!thread` module's interface for " -"platforms where threads are not supported. The intention is to simplify " -"thread-aware modules (ones that *don't* rely on threads to run) by putting " -"the following code at the top::" +"The :mod:`!thread` and :mod:`threading` modules now have companion modules, :" +"mod:`!dummy_thread` and :mod:`!dummy_threading`, that provide a do-nothing " +"implementation of the :mod:`!thread` module's interface for platforms where " +"threads are not supported. The intention is to simplify thread-aware " +"modules (ones that *don't* rely on threads to run) by putting the following " +"code at the top::" msgstr "" #: ../../whatsnew/2.3.rst:1519 @@ -2492,13 +2486,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:1524 msgid "" "In this example, :mod:`!_threading` is used as the module name to make it " -"clear that the module being used is not necessarily the " -"actual :mod:`threading` module. Code can call functions and use classes " -"in :mod:`!_threading` whether or not threads are supported, avoiding " -"an :keyword:`if` statement and making the code slightly clearer. This " -"module will not magically make multithreaded code run without threads; code " -"that waits for another thread to return or to do something will simply hang " -"forever." +"clear that the module being used is not necessarily the actual :mod:" +"`threading` module. Code can call functions and use classes in :mod:`!" +"_threading` whether or not threads are supported, avoiding an :keyword:`if` " +"statement and making the code slightly clearer. This module will not " +"magically make multithreaded code run without threads; code that waits for " +"another thread to return or to do something will simply hang forever." msgstr "" #: ../../whatsnew/2.3.rst:1532 @@ -2552,9 +2545,9 @@ msgid "" "a command, passing it to the correct thread, and waiting for the results. " "Other interfaces can't be handled automatically but :mod:`!Tkinter` will now " "raise an exception on such an access so that you can at least find out about " -"the problem. See https://mail.python.org/pipermail/python-dev/2002-December/" -"031107.html for a more detailed explanation of this change. (Implemented by " -"Martin von Löwis.)" +"the problem. See https://mail.python.org/pipermail/python-dev/2002-" +"December/031107.html for a more detailed explanation of this change. " +"(Implemented by Martin von Löwis.)" msgstr "" #: ../../whatsnew/2.3.rst:1572 @@ -2606,9 +2599,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1598 msgid "" "Adding the mix-in as a superclass provides the full dictionary interface " -"whenever the class " -"defines :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, " -"and :meth:`!keys`. For example::" +"whenever the class defines :meth:`~object.__getitem__`, :meth:`~object." +"__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1602 @@ -2658,9 +2650,9 @@ msgstr "(由 Raymond Hettinger 所貢獻。)" #: ../../whatsnew/2.3.rst:1641 msgid "" "The DOM implementation in :mod:`xml.dom.minidom` can now generate XML output " -"in a particular encoding by providing an optional encoding argument to " -"the :meth:`~xml.dom.minidom.Node.toxml` " -"and :meth:`~xml.dom.minidom.Node.toprettyxml` methods of DOM nodes." +"in a particular encoding by providing an optional encoding argument to the :" +"meth:`~xml.dom.minidom.Node.toxml` and :meth:`~xml.dom.minidom.Node." +"toprettyxml` methods of DOM nodes." msgstr "" #: ../../whatsnew/2.3.rst:1645 @@ -2717,9 +2709,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1681 msgid "" -"Date and time types suitable for expressing timestamps were added as " -"the :mod:`datetime` module. The types don't support different calendars or " -"many fancy features, and just stick to the basics of representing time." +"Date and time types suitable for expressing timestamps were added as the :" +"mod:`datetime` module. The types don't support different calendars or many " +"fancy features, and just stick to the basics of representing time." msgstr "" #: ../../whatsnew/2.3.rst:1685 @@ -2727,19 +2719,19 @@ msgid "" "The three primary types are: :class:`~datetime.date`, representing a day, " "month, and year; :class:`~datetime.time`, consisting of hour, minute, and " "second; and :class:`~datetime.datetime`, which contains all the attributes " -"of both :class:`~datetime.date` and :class:`~datetime.time`. There's also " -"a :class:`~datetime.timedelta` class representing differences between two " +"of both :class:`~datetime.date` and :class:`~datetime.time`. There's also a :" +"class:`~datetime.timedelta` class representing differences between two " "points in time, and time zone logic is implemented by classes inheriting " "from the abstract :class:`~datetime.tzinfo` class." msgstr "" #: ../../whatsnew/2.3.rst:1692 msgid "" -"You can create instances of :class:`~datetime.date` " -"and :class:`~datetime.time` by either supplying keyword arguments to the " -"appropriate constructor, e.g. ``datetime.date(year=1972, month=10, " -"day=15)``, or by using one of a number of class methods. For example, " -"the :meth:`~datetime.date.today` class method returns the current local date." +"You can create instances of :class:`~datetime.date` and :class:`~datetime." +"time` by either supplying keyword arguments to the appropriate constructor, " +"e.g. ``datetime.date(year=1972, month=10, day=15)``, or by using one of a " +"number of class methods. For example, the :meth:`~datetime.date.today` " +"class method returns the current local date." msgstr "" #: ../../whatsnew/2.3.rst:1698 @@ -2786,12 +2778,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:1720 msgid "" "Instances can be compared, hashed, and converted to strings (the result is " -"the same as that " -"of :meth:`~datetime.datetime.isoformat`). :class:`~datetime.date` " -"and :class:`~datetime.datetime` instances can be subtracted from each other, " -"and added to :class:`~datetime.timedelta` instances. The largest missing " -"feature is that there's no standard library support for parsing strings and " -"getting back a :class:`~datetime.date` or :class:`~datetime.datetime`." +"the same as that of :meth:`~datetime.datetime.isoformat`). :class:" +"`~datetime.date` and :class:`~datetime.datetime` instances can be subtracted " +"from each other, and added to :class:`~datetime.timedelta` instances. The " +"largest missing feature is that there's no standard library support for " +"parsing strings and getting back a :class:`~datetime.date` or :class:" +"`~datetime.datetime`." msgstr "" #: ../../whatsnew/2.3.rst:1727 @@ -2845,8 +2837,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1756 msgid "" -"Parsing a command line is then done by calling " -"the :meth:`~optparse.OptionParser.parse_args` method. ::" +"Parsing a command line is then done by calling the :meth:`~optparse." +"OptionParser.parse_args` method. ::" msgstr "" #: ../../whatsnew/2.3.rst:1758 @@ -2965,23 +2957,22 @@ msgstr "" #: ../../whatsnew/2.3.rst:1842 msgid "" "To allocate and free an undistinguished chunk of memory use the \"raw " -"memory\" family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, " -"and :c:func:`PyMem_Free`." +"memory\" family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:" +"func:`PyMem_Free`." msgstr "" #: ../../whatsnew/2.3.rst:1845 msgid "" "The \"object memory\" family is the interface to the pymalloc facility " "described above and is biased towards a large number of \"small\" " -"allocations: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, " -"and :c:func:`PyObject_Free`." +"allocations: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, and :c:" +"func:`PyObject_Free`." msgstr "" #: ../../whatsnew/2.3.rst:1849 msgid "" -"To allocate and free Python objects, use the \"object\" " -"family :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, " -"and :c:func:`PyObject_Del`." +"To allocate and free Python objects, use the \"object\" family :c:macro:" +"`PyObject_New`, :c:macro:`PyObject_NewVar`, and :c:func:`PyObject_Del`." msgstr "" #: ../../whatsnew/2.3.rst:1852 @@ -2989,8 +2980,8 @@ msgid "" "Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides " "debugging features to catch memory overwrites and doubled frees in both " "extension modules and in the interpreter itself. To enable this support, " -"compile a debugging version of the Python interpreter by " -"running :program:`configure` with :option:`!--with-pydebug`." +"compile a debugging version of the Python interpreter by running :program:" +"`configure` with :option:`!--with-pydebug`." msgstr "" #: ../../whatsnew/2.3.rst:1858 @@ -3025,16 +3016,15 @@ msgstr "Python 建置程序和 C API 的變更包括:" msgid "" "The cycle detection implementation used by the garbage collection has proven " "to be stable, so it's now been made mandatory. You can no longer compile " -"Python without it, and the :option:`!--with-cycle-gc` switch " -"to :program:`configure` has been removed." +"Python without it, and the :option:`!--with-cycle-gc` switch to :program:" +"`configure` has been removed." msgstr "" #: ../../whatsnew/2.3.rst:1885 msgid "" -"Python can now optionally be built as a shared library " -"(:file:`libpython2.3.so`) by supplying :option:`!--enable-shared` when " -"running Python's :program:`configure` script. (Contributed by Ondrej " -"Palkovsky.)" +"Python can now optionally be built as a shared library (:file:`libpython2.3." +"so`) by supplying :option:`!--enable-shared` when running Python's :program:" +"`configure` script. (Contributed by Ondrej Palkovsky.)" msgstr "" #: ../../whatsnew/2.3.rst:1889 @@ -3049,8 +3039,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1894 msgid "" "The interpreter can be compiled without any docstrings for the built-in " -"functions and modules by supplying :option:`!--without-doc-strings` to " -"the :program:`configure` script. This makes the Python executable about 10% " +"functions and modules by supplying :option:`!--without-doc-strings` to the :" +"program:`configure` script. This makes the Python executable about 10% " "smaller, but will also mean that you can't get help for Python's built-ins. " "(Contributed by Gustavo Niemeyer.)" msgstr "" @@ -3069,9 +3059,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1907 msgid "" ":c:func:`PyArg_ParseTuple` accepts new format characters for various sizes " -"of unsigned integers: ``B`` for :c:expr:`unsigned char`, ``H`` " -"for :c:expr:`unsigned short int`, ``I`` for :c:expr:`unsigned int`, and " -"``K`` for :c:expr:`unsigned long long`." +"of unsigned integers: ``B`` for :c:expr:`unsigned char`, ``H`` for :c:expr:" +"`unsigned short int`, ``I`` for :c:expr:`unsigned int`, and ``K`` for :c:" +"expr:`unsigned long long`." msgstr "" #: ../../whatsnew/2.3.rst:1912 @@ -3083,9 +3073,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1915 msgid "" "File objects now manage their internal string buffer differently, increasing " -"it exponentially when needed. This results in the benchmark tests " -"in :file:`Lib/test/test_bufio.py` speeding up considerably (from 57 seconds " -"to 1.7 seconds, according to one measurement)." +"it exponentially when needed. This results in the benchmark tests in :file:" +"`Lib/test/test_bufio.py` speeding up considerably (from 57 seconds to 1.7 " +"seconds, according to one measurement)." msgstr "" #: ../../whatsnew/2.3.rst:1920 @@ -3104,12 +3094,12 @@ 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:`~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 or the source." +"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 " +"or the source." msgstr "" #: ../../whatsnew/2.3.rst:1938 @@ -3121,11 +3111,11 @@ msgid "" "Support for a port to IBM's OS/2 using the EMX runtime environment was " "merged into the main Python source tree. EMX is a POSIX emulation layer " "over the OS/2 system APIs. The Python port for EMX tries to support all the " -"POSIX-like capability exposed by the EMX runtime, and mostly " -"succeeds; :func:`!fork` and :func:`fcntl` are restricted by the limitations " -"of the underlying emulation layer. The standard OS/2 port, which uses IBM's " -"Visual Age compiler, also gained support for case-sensitive import semantics " -"as part of the integration of the EMX port into CVS. (Contributed by Andrew " +"POSIX-like capability exposed by the EMX runtime, and mostly succeeds; :func:" +"`!fork` and :func:`fcntl` are restricted by the limitations of the " +"underlying emulation layer. The standard OS/2 port, which uses IBM's Visual " +"Age compiler, also gained support for case-sensitive import semantics as " +"part of the integration of the EMX port into CVS. (Contributed by Andrew " "MacIntyre.)" msgstr "" @@ -3146,8 +3136,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1957 msgid "" -"Other new platforms now supported by Python include AtheOS (http://" -"www.atheos.cx/), GNU/Hurd, and OpenVMS." +"Other new platforms now supported by Python include AtheOS (http://www." +"atheos.cx/), GNU/Hurd, and OpenVMS." msgstr "" #: ../../whatsnew/2.3.rst:1966 @@ -3217,11 +3207,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:2006 msgid "" -"A nifty new feature is that trace functions can now assign to " -"the :attr:`~frame.f_lineno` attribute of frame objects, changing the line " -"that will be executed next. A ``jump`` command has been added to " -"the :mod:`pdb` debugger taking advantage of this new feature. (Implemented " -"by Richie Hindle.)" +"A nifty new feature is that trace functions can now assign to the :attr:" +"`~frame.f_lineno` attribute of frame objects, changing the line that will be " +"executed next. A ``jump`` command has been added to the :mod:`pdb` debugger " +"taking advantage of this new feature. (Implemented by Richie Hindle.)" msgstr "" #: ../../whatsnew/2.3.rst:2015 @@ -3270,10 +3259,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:2039 msgid "" -"Large octal and hex literals such as ``0xffffffff`` now trigger " -"a :exc:`FutureWarning`. Currently they're stored as 32-bit numbers and " -"result in a negative value, but in Python 2.4 they'll become positive long " -"integers." +"Large octal and hex literals such as ``0xffffffff`` now trigger a :exc:" +"`FutureWarning`. Currently they're stored as 32-bit numbers and result in a " +"negative value, but in Python 2.4 they'll become positive long integers." msgstr "" #: ../../whatsnew/2.3.rst:2043 From 21be873880305bb92a8dd582795ace0a54c42813 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 9 Dec 2025 00:16:19 +0000 Subject: [PATCH 2/2] sync with cpython 378b24b5 --- c-api/gcsupport.po | 151 ++++++----- c-api/typeobj.po | 657 +++++++++++++++++++++++---------------------- 2 files changed, 411 insertions(+), 397 deletions(-) diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index 1489b716d56..a95dd47f005 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2025-12-09 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:31+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -75,8 +75,8 @@ msgstr "" #: ../../c-api/gcsupport.rst:37 msgid "" -"Before fields which refer to other containers are " -"invalidated, :c:func:`PyObject_GC_UnTrack` must be called." +"Before fields which refer to other containers are invalidated, :c:func:" +"`PyObject_GC_UnTrack` must be called." msgstr "" #: ../../c-api/gcsupport.rst:40 @@ -86,39 +86,39 @@ msgstr "" #: ../../c-api/gcsupport.rst:43 msgid "" -"If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least " -"a :c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from " -"its subclass or subclasses." +"If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least a :" +"c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from its " +"subclass or subclasses." msgstr "" #: ../../c-api/gcsupport.rst:47 msgid "" "When calling :c:func:`PyType_Ready` or some of the APIs that indirectly call " "it like :c:func:`PyType_FromSpecWithBases` or :c:func:`PyType_FromSpec` the " -"interpreter will automatically populate " -"the :c:member:`~PyTypeObject.tp_flags`, :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields if the type inherits from a " -"class that implements the garbage collector protocol and the child class " -"does *not* include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." +"interpreter will automatically populate the :c:member:`~PyTypeObject." +"tp_flags`, :c:member:`~PyTypeObject.tp_traverse` and :c:member:" +"`~PyTypeObject.tp_clear` fields if the type inherits from a class that " +"implements the garbage collector protocol and the child class does *not* " +"include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" #: ../../c-api/gcsupport.rst:57 msgid "" -"Analogous to :c:macro:`PyObject_New` but for container objects with " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set." +"Analogous to :c:macro:`PyObject_New` but for container objects with the :c:" +"macro:`Py_TPFLAGS_HAVE_GC` flag set." msgstr "" #: ../../c-api/gcsupport.rst:60 ../../c-api/gcsupport.rst:84 msgid "" -"Do not call this directly to allocate memory for an object; call the " -"type's :c:member:`~PyTypeObject.tp_alloc` slot instead." +"Do not call this directly to allocate memory for an object; call the type's :" +"c:member:`~PyTypeObject.tp_alloc` slot instead." msgstr "" #: ../../c-api/gcsupport.rst:63 ../../c-api/gcsupport.rst:87 msgid "" -"When populating a type's :c:member:`~PyTypeObject.tp_alloc` " -"slot, :c:func:`PyType_GenericAlloc` is preferred over a custom function that " -"simply calls this macro." +"When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot, :c:func:" +"`PyType_GenericAlloc` is preferred over a custom function that simply calls " +"this macro." msgstr "" #: ../../c-api/gcsupport.rst:67 ../../c-api/gcsupport.rst:91 @@ -146,8 +146,8 @@ msgstr ":c:member:`~PyTypeObject.tp_alloc`" #: ../../c-api/gcsupport.rst:81 msgid "" -"Analogous to :c:macro:`PyObject_NewVar` but for container objects with " -"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set." +"Analogous to :c:macro:`PyObject_NewVar` but for container objects with the :" +"c:macro:`Py_TPFLAGS_HAVE_GC` flag set." msgstr "" #: ../../c-api/gcsupport.rst:98 @@ -170,17 +170,17 @@ msgstr "" #: ../../c-api/gcsupport.rst:114 msgid "" -"Memory allocated by this function must be freed " -"with :c:func:`PyObject_GC_Del` (usually called via the " -"object's :c:member:`~PyTypeObject.tp_free` slot)." +"Memory allocated by this function must be freed with :c:func:" +"`PyObject_GC_Del` (usually called via the object's :c:member:`~PyTypeObject." +"tp_free` slot)." msgstr "" #: ../../c-api/gcsupport.rst:119 msgid "" "The function is marked as unstable because the final mechanism for reserving " "extra data after an instance is not yet decided. For allocating a variable " -"number of fields, prefer using :c:type:`PyVarObject` " -"and :c:member:`~PyTypeObject.tp_itemsize` instead." +"number of fields, prefer using :c:type:`PyVarObject` and :c:member:" +"`~PyTypeObject.tp_itemsize` instead." msgstr "" #: ../../c-api/gcsupport.rst:130 @@ -239,21 +239,21 @@ msgstr "" #: ../../c-api/gcsupport.rst:178 msgid "" -"Releases memory allocated to an object using :c:macro:`PyObject_GC_New` " -"or :c:macro:`PyObject_GC_NewVar`." +"Releases memory allocated to an object using :c:macro:`PyObject_GC_New` or :" +"c:macro:`PyObject_GC_NewVar`." msgstr "" #: ../../c-api/gcsupport.rst:181 msgid "" -"Do not call this directly to free an object's memory; call the " -"type's :c:member:`~PyTypeObject.tp_free` slot instead." +"Do not call this directly to free an object's memory; call the type's :c:" +"member:`~PyTypeObject.tp_free` slot instead." msgstr "" #: ../../c-api/gcsupport.rst:184 msgid "" -"Do not use this for memory allocated " -"by :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, or related " -"allocation functions; use :c:func:`PyObject_Free` instead." +"Do not use this for memory allocated by :c:macro:`PyObject_New`, :c:macro:" +"`PyObject_NewVar`, or related allocation functions; use :c:func:" +"`PyObject_Free` instead." msgstr "" #: ../../c-api/gcsupport.rst:190 @@ -276,10 +276,10 @@ msgstr ":c:member:`~PyTypeObject.tp_free`" msgid "" "Remove the object *op* from the set of container objects tracked by the " "collector. Note that :c:func:`PyObject_GC_Track` can be called again on " -"this object to add it back to the set of tracked objects. The deallocator " -"(:c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the " -"object before any of the fields used by " -"the :c:member:`~PyTypeObject.tp_traverse` handler become invalid." +"this object to add it back to the set of tracked objects. The deallocator (:" +"c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the object " +"before any of the fields used by the :c:member:`~PyTypeObject.tp_traverse` " +"handler become invalid." msgstr "" #: ../../c-api/gcsupport.rst:208 @@ -296,12 +296,12 @@ msgstr "" #: ../../c-api/gcsupport.rst:216 msgid "" -"Type of the visitor function passed to " -"the :c:member:`~PyTypeObject.tp_traverse` handler. The function should be " -"called with an object to traverse as *object* and the third parameter to " -"the :c:member:`~PyTypeObject.tp_traverse` handler as *arg*. The Python core " -"uses several visitor functions to implement cyclic garbage detection; it's " -"not expected that users will need to write their own visitor functions." +"Type of the visitor function passed to the :c:member:`~PyTypeObject." +"tp_traverse` handler. The function should be called with an object to " +"traverse as *object* and the third parameter to the :c:member:`~PyTypeObject." +"tp_traverse` handler as *arg*. The Python core uses several visitor " +"functions to implement cyclic garbage detection; it's not expected that " +"users will need to write their own visitor functions." msgstr "" #: ../../c-api/gcsupport.rst:223 @@ -322,13 +322,20 @@ msgstr "" #: ../../c-api/gcsupport.rst:235 msgid "" -"To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, " -"a :c:func:`Py_VISIT` macro is provided. In order to use this macro, " -"the :c:member:`~PyTypeObject.tp_traverse` implementation must name its " -"arguments exactly *visit* and *arg*:" +"The traversal function must not have any side effects. Implementations may " +"not modify the reference counts of any Python objects nor create or destroy " +"any Python objects." +msgstr "" + +#: ../../c-api/gcsupport.rst:239 +msgid "" +"To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, a :c:" +"func:`Py_VISIT` macro is provided. In order to use this macro, the :c:" +"member:`~PyTypeObject.tp_traverse` implementation must name its arguments " +"exactly *visit* and *arg*:" msgstr "" -#: ../../c-api/gcsupport.rst:242 +#: ../../c-api/gcsupport.rst:246 msgid "" "If the :c:expr:`PyObject *` *o* is not ``NULL``, call the *visit* callback, " "with arguments *o* and *arg*. If *visit* returns a non-zero value, then " @@ -336,7 +343,7 @@ msgid "" "look like::" msgstr "" -#: ../../c-api/gcsupport.rst:247 +#: ../../c-api/gcsupport.rst:251 msgid "" "static int\n" "my_traverse(Noddy *self, visitproc visit, void *arg)\n" @@ -354,13 +361,13 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/gcsupport.rst:255 +#: ../../c-api/gcsupport.rst:259 msgid "" -"The :c:member:`~PyTypeObject.tp_clear` handler must be of " -"the :c:type:`inquiry` type, or ``NULL`` if the object is immutable." +"The :c:member:`~PyTypeObject.tp_clear` handler must be of the :c:type:" +"`inquiry` type, or ``NULL`` if the object is immutable." msgstr "" -#: ../../c-api/gcsupport.rst:261 +#: ../../c-api/gcsupport.rst:265 msgid "" "Drop references that may have created reference cycles. Immutable objects " "do not have to define this method since they can never directly create " @@ -370,82 +377,82 @@ msgid "" "in a reference cycle." msgstr "" -#: ../../c-api/gcsupport.rst:270 +#: ../../c-api/gcsupport.rst:274 msgid "Controlling the Garbage Collector State" msgstr "" -#: ../../c-api/gcsupport.rst:272 +#: ../../c-api/gcsupport.rst:276 msgid "" "The C-API provides the following functions for controlling garbage " "collection runs." msgstr "" -#: ../../c-api/gcsupport.rst:277 +#: ../../c-api/gcsupport.rst:281 msgid "" "Perform a full garbage collection, if the garbage collector is enabled. " "(Note that :func:`gc.collect` runs it unconditionally.)" msgstr "" -#: ../../c-api/gcsupport.rst:280 +#: ../../c-api/gcsupport.rst:284 msgid "" "Returns the number of collected + unreachable objects which cannot be " "collected. If the garbage collector is disabled or already collecting, " -"returns ``0`` immediately. Errors during garbage collection are passed " -"to :data:`sys.unraisablehook`. This function does not raise exceptions." +"returns ``0`` immediately. Errors during garbage collection are passed to :" +"data:`sys.unraisablehook`. This function does not raise exceptions." msgstr "" -#: ../../c-api/gcsupport.rst:290 +#: ../../c-api/gcsupport.rst:294 msgid "" "Enable the garbage collector: similar to :func:`gc.enable`. Returns the " "previous state, 0 for disabled and 1 for enabled." msgstr "" -#: ../../c-api/gcsupport.rst:298 +#: ../../c-api/gcsupport.rst:302 msgid "" "Disable the garbage collector: similar to :func:`gc.disable`. Returns the " "previous state, 0 for disabled and 1 for enabled." msgstr "" -#: ../../c-api/gcsupport.rst:306 +#: ../../c-api/gcsupport.rst:310 msgid "" "Query the state of the garbage collector: similar to :func:`gc.isenabled`. " "Returns the current state, 0 for disabled and 1 for enabled." msgstr "" -#: ../../c-api/gcsupport.rst:313 +#: ../../c-api/gcsupport.rst:317 msgid "Querying Garbage Collector State" msgstr "" -#: ../../c-api/gcsupport.rst:315 +#: ../../c-api/gcsupport.rst:319 msgid "" "The C-API provides the following interface for querying information about " "the garbage collector." msgstr "" -#: ../../c-api/gcsupport.rst:320 +#: ../../c-api/gcsupport.rst:324 msgid "" "Run supplied *callback* on all live GC-capable objects. *arg* is passed " "through to all invocations of *callback*." msgstr "" -#: ../../c-api/gcsupport.rst:324 +#: ../../c-api/gcsupport.rst:328 msgid "" "If new objects are (de)allocated by the callback it is undefined if they " "will be visited." msgstr "" -#: ../../c-api/gcsupport.rst:327 +#: ../../c-api/gcsupport.rst:331 msgid "" "Garbage collection is disabled during operation. Explicitly running a " "collection in the callback may lead to undefined behaviour e.g. visiting the " "same objects multiple times or not at all." msgstr "" -#: ../../c-api/gcsupport.rst:335 +#: ../../c-api/gcsupport.rst:339 msgid "" -"Type of the visitor function to be passed " -"to :c:func:`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* " -"passed to ``PyUnstable_GC_VisitObjects``. Return ``1`` to continue " -"iteration, return ``0`` to stop iteration. Other return values are reserved " -"for now so behavior on returning anything else is undefined." +"Type of the visitor function to be passed to :c:func:" +"`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* passed to " +"``PyUnstable_GC_VisitObjects``. Return ``1`` to continue iteration, return " +"``0`` to stop iteration. Other return values are reserved for now so " +"behavior on returning anything else is undefined." msgstr "" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 285808351ba..b17161e990c 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 00:17+0000\n" +"POT-Creation-Date: 2025-12-09 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-" @@ -1347,20 +1347,20 @@ msgstr "" #: ../../c-api/typeobj.rst:1323 ../../c-api/typeobj.rst:1367 #: ../../c-api/typeobj.rst:1388 ../../c-api/typeobj.rst:1407 #: ../../c-api/typeobj.rst:1437 ../../c-api/typeobj.rst:1459 -#: ../../c-api/typeobj.rst:1487 ../../c-api/typeobj.rst:1580 -#: ../../c-api/typeobj.rst:1726 ../../c-api/typeobj.rst:1793 -#: ../../c-api/typeobj.rst:1829 ../../c-api/typeobj.rst:1856 -#: ../../c-api/typeobj.rst:1881 ../../c-api/typeobj.rst:1896 -#: ../../c-api/typeobj.rst:1913 ../../c-api/typeobj.rst:1929 -#: ../../c-api/typeobj.rst:1961 ../../c-api/typeobj.rst:1993 -#: ../../c-api/typeobj.rst:2021 ../../c-api/typeobj.rst:2041 -#: ../../c-api/typeobj.rst:2070 ../../c-api/typeobj.rst:2116 -#: ../../c-api/typeobj.rst:2135 ../../c-api/typeobj.rst:2177 -#: ../../c-api/typeobj.rst:2202 ../../c-api/typeobj.rst:2242 -#: ../../c-api/typeobj.rst:2272 ../../c-api/typeobj.rst:2285 -#: ../../c-api/typeobj.rst:2295 ../../c-api/typeobj.rst:2312 -#: ../../c-api/typeobj.rst:2329 ../../c-api/typeobj.rst:2345 -#: ../../c-api/typeobj.rst:2489 ../../c-api/typeobj.rst:2549 +#: ../../c-api/typeobj.rst:1487 ../../c-api/typeobj.rst:1585 +#: ../../c-api/typeobj.rst:1731 ../../c-api/typeobj.rst:1798 +#: ../../c-api/typeobj.rst:1834 ../../c-api/typeobj.rst:1861 +#: ../../c-api/typeobj.rst:1886 ../../c-api/typeobj.rst:1901 +#: ../../c-api/typeobj.rst:1918 ../../c-api/typeobj.rst:1934 +#: ../../c-api/typeobj.rst:1966 ../../c-api/typeobj.rst:1998 +#: ../../c-api/typeobj.rst:2026 ../../c-api/typeobj.rst:2046 +#: ../../c-api/typeobj.rst:2075 ../../c-api/typeobj.rst:2121 +#: ../../c-api/typeobj.rst:2140 ../../c-api/typeobj.rst:2182 +#: ../../c-api/typeobj.rst:2207 ../../c-api/typeobj.rst:2247 +#: ../../c-api/typeobj.rst:2277 ../../c-api/typeobj.rst:2290 +#: ../../c-api/typeobj.rst:2300 ../../c-api/typeobj.rst:2317 +#: ../../c-api/typeobj.rst:2334 ../../c-api/typeobj.rst:2350 +#: ../../c-api/typeobj.rst:2494 ../../c-api/typeobj.rst:2554 msgid "**Inheritance:**" msgstr "" @@ -1399,10 +1399,10 @@ msgstr "" #: ../../c-api/typeobj.rst:529 ../../c-api/typeobj.rst:811 #: ../../c-api/typeobj.rst:938 ../../c-api/typeobj.rst:1038 -#: ../../c-api/typeobj.rst:1060 ../../c-api/typeobj.rst:1858 -#: ../../c-api/typeobj.rst:1883 ../../c-api/typeobj.rst:2023 -#: ../../c-api/typeobj.rst:2043 ../../c-api/typeobj.rst:2118 -#: ../../c-api/typeobj.rst:2244 ../../c-api/typeobj.rst:2491 +#: ../../c-api/typeobj.rst:1060 ../../c-api/typeobj.rst:1863 +#: ../../c-api/typeobj.rst:1888 ../../c-api/typeobj.rst:2028 +#: ../../c-api/typeobj.rst:2048 ../../c-api/typeobj.rst:2123 +#: ../../c-api/typeobj.rst:2249 ../../c-api/typeobj.rst:2496 msgid "This field is inherited by subtypes." msgstr "" @@ -1789,8 +1789,8 @@ msgid "" "violate any assumptions of the library." msgstr "" -#: ../../c-api/typeobj.rst:815 ../../c-api/typeobj.rst:1737 -#: ../../c-api/typeobj.rst:2504 +#: ../../c-api/typeobj.rst:815 ../../c-api/typeobj.rst:1742 +#: ../../c-api/typeobj.rst:2509 msgid "" ":ref:`life-cycle` for details about how this slot relates to other slots." msgstr "" @@ -1954,11 +1954,11 @@ msgstr "" #: ../../c-api/typeobj.rst:940 ../../c-api/typeobj.rst:1021 #: ../../c-api/typeobj.rst:1062 ../../c-api/typeobj.rst:1089 #: ../../c-api/typeobj.rst:1117 ../../c-api/typeobj.rst:1159 -#: ../../c-api/typeobj.rst:1802 ../../c-api/typeobj.rst:1836 -#: ../../c-api/typeobj.rst:1965 ../../c-api/typeobj.rst:1998 -#: ../../c-api/typeobj.rst:2077 ../../c-api/typeobj.rst:2120 -#: ../../c-api/typeobj.rst:2142 ../../c-api/typeobj.rst:2183 -#: ../../c-api/typeobj.rst:2213 ../../c-api/typeobj.rst:2246 +#: ../../c-api/typeobj.rst:1807 ../../c-api/typeobj.rst:1841 +#: ../../c-api/typeobj.rst:1970 ../../c-api/typeobj.rst:2003 +#: ../../c-api/typeobj.rst:2082 ../../c-api/typeobj.rst:2125 +#: ../../c-api/typeobj.rst:2147 ../../c-api/typeobj.rst:2188 +#: ../../c-api/typeobj.rst:2218 ../../c-api/typeobj.rst:2251 msgid "**Default:**" msgstr "**預設:**" @@ -2048,7 +2048,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:1014 ../../c-api/typeobj.rst:1795 +#: ../../c-api/typeobj.rst:1014 ../../c-api/typeobj.rst:1800 msgid "" "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." "tp_richcompare`" @@ -2281,8 +2281,8 @@ msgid "" "`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1231 ../../c-api/typeobj.rst:1582 -#: ../../c-api/typeobj.rst:1728 +#: ../../c-api/typeobj.rst:1231 ../../c-api/typeobj.rst:1587 +#: ../../c-api/typeobj.rst:1733 msgid "" "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." "tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" @@ -2567,7 +2567,7 @@ msgstr "" msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" msgstr "int tp_traverse(PyObject *self, visitproc visit, void *arg);" -#: ../../c-api/typeobj.rst:1501 ../../c-api/typeobj.rst:1723 +#: ../../c-api/typeobj.rst:1501 ../../c-api/typeobj.rst:1728 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." @@ -2669,14 +2669,21 @@ msgid "" "it, as they are allowed to be removed even if the instance is still alive)." msgstr "" -#: ../../c-api/typeobj.rst:1557 +#: ../../c-api/typeobj.rst:1558 +msgid "" +"The traversal function must not have any side effects. It must not modify " +"the reference counts of any Python objects nor create or destroy any Python " +"objects." +msgstr "" + +#: ../../c-api/typeobj.rst:1562 msgid "" "Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to :c:" "func:`!local_traverse` to have these specific names; don't name them just " "anything." msgstr "" -#: ../../c-api/typeobj.rst:1561 +#: ../../c-api/typeobj.rst:1566 msgid "" "Instances of :ref:`heap-allocated types ` hold a reference to " "their type. Their traversal function must therefore either visit :c:func:" @@ -2685,20 +2692,20 @@ msgid "" "superclass). If they do not, the type object may not be garbage-collected." msgstr "" -#: ../../c-api/typeobj.rst:1570 +#: ../../c-api/typeobj.rst:1575 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` function can be called from any " "thread." msgstr ":c:member:`~PyTypeObject.tp_traverse` 函式可以從任何執行緒呼叫。" -#: ../../c-api/typeobj.rst:1575 +#: ../../c-api/typeobj.rst:1580 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1584 +#: ../../c-api/typeobj.rst:1589 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" @@ -2706,15 +2713,15 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1594 +#: ../../c-api/typeobj.rst:1599 msgid "An optional pointer to a clear function. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1596 +#: ../../c-api/typeobj.rst:1601 msgid "int tp_clear(PyObject *);" msgstr "int tp_clear(PyObject *);" -#: ../../c-api/typeobj.rst:1598 +#: ../../c-api/typeobj.rst:1603 msgid "" "The purpose of this function is to break reference cycles that are causing " "a :term:`cyclic isolate` so that the objects can be safely destroyed. A " @@ -2722,7 +2729,7 @@ msgid "" "to satisfy design invariants held during normal use." msgstr "" -#: ../../c-api/typeobj.rst:1603 +#: ../../c-api/typeobj.rst:1608 msgid "" ":c:member:`!tp_clear` does not need to delete references to objects that " "can't participate in reference cycles, such as Python strings or Python " @@ -2733,44 +2740,44 @@ msgid "" "func:`Py_CLEAR`.)" msgstr "" -#: ../../c-api/typeobj.rst:1611 +#: ../../c-api/typeobj.rst:1616 msgid "" "Any non-trivial cleanup should be performed in :c:member:`~PyTypeObject." "tp_finalize` instead of :c:member:`!tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1616 +#: ../../c-api/typeobj.rst:1621 msgid "" "If :c:member:`!tp_clear` fails to break a reference cycle then the objects " "in the :term:`cyclic isolate` may remain indefinitely uncollectable " "(\"leak\"). See :data:`gc.garbage`." msgstr "" -#: ../../c-api/typeobj.rst:1622 +#: ../../c-api/typeobj.rst:1627 msgid "" "Referents (direct and indirect) might have already been cleared; they are " "not guaranteed to be in a consistent state." msgstr "" -#: ../../c-api/typeobj.rst:1627 +#: ../../c-api/typeobj.rst:1632 msgid "" "The :c:member:`~PyTypeObject.tp_clear` function can be called from any " "thread." msgstr ":c:member:`~PyTypeObject.tp_clear` 函式可以從任何執行緒呼叫。" -#: ../../c-api/typeobj.rst:1632 +#: ../../c-api/typeobj.rst:1637 msgid "" "An object is not guaranteed to be automatically cleared before its " "destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called." msgstr "" -#: ../../c-api/typeobj.rst:1635 +#: ../../c-api/typeobj.rst:1640 msgid "" "This function differs from the destructor (:c:member:`~PyTypeObject." "tp_dealloc`) in the following ways:" msgstr "" -#: ../../c-api/typeobj.rst:1638 +#: ../../c-api/typeobj.rst:1643 msgid "" "The purpose of clearing an object is to remove references to other objects " "that might participate in a reference cycle. The purpose of the destructor, " @@ -2780,7 +2787,7 @@ msgid "" "`~PyTypeObject.tp_free`)." msgstr "" -#: ../../c-api/typeobj.rst:1644 +#: ../../c-api/typeobj.rst:1649 msgid "" "When :c:member:`!tp_clear` is called, other objects might still hold " "references to the object being cleared. Because of this, :c:member:`!" @@ -2790,7 +2797,7 @@ msgid "" "object itself by deallocating it." msgstr "" -#: ../../c-api/typeobj.rst:1650 +#: ../../c-api/typeobj.rst:1655 msgid "" ":c:member:`!tp_clear` might never be automatically called. An object's " "destructor, on the other hand, will be automatically called some time after " @@ -2798,20 +2805,20 @@ msgid "" "object or the object is a member of a :term:`cyclic isolate`)." msgstr "" -#: ../../c-api/typeobj.rst:1655 +#: ../../c-api/typeobj.rst:1660 msgid "" "No guarantees are made about when, if, or how often Python automatically " "clears an object, except:" msgstr "" -#: ../../c-api/typeobj.rst:1658 +#: ../../c-api/typeobj.rst:1663 msgid "" "Python will not automatically clear an object if it is reachable, i.e., " "there is a reference to it and it is not a member of a :term:`cyclic " "isolate`." msgstr "" -#: ../../c-api/typeobj.rst:1661 +#: ../../c-api/typeobj.rst:1666 msgid "" "Python will not automatically clear an object if it has not been " "automatically finalized (see :c:member:`~PyTypeObject.tp_finalize`). (If " @@ -2819,14 +2826,14 @@ msgid "" "automatically finalized again before it is cleared.)" msgstr "" -#: ../../c-api/typeobj.rst:1665 +#: ../../c-api/typeobj.rst:1670 msgid "" "If an object is a member of a :term:`cyclic isolate`, Python will not " "automatically clear it if any member of the cyclic isolate has not yet been " "automatically finalized (:c:member:`~PyTypeObject.tp_finalize`)." msgstr "" -#: ../../c-api/typeobj.rst:1668 +#: ../../c-api/typeobj.rst:1673 msgid "" "Python will not destroy an object until after any automatic calls to its :c:" "member:`!tp_clear` function have returned. This ensures that the act of " @@ -2834,20 +2841,20 @@ msgid "" "member:`!tp_clear` is still executing." msgstr "" -#: ../../c-api/typeobj.rst:1672 +#: ../../c-api/typeobj.rst:1677 msgid "" "Python will not automatically call :c:member:`!tp_clear` multiple times " "concurrently." msgstr "" -#: ../../c-api/typeobj.rst:1675 +#: ../../c-api/typeobj.rst:1680 msgid "" "CPython currently only automatically clears objects as needed to break " "reference cycles in a :term:`cyclic isolate`, but future versions might " "clear objects regularly before their destruction." msgstr "" -#: ../../c-api/typeobj.rst:1679 +#: ../../c-api/typeobj.rst:1684 msgid "" "Taken together, all :c:member:`~PyTypeObject.tp_clear` functions in the " "system must combine to break all reference cycles. This is subtle, and if " @@ -2860,7 +2867,7 @@ msgid "" "good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1690 +#: ../../c-api/typeobj.rst:1695 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2868,7 +2875,7 @@ msgid "" "example::" msgstr "" -#: ../../c-api/typeobj.rst:1694 +#: ../../c-api/typeobj.rst:1699 msgid "" "static int\n" "local_clear(PyObject *op)\n" @@ -2892,7 +2899,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1705 +#: ../../c-api/typeobj.rst:1710 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " "delicate: the reference to the contained object must not be released (via :" @@ -2907,18 +2914,18 @@ msgid "" "performs the operations in a safe order." msgstr "" -#: ../../c-api/typeobj.rst:1717 +#: ../../c-api/typeobj.rst:1722 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, the clear function must call :c:func:" "`PyObject_ClearManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1721 +#: ../../c-api/typeobj.rst:1726 msgid "PyObject_ClearManagedDict((PyObject*)self);" msgstr "PyObject_ClearManagedDict((PyObject*)self);" -#: ../../c-api/typeobj.rst:1730 +#: ../../c-api/typeobj.rst:1735 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" @@ -2926,22 +2933,22 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1744 +#: ../../c-api/typeobj.rst:1749 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1746 +#: ../../c-api/typeobj.rst:1751 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" msgstr "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -#: ../../c-api/typeobj.rst:1748 +#: ../../c-api/typeobj.rst:1753 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" -#: ../../c-api/typeobj.rst:1751 +#: ../../c-api/typeobj.rst:1756 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2949,50 +2956,50 @@ msgid "" "set an exception condition." msgstr "" -#: ../../c-api/typeobj.rst:1756 +#: ../../c-api/typeobj.rst:1761 msgid "" "The following constants are defined to be used as the third argument for :c:" "member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" msgstr "" -#: ../../c-api/typeobj.rst:1762 +#: ../../c-api/typeobj.rst:1767 msgid "Constant" msgstr "常數" -#: ../../c-api/typeobj.rst:1762 +#: ../../c-api/typeobj.rst:1767 msgid "Comparison" msgstr "" -#: ../../c-api/typeobj.rst:1764 +#: ../../c-api/typeobj.rst:1769 msgid "``<``" msgstr "``<``" -#: ../../c-api/typeobj.rst:1766 +#: ../../c-api/typeobj.rst:1771 msgid "``<=``" msgstr "``<=``" -#: ../../c-api/typeobj.rst:1768 +#: ../../c-api/typeobj.rst:1773 msgid "``==``" msgstr "``==``" -#: ../../c-api/typeobj.rst:1770 +#: ../../c-api/typeobj.rst:1775 msgid "``!=``" msgstr "``!=``" -#: ../../c-api/typeobj.rst:1772 +#: ../../c-api/typeobj.rst:1777 msgid "``>``" msgstr "``>``" -#: ../../c-api/typeobj.rst:1774 +#: ../../c-api/typeobj.rst:1779 msgid "``>=``" msgstr "``>=``" -#: ../../c-api/typeobj.rst:1777 +#: ../../c-api/typeobj.rst:1782 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: ../../c-api/typeobj.rst:1781 +#: ../../c-api/typeobj.rst:1786 msgid "" "Return ``Py_True`` or ``Py_False`` from the function, depending on the " "result of a comparison. VAL_A and VAL_B must be orderable by C comparison " @@ -3000,15 +3007,15 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: ../../c-api/typeobj.rst:1787 +#: ../../c-api/typeobj.rst:1792 msgid "The returned value is a new :term:`strong reference`." msgstr "" -#: ../../c-api/typeobj.rst:1789 +#: ../../c-api/typeobj.rst:1794 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: ../../c-api/typeobj.rst:1797 +#: ../../c-api/typeobj.rst:1802 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" @@ -3016,7 +3023,7 @@ msgid "" "tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1804 +#: ../../c-api/typeobj.rst:1809 msgid "" ":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." "tp_richcompare` implementation, which may be inherited. However, if only :c:" @@ -3025,13 +3032,13 @@ msgid "" "comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1813 +#: ../../c-api/typeobj.rst:1818 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1816 +#: ../../c-api/typeobj.rst:1821 msgid "" "If the instances of this type are weakly referenceable, this field is " "greater than zero and contains the offset in the instance structure of the " @@ -3041,19 +3048,19 @@ msgid "" "`PyObject*` which is initialized to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1823 +#: ../../c-api/typeobj.rst:1828 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " "is the list head for weak references to the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1826 +#: ../../c-api/typeobj.rst:1831 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1831 +#: ../../c-api/typeobj.rst:1836 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype uses a " @@ -3062,7 +3069,7 @@ msgid "" "not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1838 +#: ../../c-api/typeobj.rst:1843 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." @@ -3070,32 +3077,32 @@ msgid "" "unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1848 +#: ../../c-api/typeobj.rst:1853 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " "object. Its presence normally signals that the instances of this type are :" "term:`iterable` (although sequences may be iterable without this function)." msgstr "" -#: ../../c-api/typeobj.rst:1852 +#: ../../c-api/typeobj.rst:1857 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: ../../c-api/typeobj.rst:1854 +#: ../../c-api/typeobj.rst:1859 msgid "PyObject *tp_iter(PyObject *self);" msgstr "PyObject *tp_iter(PyObject *self);" -#: ../../c-api/typeobj.rst:1865 +#: ../../c-api/typeobj.rst:1870 msgid "" "An optional pointer to a function that returns the next item in an :term:" "`iterator`. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1868 +#: ../../c-api/typeobj.rst:1873 msgid "PyObject *tp_iternext(PyObject *self);" msgstr "PyObject *tp_iternext(PyObject *self);" -#: ../../c-api/typeobj.rst:1870 +#: ../../c-api/typeobj.rst:1875 msgid "" "When the iterator is exhausted, it must return ``NULL``; a :exc:" "`StopIteration` exception may or may not be set. When another error occurs, " @@ -3103,74 +3110,74 @@ msgid "" "this type are iterators." msgstr "" -#: ../../c-api/typeobj.rst:1875 +#: ../../c-api/typeobj.rst:1880 msgid "" "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " "function, and that function should return the iterator instance itself (not " "a new iterator instance)." msgstr "" -#: ../../c-api/typeobj.rst:1879 +#: ../../c-api/typeobj.rst:1884 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: ../../c-api/typeobj.rst:1890 +#: ../../c-api/typeobj.rst:1895 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -#: ../../c-api/typeobj.rst:1893 +#: ../../c-api/typeobj.rst:1898 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1898 +#: ../../c-api/typeobj.rst:1903 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1906 +#: ../../c-api/typeobj.rst:1911 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMemberDef` structures, declaring regular data members (fields or slots) " "of instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1910 +#: ../../c-api/typeobj.rst:1915 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1915 +#: ../../c-api/typeobj.rst:1920 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1923 +#: ../../c-api/typeobj.rst:1928 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyGetSetDef` structures, declaring computed attributes of instances of this " "type." msgstr "" -#: ../../c-api/typeobj.rst:1926 +#: ../../c-api/typeobj.rst:1931 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1931 +#: ../../c-api/typeobj.rst:1936 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1939 +#: ../../c-api/typeobj.rst:1944 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -3178,7 +3185,7 @@ msgid "" "metatype." msgstr "" -#: ../../c-api/typeobj.rst:1947 +#: ../../c-api/typeobj.rst:1952 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -3186,7 +3193,7 @@ msgid "" "valid C99 address constants." msgstr "" -#: ../../c-api/typeobj.rst:1952 +#: ../../c-api/typeobj.rst:1957 msgid "" "However, the unary '&' operator applied to a non-static variable like :c:" "data:`PyBaseObject_Type` is not required to produce an address constant. " @@ -3194,27 +3201,27 @@ msgid "" "strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1958 +#: ../../c-api/typeobj.rst:1963 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: ../../c-api/typeobj.rst:1963 +#: ../../c-api/typeobj.rst:1968 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: ../../c-api/typeobj.rst:1967 +#: ../../c-api/typeobj.rst:1972 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: ../../c-api/typeobj.rst:1973 +#: ../../c-api/typeobj.rst:1978 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1975 +#: ../../c-api/typeobj.rst:1980 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " @@ -3225,73 +3232,73 @@ msgid "" "be treated as read-only." msgstr "" -#: ../../c-api/typeobj.rst:1983 +#: ../../c-api/typeobj.rst:1988 msgid "" "Some types may not store their dictionary in this slot. Use :c:func:" "`PyType_GetDict` to retrieve the dictionary for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1989 +#: ../../c-api/typeobj.rst:1994 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " "Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" "func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1995 +#: ../../c-api/typeobj.rst:2000 msgid "" "This field is not inherited by subtypes (though the attributes defined in " "here are inherited through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:2000 +#: ../../c-api/typeobj.rst:2005 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: ../../c-api/typeobj.rst:2005 +#: ../../c-api/typeobj.rst:2010 msgid "" "It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" "member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" -#: ../../c-api/typeobj.rst:2013 +#: ../../c-api/typeobj.rst:2018 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: ../../c-api/typeobj.rst:2015 ../../c-api/typeobj.rst:2033 -#: ../../c-api/typeobj.rst:2099 ../../c-api/typeobj.rst:2131 -#: ../../c-api/typeobj.rst:2156 +#: ../../c-api/typeobj.rst:2020 ../../c-api/typeobj.rst:2038 +#: ../../c-api/typeobj.rst:2104 ../../c-api/typeobj.rst:2136 +#: ../../c-api/typeobj.rst:2161 msgid "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2017 +#: ../../c-api/typeobj.rst:2022 msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" msgstr "" "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" -#: ../../c-api/typeobj.rst:2030 +#: ../../c-api/typeobj.rst:2035 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: ../../c-api/typeobj.rst:2035 +#: ../../c-api/typeobj.rst:2040 msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" msgstr "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" -#: ../../c-api/typeobj.rst:2037 +#: ../../c-api/typeobj.rst:2042 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: ../../c-api/typeobj.rst:2048 +#: ../../c-api/typeobj.rst:2053 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:2051 +#: ../../c-api/typeobj.rst:2056 msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " @@ -3299,19 +3306,19 @@ msgid "" "func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:2056 +#: ../../c-api/typeobj.rst:2061 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " "the dictionary for attributes of the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:2059 +#: ../../c-api/typeobj.rst:2064 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." msgstr "" -#: ../../c-api/typeobj.rst:2061 +#: ../../c-api/typeobj.rst:2066 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" "only. To get the pointer to the dictionary call :c:func:" @@ -3320,13 +3327,13 @@ msgid "" "to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: ../../c-api/typeobj.rst:2067 +#: ../../c-api/typeobj.rst:2072 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit and :c:" "member:`~PyTypeObject.tp_dictoffset`." msgstr "" -#: ../../c-api/typeobj.rst:2072 +#: ../../c-api/typeobj.rst:2077 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " @@ -3334,25 +3341,25 @@ msgid "" "`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -#: ../../c-api/typeobj.rst:2079 +#: ../../c-api/typeobj.rst:2084 msgid "" "This slot has no default. For :ref:`static types `, if the " "field is ``NULL`` then no :attr:`~object.__dict__` gets created for " "instances." msgstr "" -#: ../../c-api/typeobj.rst:2082 +#: ../../c-api/typeobj.rst:2087 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " "will be set to ``-1``, to indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:2092 +#: ../../c-api/typeobj.rst:2097 msgid "An optional pointer to an instance initialization function." msgstr "" -#: ../../c-api/typeobj.rst:2094 +#: ../../c-api/typeobj.rst:2099 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " @@ -3360,18 +3367,18 @@ msgid "" "instance by calling its :meth:`!__init__` method again." msgstr "" -#: ../../c-api/typeobj.rst:2101 +#: ../../c-api/typeobj.rst:2106 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:2103 +#: ../../c-api/typeobj.rst:2108 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " "arguments represent positional and keyword arguments of the call to :meth:" "`~object.__init__`." msgstr "" -#: ../../c-api/typeobj.rst:2107 +#: ../../c-api/typeobj.rst:2112 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " "when an instance is created normally by calling its type, after the type's :" @@ -3383,53 +3390,53 @@ msgid "" "subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: ../../c-api/typeobj.rst:2114 +#: ../../c-api/typeobj.rst:2119 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: ../../c-api/typeobj.rst:2122 +#: ../../c-api/typeobj.rst:2127 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" -#: ../../c-api/typeobj.rst:2129 +#: ../../c-api/typeobj.rst:2134 msgid "An optional pointer to an instance allocation function." msgstr "" -#: ../../c-api/typeobj.rst:2133 +#: ../../c-api/typeobj.rst:2138 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -#: ../../c-api/typeobj.rst:2137 +#: ../../c-api/typeobj.rst:2142 msgid "" "Static subtypes inherit this slot, which will be :c:func:" "`PyType_GenericAlloc` if inherited from :class:`object`." msgstr "" -#: ../../c-api/typeobj.rst:2140 ../../c-api/typeobj.rst:2211 +#: ../../c-api/typeobj.rst:2145 ../../c-api/typeobj.rst:2216 msgid ":ref:`Heap subtypes ` do not inherit this slot." msgstr "" -#: ../../c-api/typeobj.rst:2144 +#: ../../c-api/typeobj.rst:2149 msgid "" "For heap subtypes, this field is always set to :c:func:`PyType_GenericAlloc`." msgstr "" -#: ../../c-api/typeobj.rst:2147 ../../c-api/typeobj.rst:2219 +#: ../../c-api/typeobj.rst:2152 ../../c-api/typeobj.rst:2224 msgid "For static subtypes, this slot is inherited (see above)." msgstr "" -#: ../../c-api/typeobj.rst:2154 +#: ../../c-api/typeobj.rst:2159 msgid "An optional pointer to an instance creation function." msgstr "" -#: ../../c-api/typeobj.rst:2158 +#: ../../c-api/typeobj.rst:2163 msgid "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:2160 +#: ../../c-api/typeobj.rst:2165 msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " @@ -3438,7 +3445,7 @@ msgid "" "that type (but not an unrelated type)." msgstr "" -#: ../../c-api/typeobj.rst:2166 +#: ../../c-api/typeobj.rst:2171 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " @@ -3450,20 +3457,20 @@ msgid "" "be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: ../../c-api/typeobj.rst:2174 +#: ../../c-api/typeobj.rst:2179 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" -#: ../../c-api/typeobj.rst:2179 +#: ../../c-api/typeobj.rst:2184 msgid "" "This field is inherited by subtypes, except it is not inherited by :ref:" "`static types ` whose :c:member:`~PyTypeObject.tp_base` is " "``NULL`` or ``&PyBaseObject_Type``." msgstr "" -#: ../../c-api/typeobj.rst:2185 +#: ../../c-api/typeobj.rst:2190 msgid "" "For :ref:`static types ` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " @@ -3471,22 +3478,22 @@ msgid "" "factory function." msgstr "" -#: ../../c-api/typeobj.rst:2195 +#: ../../c-api/typeobj.rst:2200 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2197 +#: ../../c-api/typeobj.rst:2202 msgid "void tp_free(void *self);" msgstr "void tp_free(void *self);" -#: ../../c-api/typeobj.rst:2199 +#: ../../c-api/typeobj.rst:2204 msgid "" "This function must free the memory allocated by :c:member:`~PyTypeObject." "tp_alloc`." msgstr "" -#: ../../c-api/typeobj.rst:2204 +#: ../../c-api/typeobj.rst:2209 msgid "" "Static subtypes inherit this slot, which will be :c:func:`PyObject_Free` if " "inherited from :class:`object`. Exception: If the type supports garbage " @@ -3495,18 +3502,18 @@ msgid "" "this slot is not inherited but instead defaults to :c:func:`PyObject_GC_Del`." msgstr "" -#: ../../c-api/typeobj.rst:2215 +#: ../../c-api/typeobj.rst:2220 msgid "" "For :ref:`heap subtypes `, this slot defaults to a deallocator " "suitable to match :c:func:`PyType_GenericAlloc` and the value of the :c:" "macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" -#: ../../c-api/typeobj.rst:2226 +#: ../../c-api/typeobj.rst:2231 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: ../../c-api/typeobj.rst:2228 +#: ../../c-api/typeobj.rst:2233 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " @@ -3518,93 +3525,93 @@ msgid "" "instance. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2236 +#: ../../c-api/typeobj.rst:2241 msgid "int tp_is_gc(PyObject *self);" msgstr "int tp_is_gc(PyObject *self);" -#: ../../c-api/typeobj.rst:2238 +#: ../../c-api/typeobj.rst:2243 msgid "" "(The only example of this are types themselves. The metatype, :c:data:" "`PyType_Type`, defines this function to distinguish between statically and :" "ref:`dynamically allocated types `.)" msgstr "" -#: ../../c-api/typeobj.rst:2248 +#: ../../c-api/typeobj.rst:2253 msgid "" "This slot has no default. If this field is ``NULL``, :c:macro:" "`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" -#: ../../c-api/typeobj.rst:2256 +#: ../../c-api/typeobj.rst:2261 msgid "Tuple of base types." msgstr "" -#: ../../c-api/typeobj.rst:2258 ../../c-api/typeobj.rst:2282 +#: ../../c-api/typeobj.rst:2263 ../../c-api/typeobj.rst:2287 msgid "" "This field should be set to ``NULL`` and treated as read-only. Python will " "fill it in when the type is :c:func:`initialized `." msgstr "" -#: ../../c-api/typeobj.rst:2261 +#: ../../c-api/typeobj.rst:2266 msgid "" "For dynamically created classes, the :c:data:`Py_tp_bases` :c:type:`slot " "` can be used instead of the *bases* argument of :c:func:" "`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: ../../c-api/typeobj.rst:2268 +#: ../../c-api/typeobj.rst:2273 msgid "" "Multiple inheritance does not work well for statically defined types. If you " "set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " "will only be inherited from the first base." msgstr "" -#: ../../c-api/typeobj.rst:2274 ../../c-api/typeobj.rst:2297 -#: ../../c-api/typeobj.rst:2314 ../../c-api/typeobj.rst:2331 -#: ../../c-api/typeobj.rst:2347 +#: ../../c-api/typeobj.rst:2279 ../../c-api/typeobj.rst:2302 +#: ../../c-api/typeobj.rst:2319 ../../c-api/typeobj.rst:2336 +#: ../../c-api/typeobj.rst:2352 msgid "This field is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:2279 +#: ../../c-api/typeobj.rst:2284 msgid "" "Tuple containing the expanded set of base types, starting with the type " "itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -#: ../../c-api/typeobj.rst:2287 +#: ../../c-api/typeobj.rst:2292 msgid "" "This field is not inherited; it is calculated fresh by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2293 +#: ../../c-api/typeobj.rst:2298 msgid "Unused. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2302 +#: ../../c-api/typeobj.rst:2307 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -#: ../../c-api/typeobj.rst:2304 +#: ../../c-api/typeobj.rst:2309 msgid "" "To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__`." msgstr "" -#: ../../c-api/typeobj.rst:2309 +#: ../../c-api/typeobj.rst:2314 msgid "" "For some types, this field does not hold a valid :c:expr:`PyObject*`. The " "type was changed to :c:expr:`void*` to indicate this." msgstr "" -#: ../../c-api/typeobj.rst:2319 +#: ../../c-api/typeobj.rst:2324 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2324 +#: ../../c-api/typeobj.rst:2329 msgid "" "Internals detail: For the static builtin types this is always ``NULL``, even " "if weakrefs are added. Instead, the weakrefs for each are stored on " @@ -3612,27 +3619,27 @@ msgid "" "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -#: ../../c-api/typeobj.rst:2338 +#: ../../c-api/typeobj.rst:2343 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "此欄位已被棄用。請改用 :c:member:`~PyTypeObject.tp_finalize`。" -#: ../../c-api/typeobj.rst:2343 +#: ../../c-api/typeobj.rst:2348 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2354 +#: ../../c-api/typeobj.rst:2359 msgid "" "An optional pointer to an instance finalization function. This is the C " "implementation of the :meth:`~object.__del__` special method. Its signature " "is::" msgstr "" -#: ../../c-api/typeobj.rst:2358 +#: ../../c-api/typeobj.rst:2363 msgid "void tp_finalize(PyObject *self);" msgstr "void tp_finalize(PyObject *self);" -#: ../../c-api/typeobj.rst:2360 +#: ../../c-api/typeobj.rst:2365 msgid "" "The primary purpose of finalization is to perform any non-trivial cleanup " "that must be performed before the object is destroyed, while the object and " @@ -3640,7 +3647,7 @@ msgid "" "consistent state. The finalizer is allowed to execute arbitrary Python code." msgstr "" -#: ../../c-api/typeobj.rst:2366 +#: ../../c-api/typeobj.rst:2371 msgid "" "Before Python automatically finalizes an object, some of the object's direct " "or indirect referents might have themselves been automatically finalized. " @@ -3648,14 +3655,14 @@ msgid "" "member:`~PyTypeObject.tp_clear`) yet." msgstr "" -#: ../../c-api/typeobj.rst:2371 +#: ../../c-api/typeobj.rst:2376 msgid "" "Other non-finalized objects might still be using a finalized object, so the " "finalizer must leave the object in a sane state (e.g., invariants are still " "met)." msgstr "" -#: ../../c-api/typeobj.rst:2377 +#: ../../c-api/typeobj.rst:2382 msgid "" "After Python automatically finalizes an object, Python might start " "automatically clearing (:c:member:`~PyTypeObject.tp_clear`) the object and " @@ -3664,7 +3671,7 @@ msgid "" "cleared referents." msgstr "" -#: ../../c-api/typeobj.rst:2385 +#: ../../c-api/typeobj.rst:2390 msgid "" "An object is not guaranteed to be automatically finalized before its " "destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called. It is " @@ -3673,25 +3680,25 @@ msgid "" "finalized before destruction." msgstr "" -#: ../../c-api/typeobj.rst:2393 +#: ../../c-api/typeobj.rst:2398 msgid "" "The :c:member:`~PyTypeObject.tp_finalize` function can be called from any " "thread, although the :term:`GIL` will be held." msgstr "" -#: ../../c-api/typeobj.rst:2398 +#: ../../c-api/typeobj.rst:2403 msgid "" "The :c:member:`!tp_finalize` function can be called during shutdown, after " "some global variables have been deleted. See the documentation of the :meth:" "`~object.__del__` method for details." msgstr "" -#: ../../c-api/typeobj.rst:2402 +#: ../../c-api/typeobj.rst:2407 msgid "" "When Python finalizes an object, it behaves like the following algorithm:" msgstr "" -#: ../../c-api/typeobj.rst:2404 +#: ../../c-api/typeobj.rst:2409 msgid "" "Python might mark the object as *finalized*. Currently, Python always marks " "objects whose type supports garbage collection (i.e., the :c:macro:" @@ -3699,13 +3706,13 @@ msgid "" "never marks other types of objects; this might change in a future version." msgstr "" -#: ../../c-api/typeobj.rst:2409 +#: ../../c-api/typeobj.rst:2414 msgid "" "If the object is not marked as *finalized* and its :c:member:`!tp_finalize` " "finalizer function is non-``NULL``, the finalizer function is called." msgstr "" -#: ../../c-api/typeobj.rst:2412 +#: ../../c-api/typeobj.rst:2417 msgid "" "If the finalizer function was called and the finalizer made the object " "reachable (i.e., there is a reference to the object and it is not a member " @@ -3715,7 +3722,7 @@ msgid "" "make it reachable, i.e., the object is (still) a member of a cyclic isolate." msgstr "" -#: ../../c-api/typeobj.rst:2419 +#: ../../c-api/typeobj.rst:2424 msgid "" "If the finalizer resurrected the object, the object's pending destruction is " "canceled and the object's *finalized* mark might be removed if present. " @@ -3723,7 +3730,7 @@ msgid "" "future version." msgstr "" -#: ../../c-api/typeobj.rst:2424 +#: ../../c-api/typeobj.rst:2429 msgid "" "*Automatic finalization* refers to any finalization performed by Python " "except via calls to :c:func:`PyObject_CallFinalizer` or :c:func:" @@ -3731,14 +3738,14 @@ msgid "" "or how often an object is automatically finalized, except:" msgstr "" -#: ../../c-api/typeobj.rst:2429 +#: ../../c-api/typeobj.rst:2434 msgid "" "Python will not automatically finalize an object if it is reachable, i.e., " "there is a reference to it and it is not a member of a :term:`cyclic " "isolate`." msgstr "" -#: ../../c-api/typeobj.rst:2432 +#: ../../c-api/typeobj.rst:2437 msgid "" "Python will not automatically finalize an object if finalizing it would not " "mark the object as *finalized*. Currently, this applies to objects whose " @@ -3748,53 +3755,53 @@ msgid "" "`PyObject_CallFinalizerFromDealloc`." msgstr "" -#: ../../c-api/typeobj.rst:2438 +#: ../../c-api/typeobj.rst:2443 msgid "" "Python will not automatically finalize any two members of a :term:`cyclic " "isolate` concurrently." msgstr "" -#: ../../c-api/typeobj.rst:2440 +#: ../../c-api/typeobj.rst:2445 msgid "" "Python will not automatically finalize an object after it has automatically " "cleared (:c:member:`~PyTypeObject.tp_clear`) the object." msgstr "" -#: ../../c-api/typeobj.rst:2442 +#: ../../c-api/typeobj.rst:2447 msgid "" "If an object is a member of a :term:`cyclic isolate`, Python will not " "automatically finalize it after automatically clearing (see :c:member:" "`~PyTypeObject.tp_clear`) any other member." msgstr "" -#: ../../c-api/typeobj.rst:2445 +#: ../../c-api/typeobj.rst:2450 msgid "" "Python will automatically finalize every member of a :term:`cyclic isolate` " "before it automatically clears (see :c:member:`~PyTypeObject.tp_clear`) any " "of them." msgstr "" -#: ../../c-api/typeobj.rst:2448 +#: ../../c-api/typeobj.rst:2453 msgid "" "If Python is going to automatically clear an object (:c:member:" "`~PyTypeObject.tp_clear`), it will automatically finalize the object first." msgstr "" -#: ../../c-api/typeobj.rst:2452 +#: ../../c-api/typeobj.rst:2457 msgid "" "Python currently only automatically finalizes objects that are members of a :" "term:`cyclic isolate`, but future versions might finalize objects regularly " "before their destruction." msgstr "" -#: ../../c-api/typeobj.rst:2456 +#: ../../c-api/typeobj.rst:2461 msgid "" "To manually finalize an object, do not call this function directly; call :c:" "func:`PyObject_CallFinalizer` or :c:func:`PyObject_CallFinalizerFromDealloc` " "instead." msgstr "" -#: ../../c-api/typeobj.rst:2460 +#: ../../c-api/typeobj.rst:2465 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should leave the current exception " "status unchanged. The recommended way to write a non-trivial finalizer is " @@ -3805,7 +3812,7 @@ msgid "" "`PyErr_WriteUnraisable` or :c:func:`PyErr_FormatUnraisable`. For example::" msgstr "" -#: ../../c-api/typeobj.rst:2469 +#: ../../c-api/typeobj.rst:2474 msgid "" "static void\n" "foo_finalize(PyObject *self)\n" @@ -3828,26 +3835,26 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:2497 +#: ../../c-api/typeobj.rst:2502 msgid "" "Before version 3.8 it was necessary to set the :c:macro:" "`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " "This is no longer required." msgstr "" -#: ../../c-api/typeobj.rst:2503 +#: ../../c-api/typeobj.rst:2508 msgid ":pep:`442`: \"Safe object finalization\"" msgstr "" -#: ../../c-api/typeobj.rst:2506 +#: ../../c-api/typeobj.rst:2511 msgid ":c:func:`PyObject_CallFinalizer`" msgstr ":c:func:`PyObject_CallFinalizer`" -#: ../../c-api/typeobj.rst:2507 +#: ../../c-api/typeobj.rst:2512 msgid ":c:func:`PyObject_CallFinalizerFromDealloc`" msgstr ":c:func:`PyObject_CallFinalizerFromDealloc`" -#: ../../c-api/typeobj.rst:2514 +#: ../../c-api/typeobj.rst:2519 msgid "" "A :ref:`vectorcall function ` to use for calls of this type " "object (rather than instances). In other words, ``tp_vectorcall`` can be " @@ -3855,13 +3862,13 @@ msgid "" "of *type*." msgstr "" -#: ../../c-api/typeobj.rst:2519 +#: ../../c-api/typeobj.rst:2524 msgid "" "As with any vectorcall function, if ``tp_vectorcall`` is ``NULL``, the " "*tp_call* protocol (``Py_TYPE(type)->tp_call``) is used instead." msgstr "" -#: ../../c-api/typeobj.rst:2524 +#: ../../c-api/typeobj.rst:2529 msgid "" "The :ref:`vectorcall protocol ` requires that the vectorcall " "function has the same behavior as the corresponding ``tp_call``. This means " @@ -3869,27 +3876,27 @@ msgid "" ">tp_call``." msgstr "" -#: ../../c-api/typeobj.rst:2529 +#: ../../c-api/typeobj.rst:2534 msgid "" "Specifically, if *type* uses the default metaclass, ``type->tp_vectorcall`` " "must behave the same as :c:expr:`PyType_Type->tp_call`, which:" msgstr "" -#: ../../c-api/typeobj.rst:2533 +#: ../../c-api/typeobj.rst:2538 msgid "calls ``type->tp_new``," msgstr "呼叫 ``type->tp_new``," -#: ../../c-api/typeobj.rst:2535 +#: ../../c-api/typeobj.rst:2540 msgid "" "if the result is a subclass of *type*, calls ``type->tp_init`` on the result " "of ``tp_new``, and" msgstr "" -#: ../../c-api/typeobj.rst:2538 +#: ../../c-api/typeobj.rst:2543 msgid "returns the result of ``tp_new``." msgstr "回傳 ``tp_new`` 的結果。" -#: ../../c-api/typeobj.rst:2540 +#: ../../c-api/typeobj.rst:2545 msgid "" "Typically, ``tp_vectorcall`` is overridden to optimize this process for " "specific :c:member:`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject." @@ -3898,65 +3905,65 @@ msgid "" "__init__`, respectively)." msgstr "" -#: ../../c-api/typeobj.rst:2551 +#: ../../c-api/typeobj.rst:2556 msgid "This field is never inherited." msgstr "" -#: ../../c-api/typeobj.rst:2553 +#: ../../c-api/typeobj.rst:2558 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: ../../c-api/typeobj.rst:2558 +#: ../../c-api/typeobj.rst:2563 msgid "Internal. Do not use." msgstr "" -#: ../../c-api/typeobj.rst:2566 +#: ../../c-api/typeobj.rst:2571 msgid "Static Types" msgstr "靜態型別" -#: ../../c-api/typeobj.rst:2568 +#: ../../c-api/typeobj.rst:2573 msgid "" "Traditionally, types defined in C code are *static*, that is, a static :c:" "type:`PyTypeObject` structure is defined directly in code and initialized " "using :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2572 +#: ../../c-api/typeobj.rst:2577 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: ../../c-api/typeobj.rst:2574 +#: ../../c-api/typeobj.rst:2579 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: ../../c-api/typeobj.rst:2576 +#: ../../c-api/typeobj.rst:2581 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" -#: ../../c-api/typeobj.rst:2578 +#: ../../c-api/typeobj.rst:2583 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" -#: ../../c-api/typeobj.rst:2582 +#: ../../c-api/typeobj.rst:2587 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "` as an opaque struct, any extension modules using static " "types must be compiled for a specific Python minor version." msgstr "" -#: ../../c-api/typeobj.rst:2590 +#: ../../c-api/typeobj.rst:2595 msgid "Heap Types" msgstr "堆積型別" -#: ../../c-api/typeobj.rst:2592 +#: ../../c-api/typeobj.rst:2597 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " @@ -3964,29 +3971,29 @@ msgid "" "`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: ../../c-api/typeobj.rst:2597 +#: ../../c-api/typeobj.rst:2602 msgid "" "This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" "func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" "`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." msgstr "" -#: ../../c-api/typeobj.rst:2605 +#: ../../c-api/typeobj.rst:2610 msgid "Number Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2612 +#: ../../c-api/typeobj.rst:2617 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the number protocol. Each function is used by the function of " "similar name documented in the :ref:`number` section." msgstr "" -#: ../../c-api/typeobj.rst:2618 ../../c-api/typeobj.rst:3074 +#: ../../c-api/typeobj.rst:2623 ../../c-api/typeobj.rst:3079 msgid "Here is the structure definition::" msgstr "" -#: ../../c-api/typeobj.rst:2620 +#: ../../c-api/typeobj.rst:2625 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -4074,7 +4081,7 @@ msgstr "" " binaryfunc nb_inplace_matrix_multiply;\n" "} PyNumberMethods;" -#: ../../c-api/typeobj.rst:2665 +#: ../../c-api/typeobj.rst:2670 msgid "" "Binary and ternary functions must check the type of all their operands, and " "implement the necessary conversions (at least one of the operands is an " @@ -4084,31 +4091,31 @@ msgid "" "and set an exception." msgstr "" -#: ../../c-api/typeobj.rst:2674 +#: ../../c-api/typeobj.rst:2679 msgid "" "The :c:member:`~PyNumberMethods.nb_reserved` field should always be " "``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " "Python 3.0.1." msgstr "" -#: ../../c-api/typeobj.rst:2825 +#: ../../c-api/typeobj.rst:2830 msgid "Mapping Object Structures" msgstr "對映物件結構" -#: ../../c-api/typeobj.rst:2832 +#: ../../c-api/typeobj.rst:2837 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the mapping protocol. It has three members:" msgstr "" -#: ../../c-api/typeobj.rst:2839 +#: ../../c-api/typeobj.rst:2844 msgid "" "This function is used by :c:func:`PyMapping_Size` and :c:func:" "`PyObject_Size`, and has the same signature. This slot may be set to " "``NULL`` if the object has no defined length." msgstr "" -#: ../../c-api/typeobj.rst:2847 +#: ../../c-api/typeobj.rst:2852 msgid "" "This function is used by :c:func:`PyObject_GetItem` and :c:func:" "`PySequence_GetSlice`, and has the same signature as :c:func:`!" @@ -4116,7 +4123,7 @@ msgid "" "`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2857 +#: ../../c-api/typeobj.rst:2862 msgid "" "This function is used by :c:func:`PyObject_SetItem`, :c:func:" "`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" @@ -4126,17 +4133,17 @@ msgid "" "deletion." msgstr "" -#: ../../c-api/typeobj.rst:2868 +#: ../../c-api/typeobj.rst:2873 msgid "Sequence Object Structures" msgstr "序列物件結構" -#: ../../c-api/typeobj.rst:2875 +#: ../../c-api/typeobj.rst:2880 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: ../../c-api/typeobj.rst:2882 +#: ../../c-api/typeobj.rst:2887 msgid "" "This function is used by :c:func:`PySequence_Size` and :c:func:" "`PyObject_Size`, and has the same signature. It is also used for handling " @@ -4144,21 +4151,21 @@ msgid "" "member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: ../../c-api/typeobj.rst:2891 +#: ../../c-api/typeobj.rst:2896 msgid "" "This function is used by :c:func:`PySequence_Concat` and has the same " "signature. It is also used by the ``+`` operator, after trying the numeric " "addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2899 +#: ../../c-api/typeobj.rst:2904 msgid "" "This function is used by :c:func:`PySequence_Repeat` and has the same " "signature. It is also used by the ``*`` operator, after trying numeric " "multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2907 +#: ../../c-api/typeobj.rst:2912 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -4167,7 +4174,7 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2913 +#: ../../c-api/typeobj.rst:2918 msgid "" "Negative indexes are handled as follows: if the :c:member:" "`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " @@ -4176,7 +4183,7 @@ msgid "" "index is passed as is to the function." msgstr "" -#: ../../c-api/typeobj.rst:2922 +#: ../../c-api/typeobj.rst:2927 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " "signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" @@ -4185,14 +4192,14 @@ msgid "" "``NULL`` if the object does not support item assignment and deletion." msgstr "" -#: ../../c-api/typeobj.rst:2933 +#: ../../c-api/typeobj.rst:2938 msgid "" "This function may be used by :c:func:`PySequence_Contains` and has the same " "signature. This slot may be left to ``NULL``, in this case :c:func:`!" "PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -#: ../../c-api/typeobj.rst:2942 +#: ../../c-api/typeobj.rst:2947 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -4202,7 +4209,7 @@ msgid "" "c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2953 +#: ../../c-api/typeobj.rst:2958 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -4212,76 +4219,76 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2964 +#: ../../c-api/typeobj.rst:2969 msgid "Buffer Object Structures" msgstr "緩衝區物件結構" -#: ../../c-api/typeobj.rst:2972 +#: ../../c-api/typeobj.rst:2977 msgid "" "This structure holds pointers to the functions required by the :ref:`Buffer " "protocol `. The protocol defines how an exporter object can " "expose its internal data to consumer objects." msgstr "" -#: ../../c-api/typeobj.rst:2980 ../../c-api/typeobj.rst:3031 -#: ../../c-api/typeobj.rst:3087 ../../c-api/typeobj.rst:3100 -#: ../../c-api/typeobj.rst:3114 ../../c-api/typeobj.rst:3126 +#: ../../c-api/typeobj.rst:2985 ../../c-api/typeobj.rst:3036 +#: ../../c-api/typeobj.rst:3092 ../../c-api/typeobj.rst:3105 +#: ../../c-api/typeobj.rst:3119 ../../c-api/typeobj.rst:3131 msgid "The signature of this function is::" msgstr "函式的簽名為: ::" -#: ../../c-api/typeobj.rst:2982 +#: ../../c-api/typeobj.rst:2987 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" msgstr "int (PyObject *exporter, Py_buffer *view, int flags);" -#: ../../c-api/typeobj.rst:2984 +#: ../../c-api/typeobj.rst:2989 msgid "" "Handle a request to *exporter* to fill in *view* as specified by *flags*. " "Except for point (3), an implementation of this function MUST take these " "steps:" msgstr "" -#: ../../c-api/typeobj.rst:2988 +#: ../../c-api/typeobj.rst:2993 msgid "" "Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" "expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:2991 +#: ../../c-api/typeobj.rst:2996 msgid "Fill in the requested fields." msgstr "" -#: ../../c-api/typeobj.rst:2993 +#: ../../c-api/typeobj.rst:2998 msgid "Increment an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2995 +#: ../../c-api/typeobj.rst:3000 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: ../../c-api/typeobj.rst:2997 +#: ../../c-api/typeobj.rst:3002 msgid "Return ``0``." msgstr "回傳 ``0``。" -#: ../../c-api/typeobj.rst:2999 +#: ../../c-api/typeobj.rst:3004 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: ../../c-api/typeobj.rst:3002 +#: ../../c-api/typeobj.rst:3007 msgid "" "Re-export: Each member of the tree acts as the exporting object and sets :c:" "expr:`view->obj` to a new reference to itself." msgstr "" -#: ../../c-api/typeobj.rst:3005 +#: ../../c-api/typeobj.rst:3010 msgid "" "Redirect: The buffer request is redirected to the root object of the tree. " "Here, :c:expr:`view->obj` will be a new reference to the root object." msgstr "" -#: ../../c-api/typeobj.rst:3009 +#: ../../c-api/typeobj.rst:3014 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure `, the rules how an exporter must react to " @@ -4289,7 +4296,7 @@ msgid "" "types>`." msgstr "" -#: ../../c-api/typeobj.rst:3014 +#: ../../c-api/typeobj.rst:3019 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " "exporter and must remain valid until there are no consumers left. :c:member:" @@ -4298,23 +4305,23 @@ msgid "" "internal` are read-only for the consumer." msgstr "" -#: ../../c-api/typeobj.rst:3021 +#: ../../c-api/typeobj.rst:3026 msgid "" ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " "buffer while dealing correctly with all request types." msgstr "" -#: ../../c-api/typeobj.rst:3024 +#: ../../c-api/typeobj.rst:3029 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: ../../c-api/typeobj.rst:3033 +#: ../../c-api/typeobj.rst:3038 msgid "void (PyObject *exporter, Py_buffer *view);" msgstr "void (PyObject *exporter, Py_buffer *view);" -#: ../../c-api/typeobj.rst:3035 +#: ../../c-api/typeobj.rst:3040 msgid "" "Handle a request to release the resources of the buffer. If no resources " "need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " @@ -4322,15 +4329,15 @@ msgid "" "these optional steps:" msgstr "" -#: ../../c-api/typeobj.rst:3040 +#: ../../c-api/typeobj.rst:3045 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:3042 +#: ../../c-api/typeobj.rst:3047 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: ../../c-api/typeobj.rst:3044 +#: ../../c-api/typeobj.rst:3049 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " @@ -4338,30 +4345,30 @@ msgid "" "*view* argument." msgstr "" -#: ../../c-api/typeobj.rst:3050 +#: ../../c-api/typeobj.rst:3055 msgid "" "This function MUST NOT decrement :c:expr:`view->obj`, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" -#: ../../c-api/typeobj.rst:3055 +#: ../../c-api/typeobj.rst:3060 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: ../../c-api/typeobj.rst:3063 +#: ../../c-api/typeobj.rst:3068 msgid "Async Object Structures" msgstr "非同步物件結構" -#: ../../c-api/typeobj.rst:3071 +#: ../../c-api/typeobj.rst:3076 msgid "" "This structure holds pointers to the functions required to implement :term:" "`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: ../../c-api/typeobj.rst:3076 +#: ../../c-api/typeobj.rst:3081 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -4377,62 +4384,62 @@ msgstr "" " sendfunc am_send;\n" "} PyAsyncMethods;" -#: ../../c-api/typeobj.rst:3089 +#: ../../c-api/typeobj.rst:3094 msgid "PyObject *am_await(PyObject *self);" msgstr "PyObject *am_await(PyObject *self);" -#: ../../c-api/typeobj.rst:3091 +#: ../../c-api/typeobj.rst:3096 msgid "" "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " "must return ``1`` for it." msgstr "" -#: ../../c-api/typeobj.rst:3094 +#: ../../c-api/typeobj.rst:3099 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: ../../c-api/typeobj.rst:3102 +#: ../../c-api/typeobj.rst:3107 msgid "PyObject *am_aiter(PyObject *self);" msgstr "PyObject *am_aiter(PyObject *self);" -#: ../../c-api/typeobj.rst:3104 +#: ../../c-api/typeobj.rst:3109 msgid "" "Must return an :term:`asynchronous iterator` object. See :meth:`~object." "__anext__` for details." msgstr "" -#: ../../c-api/typeobj.rst:3107 +#: ../../c-api/typeobj.rst:3112 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: ../../c-api/typeobj.rst:3116 +#: ../../c-api/typeobj.rst:3121 msgid "PyObject *am_anext(PyObject *self);" msgstr "PyObject *am_anext(PyObject *self);" -#: ../../c-api/typeobj.rst:3118 +#: ../../c-api/typeobj.rst:3123 msgid "" "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " "details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:3128 +#: ../../c-api/typeobj.rst:3133 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" -#: ../../c-api/typeobj.rst:3130 +#: ../../c-api/typeobj.rst:3135 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:3139 +#: ../../c-api/typeobj.rst:3144 msgid "Slot Type typedefs" msgstr "" -#: ../../c-api/typeobj.rst:3143 +#: ../../c-api/typeobj.rst:3148 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " @@ -4446,80 +4453,80 @@ msgid "" "length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:3153 +#: ../../c-api/typeobj.rst:3158 msgid "" "This function should not do any other instance initialization, not even to " "allocate additional memory; that should be done by :c:member:`~PyTypeObject." "tp_new`." msgstr "" -#: ../../c-api/typeobj.rst:3160 +#: ../../c-api/typeobj.rst:3165 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "請見 :c:member:`~PyTypeObject.tp_free`。" -#: ../../c-api/typeobj.rst:3164 +#: ../../c-api/typeobj.rst:3169 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "請見 :c:member:`~PyTypeObject.tp_new`。" -#: ../../c-api/typeobj.rst:3168 +#: ../../c-api/typeobj.rst:3173 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "請見 :c:member:`~PyTypeObject.tp_init`。" -#: ../../c-api/typeobj.rst:3172 +#: ../../c-api/typeobj.rst:3177 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "請見 :c:member:`~PyTypeObject.tp_repr`。" -#: ../../c-api/typeobj.rst:3176 ../../c-api/typeobj.rst:3185 +#: ../../c-api/typeobj.rst:3181 ../../c-api/typeobj.rst:3190 msgid "Return the value of the named attribute for the object." msgstr "" -#: ../../c-api/typeobj.rst:3180 ../../c-api/typeobj.rst:3191 +#: ../../c-api/typeobj.rst:3185 ../../c-api/typeobj.rst:3196 msgid "" "Set the value of the named attribute for the object. The value argument is " "set to ``NULL`` to delete the attribute." msgstr "" -#: ../../c-api/typeobj.rst:3187 +#: ../../c-api/typeobj.rst:3192 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_getattro`。" -#: ../../c-api/typeobj.rst:3194 +#: ../../c-api/typeobj.rst:3199 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_setattro`。" -#: ../../c-api/typeobj.rst:3198 +#: ../../c-api/typeobj.rst:3203 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_get`。" -#: ../../c-api/typeobj.rst:3202 +#: ../../c-api/typeobj.rst:3207 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_set`。" -#: ../../c-api/typeobj.rst:3206 +#: ../../c-api/typeobj.rst:3211 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "請見 :c:member:`~PyTypeObject.tp_hash`。" -#: ../../c-api/typeobj.rst:3210 +#: ../../c-api/typeobj.rst:3215 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" -#: ../../c-api/typeobj.rst:3214 +#: ../../c-api/typeobj.rst:3219 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "請見 :c:member:`~PyTypeObject.tp_iter`。" -#: ../../c-api/typeobj.rst:3218 +#: ../../c-api/typeobj.rst:3223 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "請見 :c:member:`~PyTypeObject.tp_iternext`。" -#: ../../c-api/typeobj.rst:3232 +#: ../../c-api/typeobj.rst:3237 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "請見 :c:member:`~PyAsyncMethods.am_send`。" -#: ../../c-api/typeobj.rst:3248 +#: ../../c-api/typeobj.rst:3253 msgid "Examples" msgstr "範例" -#: ../../c-api/typeobj.rst:3250 +#: ../../c-api/typeobj.rst:3255 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -4527,11 +4534,11 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: ../../c-api/typeobj.rst:3255 +#: ../../c-api/typeobj.rst:3260 msgid "A basic :ref:`static type `::" msgstr "" -#: ../../c-api/typeobj.rst:3257 +#: ../../c-api/typeobj.rst:3262 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4563,13 +4570,13 @@ msgstr "" " .tp_repr = (reprfunc)myobj_repr,\n" "};" -#: ../../c-api/typeobj.rst:3272 +#: ../../c-api/typeobj.rst:3277 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: ../../c-api/typeobj.rst:3275 +#: ../../c-api/typeobj.rst:3280 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4653,11 +4660,11 @@ msgstr "" " myobj_new, /* tp_new */\n" "};" -#: ../../c-api/typeobj.rst:3316 +#: ../../c-api/typeobj.rst:3321 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: ../../c-api/typeobj.rst:3318 +#: ../../c-api/typeobj.rst:3323 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4683,14 +4690,14 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:3341 +#: ../../c-api/typeobj.rst:3346 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " "instances (e.g. uses a separate factory func) using :c:macro:" "`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" -#: ../../c-api/typeobj.rst:3345 +#: ../../c-api/typeobj.rst:3350 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -4708,12 +4715,12 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:3360 +#: ../../c-api/typeobj.rst:3365 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" -#: ../../c-api/typeobj.rst:3362 +#: ../../c-api/typeobj.rst:3367 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4733,13 +4740,13 @@ msgstr "" " .tp_name = \"mymod.MyObject\",\n" "};" -#: ../../c-api/typeobj.rst:3371 +#: ../../c-api/typeobj.rst:3376 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" msgstr "" -#: ../../c-api/typeobj.rst:3373 +#: ../../c-api/typeobj.rst:3378 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n"