For arrays and lists in Python and Numpy are the following lines equivalent:
itemlist = []
for j in range(len(myarray)):
item = myarray[j]
itemlist.append(item)
and:
itemlist = []
for item in myarray:
itemlist.append(item)
I'm interested in the order of itemlist. In a few examples that I have tried they are identical, but is it guaranteed? For example, I know that the foreach
statement in C# doesn't guarantee order, and that I should be careful with it.