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

Chris Angelico rosuav at
Fri Mar 28 09:38:52 CET 2014

On Fri, Mar 28, 2014 at 7:26 PM, Peter Otten <__peter__ at> 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.


More information about the Python-list mailing list