[Python-ideas] Concurrency Modules

Nick Coghlan ncoghlan at gmail.com
Mon Jul 27 16:35:14 CEST 2015


On 27 July 2015 at 07:54, Sven R. Kunze <srkunze at mail.de> wrote:
> Something that struck me as odd was that asyncio got syntactic sugar
> although the module itself is actually quite young compared to the support
> of processes and of threads. These two alternatives have actually no a
> single bit of syntax support until now.

Their shared abstraction layer is the concurrent.futures module:
https://docs.python.org/3/library/concurrent.futures.html (available
for Python 2 as the "futures" module on PyPI)

For "call and response" use cases involving pools of worker threads or
processes, concurrent.futures is a better option than hand rolling our
own pool management and request dispatch and response processing code.

That model is integrated into the asyncio event loop to support
dispatching blocking tasks to a background thread or process.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list