E
Esmail
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
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).
Thanks.
Esmail
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
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).
Thanks.
Esmail