futures howeverneither the thread or the process by default provide simple mechanism for obtaining result from such an independent operation this may not be problem as operations may be self-containedfor example they may obtain data from the database or from today' date and then updated ui howeverin many situations the calculation will return result which needs to be handled by the original invoking code (the callerthis could involve performing long running calculation and then using the result returned to generate another value or update another object etc future is an abstraction that simplifies the definition and execution of such concurrent tasks futures are available in many different languages including python but also javascalac+etc when using futurea callable object (such as functionis passed to the future which executes the behaviour either as separate thread or as separate process and then can return result once it is generated the result can either be handled by call back function (that is invoked when the result is availableor by using operation that will wait for result to be provided futures in python the concurrent futures library was introduced into python in version (and is also available in python onwardsthe concurrent futures library provides the future class and high level api for working with futures the concurrent futures future class encapsulates the asynchronous execution of callable object ( function or methodthe future class provides range of methods that can be used to obtain information about the state of the futureretrieve results or cancel the futurecancel(attempt to cancel the future if the future is currently being executed and cannot be cancelled then the method will return falseotherwise the call will be cancelled and the method will return true cancelled(returns true if the future was successfully cancelled running(returns true if the future is currently being executed and cannot be cancelled done(returns true if the future was successfully cancelled or finished running result(timeout=nonereturn the value returned by the future if the future hasn' yet completed then this method will wait up to timeout seconds if the call hasn' completed in timeout secondsthen timeouterror will be raised timeout can be an int or float if timeout is not specified or nonethere is no limit to the wait time if the future is cancelled before completing then the cancellederror will be raised if the call raisedthis method will raise the same exception