StopIteration

The exception an iterator raises from next() to say it has no more items.

In more detail

A for loop catches it quietly and ends, so you only see it when calling next() by hand past the end. Inside a generator, just return or reach the end instead of raising it.

Related terms

Taught in

References

Certification courses