2025-04-26 – 22:15-22:40 (Africa/Abidjan), Barn
Have you seen Python’s comprehensions but found them odd and intimidating? You’re not alone! Whether you’re just starting out with Python, or you’ve been using it for a long time, I wouldn’t blame you for steering clear of the strange “this for this in that” syntax. But fear not; I will rescue you with cake!
We'll walk through for loops, and how comprehensions are their tasty cousins. We'll talk about the various comprehensions we have at our disposal, including dictionary comprehensions, and comprehensions with conditionals. And then, like a towering 3-tiered cake, we'll try our hand at nested comprehensions.
This talk will arm you with a mental anchor to fall back on every time you write a comprehension, regardless of how simple or complex. Over time—if you use this recipe enough—you won’t even need to crack open the cookbook. We will ask…
What do we want? Cake!
When do we want it? As we loop over this iterable!
You’ll leave hungry for those confusing-looking Python treats… and cake.
I like cats, my family, coffee, and Python. I make software at O'Reilly Media. I make bad jokes everywhere; you've been warned.