[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NOISE] Curly braces [was Re: Curl]

On 11/30/01 5:38 PM, "Tony Kimball" <alk@pobox.com> wrote:

> Algebraic expressions are not the only analogous case -- they are just
> the most familiar, because you've been taught to use them since you
> were wee.  Indentation problems occur in Python, mismatched braces
> occur in C, etc.  Lisp expressions and C blocks have the advantage
> that the reader/parser will catch the error in almost every practical
> case.  Infix expressions relying on operator precedence lack this
> advantage.  I haven't coded enough Python to make an inference
> regarding the likelihood of an uncaught indentation error.

If you have an error in your indentation, your code doesn't run. At least, I
haven't yet run into a circumstance where when I had incorrectly indented
code, it ran without giving an error (traceback). I wouldn't say that I've
hacked a lot of Python, especially considering who else on this list, but
I've hacked enough, I think, to say this with confidence. Indeed, you mostly
run into indentation errors when first getting into Python, and less so
afterward, and that seems to be the most practical strenuous test available.
You know something is wrong with a language when it enforces a construct
(like indentation) but fails to catch violations of that construct when it
is likely to occur the most. IOW, if I had found that my Python programs
were requiring me to fix indentation to run correctly, but would run anyway
-- incorrectly, then it wouldn't be of much real use.

Of course, some editing environments make this easier than others. A while
back, Sean McGrath showed me a neat setup he had under GNU Emacs to
automatically handle indentation and to to provide visual clues when the
program structure was incorrect (similar to blinking parens). I'm a fan of
XEmacs' Cpython-WSM (whitespace) mode.

Dan Moniz <dnm@pobox.com> [http://www.pobox.com/~dnm/]