Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'example:': 0.03; 'python': 0.09; 'pep': 0.09; 'subject:while': 0.09; 'english.': 0.15; 'languages.': 0.15; '"while': 0.16; '"with"': 0.16; '24,': 0.16; 'boolean': 0.16; 'expr': 0.16; 'oct': 0.16; 'statement.': 0.16; 'subject:expression': 0.16; 'ugly.': 0.16; 'var.': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'tim': 0.18; 'not,': 0.21; 'header:In-Reply- To:1': 0.25; 'skip:" 20': 0.26; 'wonder': 0.27; 'message- id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'correct': 0.28; 'chase': 0.29; 'this.': 0.29; 'received:209.85.215.46': 0.30; 'could': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'really': 0.36; 'but': 0.36; 'flow': 0.36; 'test': 0.36; 'being': 0.37; 'quite': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'easily': 0.39; 'header:Received:5': 0.40; 'most': 0.61; 'different.': 0.84; 'naturally.': 0.84; 'parity': 0.84; 'prey': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Hcw93M8WNsFMbJcgC8NnmtnpouybMVoDSl0sgpO468I=; b=IXWZFWGQkR9RmMIv9iOj7m8CEKdAYdtLGntehFl5XqYNEs73jjLKKorHhabNfVzI+x ScXU2LLw3qWXeAU91juhEuqcyIjnYw3Tksx2GyZIK3R9ih6b2xR0LH9ZO0eS/EbYSu6K O1EVS87zOc0QNe/pzZkaonmEdcVMD2Wh1zN00kBmEhUXD5PzQVu9ybX4IQu1fTOM00Dt MUgGy3dcpE+NTH4DCXMqJ0Yego+e7dhUXEXCvlijVij5lPZw1TOE7ayRoV76RUZzuwI7 U8QYZgxLeFaQrci33HKiOL1g0+OueFkmqABiNV1sww+3EEjPql0pwo3J93wX/I8LPivk CHrQ== MIME-Version: 1.0 In-Reply-To: <50886398.5050301@tim.thechases.com> References: <50886398.5050301@tim.thechases.com> From: Ian Kelly Date: Wed, 24 Oct 2012 16:54:14 -0600 Subject: Re: while expression feature proposal To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351119286 news.xs4all.nl 6881 [2001:888:2000:d::a6]:57988 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32076 On Wed, Oct 24, 2012 at 3:54 PM, Tim Chase wrote: > It may be idiomatic, but that doesn't stop it from being pretty > ugly. I must say I really like the parity of Dan's > > while EXPR as VAR: > BLOCK > > proposal with the "with" statement. It also doesn't fall prey to > the "mistaken-assignment vs. intentional-assignment" found in most > C-like languages. I could see a pretty reasonable PEP coming from this. Often though the while test is not a simple boolean test of VAR. For example: j = int(random() * n) while j in selected: j = int(random() * n) It also doesn't flow quite as naturally. "with x as y" is grammatically correct English. "while x as y" is not, and I wonder how easily it might be confused for "while x is y", which is valid Python and means something completely different.