Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #84643 > unrolled thread
| Started by | Chris Warrick <kwpolska@gmail.com> |
|---|---|
| First post | 2015-01-27 14:20 +0100 |
| Last post | 2015-01-27 10:27 -0800 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Is there a more elegant way to spell this? Chris Warrick <kwpolska@gmail.com> - 2015-01-27 14:20 +0100
Re: Is there a more elegant way to spell this? Rob Gaddi <rgaddi@technologyhighland.invalid> - 2015-01-27 09:49 -0800
Re: Is there a more elegant way to spell this? Emile van Sebille <emile@fenx.com> - 2015-01-27 10:27 -0800
| From | Chris Warrick <kwpolska@gmail.com> |
|---|---|
| Date | 2015-01-27 14:20 +0100 |
| Subject | Re: Is there a more elegant way to spell this? |
| Message-ID | <mailman.18171.1422364818.18130.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
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:
if some_predicate:
do_something_to(x)
--
Chris Warrick <https://chriswarrick.com/>
Sent from my Galaxy S3.
[toc] | [next] | [standalone]
| From | Rob Gaddi <rgaddi@technologyhighland.invalid> |
|---|---|
| Date | 2015-01-27 09:49 -0800 |
| Message-ID | <20150127094911.236b6e6d@rg.highlandtechnology.com> |
| In reply to | #84643 |
On Tue, 27 Jan 2015 14:20:10 +0100
Chris Warrick <kwpolska@gmail.com> wrote:
> 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:
> 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.
[toc] | [prev] | [next] | [standalone]
| From | Emile van Sebille <emile@fenx.com> |
|---|---|
| Date | 2015-01-27 10:27 -0800 |
| Message-ID | <mailman.18183.1422383271.18130.python-list@python.org> |
| In reply to | #84657 |
On 1/27/2015 9:49 AM, Rob Gaddi wrote:
> Or the somewhat less indenty
>
> for x in seq:
> if not some_predicate: continue
> do_something_to(x)
>
... or shorter and equally less indenty
for x in seq:
if some_predicate: do_something_to(x)
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web