# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # # Translators: # python-doc bot, 2025 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.9\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-01-03 16:35+0000\n" "PO-Revision-Date: 2025-09-22 17:54+0000\n" "Last-Translator: python-doc bot, 2025\n" "Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: zh_CN\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../c-api/tuple.rst:6 msgid "Tuple Objects" msgstr "元组对象" #: ../../c-api/tuple.rst:13 msgid "This subtype of :c:type:`PyObject` represents a Python tuple object." msgstr "这个 :c:type:`PyObject` 的子类型代表一个 Python 的元组对象。" #: ../../c-api/tuple.rst:18 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python tuple type; it" " is the same object as :class:`tuple` in the Python layer." msgstr "" ":c:type:`PyTypeObject` 的实例代表一个 Python 元组类型,这与 Python 层面的 :class:`tuple` " "是相同的对象。" #: ../../c-api/tuple.rst:24 msgid "" "Return true if *p* is a tuple object or an instance of a subtype of the " "tuple type. This function always succeeds." msgstr "如果 *p* 是一个 tuple 对象或者 tuple 类型的子类型的实例则返回真值。 此函数总是会成功执行。" #: ../../c-api/tuple.rst:30 msgid "" "Return true if *p* is a tuple object, but not an instance of a subtype of " "the tuple type. This function always succeeds." msgstr "如果 *p* 是一个 tuple 对象但不是 tuple 类型的子类型的实例则返回真值。 此函数总是会成功执行。" #: ../../c-api/tuple.rst:36 msgid "Return a new tuple object of size *len*, or ``NULL`` on failure." msgstr "成功时返回一个新的元组对象,长度为 *len*,失败时返回 ``NULL``。" #: ../../c-api/tuple.rst:41 msgid "" "Return a new tuple object of size *n*, or ``NULL`` on failure. The tuple " "values are initialized to the subsequent *n* C arguments pointing to Python " "objects. ``PyTuple_Pack(2, a, b)`` is equivalent to " "``Py_BuildValue(\"(OO)\", a, b)``." msgstr "" "成功时返回一个新的元组对象,大小为 *n* ,失败时返回 ``NULL``。 元组值初始化为指向 Python 对象的后续 *n* 个 C 参数。 " "``PyTuple_Pack(2, a, b)`` 和 ``Py_BuildValue(\"(OO)\", a, b)`` 相等。" #: ../../c-api/tuple.rst:48 msgid "Take a pointer to a tuple object, and return the size of that tuple." msgstr "获取指向元组对象的指针,并返回该元组的大小。" #: ../../c-api/tuple.rst:53 msgid "" "Return the size of the tuple *p*, which must be non-``NULL`` and point to a " "tuple; no error checking is performed." msgstr "返回元组 *p* 的大小,它必须为非 ``NULL`` 并且指向一个元组;不执行错误检查。" #: ../../c-api/tuple.rst:59 msgid "" "Return the object at position *pos* in the tuple pointed to by *p*. If " "*pos* is out of bounds, return ``NULL`` and set an :exc:`IndexError` " "exception." msgstr "" "返回 *p* 所指向的元组中,位于 *pos* 处的对象。 如果 *pos* 超出界限,返回 ``NULL``,并抛出一个 " ":exc:`IndexError` 异常。" #: ../../c-api/tuple.rst:65 msgid "Like :c:func:`PyTuple_GetItem`, but does no checking of its arguments." msgstr "类似于 :c:func:`PyTuple_GetItem`,但不检查其参数。" #: ../../c-api/tuple.rst:70 msgid "" "Return the slice of the tuple pointed to by *p* between *low* and *high*, or" " ``NULL`` on failure. This is the equivalent of the Python expression " "``p[low:high]``. Indexing from the end of the list is not supported." msgstr "" "返回 *p* 所指向的元组的切片,在 *low* 和 *high* 之间,或者在失败时返回 ``NULL``。 这等同于 Python 表达式 " "``p[low:high]``。 不支持从列表末尾索引。" #: ../../c-api/tuple.rst:77 msgid "" "Insert a reference to object *o* at position *pos* of the tuple pointed to " "by *p*. Return ``0`` on success. If *pos* is out of bounds, return ``-1`` " "and set an :exc:`IndexError` exception." msgstr "" "在 *p* 指向的元组的 *pos* 位置插入对对象 *o* 的引用。 成功时返回 ``0``;如果 *pos* 越界,则返回 ``-1``,并抛出一个" " :exc:`IndexError` 异常。" #: ../../c-api/tuple.rst:83 msgid "" "This function \"steals\" a reference to *o* and discards a reference to an " "item already in the tuple at the affected position." msgstr "此函数会“窃取”对 *o* 的引用,并丢弃对元组中已在受影响位置的条目的引用。" #: ../../c-api/tuple.rst:89 msgid "" "Like :c:func:`PyTuple_SetItem`, but does no error checking, and should " "*only* be used to fill in brand new tuples." msgstr "类似于 :c:func:`PyTuple_SetItem`,但不进行错误检查,并且应该 *只是* 被用来填充全新的元组。" #: ../../c-api/tuple.rst:94 msgid "" "This macro \"steals\" a reference to *o*, and, unlike " ":c:func:`PyTuple_SetItem`, does *not* discard a reference to any item that " "is being replaced; any reference in the tuple at position *pos* will be " "leaked." msgstr "" "这个宏会“偷走”一个对 *o* 的引用,但与 :c:func:`PyTuple_SetItem` 不同,它 *不会* " "丢弃对任何被替换项的引用;元组中位于 *pos* 位置的任何引用都将被泄漏。" #: ../../c-api/tuple.rst:102 msgid "" "Can be used to resize a tuple. *newsize* will be the new length of the " "tuple. Because tuples are *supposed* to be immutable, this should only be " "used if there is only one reference to the object. Do *not* use this if the" " tuple may already be known to some other part of the code. The tuple will " "always grow or shrink at the end. Think of this as destroying the old tuple" " and creating a new one, only more efficiently. Returns ``0`` on success. " "Client code should never assume that the resulting value of ``*p`` will be " "the same as before calling this function. If the object referenced by ``*p``" " is replaced, the original ``*p`` is destroyed. On failure, returns ``-1`` " "and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` or " ":exc:`SystemError`." msgstr "" "可以用于调整元组的大小。 *newsize* 将是元组的新长度。 因为元组 *被认为* 是不可变的,所以只有在对象仅有一个引用时,才应该使用它。 " "如果元组已经被代码的其他部分所引用,请不要使用此项。 元组在最后总是会增长或缩小。 把它看作是销毁旧元组并创建一个新元组,只会更有效。 成功时返回 " "``0`` 。 客户端代码不应假定 ``*p`` 的结果值将与调用此函数之前的值相同。 如果替换了 ``*p`` 引用的对象,则原始的 ``*p`` " "将被销毁。 失败时,返回 ``-1``,将 ``*p`` 设置为 ``NULL``,并引发 :exc:`MemoryError` 或者 " ":exc:`SystemError`。" #: ../../c-api/tuple.rst:115 msgid "Struct Sequence Objects" msgstr "结构序列对象" #: ../../c-api/tuple.rst:117 msgid "" "Struct sequence objects are the C equivalent of " ":func:`~collections.namedtuple` objects, i.e. a sequence whose items can " "also be accessed through attributes. To create a struct sequence, you first " "have to create a specific struct sequence type." msgstr "" "结构序列对象是等价于 :func:`~collections.namedtuple` 的 C 对象,即一个序列,其中的条目也可以通过属性访问。 " "要创建结构序列,你首先必须创建特定的结构序列类型。" #: ../../c-api/tuple.rst:124 msgid "" "Create a new struct sequence type from the data in *desc*, described below. " "Instances of the resulting type can be created with " ":c:func:`PyStructSequence_New`." msgstr "" "根据 *desc* 中的数据创建一个新的结构序列类型,如下所述。 可以使用 :c:func:`PyStructSequence_New` " "创建结果类型的实例。" #: ../../c-api/tuple.rst:130 msgid "Initializes a struct sequence type *type* from *desc* in place." msgstr "从 *desc* 就地初始化结构序列类型 *type*。" #: ../../c-api/tuple.rst:135 msgid "" "The same as ``PyStructSequence_InitType``, but returns ``0`` on success and " "``-1`` on failure." msgstr "与 ``PyStructSequence_InitType`` 相同,但成功时返回 ``0`` ,失败时返回 ``-1`` 。" #: ../../c-api/tuple.rst:143 msgid "Contains the meta information of a struct sequence type to create." msgstr "包含要创建的结构序列类型的元信息。" #: ../../c-api/tuple.rst:146 ../../c-api/tuple.rst:169 msgid "Field" msgstr "域" #: ../../c-api/tuple.rst:146 ../../c-api/tuple.rst:169 msgid "C Type" msgstr "C 类型" #: ../../c-api/tuple.rst:146 ../../c-api/tuple.rst:169 msgid "Meaning" msgstr "含意" #: ../../c-api/tuple.rst:148 ../../c-api/tuple.rst:171 msgid "``name``" msgstr "``name``" #: ../../c-api/tuple.rst:148 ../../c-api/tuple.rst:150 #: ../../c-api/tuple.rst:171 ../../c-api/tuple.rst:176 msgid "``const char *``" msgstr "``const char *``" #: ../../c-api/tuple.rst:148 msgid "name of the struct sequence type" msgstr "结构序列类型的名称" #: ../../c-api/tuple.rst:150 ../../c-api/tuple.rst:176 msgid "``doc``" msgstr "``doc``" #: ../../c-api/tuple.rst:150 msgid "pointer to docstring for the type or ``NULL`` to omit" msgstr "指向要忽略类型的文档字符串或 ``NULL`` 的指针" #: ../../c-api/tuple.rst:153 msgid "``fields``" msgstr "``fields``" #: ../../c-api/tuple.rst:153 msgid "``PyStructSequence_Field *``" msgstr "``PyStructSequence_Field *``" #: ../../c-api/tuple.rst:153 msgid "pointer to ``NULL``-terminated array with field names of the new type" msgstr "指向以 ``NULL`` 结尾的数组的指针,其字段名称为新类型" #: ../../c-api/tuple.rst:156 msgid "``n_in_sequence``" msgstr "``n_in_sequence``" #: ../../c-api/tuple.rst:156 msgid "``int``" msgstr "``int``" #: ../../c-api/tuple.rst:156 msgid "number of fields visible to the Python side (if used as tuple)" msgstr "Python侧可见的字段数(如果用作元组)" #: ../../c-api/tuple.rst:163 msgid "" "Describes a field of a struct sequence. As a struct sequence is modeled as a" " tuple, all fields are typed as :c:type:`PyObject*`. The index in the " ":attr:`fields` array of the :c:type:`PyStructSequence_Desc` determines which" " field of the struct sequence is described." msgstr "" "描述结构序列的一个字段。 当结构序列被建模为元组时,所有字段的类型都是 :c:type:`PyObject*`。 在 " ":c:type:`PyStructSequence_Desc` 的 :attr:`fields` 数组中的索引确定了结构序列描述的是哪个字段。" #: ../../c-api/tuple.rst:171 msgid "" "name for the field or ``NULL`` to end the list of named fields, set to " ":c:data:`PyStructSequence_UnnamedField` to leave unnamed" msgstr "" "字段的名称或 ``NULL`` ,若要结束命名字段的列表,请设置为 :c:data:`PyStructSequence_UnnamedField` " "以保留未命名字段" #: ../../c-api/tuple.rst:176 msgid "field docstring or ``NULL`` to omit" msgstr "要忽略的字段文档字符串或 ``NULL``" #: ../../c-api/tuple.rst:182 msgid "Special value for a field name to leave it unnamed." msgstr "字段名的特殊值将保持未命名状态。" #: ../../c-api/tuple.rst:184 msgid "The type was changed from ``char *``." msgstr "这个类型已从 ``char *`` 更改。" #: ../../c-api/tuple.rst:190 msgid "" "Creates an instance of *type*, which must have been created with " ":c:func:`PyStructSequence_NewType`." msgstr "创建 *type* 的实例,该实例必须使用 :c:func:`PyStructSequence_NewType` 创建。" #: ../../c-api/tuple.rst:196 msgid "" "Return the object at position *pos* in the struct sequence pointed to by " "*p*. No bounds checking is performed." msgstr "返回 *p* 所指向的结构序列中,位于 *pos* 处的对象。不需要进行边界检查。" #: ../../c-api/tuple.rst:202 msgid "Macro equivalent of :c:func:`PyStructSequence_GetItem`." msgstr ":c:func:`PyStructSequence_GetItem` 的宏版本。" #: ../../c-api/tuple.rst:207 msgid "" "Sets the field at index *pos* of the struct sequence *p* to value *o*. Like" " :c:func:`PyTuple_SET_ITEM`, this should only be used to fill in brand new " "instances." msgstr "" "将结构序列 *p* 的索引 *pos* 处的字段设置为值 *o*。 与 :c:func:`PyTuple_SET_ITEM` " "一样,它应该只用于填充全新的实例。" #: ../../c-api/tuple.rst:213 ../../c-api/tuple.rst:222 msgid "This function \"steals\" a reference to *o*." msgstr "这个函数“窃取”了指向 *o* 的一个引用。" #: ../../c-api/tuple.rst:218 msgid "Macro equivalent of :c:func:`PyStructSequence_SetItem`." msgstr ":c:func:`PyStructSequence_SetItem` 的宏版本。"