May-31-2022, 08:08 PM
In any programming course/books I learned the intro section mentions the sequential
mode of execution of any program (implying at least the sequential way of navigating
through lines in an editor). But I suppose this sequential mode is also valid for
token-by-token processing.
Yet, in Python list and dictionary comprehensions, like
the operational part of the for loop (i**2, n ** 2) comes before the definitive.
And it is not sequential. How does this happen in Python?
mode of execution of any program (implying at least the sequential way of navigating
through lines in an editor). But I suppose this sequential mode is also valid for
token-by-token processing.
Yet, in Python list and dictionary comprehensions, like
sum([i**2 for i in range(3)])or
results = {n: n ** 2 for n in range(10)}
the operational part of the for loop (i**2, n ** 2) comes before the definitive.
And it is not sequential. How does this happen in Python?