An iterable implements __iter__ returning an iterator; an iterator implements __next__ and raises StopIteration when exhausted. Generator functions compile into state machines that pause at yield, holding only the current item in memory instead of materializing an entire list—ideal for streaming files, DB cursors, and LLM SSE chunks.
Follow-up Interview Question · What happens if you iterate over the same generator object twice?