Consider the following:
xtest=np.arange(0,10)
ytest=np.arange(0,3)
zValuesBisBis=[[j for j in xtest] for i in ytest]
zValuesBisBisBis=[j for j in xtest for i in ytest]
print(zValuesBisBis)
print(zValuesBisBisBis)
It returns me respectively:
[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]
[0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9]
And I don't understand why the loop order is changed between the two. I mean the content of the list obviously are not the same (one is a list of list while the other is a list of number). But the ordering of the loop should be identical, i.e I would expect to have the second print to be the "flattened" version of the first one.
Why such behavior ?