asyncio - run coroutine in the background
frank at chagford.com
Mon Feb 15 03:17:28 EST 2016
"Paul Rubin" wrote in message
news:87h9ha8lt0.fsf at jester.gateway.pace.com...
> "Frank Millman" <frank at chagford.com> writes:
> > The benefit of my class is that it enables me to take the coroutine
> > and run it in another thread, without having to re-engineer the whole
> > thing.
> Threads in Python don't get you parallelism either, of course.
Agreed. My class does not alter the total time taken, but it does free up
the original task to carry on with other work.
run_in_executor() uses threads by default, but it does allow you to specify
processes as an alternative.
> I haven't used async/await yet and it's looking painful. I've been
> wanting to read this:
> but I start to think it isn't all that great an approach to concurrency.
Thanks for that link. I had a quick scan, and it looks interesting, but some
of it a bit above my head. I have bookmarked it, as I think that as my
understanding increases, I will gain more from it on each re-read.
More information about the Python-list