[GRASSGUI] Re: indentation

Brad Douglas rez at touchofmadness.com
Mon Apr 30 17:54:54 EDT 2007


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.

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.  I tend to
shy away from this method and use spaces directly (configured tab to
convert to spaces in editor).

PS -
I've been away for a few weeks and am slowly catching up. :)

On Mon, 2007-04-30 at 17:52 +0200, Martin Landa wrote:
> I vote for 4-spaces.
> 
> Martin
> 
> 2007/4/30, Michael Barton <michael.barton at asu.edu>:
> > What do you think? 4 spaces (takes up less room) or 8 (I guess it is some
> > kind of standard).
> >
> > Michael
> >
> >
> > On 4/30/07 8:09 AM, "Martin Landa" <landa.martin at gmail.com> wrote:
> >
> > > yes, I am only following default settings of python-menu in GNU Emacs;-)
> > >
> > > 2007/4/30, Michael Barton <michael.barton at asu.edu>:
> > >> Here is where I got the 8 spaces.
> > >>
> > >> Michael
> > >> __________________________________________
> > >> Michael Barton, Professor of Anthropology
> > >> School of Human Evolution & Social Change
> > >> Center for Social Dynamics & Complexity
> > >> Arizona State University
> > >>
> > >> phone: 480-965-6213
> > >> fax: 480-965-7671
> > >> www: http://www.public.asu.edu/~cmbarton
> > >>
> > >>
> > >> ------ Forwarded Message
> > >>> From: Glynn Clements <glynn at gclements.plus.com>
> > >>> Date: Tue, 24 Apr 2007 05:41:55 +0100
> > >>> To: Michael Barton <michael.barton at asu.edu>
> > >>> Cc: Martin Landa <landa.martin at gmail.com>, grass-gui <grassgui at grass.itc.it>
> > >>> Subject: Re: [GRASSGUI] Re: a couple of questions
> > >>>
> > >>>
> > >>> Michael Barton wrote:
> > >>>
> > >>>>>>  One thing that I notice is that when we both work on a file, we
> > >>>>>> apparently
> > >>>>>> have different ways of indenting. This produces errors if not consistent
> > >>>>>> within a method or sometimes within a class. To get in sync, I was
> > >>>>>> wondering
> > >>>>>> how you do indents‹spaces or tabs? If spaces, how many? Glynn Clements
> > >>>>>> recommended tabs and a common indent distance of 4 spaces.
> > >>>>>
> > >>>>> yes, it must be synchronized. Hm, I am using default python-mode in
> > >>>>> Emacs 21.3.1. On my laptop Emacs 22.x.
> > >>>>
> > >>>> I'm using default python-mode tabs in Eclipse. It may be a thing of using
> > >>>> tabs or spaces. I can turn all my tabs to spaces. But a recent post from
> > >>>> Glynn suggested that tabs were preferable (for some reason I don't
> > >>>> remember).
> > >>>
> > >>> Hmm; I don't recall that.
> > >>>
> > >>> Spaces are more robust, as there's no ambiguity as to how many columns
> > >>> a space occupies. With tabs, there's always the problem of people
> > >>> thinking that tab width is a preference, and then their code isn't
> > >>> indented correctly (and, in Python, that means that it doesn't work).
> > >>>
> > >>> If everyone always, without exception, used tabs for indentation, then
> > >>> you could change your editor's tab width with no adverse consequences.
> > >>>
> > >>> Unfortunately, that's a pretty big "if"; in my experience, any
> > >>> approach which relies upon the concept of "without exception" is
> > >>> essentially doomed.
> > >>>
> > >>> Ultimately, it doesn't matter what you use so long as your editor's
> > >>> tab width is 8 columns. If it's something else, then you *must* use
> > >>> spaces.


-- 
Brad Douglas <rez touchofmadness com>                    KB8UYR/6
Address: 37.493,-121.924 / WGS84    National Map Corps #TNMC-3785




More information about the grass-gui mailing list