Hi Brett,

On 2016-08-10 12:27 PM, Brett Cannon wrote:
[..]

According to the inspect module that's a coroutine function that creates a coroutine/awaitable (and a function w/ @types.coroutine is just an awaitable when it contains a `yield`). Now the existence of `yield` in a function causing it to be a generator is obviously not a new concept, but since coroutines come from a weird generator background thanks to `yield from` we might need to start being very clear what @types.coroutine, `async def`, and `async def` w/ `yield` are -- awaitable (but not coroutine in spite of the decorator name), coroutine, and async generator, respectively -- and not refer to @types.coroutine/`yield from` in the same breath to minimize confusion.


Good suggestion. FWIW, in PEP 492, we called awaitables created with @types.coroutine as "generator-based coroutines".

These days I see less and less people use @asyncio.coroutine and 'yield from'. Even less so know about @types.coroutine and how async/await tied to generators in the interpreter. This knowledge is now only required for people who implement/maintain frameworks like asyncio/twisted/curio.

So I hope that we're already at the stage when people can just use async/await without really thinking how it's implemented. PEP 525 is another step in that direction -- making asynchronous iterators easy to use.

Yury
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to