allowing braces around suites

Andrew Durdin adurdin at gmail.com
Sun Aug 29 00:40:33 CEST 2004


On Sun, 29 Aug 2004 00:12:32 +0200, Christophe Cavalaria
<chris.cavalaria at free.fr> wrote:
> 
> Well, there are worse coding conventions than that. Remember that chaining
> unbraced if and else if becomes ambiguous.

Oh yes. I was bitten again by that just a couple of days ago. I had:

if(sometest)
    do(this);
else
    do(that);

And needed another (separate) test for do(this), so naturally changed
the code to be:

if(sometest)
    if(othertest)
        do(this);
else
    do(that);

It made me wish I was writing the program in Python -- no silly braces
to have to put in there :)



More information about the Python-list mailing list