there is a very detailed table on python wiki which answers your question.
However, in your particular example you should use enumerate
to get an index of an iterable within a loop. like so:
for i, item in enumerate(some_seq):
bar(item, i)
there is a very detailed table on python wiki which answers your question.
However, in your particular example you should use enumerate
to get an index of an iterable within a loop. like so:
for i, item in enumerate(some_seq):
bar(item, i)