3 ms·
List comprehensions are not conceptually like procedural code at all. They are completely declarative. List comprehensions: the set contains this. Map/filter:
by yummyfajitas 17y ago
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.
- riobard 17y agoMaybe 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 :|