I can use if and for in list comprehensions/generator expressions as
if
for
list(i for i in range(100) if i*i < 30)
I
The various functions in itertools (takewhile() comes to mind) can help.
takewhile()