August 2015
Intermediate to advanced
286 pages
5h 42m
English
Another key component of the Asyncio module is the Future class. This is very similar to concurrent.futures.Futures, but of course, it is adapted in the main mechanism of Asyncio's event loop. The asyncio.Future class represents a result (but can also be an exception) that is not yet available. It therefore represents an abstraction of something that is yet to be accomplished.
Callbacks that have to process any results are in fact added to the instances of this class.
To manage an object Future in Asyncio, we must declare the following:
import asyncio future = asyncio.Future()
The basic methods of this class are:
cancel(): This cancels the future and schedules callbacksresult(): This returns the result ...Read now
Unlock full access