[issue41813] Clarify specification of object.__await__

Paolo Lammens report at bugs.python.org
Sat Sep 19 11:27:49 EDT 2020


Paolo Lammens <lammenspaolo at gmail.com> added the comment:

The proposed addition (see attached PR) is the following note:

   .. note::

      The language doesn't place any restriction on the type or value of the objects
      yielded by the iterator returned by :meth:`__await__`, as this is specific to
      the implementation of the event loop that will be managing the :term:`awaitable`
      object. In the case of :mod:`asyncio`, user code should always be using other
      :term:`coroutines <coroutine>`, :mod:`asyncio` Tasks, Futures, and other
      :mod:`asyncio` objects to implement :meth:`__await__`, yielding objects from
      these, and never yielding objects directly—as the kind of objects that the event
      loop expects are considered a private implementation detail of :mod:`asyncio`.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41813>
_______________________________________


More information about the Python-bugs-list mailing list