alternatives to making blocks like { } or other ??

Tim Williams timothy.williams at nvl.army.mil
Thu May 20 08:07:49 EDT 2004


Greg Ewing <greg at cosc.canterbury.ac.nz> wrote in message news:<2h2epuF8ckqaU1 at uni-berlin.de>...
> Tim Williams wrote:
> > I found a bug in one of my programs recently where a line
> > of code should have been outside of an 'if', but wasn't because I hit
> > TAB one too many times.
> 
> And for some reason it wasn't obvious from looking
> at the indentation?
> 

Not right away. It wasn't until I noticed things started running
differently that I ran it in the debugger and saw my error. I had the
offending line in the right place at one point, but after adding some
code, I mistakenly indented that  one line when I was indenting the
new code. (I think that's what happened anyway - it's been awhile.)

I don't know about anyone else, but I've spent more than enough time
looking over and over at pieces of my code where a bug existed, not
finding the error sooner because I "knew" this piece of code was
right. Maybe this just says something about my programming ability.


> In a brace-delimited language, you can get the
> opposite problem, which is much worse: the code
> *looks* right judging by the indentation, but it
> doesn't match the brace structure.
> 
> Python is a WYSIWYG language!

But at least there, I can turn on paren-match mode in emacs and see
what code is in the block. If it's indented inconsistenly, then I can
fix how it looks, but I'm not changing the logic with whitespace.

Enough of this thread. I'll agree to disagree on this.



More information about the Python-list mailing list