Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #84661
| From | random832@fastmail.us |
|---|---|
| Subject | Re: Is there a more elegant way to spell this? |
| Date | 2015-01-27 13:13 -0500 |
| References | <mailman.18170.1422364524.18130.python-list@python.org> <qot7fw8s3la.fsf@ruuvi.it.helsinki.fi> <MPG.2f31f1c4a200b3239896a0@nntp.aioe.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18181.1422382422.18130.python-list@python.org> (permalink) |
On Tue, Jan 27, 2015, at 13:05, Mario Figueiredo wrote: > In article <qot7fw8s3la.fsf@ruuvi.it.helsinki.fi>, > jpiitula@ling.helsinki.fi says... > > > > If you mean literally some_predicate, then perhaps this. > > > > if some_predicate: > > for x in seq: > > handle(x) > > > > Careful. See Chris Warrick answer for the correct position of the 'if' > statement. I think by "if you mean literally some_predicate" he was taking some_predicate as a variable [rather than an expression] that does not change during the loop. That'd be a silly thing to do in the originally posted code, though, since it'd be easier to do "[] if not some_predicate else [...]"
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is there a more elegant way to spell this? Neal Becker <ndbecker2@gmail.com> - 2015-01-27 08:15 -0500
Re: Is there a more elegant way to spell this? Rustom Mody <rustompmody@gmail.com> - 2015-01-27 06:08 -0800
Re: Is there a more elegant way to spell this? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-01-27 16:25 +0200
Re: Is there a more elegant way to spell this? Neal Becker <ndbecker2@gmail.com> - 2015-01-27 09:37 -0500
Re: Is there a more elegant way to spell this? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-01-27 16:47 +0200
Re: Is there a more elegant way to spell this? Mario Figueiredo <marfig@gmail.com> - 2015-01-27 19:05 +0100
Re: Is there a more elegant way to spell this? random832@fastmail.us - 2015-01-27 13:13 -0500
Re: Is there a more elegant way to spell this? Neal Becker <ndbecker2@gmail.com> - 2015-01-27 13:25 -0500
Re: Is there a more elegant way to spell this? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-28 11:55 +1100
Re: Is there a more elegant way to spell this? Mario Figueiredo <marfig@gmail.com> - 2015-01-28 02:19 +0100
Re: Is there a more elegant way to spell this? Ben Finney <ben+python@benfinney.id.au> - 2015-01-28 12:29 +1100
Re: Is there a more elegant way to spell this? Mario Figueiredo <marfig@gmail.com> - 2015-01-28 09:32 +0100
Re: Is there a more elegant way to spell this? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-28 13:16 +1100
csiph-web