alternatives to making blocks like { } or other ??

JanC usenet_spam at janc.invalid
Sun May 23 11:57:11 EDT 2004


timothy.williams at nvl.army.mil (Tim Williams) schreef:

>>> I have to put my 2 cents in here. I love Python, but the one thing I
>>> miss is using {} or something to enclose blocks. I edit in emacs
>>> python-mode, and believe in indentation, but sometimes I'll
>>> inadvertently change a line of code's indentation and it throws the
>>> logic off. 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. A {} block would've caught that. I know that's
>>> just being careless, but I need all the help I can get!

>> 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.

In Scintilla-based editors like SciTE you (can) get a hint of the block 
structure as a by-product of the folding support.
An example screenshot: <http://scintilla.sf.net/SciTEImage.html>

Maybe something similar is possible in emacs?

-- 
JanC

"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9



More information about the Python-list mailing list