O'Reilly logo

Software Architecture with Python by Anand Balachandran Pillai

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Concurrent futures – high-level concurrent processing

The concurrent.futures module provides high-level concurrent processing using either threads or processes, while asynchronously returning data using future objects.

It provides an executor interface which exposes mainly two methods, which are as follows:

  • submit: Submits a callable to be executed asynchronously, returning a future object representing the execution of the callable.
  • map: Maps a callable to a set of iterables, scheduling the execution asynchronously in the future object. However, this method returns the results of processing directly instead of returning a list of futures.

There are two concrete implementations of the executor interface: ThreadPoolExecutor executes the callable in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required