futures in python it should be noted howeverthat future instances should not be created directlyrather they should be created via the submit method of an appropriate executor future creation futures are created and executed by executors an executor provides two methods that can be used to execute future (or futuresand one to shut down the executor at the root of the executor class hierarchy is the concurrent futures executor abstract class it has two subclassesthe threadpoolexecutor and the processpoolexecutor the threadpoolexecutor uses threads to execute the futures while the processpoolexecutor uses separate processes you can therefore choose how you want the future to be executed by specifying one or other of these executors simple example future to illustrate these ideaswe will look at very simple example of using future to do this we will use simple worker functionsimilar to that used in the previous from time import sleep define function to be used with future def worker(msg)for in range( )print(msgend=''flush=truesleep( return the only difference with this version of worker is that it also returns result which is the number of times that the worker printed out the message we can of course invoke this method inline as followsres worker(' 'print(res