Comprehensible Comprehensions
Finding list comprehensions incomprehensible? Having trouble figuring out when to use list comprehensions or just plain for loops? Come to this talk and learn the how, when, and why of list comprehensions.
Finding list comprehensions incomprehensible? Having trouble figuring out when to use list comprehensions or just plain `for` loops?
If you find comprehensions tricky to write or perplexing to read, this talk is for you.
We're going to learn:
- when and how to turn a `for` loop into a comprehension
- why list comprehensions are often hard to read
- how to use list, set, an dictionary comprehensions as well as generator expressions
- how to make your comprehensions even more readable than your loops
- when and how not to use comprehensions
You'll come away from this talk with a cheat sheet for helping you remember when and how to use comprehensions.
Finding list comprehensions incomprehensible? Having trouble figuring out when to use list comprehensions or just plain `for` loops?
If you find comprehensions tricky to write or perplexing to read, this talk is for you.
We're going to learn:
- when and how to turn a `for` loop into a comprehension
- why list comprehensions are often hard to read
- how to use list, set, an dictionary comprehensions as well as generator expressions
- how to make your comprehensions even more readable than your loops
- when and how not to use comprehensions
You'll come away from this talk with a cheat sheet for helping you remember when and how to use comprehensions.
Presented by
Trey Hunner
Trey Hunner is a Python/Django teacher, trainer, and mentor. He is a director at the Python Software Foundation, a member of the Django Software Foundation, and is heavily involved with his local Python meetup group in San Diego.
Trey holds corporate training sessions on Python and Django by day and hosts live online teaching sessions for Python learners during nights and weekends.