The first example is long line and you have to go back and forth to understand it. The second example is a single top down pass.
The second example reflects how my brain thinks and the intuitive order of what has to happen.
In the first example, it's all out of order.
All of the languages except C have similar iterator-based stuff that let you write one liners and often with lambdas. I dislike them all. They give way too much leeway and encourage many developers to try to prove how clever they are.
Once you have to debug the code containing them, all of the complexity of the syntactic sugar comes crashing down on you. The debugger starts jumping to weird places, sometimes even optimized out parts of the standard libraries while for loops usually stay debugable.
x = np.arange(0,10,1)
print(x[x%2==0])While I like python, I think the unusual order that components of a comprehension are written is to its detriment. It would make more sense if they were in the same order in both examples. The python ternary has a similar issue.
(0..10).select{it.even?}