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.
My name is Trey Hunner. I do corporate Python training for teams and I teach Python online through Python Morsels.
In Python Morsels, I publish a new Python screencast every week.
If you want to learn something new every week, join Python Morsels!Join Python Morsels ✨