Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!81.171.88.16.MISMATCH!hq-usenetpeers.eweka.nl!hq-usenetpeers.eweka.nl!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:while': 0.09; 'jan': 0.12; 'partly': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'recognise': 0.16; 'reedy': 0.16; 'repetition,': 0.16; 'true:': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'header:User-Agent:1': 0.23; 'looks': 0.24; "i've": 0.25; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'code': 0.31; 'this.': 0.32; 'form.': 0.35; 'but': 0.35; 'easily': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'pm,': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'break': 0.61; 'due': 0.66; 'proposal.': 0.84; 'received:fios.verizon.net': 0.84; 'subject:Extension': 0.84; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Extension of while syntax Date: Thu, 11 Dec 2014 22:00:44 -0500 References: <14d2b880-3837-4267-a769-33ae7393f78b@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-108-16-203-145.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <14d2b880-3837-4267-a769-33ae7393f78b@googlegroups.com> 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1418353269 news.xs4all.nl 2845 [2001:888:2000:d::a6]:39666 X-Complaints-To: abuse@xs4all.nl X-Received-Body-CRC: 2769154443 X-Received-Bytes: 3543 Xref: csiph.com comp.lang.python:82409 On 12/11/2014 9:21 PM, Nelson Crosby wrote: > I was thinking a bit about the following pattern: > > value = get_some_value() > while value in undesired_values: > value = get_some_value() This is do_while or do_until. In Python, write it as do_until in this form. while True: value = get_some_value() if value not in undesired_values: break > I've always hated code that looks like this. Partly due to the repetition, > but partly also due to the fact that without being able to immediately > recognise this pattern, it isn't very readable. The repetitiion is easily eliminated. > value = get_some_value() while value in undesired_values() Forget this, or anything like it, as a 'serious' proposal. -- Terry Jan Reedy