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


Groups > comp.lang.python > #37520

Re: Arent these snippets equivalent?

References <d7191cec-d963-42c8-90ba-db6d1359ceeb@googlegroups.com> <mailman.923.1358979203.2939.python-list@python.org> <roy-3DE6E9.17475523012013@news.panix.com>
Date 2013-01-24 10:29 +1100
Subject Re: Arent these snippets equivalent?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.933.1358983756.2939.python-list@python.org> (permalink)

Show all headers | 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