[Python-Dev] Importance of "async" keyword
Nick Coghlan
ncoghlan at gmail.com
Fri Jun 26 12:52:43 CEST 2015
More information about the Python-Dev mailing list
Fri Jun 26 12:52:43 CEST 2015
- Previous message (by thread): [Python-Dev] Importance of "async" keyword
- Next message (by thread): [Python-Dev] Importance of "async" keyword
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 26 Jun 2015 10:46, "Greg Ewing" <greg.ewing at canterbury.ac.nz> wrote: > > Sven R. Kunze wrote: >> So, we would have to implement things twice for the asyncio world and the classic world. > > > Not exactly; it's possible to create a wrapper that takes an > async function and runs it to completion, allowing it to be > called from sync code. I can't remember offhand, but there's > likely something like this already in asyncio. https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.BaseEventLoop.run_until_complete It's also possible to use a more comprehensive synchronous-to-asynchronous adapter like gevent to call asynchronous code from synchronous code. Going in the other direction (calling sync code from async) uses a thread or process pool: https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.BaseEventLoop.run_in_executor Cheers, Nick. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150626/4f72a753/attachment.html>
- Previous message (by thread): [Python-Dev] Importance of "async" keyword
- Next message (by thread): [Python-Dev] Importance of "async" keyword
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list