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: 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> <87r3w5gx7s.fsf@elektro.pacujo.net> Date: Fri, 12 Dec 2014 18:38:42 +1100 Subject: Re: Extension of while syntax From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Fri, Dec 12, 2014 at 6:10 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> 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