semicolon at end of python's statements
Ben Finney
ben+python at benfinney.id.au
Thu Aug 29 18:17:51 EDT 2013
Fábio Santos <fabiosantosart at 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
More information about the Python-list
mailing list