Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

This is the one case where python's list comprehension syntax isn't so efficient. Don't worry about it - be consistent and use it nevertheless. It doesn't matter much.

In the cases where x gets also transformed or you do some unpacking the syntax is very efficient and easy to read: [f(y) for x, y in items if g(x)]. Basically it's a poor man's relations programming (think databases). It's brilliant. (And definitely easier to read and write than the Haskell list comprehension syntax).



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

Search: