Iterator

Step through a collection without exposing its guts

Iterator lets you traverse a collection's elements without revealing how it stores them. This is the pattern most fully absorbed into the language: Python's for loop is the iterator protocol. You define __iter__ (often as a generator) and the whole ecosystem โ€” for, list(), sum(), unpacking โ€” just works.

A Calendar of bookings can decide its own order and yield entries; callers never touch the internal list.