Tab indentions on different platforms?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sun Dec 30 18:28:50 EST 2007


On Sun, 30 Dec 2007 20:33:19 +0000, Thorsten Kampe wrote:

> * Steven D'Aprano (Sun, 30 Dec 2007 00:37:32 -0000)
>> On Sat, 29 Dec 2007 15:29:25 +0000, Thorsten Kampe wrote:
>> > I'd personally go for spaces because:
>> > 
>> > 1. I don't like things I cannot see (control characters)
>> 
>> You can see spaces but not tabs? Your editor is pretty weird. In all
>> the editors I've every used, both spaces and tabs show up as empty
>> white space.
> 
> That's because the editor displays those invisible tab control
> characters as something they're not: spaces.

Editors display tab characters as "indent to next tab stop". That's what 
they're for, and any editor that doesn't behave that way is buggy. 

Tab characters are no more invisible than space characters. How can you 
see space characters but not tabs? Why aren't space characters invisible 
too? Why do you dislike tabs *specifically* because they are invisible, 
but like invisible spaces?



>> > 2. I never had problems with spaces but plenty with tabs
>> 
>> What problems have you had with tabs that aren't related to buggy
>> applications or users that mix tabs and spaces?
> 
> Fortunately I don't remember every incident when I stumbled about
> something weird behaving or looking. One thing I do remember is reading
> python source code (not my own) with a pager. The source code was badly
> indented. The pager was not "buggy".

Given the constraints of the typical pager one-line display, and the 
tendency of pagers I've seen to arbitrarily drop leading whitespace *of 
any sort* from the start of lines, I'd like to know how you could tell 
the indentation was wrong.

If the source code was correctly indented, but displayed wrongly by the 
pager, then of course the pager was buggy. And if the source code was 
incorrectly indented and the pager showed it as it was, well, that can 
happen with spaces too:

x = 1  
 for i in range(20):       
         x += i       
    print x


No tabs there, all the indentation is done with spaces. How would you 
expect a pager to display that?



-- 
Steven



More information about the Python-list mailing list