Futures
Explore the concept of Futures in Python's concurrent package. Understand how to check task status, cancel tasks, handle exceptions, and add callbacks to enable non-blocking concurrent programming. This lesson helps you manage deferred computations effectively using ThreadPoolExecutor.
We'll cover the following...
Futures
You can think of Future as an entity that represents a deferred computation that may or may not have been completed. It is an object that represents the outcome of a computation to be completed in future. We can query about the status of the deferred computation using the methods exposed by the Future class. Some of the useful ones are:
done: Returns true if the execution of the callable was successfully completed or cancelled.
cancel: Attempts to cancel execution of a callable. ...