A crash course in Python “comprehensions” and “generators”

Master them in 20 minutes. Use them every day.

Pete Fison
PythonIQ
Published in
7 min readNov 28, 2022

--

Photo by Kelly Sikkema on Unsplash

I love Python’s list comprehensions and generators.

They keep my code concise. They’re great one-liners for exploring and “munging” data. They’re intuitive, and once you know what you’re looking at, very easy to read.

--

--

Pete Fison
PythonIQ

Experienced Python developer with a special interest in web scraping, data wrangling, ETL, NLP, and AI Prompt Engineering. Former IT Director & Video Producer.