List Comprehensions in Python look like the code below
These tend to be fast enough that we don’t care about what get’s executed when. However let us look at the more complex calculation
In this situation, we might want to be sure that the async_calculation
is triggered as soon as it is found. We could play it safe with a for loop
However we can check the order of operations in the list comprehension easily:
creates the output
Confirming that the execution of the print
/ heavy_async_calculation
is done as soon as the check passes