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


Groups > comp.lang.python > #82418

Re: Extension of while syntax

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.035
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'python.': 0.02; 'modify': 0.07; 'shifting': 0.09; 'subject:while': 0.09; 'cc:addr:python- list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'syntax,': 0.16; 'true:': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'certainly': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'dec': 0.30; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'fri,': 0.33; 'could': 0.34; 'common': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'form,': 0.38; 'pm,': 0.38; '12,': 0.39; 'extremely': 0.39; 'sure': 0.39; 'how': 0.40; 'skip:u 10': 0.60; 'is.': 0.60; 'break': 0.61; 'full': 0.61; 'soon': 0.63; 'common,': 0.84; 'idiom': 0.84; 'subject:Extension': 0.84; 'to:none': 0.92
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:cc :content-type; bh=cRYnOceo8iWQbeX+tu16ud8w/8jC5alZRrC3bknnv6w=; b=rwQK/QrTNsWizQyUkmSnJOrpfB6MVr37qrcsWUl/3yB6cuDCwPDmqePouUXfxVBNBH WGqhY1F+eQXMu1r/c4M/pSHJZTZ5mM5SXm1SZfDY0XsAfhe/Lqhymt7mc4mKScUNTNqQ 4VBqUS+1OJaRdb4z+PyZ8z7rj9zKZeCS+8MpHeASLLsPJgdCdlEUZtnKLHBBCfBMahMc 1wv+cqTtxqFkh1mY1Qur7Fn/Px/o3/VCT5g+CS1utTmWDKzcmDeiilomxnLSvINi18w7 /7Hs/Z66pTdFp8R3Rv+G6GuKknuADyFhBNWRNIc6wrwNVz1we4kp6C72ypzhbZbpxBDY /IwQ==
MIME-Version 1.0
X-Received by 10.50.171.168 with SMTP id av8mr3360162igc.2.1418369922372; Thu, 11 Dec 2014 23:38:42 -0800 (PST)
In-Reply-To <87r3w5gx7s.fsf@elektro.pacujo.net>
References <14d2b880-3837-4267-a769-33ae7393f78b@googlegroups.com> <mailman.16886.1418351925.18130.python-list@python.org> <87r3w5gx7s.fsf@elektro.pacujo.net>
Date Fri, 12 Dec 2014 18:38:42 +1100
Subject Re: Extension of while syntax
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.16895.1418369925.18130.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1418369925 news.xs4all.nl 2945 [2001:888:2000:d::a6]:48170
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82418

Show key headers only | View raw


On Fri, Dec 12, 2014 at 6:10 PM, Marko Rauhamaa <marko@pacujo.net> wrote:
> Chris Angelico <rosuav@gmail.com>:
>
>> You could deduplicate it by shifting the condition:
>>
>> while True:
>>     value = get_some_value()
>>     if value not in undesired_values: break
>>
>> But I'm not sure how common this idiom actually is.
>
> Extremely common, and not only in Python.

Something like it is certainly common, but to justify dedicated
syntax, the pure form has to be so amazingly common as to merit it. As
soon as you modify the pure form in any way, you need the statement
form, for full flexibility.

ChrisA

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Extension of while syntax Nelson Crosby <nc@sourcecomb.com> - 2014-12-11 18:21 -0800
  Re: Extension of while syntax Ben Finney <ben+python@benfinney.id.au> - 2014-12-12 13:37 +1100
  Re: Extension of while syntax Chris Angelico <rosuav@gmail.com> - 2014-12-12 13:38 +1100
    Re: Extension of while syntax Marko Rauhamaa <marko@pacujo.net> - 2014-12-12 09:10 +0200
      Re: Extension of while syntax Chris Angelico <rosuav@gmail.com> - 2014-12-12 18:38 +1100
        Re: Extension of while syntax Marko Rauhamaa <marko@pacujo.net> - 2014-12-12 10:25 +0200
      Re: Extension of while syntax cl@isbd.net - 2014-12-12 09:09 +0000
        Re: Extension of while syntax Marko Rauhamaa <marko@pacujo.net> - 2014-12-12 12:33 +0200
  RE: Extension of while syntax "Clayton Kirkwood" <crk@godblessthe.us> - 2014-12-11 18:59 -0800
  Re: Extension of while syntax Terry Reedy <tjreedy@udel.edu> - 2014-12-11 22:00 -0500
  Re: Extension of while syntax Ben Finney <ben+python@benfinney.id.au> - 2014-12-12 14:14 +1100
  Re: Extension of while syntax Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-12-12 08:00 +0000
  Re: Extension of while syntax Chris Angelico <rosuav@gmail.com> - 2014-12-12 19:05 +1100
  Re: Extension of while syntax Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-12-12 11:38 -0500
  Re: Extension of while syntax Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-13 22:56 +1100

csiph-web