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

List comprehensions are not conceptually like procedural code at all. They are completely declarative.

List comprehensions: the set contains this.

Map/filter: apply these functions to the set.

Procedural: follow this recipe for turning one list into another.



Maybe it's just me ... Every time I see something like

    [fn(x) for x in xs for xs in xss if cond(xs)]
I always think it's a loop, then an inner loop (and loops -> procedure ... then get confused which is inner and which is outer :|




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

Search: