[Tutor] tabs or spaces (the endless debate!)

Tim Peters tim_one@email.msn.com
Tue Feb 18 17:48:28 2003


[attribution lost]
>> diff't environments use diff't sizes for tabs).

[R. Alan Monroe]
> So? It's purely cosmetic. The content remains true.

Not so.  If you set an editor to use hard tabs, it probably uses them
everywhere, and then structured comments and string contents that are
*intended* to "line up" across lines no longer do so unless viewed under a
tool that uses exactly the same interpretation of hard tabs as was used by
the author's tool at the time of creation.  A tab can "mean" anything, and,
for example, *usually* means "8 spaces" to Unix people but "4 spaces" to
Windows people.  It's common for printing and terminal display programs to
have their own ideas for what "a tab means" too, independent of what you've
talked your editor into believing.  Some oddball programs even interpret tab
characters as they were originally intended <wink> to be viewed:  like the
physical tab stops on a mechanical typewriter, representing fixed distances
from the left margin.

> Anyway, I don't think there's a single "right" answer to this
> question.

The Python library defines the standard for distributed Python code (4-space
indents, no hard tabs anywhere in the file).

> I have always used real tabs up until now, but I'm trying
> spaces on my latest project just for comparison. :^)

If it's a project for your own use, suit yourself.  If you intend other
people to edit it, or even look at the code, do them a favor by not forcing
them them to guess what you think a tab means.