@@ -3155,7 +3155,7 @@ msgid ""
31553155"corresponding to operations that are not supported by the particular kind of"
31563156" number implemented (e.g., bitwise operations for non-integral numbers) "
31573157"should be left undefined."
3158- msgstr ""
3158+ msgstr "定义以下方法即可模拟数字类型。特定种类的数字不支持的运算(例如非整数不能进行位运算)所对应的方法应当保持未定义状态。 "
31593159
31603160#: ../../reference/datamodel.rst:2277
31613161msgid ""
@@ -3170,12 +3170,18 @@ msgid ""
31703170"an optional third argument if the ternary version of the built-in "
31713171":func:`pow` function is to be supported."
31723172msgstr ""
3173+ "调用这些方法来实现二进制算术运算 (``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, "
3174+ ":func:`divmod`, :func:`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, "
3175+ "``|``)。例如,求表达式 ``x + y`` 的值,其中 *x* 是具有 :meth:`__add__` 方法的类的一个实例,则会调用 "
3176+ "``x.__add__(y)``。:meth:`__divmod__` 方法应该等价于使用 :meth:`__floordiv__` 和 "
3177+ ":meth:`__mod__`,它不应该被关联到 :meth:`__truediv__`。请注意如果要支持三元版本的内置 :func:`pow` "
3178+ "函数,则 :meth:`__pow__` 的定义应该接受可选的第三个参数。"
31733179
31743180#: ../../reference/datamodel.rst:2288
31753181msgid ""
31763182"If one of those methods does not support the operation with the supplied "
31773183"arguments, it should return ``NotImplemented``."
3178- msgstr ""
3184+ msgstr "如果这些方法中的某一个不支持与所提供参数进行运算,它应该返回 ``NotImplemented``。 "
31793185
31803186#: ../../reference/datamodel.rst:2311
31813187msgid ""
@@ -3188,12 +3194,17 @@ msgid ""
31883194"where *y* is an instance of a class that has an :meth:`__rsub__` method, "
31893195"``y.__rsub__(x)`` is called if ``x.__sub__(y)`` returns *NotImplemented*."
31903196msgstr ""
3197+ "调用这些方法来实现具有反射(交换)操作数的二进制算术运算 (``+``, ``-``, ``*``, ``@``, ``/``, ``//``, "
3198+ "``%``, :func:`divmod`, :func:`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, "
3199+ "``|``)。这些成员函数仅会在左操作数不支持相应运算 [#]_ 且两个操作数类型不同时被调用。[#]_ 例如,求表达式 ``x - y`` 的值,其中"
3200+ " *y* 是具有 :meth:`__rsub__` 方法的类的一个实例,则当 ``x.__sub__(y)`` 返回 *NotImplemented* "
3201+ "时会调用 ``y.__rsub__(x)``。"
31913202
31923203#: ../../reference/datamodel.rst:2322
31933204msgid ""
31943205"Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the "
31953206"coercion rules would become too complicated)."
3196- msgstr ""
3207+ msgstr "请注意三元版的 :func:`pow` 并不会尝试调用 :meth:`__rpow__` (因为强制转换规则会太过复杂)。 "
31973208
31983209#: ../../reference/datamodel.rst:2327
31993210msgid ""
@@ -3202,6 +3213,7 @@ msgid ""
32023213"will be called before the left operand's non-reflected method. This "
32033214"behavior allows subclasses to override their ancestors' operations."
32043215msgstr ""
3216+ "如果右操作数类型为左操作数类型的一个子类,且该子类提供了指定运算的反射方法,则此方法会先于左操作数的非反射方法被调用。此行为可允许子类重载其祖先类的运算符。"
32053217
32063218#: ../../reference/datamodel.rst:2347
32073219msgid ""
0 commit comments