Esmail wrote:
Hello all,
I have a simple question regarding semantics.
Given a list 'li', I can always do this to iterate through all items in
order:
for i in range(0, len(li)):
print li[i]
Will this always be equivalent to
for i in li:
print i
I assume it is, and the order will always be the same, or am I mistaken?
Would the 2nd one be considered more Pythonic? (It looks both
clearer and cleaner to me).
If you posted the first one, you would be told that the second one was
the Pythonic way.
--
http://mail.python.org/mailman/listinfo/python-list