Everything About ___
Live briefing

Everything about Generator (computer programming)

Routine that generates a sequence of values

In computer science, a generator is a routine that can be used to control the iteration behaviour of a loop. All generators are also iterators. A generator is very similar to a function that returns an array, in that a generator has parameters, can be called, and generates a sequence of values. However, instead of building an array containing all the values and returning them all at once, a generator yields the values one at a time, which requires less memory and allows the caller to get started processing the first few values immediately. In short, a generator looks like a function but behaves like an iterator. Wikipedia →

🧭 Start here: a 6-step reading path

  1. Read the overview: Generator (computer programming)A 5-minute orientation
  2. Skim a recent paper: The effect of generative artificial intelligence (AI)-based tool use on students' computational thinking skills, programming self-efficacy and motivationInfluential work since 2022
  3. Pick up a classic book: Advances in Computers, Volume 49 (Advances in Computers)The most-reprinted book on the subject
  4. Go sideways: IteratorA closely related topic
  5. Go sideways: Lazy evaluationA closely related topic

📖 Definitions

No dictionary entry for this exact phrase.

🗂️ The subject at a glance

  1. Uses
  2. Languages providing generators

🏆 Landmark papers (most cited)

🆕 Influential since 2022

📚 Books worth reading

Ranked by number of editions on Open Library, a rough measure of how lasting a book is.

🔗 Related topics