5 ms·
How is that hiding the loop? I would expect takewhile to be a loop although I never used this Python facility.
by psychoslave 2y ago
How is that hiding the loop? I would expect takewhile to be a loop although I never used this Python facility.
- schoen 2y agoAll 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.