Ben Finney <[email protected]> writes:
> Fábio Santos <[email protected]> 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.
> for foo in (spam for spam in sequence if predicate(spam)): …
Better:
for foo in filter(predicate, sequence):
process(foo)
--
\ “Corporation, n. An ingenious device for obtaining individual |
`\ profit without individual responsibility.” —Ambrose Bierce, |
_o__) _The Devil's Dictionary_, 1906 |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list