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

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


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

Search: