I have a list comprehension which approximates to:
[f(x) for x in l if f(x)]
Where l is a list and f(x) is an expensive function which retu
Use map() !!
map()
comp = [x for x in map(f, l) if x]
f is the function f(X), l is the list
f
f(X)
l
map() will return the result of f(x) for each x in the list.
f(x)