Jussi Piitulainen wrote:

> Neal Becker writes:
> 
>> Is there a more elegant way to spell this?
>> 
>> for x in [_ for _ in seq if some_predicate]:
> 
> If you mean some_predicate(_), then possibly this.
> 
> for x in filter(some_predicate, seq):
>    handle(x)
> 

I like this best, except probably even better:

for x in ifilter (some_predicate, seq):

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to