Python Category

GENERATOR

Lazy iterator produced with `yield`.

Definition

A generator yields values one at a time instead of building a full collection in memory, which is useful for large datasets or streaming inputs.

Practical Example & Use Case

During log processing, a generator can parse lines lazily so memory stays stable even when reading multi-gigabyte files.

Editorial review date: 2026-03-11

Interactive Practice

Learn GENERATOR and related Python terms by playing our vocabulary word search puzzle.