New submission from Paolo Lammens <lammenspa...@gmail.com>:

The current specification of object.__await__ is just:

> `object.__await__(self)`
>
> Must return an iterator. Should be used to implement awaitable objects. For 
> instance, `asyncio.Future` implements this method to be compatible with the 
> await expression.

This is pretty vague leaves the doubt of *what* objects is the iterator 
expected to yield (and how the value of the yielded object affects the 
management of the awaitable object).

Although the vagueness is probably on purpose (since this isn't tied to any 
particular event loop implementation, so it can be an arbitrary iterable), I 
think it's worthwhile adding a note clarifying this aspect.

I originally posed this question on StackOverflow: 
https://stackoverflow.com/q/63964011/6117426

----------
assignee: docs@python
components: Documentation
messages: 377166
nosy: docs@python, plammens
priority: normal
severity: normal
status: open
title: Clarify specification of object.__await__

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41813>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to