> > ... use tab stops every 8 characters ... as Python interprets them.
> 
>   Does Python count a tab as eight spaces, or does it simply count a tab as
> one whitespace character?
> 
>   In other words, is a sequence of eight spaces the same as one tab, or the
> same as eight tabs?

        Neither, and neither.  A tab in the file read by the
interpreter is the same as the smallest number of spaces (greater than
zero) needed to take you to the next *tab stop*.  "tab stops every 8
characters" means that they occur, at columns 9, 17, 25, 33... (if, as
is common you call the leftmost print position column 1).

        This wouldn't normally make a difference if you are talking
about the initial line indentation, since it always begins from colmun
1, so tab has the same effect as 8 spaces.  But, with tab stops set as
above, if you start a line with three spaces followed by a tab, the
next character "prints" at column 9, the same as if you just began
with a tab.  A tab *followed* by three spaces, however, leaves you
ready to print at column 12.

        While the fancier "terminals" and "printers" (including
formatting software that reiterprets the tabs as equivelent spaces,
such as pr) may allow setting tab stops at other than every 8
characters, that still uses the tab stop concept.  Instead
interpreting tabs as a fixed number of spaces is a broken, cheesy,
u$oft-like way of doing things.

>   I'm curious, and since I'm trying to learn Python, I have an excuse,
> too.  :)
> 
>   (Personally, I'd prefer the latter, simply because I usually set tab
> (ASCII character 9 (decimal)) to be 4 characters, because they take up
> less room that way.  But I'm flexible.)

        I'm a 4 column man myself.  But that's why we have
programmer's editors.  My tab *key*, when used at the begining of a
line, causes my editor to insert the most efficient combination of tab
*characters* and spaces to position me at the desired 1+n*4 column
position.  The tab characters in the file still represent moving to
the next tab stop.  This way I get the same indentation when I print a
file as when I view it on the screen, without having to fiddle the
printer's normal every 8 character tab stops.

[       Of course, I use and editor from the dark ages.  The
implementors of more "modern" editors may not have had the time to
correctly implement tab stops, having invested their time in the much
more important design of the inscrutable images in their tool bar
buttons (for which they sometimes don't even have time to implement
a keyboard shortcut).  But Python's "IDLE" IDE comes with a suitable
editor built in.]

                                                        Bill

**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************

Reply via email to