Skip to content

Glossary: Python Beyond the Basics

iterable / iterator

Also written: iterable, iter, next, StopIteration, iterators

An iterable is anything a `for` loop can walk through; an iterator is the object that remembers its place and hands out items with `next`. When items run out, `next` raises StopIteration, which the loop catches to stop.

Where the book teaches it

Related terms

generator