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


Groups > comp.lang.python > #69257

Re: Python language hack for C-style programmers [DO NOT USE!] :-)

References (2 earlier) <lh2jsg$cqu$1@ger.gmane.org> <CAPTjJmoU-Aa_Y2DDHzCyzMNUfNnuV2i2gsHWZP3gKBhzrXjLzw@mail.gmail.com> <lh39cc$6cd$1@ger.gmane.org> <CAPTjJmrXbB+3sK9BBg-PMik0wFB0XpzzqbidL1r1qUuuSNa2fQ@mail.gmail.com> <lh3bme$ubb$1@ger.gmane.org>
Date 2014-03-28 19:38 +1100
Subject Re: Python language hack for C-style programmers [DO NOT USE!] :-)
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.8661.1395995940.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Mar 28, 2014 at 7:26 PM, Peter Otten <__peter__@web.de> wrote:
> One of the most elegant applications of these two principles is to
> declare a variable in a condition. Consider:
>
> if (double d = prim(true)) {
>     left /= d;
>     break;
> }

Okay! Then I withdraw the "or, to my knowledge, C++" part of my
original statement. It's a useful feature, if not a unique one.

ChrisA

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


Thread

Re: Python language hack for C-style programmers [DO NOT USE!] :-) Chris Angelico <rosuav@gmail.com> - 2014-03-28 19:38 +1100

csiph-web