3 ms·
Since it's all generator expressions internally anyway, an intermediate doesn't actually add appreciable (any?) runtime overhead but does make the code more rea
by andrewaylett 4y ago
Since it's all generator expressions internally anyway, an intermediate doesn't actually add appreciable (any?) runtime overhead but does make the code more readable:
ys = (x.ComputeSomething() for x in xs)
result = [y for y in ys if y.isFoo and y.isBar]