Steve D'Aprano <steve+pyt...@pearwood.info> writes: > What would you expect this syntax to return? > [x + 1 for x in (0, 1, 2, 999, 3, 4) while x < 5]
[1,2,3] though the later example is more confusing. I don't think we need this since we have itertools.takewhile: from operator import gt from functools import partial from itertools import takewhile [x + 1 for x in takewhile(partial(gt,5), (0,1,2,999,3,4))] In the eye of the beholder maybe, but I think it's less ugly in Haskell: [x + 1 | x <- takeWhile (< 5) [0,1,2,999,3,4]] -- https://mail.python.org/mailman/listinfo/python-list