Python Professional — Hard
Key points
- Iterables return iterators with __iter__; iterators return values with __next__
- Iterators implement both __iter__ and __next__; iterables only implement __iter__
- Iterators raise StopIteration when no more values; iterables do not have a next value
Ready to go further?
Related questions
