Fábio Santos <fabiosantos...@gmail.com> writes: > It is a shame that this is not possible in python. for..if exists in > comprehensions and not in regular loops but that would be nice > sometimes.
So you use it in a generator expression, and iterate over the generator: for foo in (spam for spam in sequence if predicate(spam)): process(spam) That way, there's no need for new syntax. -- \ “bash awk grep perl sed, df du, du-du du-du, vi troff su fsck | `\ rm * halt LART LART LART!” —The Swedish BOFH, | _o__) alt.sysadmin.recovery | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list