Hacker News new | ask | show | jobs
by psychoslave 746 days ago
How is that hiding the loop? I would expect takewhile to be a loop although I never used this Python facility.
1 comments

All of the itertools functions are implemented using loops, but they heavily abstract over them so that users can think in terms of "streams" (or officially "iterators") without writing loop-oriented code themselves.