You want to use loop.run_in_executor
, which uses a concurrent.futures
executor, but maps the return value to an asyncio
future.
The original asyncio
PEP suggests that concurrent.futures.Future
may someday grow a __iter__
method so it can be used with yield from
as well, but for now the library has been designed to only require yield from
support and nothing more. (Otherwise some code wouldn't actually work in 3.3.)