[GRASSGUI] Re: indentation

Glynn Clements glynn at gclements.plus.com
Tue May 1 00:55:23 EDT 2007


Brad Douglas wrote:

> I think it would be beneficial to keep the same coding style used in C
> modules, where applicable.  Tab of 4 is consistent.
> 
> 8-space tab is more traditional in the Linux kernel and many other
> projects, but GRASS seemed to adopt 4-space tab early-on.  Linus'
> 8-space tab argument is that if you go past 80 chars with indentation +
> code (usually two tab indentations), it should be a separate function.

I think that you are confusing the tab width with the indentation
step. A 4-column indentation step is reasonable; 4-column tab stops
aren't.

> As Glynn mentioned, if we used '\t' instead of spaces, then the tab size
> is rather moot as it is configurable in your favorite editor. 

However, it isn't configurable in Python; tabs stops are always 8
columns apart, in the sense that a line which begins with a tab is
deemed to have the same indentation as one which begins with 8 spaces.

If you only ever use tabs, then the width of tab doesn't actually
matter. But relying upon no-one ever using spaces for indentation is
fragile.

IOW, while you can configure your editor to treat a tab as something
other than 8 spaces, you can't configure everyone else's editors, and
you can't configure Python.

Indentation step is a stylistic choice; tab width is a protocol
variation (ASCII with 4-column tabs is a different protocol to ASCII
with 8-column tabs). Any form of communication requires that both ends
use the same protocol.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-gui mailing list