[Python-Dev] async/await in Python; v2 (original) (raw)

Andrew Svetlov andrew.svetlov at gmail.com
Thu Apr 23 14:24:28 CEST 2015


On Thu, Apr 23, 2015 at 3:10 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

Andrew Svetlov wrote:

From my understanding to use cofunctions I must wrap it with costart call: yield from gather(costart(coro1, a1, a2), costart(coro2), fut3) There are other places in asyncio API those accept coroutines or futures as parameters, not only Task() and async(). In a PEP 3152 aware version of asyncio, they would all know about cofunctions and what to do with them. But we already have asyncio and code based on asyncio coroutines. To make it work I should always use costart() in places where asyncio requires coroutine.

Maybe your proposal is better than current asyncio practice. But now asyncio is built on top of two-step process, as you have mentioned: building coroutine and waiting for it's result.

That's why I prefer await as replace for well-known yield from.

-- Greg


Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/andrew.svetlov%40gmail.com

-- Thanks, Andrew Svetlov



More information about the Python-Dev mailing list