55#
66# Translators:
778+ # Dai Xu <[email protected] >, 20219+ # Freesand Leo <[email protected] >, 2021810#
911#, fuzzy
1012msgid ""
@@ -13,7 +15,7 @@ msgstr ""
1315"Report-Msgid-Bugs-To : \n "
1416"POT-Creation-Date : 2021-06-29 12:56+0000\n "
1517"PO-Revision-Date : 2021-06-28 00:49+0000\n "
16- "Last-Translator : 汪心禾 <wangxinhe06@gmail .com>, 2021\n "
18+ "Last-Translator : Freesand Leo <yuqinju@163 .com>, 2021\n "
1719"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
1820"MIME-Version : 1.0\n "
1921"Content-Type : text/plain; charset=UTF-8\n "
@@ -29,14 +31,15 @@ msgstr "对象协议"
2931msgid ""
3032"The ``NotImplemented`` singleton, used to signal that an operation is not "
3133"implemented for the given type combination."
32- msgstr ""
34+ msgstr "``NotImplemented`` 单例,用于标记某个操作没有针对给定类型组合的实现。 "
3335
3436#: ../../c-api/object.rst:17
3537msgid ""
3638"Properly handle returning :c:data:`Py_NotImplemented` from within a C "
3739"function (that is, increment the reference count of NotImplemented and "
3840"return it)."
3941msgstr ""
42+ "C 函数内部应正确处理 :c:data:`Py_NotImplemented` 的返回过程(即增加 NotImplemented 的引用计数并返回之)。"
4043
4144#: ../../c-api/object.rst:24
4245msgid ""
@@ -45,20 +48,26 @@ msgid ""
4548"currently supported is :const:`Py_PRINT_RAW`; if given, the :func:`str` of "
4649"the object is written instead of the :func:`repr`."
4750msgstr ""
51+ "向文件 *fp* 输出对象 *o*。出错时返回 ``-1``。参数 flags 用于开启某些输出选项。目前唯一支持的选项是 "
52+ ":const:`Py_PRINT_RAW` ;如果给出该选项,则对象的 :func:`str` 将被写入,而不是 :func:`repr` 。"
4853
4954#: ../../c-api/object.rst:32 ../../c-api/object.rst:43
5055msgid ""
5156"Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. "
5257"This is equivalent to the Python expression ``hasattr(o, attr_name)``. This"
5358" function always succeeds."
5459msgstr ""
60+ "如果 *o* 带有属性 *attr_name*,则返回 ``1``,否则返回 ``0``。这相当于 Python 表达式 ``hasattr(o, "
61+ "attr_name)``。 此函数总是成功。"
5562
5663#: ../../c-api/object.rst:36
5764msgid ""
5865"Note that exceptions which occur while calling :meth:`__getattr__` and "
5966":meth:`__getattribute__` methods will get suppressed. To get error reporting"
6067" use :c:func:`PyObject_GetAttr()` instead."
6168msgstr ""
69+ "注意,在调用 :meth:`__getattr__` 和 :meth:`__getattribute__` "
70+ "方法时发生的异常将被抑制。若要获得错误报告,请换用 :c:func:`PyObject_GetAttr()` 。"
6271
6372#: ../../c-api/object.rst:47
6473msgid ""
@@ -67,20 +76,26 @@ msgid ""
6776" get suppressed. To get error reporting use "
6877":c:func:`PyObject_GetAttrString()` instead."
6978msgstr ""
79+ "注意,在调用 :meth:`__getattr__` 和 :meth:`__getattribute__` "
80+ "方法并创建一个临时字符串对象时,异常将被抑制。若要获得错误报告,请换用 :c:func:`PyObject_GetAttrString()` 。"
7081
7182#: ../../c-api/object.rst:55
7283msgid ""
7384"Retrieve an attribute named *attr_name* from object *o*. Returns the "
7485"attribute value on success, or ``NULL`` on failure. This is the equivalent "
7586"of the Python expression ``o.attr_name``."
7687msgstr ""
88+ "从对象 *o* 中读取名为 *attr_name* 的属性。成功返回属性值,失败则返回 ``NULL``。 这相当于 Python 表达式 "
89+ "``o.attr_name``。"
7790
7891#: ../../c-api/object.rst:62
7992msgid ""
8093"Retrieve an attribute named *attr_name* from object *o*. Returns the "
8194"attribute value on success, or ``NULL`` on failure. This is the equivalent "
8295"of the Python expression ``o.attr_name``."
8396msgstr ""
97+ "从对象 *o* 中读取一个名为 *attr_name* 的属性。成功时返回属性值,失败则返回 ``NULL``。这相当于 Python 表达式 "
98+ "``o.attr_name``。"
8499
85100#: ../../c-api/object.rst:69
86101msgid ""
@@ -91,6 +106,9 @@ msgid ""
91106"data descriptors take preference over instance attributes, while non-data "
92107"descriptors don't. Otherwise, an :exc:`AttributeError` is raised."
93108msgstr ""
109+ "通用的属性获取函数,用于放入类型对象的 ``tp_getattro`` 槽中。它在类的字典中(位于对象的 MRO 中)查找某个描述符,并在对象的 "
110+ ":attr:`~object.__dict__` 中查找某个属性。正如 :ref:`descriptors` "
111+ "所述,数据描述符优先于实例属性,而非数据描述符则不优先。失败则会触发 :exc:`AttributeError` 。"
94112
95113#: ../../c-api/object.rst:79 ../../c-api/object.rst:90
96114msgid ""
@@ -99,18 +117,21 @@ msgid ""
99117"success. This is the equivalent of the Python statement ``o.attr_name = "
100118"v``."
101119msgstr ""
120+ "将对象 *o* 中名为 *attr_name* 的属性值设为 *v* 。失败时引发异常并返回 ``-1``;成功时返 回``0`` 。这相当于 "
121+ "Python 语句 ``o.attr_name = v``。"
102122
103123#: ../../c-api/object.rst:84
104124msgid ""
105125"If *v* is ``NULL``, the attribute is deleted, however this feature is "
106126"deprecated in favour of using :c:func:`PyObject_DelAttr`."
107- msgstr ""
127+ msgstr "如果 *v* 为 ``NULL``,属性将被删除,但是此功能已被弃用,应改用 :c:func:`PySequence_DelItem` 。 "
108128
109129#: ../../c-api/object.rst:95
110130msgid ""
111131"If *v* is ``NULL``, the attribute is deleted, however this feature is "
112132"deprecated in favour of using :c:func:`PyObject_DelAttrString`."
113133msgstr ""
134+ "如果 *v* 为 ``NULL``,该属性将被删除,但是此功能已被弃用,应改用 :c:func:`PyObject_DelAttrString` 。"
114135
115136#: ../../c-api/object.rst:101
116137msgid ""
@@ -123,24 +144,30 @@ msgid ""
123144"returned, otherwise an :exc:`AttributeError` is raised and ``-1`` is "
124145"returned."
125146msgstr ""
147+ "通用的属性设置和删除函数,用于放入类型对象的 :c:member:`~PyTypeObject.tp_setattro` "
148+ "槽。它在类的字典中(位于对象的MRO中)查找数据描述器,如果找到,则将比在实例字典中设置或删除属性优先执行。否则,该属性将在对象的 "
149+ ":attr:`~object.__dict__` 中设置或删除。如果成功将返回 ``0``,否则将引发 :exc:`AttributeError` "
150+ "并返回 ``-1``。"
126151
127152#: ../../c-api/object.rst:113 ../../c-api/object.rst:119
128153msgid ""
129154"Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on "
130155"failure. This is the equivalent of the Python statement ``del o.attr_name``."
131156msgstr ""
157+ "删除对象 *o* 中名为 *attr_name* 的属性。失败时返回 ``-1``。这相当于 Python 语句 ``del "
158+ "o.attr_name``。"
132159
133160#: ../../c-api/object.rst:125
134161msgid ""
135162"A generic implementation for the getter of a ``__dict__`` descriptor. It "
136163"creates the dictionary if necessary."
137- msgstr ""
164+ msgstr "``__dict__`` 描述符的获取函数的一种通用实现。必要时会创建该字典。 "
138165
139166#: ../../c-api/object.rst:133
140167msgid ""
141168"A generic implementation for the setter of a ``__dict__`` descriptor. This "
142169"implementation does not allow the dictionary to be deleted."
143- msgstr ""
170+ msgstr "``__dict__`` 描述符设置函数的一种通用实现。这里不允许删除该字典。 "
144171
145172#: ../../c-api/object.rst:141
146173msgid ""
@@ -152,6 +179,10 @@ msgid ""
152179"operator corresponding to *opid*. Returns the value of the comparison on "
153180"success, or ``NULL`` on failure."
154181msgstr ""
182+ "用 *opid* 指定的操作比较 *o1* 和 *o2* 的值,必须是 :const:`Py_LT` 、 :const:`Py_LE` 、 "
183+ ":const:`Py_EQ` 、 :const:`Py_NE` 、 :const:`Py_GT` 或 :const:`Py_GE` "
184+ "之一,分别对应于``<=`` 、``==`` 、 ``!=`` 、``>`` 或 ``>=``。这相当于 Python 表达式 ``o1 op "
185+ "o2``,其中 ``op`` 是对应于 *opid* 的操作符。成功时返回比较值,失败时返回 ``NULL``。"
155186
156187#: ../../c-api/object.rst:151
157188msgid ""
@@ -163,12 +194,18 @@ msgid ""
163194" of the Python expression ``o1 op o2``, where ``op`` is the operator "
164195"corresponding to *opid*."
165196msgstr ""
197+ "用 *opid* 指定的操作比较 *o1* 和 *o2* 的值,必须是 :const:`Py_LT` 、 :const:`Py_LE` 、 "
198+ ":const:`Py_EQ` 、 :const:`Py_NE` 、 :const:`Py_GT` 或 :const:`Py_GE` 之一,分别对应于 "
199+ "``<`` 、``<=``、 ``==`` 、``!=`` 、``>`` 或 ``>=``。错误时返回 ``-1``,若结果为 false 则返回 "
200+ "``0``,否则返回 ``1``。这相当于 Python 表达式 ``o1 op o2``,其中 ``op`` 是对应于 *opid* 的操作符。"
166201
167202#: ../../c-api/object.rst:160
168203msgid ""
169204"If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool` "
170205"will always return ``1`` for :const:`Py_EQ` and ``0`` for :const:`Py_NE`."
171206msgstr ""
207+ "如果 *o1* 和 *o2* 是同一个对象,:c:func:`PyObject_RichCompareBool` 为 :const:`Py_EQ` "
208+ "则返回 ``1`` ,为 :const:`Py_NE` 则返回 ``0``。"
172209
173210#: ../../c-api/object.rst:167
174211msgid ""
@@ -177,12 +214,14 @@ msgid ""
177214"the Python expression ``repr(o)``. Called by the :func:`repr` built-in "
178215"function."
179216msgstr ""
217+ "计算对象 *o* 的字符串形式。 成功时返回字符串,失败时返回 ``NULL``。 这相当于 Python 表达式 ``repr(o)``。 由内置函数"
218+ " :func:`repr` 调用。"
180219
181220#: ../../c-api/object.rst:171 ../../c-api/object.rst:195
182221msgid ""
183222"This function now includes a debug assertion to help ensure that it does not"
184223" silently discard an active exception."
185- msgstr ""
224+ msgstr "该函数现在包含一个调试断言,用以确保不会静默地丢弃活动的异常。 "
186225
187226#: ../../c-api/object.rst:179
188227msgid ""
@@ -192,6 +231,9 @@ msgid ""
192231"generates a string similar to that returned by :c:func:`PyObject_Repr` in "
193232"Python 2. Called by the :func:`ascii` built-in function."
194233msgstr ""
234+ "与 :c:func:`PyObject_Repr` 一样,计算对象 *o* 的字符串形式,但在 :c:func:`PyObject_Repr` "
235+ "返回的字符串中用 ``\\ x``、``\\ u`` 或 ``\\ U`` 转义非 ASCII 字符。这将生成一个类似于 Python 2 中由 "
236+ ":c:func:`PyObject_Repr` 返回的字符串。由内置函数 :func:`ascii` 调用。"
195237
196238#: ../../c-api/object.rst:190
197239msgid ""
@@ -200,6 +242,8 @@ msgid ""
200242"the Python expression ``str(o)``. Called by the :func:`str` built-in "
201243"function and, therefore, by the :func:`print` function."
202244msgstr ""
245+ "计算对象 *o* 的字符串形式。 成功时返回字符串,失败时返回 ``NULL``。 这相当于 Python 表达式 ``str(o)``。由内置函数 "
246+ ":func:`str` 调用,因此也由 :func:`print` 函数调用。"
203247
204248#: ../../c-api/object.rst:204
205249msgid ""
@@ -209,19 +253,22 @@ msgid ""
209253" TypeError is raised when *o* is an integer instead of a zero-initialized "
210254"bytes object."
211255msgstr ""
256+ "计算对象 *o* 的字节形式。失败时返回 ``NULL``,成功时返回一个字节串对象。这相当于 *o* 不是整数时的 Python 表达式 "
257+ "``bytes(o)`` 。与 ``bytes(o)`` 不同的是,当 *o* 是整数而不是初始为 0 的字节串对象时,会触发 TypeError。"
212258
213259#: ../../c-api/object.rst:213
214260msgid ""
215261"Return ``1`` if the class *derived* is identical to or derived from the "
216262"class *cls*, otherwise return ``0``. In case of an error, return ``-1``."
217- msgstr ""
263+ msgstr "如果 *derived* 类与 *cls* 类相同或为其派生类,则返回 ``1``,否则返回 ``0``。 如果出错则返回 ``-1``。 "
218264
219265#: ../../c-api/object.rst:216 ../../c-api/object.rst:235
220266msgid ""
221267"If *cls* is a tuple, the check will be done against every entry in *cls*. "
222268"The result will be ``1`` when at least one of the checks returns ``1``, "
223269"otherwise it will be ``0``."
224270msgstr ""
271+ "如果 *cls* 是元组,则会对 *cls* 进行逐项检测。如果至少有一次检测返回 ``1``,结果将为 ``1``,否则将是 ``0``。"
225272
226273#: ../../c-api/object.rst:220
227274msgid ""
0 commit comments