Hacker News new | ask | show | jobs
by shakna 3435 days ago
... Except generators and comprehensions are often faster than for loops in your hot path.

Apart from that... What's readable tends to be the best option.

1 comments

I think the Python community considers list comprehension more readable than loops.

And writing generators allows you to write simple code with them. I don't consider generators to be fancy - just a tool to pull out complexity into a small area and make the rest of the code readable.