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

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]


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

Search: