re: Py in 5: List Comprehensions VIEW POST

FULL DISCUSSION
 

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 :)

 

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

 

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 :)

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

code of conduct - report abuse