asyncio awaitable object

ast nomail at com.invalid
Fri Dec 8 04:08:24 EST 2017


Hello,

According to: 
https://www.python.org/dev/peps/pep-0492/#await-expression
an awaitable object is:

- A native coroutine object returned from a native coroutine function
- A generator-based coroutine object returned from a function decorated 
with types.coroutine()
- An object with an __await__ method returning an iterator

I dont understand the last one.

For example in instruction "res = await obj"

where obj has a __await__ method returning an iterator

What kind of data this generator is supposed to provide when next() 
is applied to it and what are these data becoming ?

what res contains when the iterator has finished to iterate ?

It seems that PEP492 documentation says nothing about it (or I dont 
understand, english is not my native language)












More information about the Python-list mailing list