Tabs versus Spaces in Source Code
harry.g.george at boeing.com
Mon May 15 02:13:09 EDT 2006
Edward Elliott <nobody at 127.0.0.1> writes:
> Eli Gottlieb wrote:
> > Actually, spaces are better for indenting code. The exact amount of
> > space taken up by one space character will always (or at least tend to
> > be) the same, while every combination of keyboard driver, operating
> > system, text editor, content/file format, and character encoding all
> > change precisely what the tab key does.
> What you see as tabs' weakness is their strength. They encode '1 level of
> indentation', not a fixed width. Of course tabs are rendered differently
> by different editors -- that's the point. If you like indentation to be 2
> or 3 or 7 chars wide, you can view your preference without forcing it on
> the rest of the world. It's a logical rather than a fixed encoding.
This has been discussed repeatedly, and the answer is "If you only
work alone, never use anyone else's code and no one ever uses your
codes, then do as you please. Otherwise use tab-is-4-spaces."
When you do Agile Programming with people using emacs, vim, nedit,
xedit, wordpad, eclipse, and who knows what else, the 4-spaces rule is
necessary for survival.
The reason is simple: People get confused, and accidentally get the
wrong tab indents when they move among editors or among settings on
the same editor. In most languages this is an irritation, requiring
some cleanup. In Python it is a disaster requiring re-inventing the
PLM Engineering Architecture
More information about the Python-list