Generator function

/ˈdʒɛnəˌreɪtər ˈfʌŋkʃən/ noun

A special function that can pause its execution and resume later, yielding values one at a time instead of computing all results at once. It maintains its state between calls, enabling lazy evaluation and memory-efficient iteration.

The term 'generator' comes from mathematics, meaning something that produces or creates. First implemented in CLU in the 1970s, the concept was popularized by Python in 2001 with PEP 255, emphasizing the function's ability to 'generate' a sequence of values on demand rather than all at once.

📖 Full word page — etymology, 47 translations, audio 🔑 Get Free API Key — 50 lookups/day 📚 Read the Docs — integrate Word Orb