66# Translators:
7788# Yi Cao <[email protected] >, 20209- # Freesand Leo <[email protected] >, 2020109# helloworldSB <[email protected] >, 202110+ # Dai Xu <[email protected] >, 202111+ # Freesand Leo <[email protected] >, 20211112#
1213#, fuzzy
1314msgid ""
@@ -16,7 +17,7 @@ msgstr ""
1617"Report-Msgid-Bugs-To : \n "
1718"POT-Creation-Date : 2021-01-01 16:02+0000\n "
1819"PO-Revision-Date : 2019-09-01 03:39+0000\n "
19- "Last-Translator : helloworldSB <warningfor163@foxmail .com>, 2021\n "
20+ "Last-Translator : Freesand Leo <yuqinju@163 .com>, 2021\n "
2021"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2122"MIME-Version : 1.0\n "
2223"Content-Type : text/plain; charset=UTF-8\n "
@@ -32,14 +33,15 @@ msgstr "对象协议"
3233msgid ""
3334"The ``NotImplemented`` singleton, used to signal that an operation is not "
3435"implemented for the given type combination."
35- msgstr ""
36+ msgstr "``NotImplemented`` 单例,用于标记某个操作没有针对给定类型组合的实现。 "
3637
3738#: ../../c-api/object.rst:17
3839msgid ""
3940"Properly handle returning :c:data:`Py_NotImplemented` from within a C "
4041"function (that is, increment the reference count of NotImplemented and "
4142"return it)."
4243msgstr ""
44+ "C 函数内部应正确处理 :c:data:`Py_NotImplemented` 的返回过程(即增加 NotImplemented 的引用计数并返回之)。"
4345
4446#: ../../c-api/object.rst:24
4547msgid ""
@@ -48,20 +50,26 @@ msgid ""
4850"currently supported is :const:`Py_PRINT_RAW`; if given, the :func:`str` of "
4951"the object is written instead of the :func:`repr`."
5052msgstr ""
53+ "向文件 *fp* 输出对象 *o*。出错时返回 ``-1``。参数 flags 用于开启某些输出选项。目前唯一支持的选项是 "
54+ ":const:`Py_PRINT_RAW` ;如果给出该选项,则对象的 :func:`str` 将被写入,而不是 :func:`repr` 。"
5155
5256#: ../../c-api/object.rst:32 ../../c-api/object.rst:43
5357msgid ""
5458"Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. "
5559"This is equivalent to the Python expression ``hasattr(o, attr_name)``. This"
5660" function always succeeds."
5761msgstr ""
62+ "如果 *o* 带有属性 *attr_name*,则返回 ``1``,否则返回 ``0``。这相当于 Python 表达式 ``hasattr(o, "
63+ "attr_name)``。 此函数总是成功。"
5864
5965#: ../../c-api/object.rst:36
6066msgid ""
6167"Note that exceptions which occur while calling :meth:`__getattr__` and "
6268":meth:`__getattribute__` methods will get suppressed. To get error reporting"
6369" use :c:func:`PyObject_GetAttr()` instead."
6470msgstr ""
71+ "注意,在调用 :meth:`__getattr__` 和 :meth:`__getattribute__` "
72+ "方法时发生的异常将被抑制。若要获得错误报告,请换用 :c:func:`PyObject_GetAttr()` 。"
6573
6674#: ../../c-api/object.rst:47
6775msgid ""
@@ -70,20 +78,26 @@ msgid ""
7078" get suppressed. To get error reporting use "
7179":c:func:`PyObject_GetAttrString()` instead."
7280msgstr ""
81+ "注意,在调用 :meth:`__getattr__` 和 :meth:`__getattribute__` "
82+ "方法并创建一个临时字符串对象时,异常将被抑制。若要获得错误报告,请换用 :c:func:`PyObject_GetAttrString()` 。"
7383
7484#: ../../c-api/object.rst:55
7585msgid ""
7686"Retrieve an attribute named *attr_name* from object *o*. Returns the "
7787"attribute value on success, or ``NULL`` on failure. This is the equivalent "
7888"of the Python expression ``o.attr_name``."
7989msgstr ""
90+ "从对象 *o* 中读取名为 *attr_name* 的属性。成功返回属性值,失败则返回 ``NULL``。 这相当于 Python 表达式 "
91+ "``o.attr_name``。"
8092
8193#: ../../c-api/object.rst:62
8294msgid ""
8395"Retrieve an attribute named *attr_name* from object *o*. Returns the "
8496"attribute value on success, or ``NULL`` on failure. This is the equivalent "
8597"of the Python expression ``o.attr_name``."
8698msgstr ""
99+ "从对象 *o* 中读取一个名为 *attr_name* 的属性。成功时返回属性值,失败则返回 ``NULL``。这相当于 Python 表达式 "
100+ "``o.attr_name``。"
87101
88102#: ../../c-api/object.rst:69
89103msgid ""
@@ -94,6 +108,9 @@ msgid ""
94108"data descriptors take preference over instance attributes, while non-data "
95109"descriptors don't. Otherwise, an :exc:`AttributeError` is raised."
96110msgstr ""
111+ "通用的属性获取函数,用于放入类型对象的 ``tp_getattro`` 槽中。它在类的字典中(位于对象的 MRO 中)查找某个描述符,并在对象的 "
112+ ":attr:`~object.__dict__` 中查找某个属性。正如 :ref:`descriptors` "
113+ "所述,数据描述符优先于实例属性,而非数据描述符则不优先。失败则会触发 :exc:`AttributeError` 。"
97114
98115#: ../../c-api/object.rst:79 ../../c-api/object.rst:90
99116msgid ""
@@ -102,18 +119,21 @@ msgid ""
102119"success. This is the equivalent of the Python statement ``o.attr_name = "
103120"v``."
104121msgstr ""
122+ "将对象 *o* 中名为 *attr_name* 的属性值设为 *v* 。失败时引发异常并返回 ``-1``;成功时返 回``0`` 。这相当于 "
123+ "Python 语句 ``o.attr_name = v``。"
105124
106125#: ../../c-api/object.rst:84
107126msgid ""
108127"If *v* is ``NULL``, the attribute is deleted, however this feature is "
109128"deprecated in favour of using :c:func:`PyObject_DelAttr`."
110- msgstr ""
129+ msgstr "如果 *v* 为 ``NULL``,属性将被删除,但是此功能已被弃用,应改用 :c:func:`PySequence_DelItem` 。 "
111130
112131#: ../../c-api/object.rst:95
113132msgid ""
114133"If *v* is ``NULL``, the attribute is deleted, however this feature is "
115134"deprecated in favour of using :c:func:`PyObject_DelAttrString`."
116135msgstr ""
136+ "如果 *v* 为 ``NULL``,该属性将被删除,但是此功能已被弃用,应改用 :c:func:`PySequence_DelItem` 。"
117137
118138#: ../../c-api/object.rst:101
119139msgid ""
@@ -126,24 +146,30 @@ msgid ""
126146"returned, otherwise an :exc:`AttributeError` is raised and ``-1`` is "
127147"returned."
128148msgstr ""
149+ "通用的属性设置和删除函数,用于放入类型对象的 :c:member:`~PyTypeObject.tp_setattro` "
150+ "槽。它在类的字典中(位于对象的MRO中)查找数据描述器,如果找到,则将比在实例字典中设置或删除属性优先执行。否则,该属性将在对象的 "
151+ ":attr:`~object.__dict__` 中设置或删除。如果成功将返回 ``0``,否则将引发 :exc:`AttributeError` "
152+ "并返回 ``-1``。"
129153
130154#: ../../c-api/object.rst:113 ../../c-api/object.rst:119
131155msgid ""
132156"Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on "
133157"failure. This is the equivalent of the Python statement ``del o.attr_name``."
134158msgstr ""
159+ "删除对象 *o* 中名为 *attr_name* 的属性。失败时返回 ``-1``。这相当于 Python 语句 ``del "
160+ "o.attr_name``。"
135161
136162#: ../../c-api/object.rst:125
137163msgid ""
138164"A generic implementation for the getter of a ``__dict__`` descriptor. It "
139165"creates the dictionary if necessary."
140- msgstr ""
166+ msgstr "``__dict__`` 描述符的获取函数的一种通用实现。必要时会创建字典。 "
141167
142168#: ../../c-api/object.rst:133
143169msgid ""
144170"A generic implementation for the setter of a ``__dict__`` descriptor. This "
145171"implementation does not allow the dictionary to be deleted."
146- msgstr ""
172+ msgstr "``__dict__`` 描述符设置函数的一种通用实现。这里不允许删除字典。 "
147173
148174#: ../../c-api/object.rst:141
149175msgid ""
@@ -155,6 +181,10 @@ msgid ""
155181"operator corresponding to *opid*. Returns the value of the comparison on "
156182"success, or ``NULL`` on failure."
157183msgstr ""
184+ "用 *opid* 指定的操作比较 *o1* 和 *o2* 的值,必须是 :const:`Py_LT` 、 :const:`Py_LE` 、 "
185+ ":const:`Py_EQ` 、 :const:`Py_NE` 、 :const:`Py_GT` 或 :const:`Py_GE` "
186+ "之一,分别对应于``<=`` 、``==`` 、 ``!=`` 、``>`` 或 ``>=``。这相当于 Python 表达式 ``o1 op "
187+ "o2``,其中 ``op`` 是对应于 *opid* 的操作符。成功时返回比较值,失败时返回 ``NULL``。"
158188
159189#: ../../c-api/object.rst:151
160190msgid ""
@@ -166,12 +196,18 @@ msgid ""
166196" of the Python expression ``o1 op o2``, where ``op`` is the operator "
167197"corresponding to *opid*."
168198msgstr ""
199+ "用 *opid* 指定的操作比较 *o1* 和 *o2* 的值,必须是 :const:`Py_LT` 、 :const:`Py_LE` 、 "
200+ ":const:`Py_EQ` 、 :const:`Py_NE` 、 :const:`Py_GT` 或 :const:`Py_GE` 之一,分别对应于 "
201+ "``<`` 、``<=``、 ``==`` 、``!=`` 、``>`` 或 ``>=``。错误时返回 ``-1``,若结果为 false 则返回 "
202+ "``0``,否则返回 ``1``。这相当于 Python 表达式 ``o1 op o2``,其中 ``op`` 是对应于 *opid* 的操作符。"
169203
170204#: ../../c-api/object.rst:160
171205msgid ""
172206"If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool` "
173207"will always return ``1`` for :const:`Py_EQ` and ``0`` for :const:`Py_NE`."
174208msgstr ""
209+ "如果 *o1* 和 *o2* 是同一个对象,:c:func:`PyObject_RichCompareBool` 为 :const:`Py_EQ` "
210+ "则返回 ``1`` ,为 :const:`Py_NE` 则返回 ``0``。"
175211
176212#: ../../c-api/object.rst:167
177213msgid ""
@@ -180,12 +216,14 @@ msgid ""
180216"the Python expression ``repr(o)``. Called by the :func:`repr` built-in "
181217"function."
182218msgstr ""
219+ "计算对象 *o* 的字符串形式。 成功时返回字符串,失败时返回 ``NULL``。 这相当于 Python 表达式 ``repr(o)``。 由内置函数"
220+ " :func:`repr` 调用。"
183221
184222#: ../../c-api/object.rst:171 ../../c-api/object.rst:195
185223msgid ""
186224"This function now includes a debug assertion to help ensure that it does not"
187225" silently discard an active exception."
188- msgstr ""
226+ msgstr "该函数现在包含一个调试断言,用以确保不会静默地丢弃活动的异常。 "
189227
190228#: ../../c-api/object.rst:179
191229msgid ""
@@ -195,6 +233,9 @@ msgid ""
195233"generates a string similar to that returned by :c:func:`PyObject_Repr` in "
196234"Python 2. Called by the :func:`ascii` built-in function."
197235msgstr ""
236+ "与 :c:func:`PyObject_Repr` 一样,计算对象 *o* 的字符串形式,但在 :c:func:`PyObject_Repr` "
237+ "返回的字符串中用 ``\\ x``、``\\ u`` 或 ``\\ U`` 转义非 ASCII 字符。这将生成一个类似于 Python 2 中由 "
238+ ":c:func:`PyObject_Repr` 返回的字符串。由内置函数 :func:`ascii` 调用。"
198239
199240#: ../../c-api/object.rst:190
200241msgid ""
@@ -203,6 +244,8 @@ msgid ""
203244"the Python expression ``str(o)``. Called by the :func:`str` built-in "
204245"function and, therefore, by the :func:`print` function."
205246msgstr ""
247+ "计算对象 *o* 的字符串形式。 成功时返回字符串,失败时返回 ``NULL``。 这相当于 Python 表达式 ``str(o)``。由内置函数 "
248+ ":func:`str` 调用,因此也由 :func:`print` 函数调用。"
206249
207250#: ../../c-api/object.rst:203
208251msgid ""
@@ -212,19 +255,22 @@ msgid ""
212255" TypeError is raised when *o* is an integer instead of a zero-initialized "
213256"bytes object."
214257msgstr ""
258+ "计算对象 *o* 的字节形式。失败时返回 ``NULL``,成功时返回一个字节串对象。这相当于 *o* 不是整数时的 Python 表达式 "
259+ "``bytes(o)`` 。与 ``bytes(o)`` 不同的是,当 *o* 是整数而不是初始为 0 的字节串对象时,会触发 TypeError。"
215260
216261#: ../../c-api/object.rst:212
217262msgid ""
218263"Return ``1`` if the class *derived* is identical to or derived from the "
219264"class *cls*, otherwise return ``0``. In case of an error, return ``-1``."
220- msgstr ""
265+ msgstr "如果 *derived* 类与 *cls* 类相同或为其派生类,则返回 ``1``,否则返回 ``0``。 如果出错则返回 ``-1``。 "
221266
222267#: ../../c-api/object.rst:215 ../../c-api/object.rst:234
223268msgid ""
224269"If *cls* is a tuple, the check will be done against every entry in *cls*. "
225270"The result will be ``1`` when at least one of the checks returns ``1``, "
226271"otherwise it will be ``0``."
227272msgstr ""
273+ "如果 *cls* 是元组,则会对 *cls* 进行逐项检测。如果至少有一次检测返回 ``1``,结果将为 ``1``,否则将是 ``0``。"
228274
229275#: ../../c-api/object.rst:219
230276msgid ""
0 commit comments