News for hackers. Stuff that matters.
Re:Functional Programming in Python [pdf] by michaelvmata on Tuesday July 28, 2015 @02:41PM (#9963645)

  [(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?

There are no comments on this comment yet.