June 2017
Beginner to intermediate
274 pages
6h 49m
English
The most commonly used feature of a future object is to wait for its value to be determined and then retrieve it. For asyncio's future objects, this is done by simply waiting for the future, as shown in the following code example:

This will tell the scheduler to pause the coroutine until the value of the future becomes available, after which the future's value is set in the coroutine as the result of the await expression.
If the future represents a raised exception, instead of a value, that exception is raised again from the await expression, as shown in the preceding code example. If we don't want to wait, we could ...
Read now
Unlock full access