Non-Indented python

David Bolen db3l at
Thu Nov 22 06:25:28 CET 2001

Chris Liechti <cliechti at> writes:

> tabs are specified as 8 characters. only programmers that use tabs to 
> indent make them 4 or 3 characters...

Well, you have to be a little careful how you phrase this.  I'm not
aware of any global document or specification that actually makes a
pronouncement that tabs are 8 characters (and I presume you actually
mean up to 8 characters, not 8 characters fixed).  What we've really
got is a legacy from at least the early visual terminals (and
particularly the VTxx class from DEC) that defaulted that way.  Maybe
it goes further back, but my first video display was a VT52, so I
can't say for sure :-)

But the oldest definitions were just that a TAB character moved the
cursor to the next active tab position.  The fact that these positions
defaulted to every 8 characters didn't change the fact that they could
be reprogrammed in software and then the tab would be anything you
wanted.  It was one of the ways to minimize the output over (then)
slow terminal lines to rapidly generate columnar output.

Those defaults pretty much percolated through later systems, and in
particular, typical Unix tty drivers.  I believe that the language
reference for Python makes mention of Unix as its model for the
parser's interpretation of tabs as 8 column boundaries.

> the Java styleguide says that you should use 4 characters indentation and 
> that you can write a tab for 8 characters, so they made it correct, same as 
> python has it correct too.

"correct" is too absolute (although personally I agree that using 8 -
not a fixed 8, but a multiple of 8 - is the most logical choice),
since tab widths have been "correctly" changeable back to very early
video displays.

But to move slightly more on topic, I do think the most relevant point
is that _if_ tabs get used within Python source, it is advisable to
match visually what the parser is going to see logically (just to keep
things sane), which implies that any use of tab should in fact move to
a column multiple of 8.

-- David
 \               David Bolen            \   E-mail: db3l at  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \

More information about the Python-list mailing list