- Programs often need to process sequential data
- May be of fixed or dynamic length
- Python has strong support for imperative sequential loop processing
- Loops feel natural for most common tasks on built-in types, containers and user-defined classes
- Iterators enable a more functional style to processing data streams
- Rather than directly interfacing with data storage iterators provide an abstraction
- Iterators can
- Make programs more efficient
- Easier to refactor
- Capable of handling arbitrary sized data
- Python provides tools to compose iterators and customise their behaviours
- Generators provide an advanced way to interface with iterators