On Tue, 27 Jan 2015 14:20:10 +0100
Chris Warrick <kwpol...@gmail.com> wrote:

> On Jan 27, 2015 2:16 PM, "Neal Becker" <ndbeck...@gmail.com> wrote:
> >
> > Is there a more elegant way to spell this?
> >
> > for x in [_ for _ in seq if some_predicate]:
> 
> for x in seq:
>     if some_predicate:
>         do_something_to(x)
> 
> -- 
> Chris Warrick <https://chriswarrick.com/>
> Sent from my Galaxy S3.
> 
Or the somewhat less indenty

for x in seq:
    if not some_predicate: continue
    do_something_to(x)

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to