Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #84661

Re: Is there a more elegant way to spell this?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <random832@fastmail.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; '"if': 0.09; 'received:internal': 0.09; 'jan': 0.12; 'posted': 0.15; 'loop.': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:10.202.2.212': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:66.111.4.27': 0.16; 'received:messagingengine.com': 0.16; 'received:out3-smtp.messagingengine.com': 0.16; 'says...': 0.16; 'silly': 0.16; 'statement.': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'code,': 0.22; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'chris': 0.29; 'originally': 0.30; 'easier': 0.31; 'this.': 0.32; 'received:66': 0.35; 'subject:?': 0.36; 'received:10': 0.37; 'to:addr:python-list': 0.38; 'does': 0.39; 'though,': 0.39; 'to:addr:python.org': 0.39; 'from:no real name:2**0': 0.61; 'header:Message-Id:1': 0.63; 'subject:more': 0.64; 'taking': 0.65; 'subject:there': 0.68; 'article': 0.77; 'subject:this': 0.83; "it'd": 0.84
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:x-sasl-enc:from:to:mime-version :content-transfer-encoding:content-type:subject:date:in-reply-to :references; s=mesmtp; bh=nx9fmCG2V72hxuWAK1hUoVU6Oe8=; b=fTUVfd dO8EO3Ltlzi5sWYVD9z6pMDKWo5ebvPEbnaMs2xDgozh8icutdZCkdQpnqMoR1Gi jSal9A8rHvIdg5ywcqgPRgPgkxAi+M3etX2Yvz7fikeAMrb41ymvfJFgUXWC/2Ph s4sK49rko5X6ITzJUcKc2apPPJP2FceE/NzuI=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:x-sasl-enc:from:to :mime-version:content-transfer-encoding:content-type:subject :date:in-reply-to:references; s=smtpout; bh=nx9fmCG2V72hxuWAK1hU oVU6Oe8=; b=fUkpYdhU3sBDM8O+1r9+0q31bSbSvwNK2ec2h6qJziDymSFUh3rU aGSnmqSsTgYtkQehjA5ahRAMsZiTdermJvpwqb5BL3x1Z5dykIPIs+SjrRCg5AVL egkoY+o0/4b0g7kfO+kjc1XLb1Ctmfulr8MK5tETx4F3lXTPR5nriVk=
X-Sasl-Enc XzfFrXMEU2VDfguQ86V7tyl1wsZN24KfcvYV0IwDUKSw 1422382419
From random832@fastmail.us
To python-list@python.org
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Content-Type text/plain
X-Mailer MessagingEngine.com Webmail Interface - ajax-46f3f2c7
Subject Re: Is there a more elegant way to spell this?
Date Tue, 27 Jan 2015 13:13:39 -0500
In-Reply-To <MPG.2f31f1c4a200b3239896a0@nntp.aioe.org>
References <mailman.18170.1422364524.18130.python-list@python.org> <qot7fw8s3la.fsf@ruuvi.it.helsinki.fi> <MPG.2f31f1c4a200b3239896a0@nntp.aioe.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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18181.1422382422.18130.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1422382422 news.xs4all.nl 2936 [2001:888:2000:d::a6]:41117
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:84661

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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