Hacker News new | ask | show | jobs
by snazz 2653 days ago
Yes. Iterating over a range of integers equal to the length of an iterable is really clunky compared to iterating directly over the iterable. Plus, if you actually want to use one of the elements of the list, for instance, in the body of the loop, you would have to do foo[i] instead of referring to it as bar.
1 comments

And when your actually need the index, generally you use enumerate(foo).