Op 30-08-13 06:55, Ben Finney schreef:
> Ben Finney <ben+pyt...@benfinney.id.au> writes:
> 
>> 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.
>>     for foo in (spam for spam in sequence if predicate(spam)): …
> 
> Better:
> 
>     for foo in filter(predicate, sequence):
>         process(foo)

Well better in what way? You now have to translate a predicate
expression into a predicate function. Which AFAIU was one of
the reasons to move away from map/filter to list comprehension.

As I understand it, python made a move away from map and filter
towards list comprehension. Chris seems to want some of the
possibilities that came with that incorporated into the for
statement. And your suggestion is to go back to the old kind
of filter way.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to