Python List Comprehensions Are More Powerful Than You Might Think

Write better list comprehensions with the help of these unknown features and tricks

Martin Heinz
Better Programming
Published in
5 min readSep 5, 2022

--

Photo by Aedrian on Unsplash

Python’s list comprehensions (and generators) are an awesome feature that can greatly simplify your code. Most of the time, however, we only use them to write a single for loop, maybe with the addition of one if

--

--