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

Good point. I missed that and made a mistake. It should have been:

[x * x for x in [1, 2, 3, 4] if x * x < 10]

There is a subtle shift in semantics. The functional form defines a sequence of function applications whereas the list comp notation is more of a declaration.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: