[f(x) for x in X if f(x)]

How would one go about getting [f(x) for x in X if f(x)] with one call to f(x) per element? If f(x) can return None, I would like to filter out those values in the first pass.

12 comments