Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'value,': 0.03; 'assign': 0.07; 'function,': 0.07; 'python': 0.09; 'braces': 0.09; 'received :mail-vc0-f174.google.com': 0.09; "wouldn't": 0.11; '(there': 0.16; '24,': 0.16; 'braces,': 0.16; 'expression,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'keywords.': 0.16; 'roy': 0.16; 'simplest': 0.16; 'subject:these': 0.16; 'true:': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'jan': 0.18; '(on': 0.22; 'assignment': 0.22; 'feature': 0.24; 'header:In- Reply-To:1': 0.25; 'am,': 0.27; 'language.': 0.27; 'mind.': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'received:209.85.220.174': 0.29; '(including': 0.30; 'point': 0.31; 'to:addr:python-list': 0.33; 'that,': 0.34; 'received:google.com': 0.34; 'received:209.85.220': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'test': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'most': 0.61; 'believe': 0.69; 'smith': 0.71; '2013': 0.84; 'pike': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=Jkc0CCKtA7jWDPTGGFjxbFg6+S3G5dFMhP12l7Cm3oA=; b=EteoU02djYrUmjYwnY7z2Mp6dlLZZl2HO5XAu2N2+g55jkjVK576hmHa8nqEMntDCe z7m/hiB2TAyPeLoi57i96R7UQmgG+9tZY9Mmnbj6VGXAsON5dz/O4yXGRkCULzHzUHgv F0OakMf0YpZhjzmsvgbegV9u7T7GCVF7PmfPj91IsCeIPx3GOi+/wZa9TjDk4Rum/hH1 MiGnVjaciD6PQhFuaD6H354JFwcp5v+sB4gpt66DmCL7NYLznx3PY9fok8Ojvyo1itCh 99C5eGKtdVM8TLkGJ45daXpu5pt4WifmFnhF7H+w8qk9P0J9GKeC9i+E8HoBISObWAwp bclw== MIME-Version: 1.0 X-Received: by 10.52.28.176 with SMTP id c16mr2973974vdh.126.1358983746992; Wed, 23 Jan 2013 15:29:06 -0800 (PST) In-Reply-To: References: Date: Thu, 24 Jan 2013 10:29:06 +1100 Subject: Re: Arent these snippets equivalent? From: Chris Angelico To: python-list@python.org 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358983756 news.xs4all.nl 6981 [2001:888:2000:d::a6]:47006 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37520 On Thu, Jan 24, 2013 at 9:47 AM, Roy Smith wrote: > while getchar() as c: > putchar(c) > > That would give people (including me) the use case they're after most of > the time (call a function, assign the return value, and test it). It's > way less klunky than: > > while True: > c = getchar() > if c: > break > putchar() > > It wouldn't require assignment as an expression, or braces, or any new > keywords. I believe this was discussed recently (on python-ideas?). It's nice in its simplest form, but doesn't cover all possibilities. My point about braces was that, like assignment-expressions, it's a feature that Python will not be implementing. Fundamentally against the "push" of the language. If you want C, you know where to get it. (There are other options, of course; ECMAScript and Pike come to mind. But you know what I mean.) ChrisA