Comment

Comment by michaelvmata

  [(foo(a), bar(a)) for a in collection if condition(a) or alt(a)]

  foo_bar = lambda x: (foo(x), bar(x))
  condition_or_alt = lambda x: condition(x) or alt(x)
  map(foo_bar, filter(condition_or_alt, collection))
As logic gets more complicated, wouldn't list comprehensions become easier to read straight through?
parent michaelvmata 11 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton