Consider the following code.
with open('filename.txt', 'r') as f:
var = [element for element in f.readlines()][3]
This question concerns the internals of Python, rather than the result.
Does Python calculate all the elements of the indexes in the entire list of [element for element in f.readlines()]
, or does Python just calculate all of the elements until the third index?