What can you do with generator expressions? PREMIUM

Topic Series: Generator Expressions

Trey Hunner smiling in a t-shirt against a yellow wall
By Trey Hunner

Topic Trail: 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.

To track your progress on this Python Morsels topic trail, sign in or sign up.