Hacker News new | past | comments | ask | show | jobs | submit login

It used to be for performance reasons, the way python runs comprehension is faster than plain loops, so the more you could cram in a single comprehension, the faster it ran.

These days though, you can split it in generator expressions and make it run at the end inside a comprehension, and you get best of both worlds: splitting helps readability, running it all at once in a single comprehension at the end keeps it performing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: