@@ -3242,13 +3242,14 @@ msgstr ""
32423242msgid ""
32433243"Called to implement the unary arithmetic operations (``-``, ``+``, "
32443244":func:`abs` and ``~``)."
3245- msgstr ""
3245+ msgstr "调用此方法以实现一元算术运算 (``-``, ``+``, :func:`abs` 和 ``~``)。 "
32463246
32473247#: ../../reference/datamodel.rst:2381
32483248msgid ""
32493249"Called to implement the built-in functions :func:`complex`, :func:`int` and "
32503250":func:`float`. Should return a value of the appropriate type."
32513251msgstr ""
3252+ "调用这些方法以实现内置函数 :func:`complex`, :func:`int` 和 :func:`float`。应当返回一个相应类型的值。"
32523253
32533254#: ../../reference/datamodel.rst:2388
32543255msgid ""
@@ -3258,13 +3259,16 @@ msgid ""
32583259"functions). Presence of this method indicates that the numeric object is an "
32593260"integer type. Must return an integer."
32603261msgstr ""
3262+ "调用此方法以实现 :func:`operator.index` 以及 Python 需要无损地将数字对象转换为整数对象的场合(例如切片或是内置的 "
3263+ ":func:`bin`, :func:`hex` 和 :func:`oct` 函数)。 存在此方法表明数字对象属于整数类型。 必须返回一个整数。"
32613264
32623265#: ../../reference/datamodel.rst:2396
32633266msgid ""
32643267"In order to have a coherent integer type class, when :meth:`__index__` is "
32653268"defined :meth:`__int__` should also be defined, and both should return the "
32663269"same value."
32673270msgstr ""
3271+ "为了具有一致的整数类型类,当定义了 :meth:`__index__` 的时候也应当定义 :meth:`__int__`,两者应当返回相同的值。"
32683272
32693273#: ../../reference/datamodel.rst:2408
32703274msgid ""
@@ -3274,16 +3278,20 @@ msgid ""
32743278"return the value of the object truncated to an :class:`~numbers.Integral` "
32753279"(typically an :class:`int`)."
32763280msgstr ""
3281+ "调用这些方法以实现内置函数 :func:`round` 以及 :mod:`math` 函数 :func:`~math.trunc`, "
3282+ ":func:`~math.floor` 和 :func:`~math.ceil`。 除了将 *ndigits* 传给 "
3283+ ":meth:`!__round__` 的情况之外这些方法的返回值都应当是原对象截断为 :class:`~numbers.Integral` (通常为 "
3284+ ":class:`int`)。"
32773285
32783286#: ../../reference/datamodel.rst:2414
32793287msgid ""
32803288"If :meth:`__int__` is not defined then the built-in function :func:`int` "
32813289"falls back to :meth:`__trunc__`."
3282- msgstr ""
3290+ msgstr "如果未定义 :meth:`__int__` 则内置函数 :func:`int` 会回退到 :meth:`__trunc__`。 "
32833291
32843292#: ../../reference/datamodel.rst:2421
32853293msgid "With Statement Context Managers"
3286- msgstr ""
3294+ msgstr "with 语句上下文管理器 "
32873295
32883296#: ../../reference/datamodel.rst:2423
32893297msgid ""
@@ -3294,6 +3302,9 @@ msgid ""
32943302"using the :keyword:`with` statement (described in section :ref:`with`), but "
32953303"can also be used by directly invoking their methods."
32963304msgstr ""
3305+ ":dfn:`上下文管理器` 是一种对象,它定义了在执行 :keyword:`with` 语句时所要创建的运行时上下文。 "
3306+ "上下文管理器负责处理所需运行时上下文的入口和出口以供代码块执行使用。 上下文管理器通常使用 :keyword:`with` 语句 (详见 "
3307+ ":ref:`with` 一节) 来发起调用,但也可以通过直接发起调用它们的方法来使用。"
32973308
32983309#: ../../reference/datamodel.rst:2434
32993310msgid ""
0 commit comments