TABs (was: Waffling between Python and Ruby)

Just van Rossum just at letterror.com
Mon Jun 19 03:08:02 EDT 2000


[me]
>> The fact that the "tab == 8 spaces" rule is a) not generally accepted and
>> b) not generally enforcable across editors makes it IMHO a pretty useless
>> definition. Tools that break when using anything but 8 are badly designed:
>> it's like using two digits to store a year...

[David Bolen wrote]
>In this particular case, it's not so much that anything is actually
>breaking (since the use in question was solely using TABs for
>indentation), but that the visual indentation being enforced by
>setting the editor to use 4 instead of the more common 8 just makes it
>harder to get the same visual representation in other tools - without
>somehow also adjusting each of those tools.

I know, but to me that reinforces the Y2K problem analogy: most of these
problems didn't make apps crash, they just gave wrong results silently...

>But I do agree with you that the fact that this sort of discussion
>takes place over what a TAB really should be defined to do makes it
>largely unsuitable for use in code that is meant to be distributed and
>shared.

But that's not at all what I wanted to say. I'm perfectly happy with using
tabs (I use them all the time). It's only the mixing of tabs & spaces
that's bad.

The thing I really wanted to say (but somehow didn't ;-) is that using a
mix of tabs and spaces to get an indentation that's not the same as the
current tab stop comes from the assumption that "a tab is X spaces". By
saying "a tab setting of anything else but 8 is evil" you're guilty of
_encouraging_ the evil mixing of tabs and spaces. In other words, if noone
ever assumed anything about tab size, noone in their right mind would've
even started mixing tabs with spaces.

Using spaces-only is a safe solution, but only if you are absolutely sure
you never want anyone to use a proportional font to view your code... (For
those of you who have never used proportional fonts before <wink>: the
width of the space character varies from font to font (as it should); this
means spaces are pretty much useless as indentation!)

Just






More information about the Python-list mailing list