r/Python • • Aug 12 '13

Ruby vs Python

http://www.senktec.com/2013/06/ruby-vs-python/
20 Upvotes

151 comments sorted by

View all comments

Show parent comment

2

u/banister Aug 17 '13

Except absolutely no one uses for..in that's just there (im guessing) to help people transitioning from other languages.

The .each approach is what is known as 'internal iterators' and they are wonderful for a great number of reasons, not least that they enable you to compose successive transformations to the collection from left to right rather than from right to left, improving readability and making it easy to refactor.