Python list comprehension – want to avoid repeated evaluation

[y for y in (f(x) for x in l) if y]

Will do.

Leave a Comment