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


Groups > comp.lang.python > #37520

Re: Arent these snippets equivalent?

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 <rosuav@gmail.com>
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 <roy-3DE6E9.17475523012013@news.panix.com>
References <d7191cec-d963-42c8-90ba-db6d1359ceeb@googlegroups.com> <mailman.923.1358979203.2939.python-list@python.org> <roy-3DE6E9.17475523012013@news.panix.com>
Date Thu, 24 Jan 2013 10:29:06 +1100
Subject Re: Arent these snippets equivalent?
From Chris Angelico <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.933.1358983756.2939.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Thu, Jan 24, 2013 at 9:47 AM, Roy Smith <roy@panix.com> 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

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


Thread

Arent these snippets equivalent? Coolgg <gauravj123@gmail.com> - 2013-01-23 13:56 -0800
  Re: Arent these snippets equivalent? John Gordon <gordon@panix.com> - 2013-01-23 22:06 +0000
  Re: Arent these snippets equivalent? Chris Angelico <rosuav@gmail.com> - 2013-01-24 09:13 +1100
    Re: Arent these snippets equivalent? Roy Smith <roy@panix.com> - 2013-01-23 17:47 -0500
      Re: Arent these snippets equivalent? Tim Chase <python.list@tim.thechases.com> - 2013-01-23 17:29 -0600
      Re: Arent these snippets equivalent? Chris Angelico <rosuav@gmail.com> - 2013-01-24 10:29 +1100
      Re: Arent these snippets equivalent? Terry Reedy <tjreedy@udel.edu> - 2013-01-23 21:38 -0500
        Re: Arent these snippets equivalent? Coolgg <gauravj123@gmail.com> - 2013-01-23 21:01 -0800
        Re: Arent these snippets equivalent? Coolgg <gauravj123@gmail.com> - 2013-01-23 21:01 -0800
  Re: Arent these snippets equivalent? Evan Driscoll <driscoll@cs.wisc.edu> - 2013-01-23 17:17 -0600

csiph-web