@@ -3424,24 +3424,30 @@ msgid ""
34243424"method. :term:`Coroutine` objects returned from :keyword:`async def` "
34253425"functions are awaitable."
34263426msgstr ""
3427+ ":term:`awaitable` 对象主要实现了 :meth:`__await__` 方法。 从 :keyword:`async def` 函数返回的"
3428+ " :term:`Coroutine` 对象即属于可等待对象。"
34273429
34283430#: ../../reference/datamodel.rst:2559
34293431msgid ""
34303432"The :term:`generator iterator` objects returned from generators decorated "
34313433"with :func:`types.coroutine` or :func:`asyncio.coroutine` are also "
34323434"awaitable, but they do not implement :meth:`__await__`."
34333435msgstr ""
3436+ "从带有 :func:`types.coroutine` 或 :func:`asyncio.coroutine` 装饰器的生成器返回的 "
3437+ ":term:`generator iterator` 对象也属于可等待对象,但它们并未实现 :meth:`__await__`。"
34343438
34353439#: ../../reference/datamodel.rst:2565
34363440msgid ""
34373441"Must return an :term:`iterator`. Should be used to implement "
34383442":term:`awaitable` objects. For instance, :class:`asyncio.Future` implements"
34393443" this method to be compatible with the :keyword:`await` expression."
34403444msgstr ""
3445+ "必须返回一个 :term:`iterator`。 应当被用来实现 :term:`awaitable` 对象。 "
3446+ "例如,:class:`asyncio.Future` 实现了此方法以与 :keyword:`await` 表达式相兼容。"
34413447
34423448#: ../../reference/datamodel.rst:2571
34433449msgid ":pep:`492` for additional information about awaitable objects."
3444- msgstr ""
3450+ msgstr ":pep:`492` 了解有关可等待对象的详细信息。 "
34453451
34463452#: ../../reference/datamodel.rst:2577
34473453msgid "Coroutine Objects"
@@ -3457,17 +3463,23 @@ msgid ""
34573463"coroutine raises an exception, it is propagated by the iterator. Coroutines"
34583464" should not directly raise unhandled :exc:`StopIteration` exceptions."
34593465msgstr ""
3466+ ":term:`Coroutine` 对象属于 :term:`awaitable` 对象。 协程的执行可通过调用 :meth:`__await__` "
3467+ "并迭代其结果来进行控制。 当协程结束执行并返回时,迭代器会引发 :exc:`StopIteration`,该异常的 "
3468+ ":attr:`~StopIteration.value` 属性将指向返回值。 如果协程引发了异常,它会被迭代器所传播。 协程不应该直接引发未处理的 "
3469+ ":exc:`StopIteration` 异常。"
34603470
34613471#: ../../reference/datamodel.rst:2587
34623472msgid ""
34633473"Coroutines also have the methods listed below, which are analogous to those "
34643474"of generators (see :ref:`generator-methods`). However, unlike generators, "
34653475"coroutines do not directly support iteration."
34663476msgstr ""
3477+ "协程也具有下面列出的方法,它们类似于生成器的对应方法 (参见 :ref:`generator-methods`)。 "
3478+ "但是,与生成器不同,协程并不直接支持迭代。"
34673479
34683480#: ../../reference/datamodel.rst:2591
34693481msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once."
3470- msgstr ""
3482+ msgstr "等待一个协程超过一次将引发 :exc:`RuntimeError`。 "
34713483
34723484#: ../../reference/datamodel.rst:2597
34733485msgid ""
@@ -3479,6 +3491,9 @@ msgid ""
34793491"exception) is the same as when iterating over the :meth:`__await__` return "
34803492"value, described above."
34813493msgstr ""
3494+ "开始或恢复协程的执行。 如果 *value* 为 ``None``,则这相当于前往 :meth:`__await__` 所返回迭代器的下一项。 如果 "
3495+ "*value* 不为 ``None``,此方法将委托给导致协程挂起的迭代器的 :meth:`~generator.send` 方法。 "
3496+ "其结果(返回值,:exc:`StopIteration` 或是其他异常)将与上述对 :meth:`__await__` 返回值进行迭代的结果相同。"
34823497
34833498#: ../../reference/datamodel.rst:2607
34843499msgid ""
@@ -3490,6 +3505,9 @@ msgid ""
34903505" the :meth:`__await__` return value, described above. If the exception is "
34913506"not caught in the coroutine, it propagates back to the caller."
34923507msgstr ""
3508+ "在协程内引发指定的异常。 此方法将委托给导致协程挂起的迭代器的 :meth:`~generator.throw` 方法,如果存在该方法。 "
3509+ "否则的话,异常会在挂起点被引发。 其结果(返回值,:exc:`StopIteration` 或是其他异常)将与上述对 :meth:`__await__`"
3510+ " 返回值进行迭代的结果相同。 如果异常未在协程内被捕获,则将回传给调用者。"
34933511
34943512#: ../../reference/datamodel.rst:2618
34953513msgid ""
@@ -3500,16 +3518,19 @@ msgid ""
35003518"causing the coroutine to immediately clean itself up. Finally, the coroutine"
35013519" is marked as having finished executing, even if it was never started."
35023520msgstr ""
3521+ "此方法会使得协程清理自身并退出。 如果协程被挂起,此方法会先委托给导致协程挂起的迭代器的 :meth:`~generator.close` "
3522+ "方法,如果存在该方法。 然后它会在挂起点引发 :exc:`GeneratorExit`,使得协程立即清理自身。 "
3523+ "最后,协程会被标记为已结束执行,即使它根本未被启动。"
35033524
35043525#: ../../reference/datamodel.rst:2626
35053526msgid ""
35063527"Coroutine objects are automatically closed using the above process when they"
35073528" are about to be destroyed."
3508- msgstr ""
3529+ msgstr "当协程对象将要被销毁时,会使用以上处理过程来自动关闭。 "
35093530
35103531#: ../../reference/datamodel.rst:2632
35113532msgid "Asynchronous Iterators"
3512- msgstr ""
3533+ msgstr "异步迭代器 "
35133534
35143535#: ../../reference/datamodel.rst:2634
35153536msgid ""
0 commit comments