On 2016-09-30, Grant Edwards <[email protected]> wrote:
> On 2016-09-30, Steve D'Aprano <[email protected]> wrote:
>
>> To me, "make for-loops be their own scope" sounds like a joke
>> feature out of joke languages like INTERCAL. I'm not aware of any
>> sensible language that does anything like this.
>
> In C99 a for loop has its own namespac:
[...]
> I think that's an absolutely brilliant feature, and I use it a _lot_
> when writing C code. I'm a big fan of minimizing the lifetime/scope
> of variables. I wish if/then/else did the same thing:
>
> if ((r=some_function()) != R_SUCCESS)
> printf("some_function() failed with status %d\n",r);
The example of what I wished C did should have been this:
if ((int r=some_function()) != R_SUCCESS)
printf("some_function() failed with status %d\n",r);
--
Grant Edwards grant.b.edwards Yow! If I pull this SWITCH
at I'll be RITA HAYWORTH!!
gmail.com Or a SCIENTOLOGIST!
--
https://mail.python.org/mailman/listinfo/python-list