18 mins

Generator Expressions

List comprehensions make new lists. Generator expressions make new generator objects. Generators are iterators, which are lazy single-use iterables. Unlike lists, generators aren't data structures. Instead they do work as you loop over them.

Want to watch/read screencasts as they're announced?
Profile picture of Trey

My name is Trey Hunner and I'm a Python trainer. Through Python Morsels I publish new Python screencasts every week and I also send out Python exercises.

If you'd like to get announcements for new Python screencasts, sign up for Python Morsels below. I promise I won't spam you (see my Privacy Policy).

✨ Sign Up For Python Morsels ✨