A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-April/139399.html below:

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

[Python-Dev] async/await in Python; v2 [Python-Dev] async/await in Python; v2Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 23 02:12:36 CEST 2015
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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4