Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.108 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.79; '*S*': 0.01; 'elegant': 0.07; 'cc:addr :python-list': 0.11; 'jan': 0.12; 'galaxy': 0.16; 'wrote:': 0.18; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'this?': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'received:google.com': 0.35; 'there': 0.35; 'subject:?': 0.36; 'pm,': 0.38; 'skip:\xc2 10': 0.60; 'subject:more': 0.64; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'subject:there': 0.68; '8bit%:100': 0.72; 'subject:this': 0.83; '2015': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=kGPsf7ZDl59YbMn6UvnTU14WeYIE8yw/xy4wK5zg9Vw=; b=kNfcIMOHV6FNuB7WJ3f79twmBwzzF3J5oJFyoCHXUV4F1akB5e1buAASy5zg6lo9v6 UFqHtvwsQnHnWAEvoqSPjZwRlzdNknwiSmfJrooOk4glxn0r9kwGevZ6wQrqvrGliQRu 2hsZX/eH+8Rkm9jXB7wInvYAFWZCeeG6w04sxD6paDkAXvJsqHN4wsrHDk8RkpujrMhR z4M+DpTOk7/FPv4ChpynYHJibDabmBeiBAdA4U8xTmuLocPmLgvTVQHNkg0gZXXeO2oD aue9oBQ99KikVo1QSrawM6Is6q8tw4HbEpXEBkkQMgqo2KgfOGfBmqlpxzGpn53cYtsO r1DA== MIME-Version: 1.0 X-Received: by 10.112.85.11 with SMTP id d11mr1579668lbz.100.1422364810054; Tue, 27 Jan 2015 05:20:10 -0800 (PST) In-Reply-To: References: Date: Tue, 27 Jan 2015 14:20:10 +0100 Subject: Re: Is there a more elegant way to spell this? From: Chris Warrick To: Neal Becker Content-Type: multipart/alternative; boundary=001a11345ed63e9242050da21d56 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422364818 news.xs4all.nl 2833 [2001:888:2000:d::a6]:42253 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84643 --001a11345ed63e9242050da21d56 Content-Type: text/plain; charset=UTF-8 On Jan 27, 2015 2:16 PM, "Neal Becker" 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 Sent from my Galaxy S3. --001a11345ed63e9242050da21d56 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On Jan 27, 2015 2:16 PM, "Neal Becker" <ndbecker2@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:
=C2=A0=C2=A0=C2=A0 if some_predicate:
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 do_something_to(x)

--
Chris Warrick <https://chriswarric= k.com/>
Sent from my Galaxy S3.

--001a11345ed63e9242050da21d56--