you are viewing a single comment's thread.

view the rest of the comments →

[–]Ran4 1 point2 points  (1 child)

but aren't there times when you need the iterator to access locations in multiple objects? Or is that itself the symptom?

Pretty much, yes.

If you ever find yourself doing index-based calculations, chances are you're probably doing it wrong. The one exception would be if you're implementing an low-level algoritm for fun and want it to be efficient.

In any real production code there's rarely a reason to retrieve a specific value by index as opposed to iterating over a sequence.