Python Professional — Hard
Key points
- Returning `self` in `__iter__` method makes the object an iterable and an iterator
- It allows the object to be used in a for loop without needing to create a separate iterator
- The object can be iterated over multiple times in different loops
Ready to go further?
Related questions
