Generators

Generators are a Python core language construct that allow a function's return value to behave as an iterator. A generator can allow more efficient memory usage by allocating and deallocating memory during the context of a large number of iterations. Generators are defined in PEP255 and included in the language as of Python 2.2 in 2001.

Python generator resources

What's next after you've learned about generators?

What are list, dictionary and set comprehensions?

Show me a list of the best Python learning resources.

What editor should I use to code my Python app?

Sign up to receive an email twice per month with Python tutorials and major updates to this site.


Matt Makai 2012-2017