May-31-2022, 08:24 PM
It is not clear what you mean by «interpreted really sequentially».
In certain syntax constructs, Python executes code in a non left-to-right way. For example in
Similarly in comprehension constructs, the for loops iterations are actually set up before the body is executed, but the body appears syntactically before the for loop.
In certain syntax constructs, Python executes code in a non left-to-right way. For example in
a = x + y if x * y > 2 else x - 1the test
x * y > 2
is executed first, then only one of x + y
or x - 1
is executed.Similarly in comprehension constructs, the for loops iterations are actually set up before the body is executed, but the body appears syntactically before the for loop.