Indentation style...

D-Man dsh8290 at rit.edu
Sun May 27 21:08:35 EDT 2001


On Sun, May 27, 2001 at 10:52:59AM -0700, Ken Peek wrote:
| I think tabs should be forced at the beginning of lines, and spaces
| should be forced after the first printable character is typed.  The
| exception to this rule would be an empty line, and multiline
| strings.

This reminds me of 'make' :
    if a line begins with a tab, it is the body of a rule
    if it begins with a space it isn't,
(though I don't remember what exactly it means, I just remeber that
the difference between a tab and a space is significant and can break
your Makefiles)

How many apps show the difference between a tab and N spaces (where
N==8, or some other random number that seemed like a good idea at the
time ;-))?

| This will allow the programmer to set their editor to display a tab
| at whatever indentation spacing they like, and the original
| structure (which is part of the documentation of the code) is
| preserved.

Others have already explained that tabs are 8 spaces.  Set
"softtabstop" and "shiftwidth" to your preferred indentation level (4
for me) and set "expandtab" to allow usage of the tab key on your
keyboard, but insert spaces (according to softtabstop) instead.
(these terms apply for (g)vim, see your editor's manual if you choose
a different editor).

-D





More information about the Python-list mailing list