Re: [Python-Dev] async/await in Python; v2

2015年4月22日 17:14:49 -0700

Guido van Rossum wrote:
On Wed, Apr 22, > OTOH I'm still struggling with what you have to do to wrap a coroutine in a Task, the way its done in asyncio by the Task() constructor, the loop.create_task() method, and the async() function
That's easy. You can always use costart() to adapt a cofunction
for use with something expecting a generator-based coroutine,
e.g.
codef my_task_func(arg):
 ...
my_task = Task(costart(my_task_func, arg))
If you're willing to make changes, Task() et al could be made to
recognise cofunctions and apply costart() where needed.
--
Greg
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to