why no "do : until"?

Grant Edwards grante at visi.com
Wed Jan 3 09:50:45 EST 2001


In article <3A52AF31.F7A9C32E at engcorp.com>, Peter Hansen wrote:

>Phew!  I pass your self-consistency test! :-) At first I did it
>inconsistently, before I came to appreciate the inherent value
>of consistency throughout.  Only problem I have is when I
>attempt to enclose a block with braces strictly for scoping
>reasons -- I don't know whether to indent the block or leave it
>outdented with the rest of the instructions.  After all, there
>is no enclosing conditional or loop structure:
>
>void f()
>    {
>    int x;
>    some code here;
>
>    // dang: do I indent this or not?
>    {
>    int x;
>
>    code that uses the inner x;
>    }
>
>    return;
>    }

That is indeed a sticky question.  I've found that when I need
to do that it's often as a temporary debugging hack, so I just
do something like:

void f()
  {
  asdf();
  qwer();
  if (1) /* debug */
    {
    int x;
    whatever uses x;
    goes here;
    }
  other stuff;
  }

That way, I can change the "if (1)" to "if (0)" to quickly
remove the debug code.

>Except for the evil, ugly, inconsistent brace style which has
>the opening brace on the end of a line and the closing brace
>outdented after the last nested statement.  People who use that
>technique should be barred from programming, not to mention
>shot.  I'd say "in my opinion" but of course this is a matter
>of *fact* and not open to discussion, so there.  :-)

Damned straight!

Somehow I learned to tolerate open/close brackets that don't
line up when using Scheme, but not C, Pascal, Modula-3, Python,
et al.

-- 
Grant Edwards                   grante             Yow!  Is it clean in other
                                  at               dimensions?
                               visi.com            



More information about the Python-list mailing list