On 26 Jun 2015 10:46, "Greg Ewing" email@example.com 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.
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.BaseEventLo...