DEV Community

Discussion on: Py in 5: List Comprehensions

Collapse
 
thejessleigh profile image
jess unrein

Excellent explainer! It's also worth noting that comprehensions are generally faster than for/while loops or using map. The Python interpreter is optimized to recognize comprehensions as a predictable pattern, so doing it the Pythonic way will also give your code a boost :)

Collapse
 
kaelscion profile image
kaelscion

You beat me to it! I am actually planning a post for next week that discusses the performance differences between Lambdas, Comprehensions, and functions like zip() for data-set creations in Python. I know you already know what the findings of that post will be, but don't spoil it! :D

Collapse
 
thejessleigh profile image
jess unrein

Oh no! Sorry to jump the gun. I've been really enjoying your Py in 5 posts. I can't wait to see the next one :)

Thread Thread
 
kaelscion profile image
kaelscion

Thanks so much! Little preview, next one is on @decorators :O. Stay tuned. I've got a post on Jinja and web template engines coming before that (Not part of py in 5 series, bit of a deeper dive), but this week it should be up :D