|
|
|
Martin Landa
|
I vote for 4-spaces.
Martin 2007/4/30, Michael Barton <[hidden email]>: > 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" <[hidden email]> wrote: > > > yes, I am only following default settings of python-menu in GNU Emacs;-) > > > > 2007/4/30, Michael Barton <[hidden email]>: > >> 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 <[hidden email]> > >>> Date: Tue, 24 Apr 2007 05:41:55 +0100 > >>> To: Michael Barton <[hidden email]> > >>> Cc: Martin Landa <[hidden email]>, grass-gui <[hidden email]> > >>> 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. > >>> > >>> -- > >>> Glynn Clements <[hidden email]> > >> > >> ------ End of Forwarded Message > >> > >> > > > > __________________________________________ > 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 > > > -- Martin Landa <[hidden email]> * http://gama.fsv.cvut.cz/~landa * _______________________________________________ grassgui mailing list [hidden email] http://grass.itc.it/mailman/listinfo/grassgui |
||||||||||||||||
|
Michael Barton
|
OK by me.
Michael On 4/30/07 8:52 AM, "Martin Landa" <[hidden email]> wrote: > I vote for 4-spaces. > > Martin > > 2007/4/30, Michael Barton <[hidden email]>: >> 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" <[hidden email]> wrote: >> >>> yes, I am only following default settings of python-menu in GNU Emacs;-) >>> >>> 2007/4/30, Michael Barton <[hidden email]>: >>>> 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 <[hidden email]> >>>>> Date: Tue, 24 Apr 2007 05:41:55 +0100 >>>>> To: Michael Barton <[hidden email]> >>>>> Cc: Martin Landa <[hidden email]>, grass-gui >>>>> <[hidden email]> >>>>> 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. >>>>> >>>>> -- >>>>> Glynn Clements <[hidden email]> >>>> >>>> ------ End of Forwarded Message >>>> >>>> >>> >> >> __________________________________________ >> 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 >> >> >> > __________________________________________ 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 _______________________________________________ grassgui mailing list [hidden email] http://grass.itc.it/mailman/listinfo/grassgui |
||||||||||||||||
|
Brad Douglas
|
In reply to this post
by Martin Landa
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 <[hidden email]>: > > 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" <[hidden email]> wrote: > > > > > yes, I am only following default settings of python-menu in GNU Emacs;-) > > > > > > 2007/4/30, Michael Barton <[hidden email]>: > > >> 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 <[hidden email]> > > >>> Date: Tue, 24 Apr 2007 05:41:55 +0100 > > >>> To: Michael Barton <[hidden email]> > > >>> Cc: Martin Landa <[hidden email]>, grass-gui <[hidden email]> > > >>> 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 _______________________________________________ grassgui mailing list [hidden email] http://grass.itc.it/mailman/listinfo/grassgui |
|
Michael Barton
|
Thanks for the informative reply. As one intrigued by the past, I always
appreciate and enjoy understanding the history of things like this. Michael On 4/30/07 2:54 PM, "Brad Douglas" <[hidden email]> 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. > > 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 <[hidden email]>: >>> 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" <[hidden email]> wrote: >>> >>>> yes, I am only following default settings of python-menu in GNU Emacs;-) >>>> >>>> 2007/4/30, Michael Barton <[hidden email]>: >>>>> 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 <[hidden email]> >>>>>> Date: Tue, 24 Apr 2007 05:41:55 +0100 >>>>>> To: Michael Barton <[hidden email]> >>>>>> Cc: Martin Landa <[hidden email]>, grass-gui >>>>>> <[hidden email]> >>>>>> 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. > __________________________________________ Michael Barton, Professor of Anthropology School of Human Evolution & Social Change Center for Social Dynamics and Complexity Arizona State University phone: 480-965-6213 fax: 480-965-7671 www: http://www.public.asu.edu/~cmbarton _______________________________________________ grassgui mailing list [hidden email] http://grass.itc.it/mailman/listinfo/grassgui |
||||||||||||||||
|
Glynn Clements
|
In reply to this post
by Brad Douglas
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 <[hidden email]> _______________________________________________ grassgui mailing list [hidden email] http://grass.itc.it/mailman/listinfo/grassgui |
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |