[Tutor] Pep 8, about indentation

Cameron Simpson cs at zip.com.au
Fri Aug 7 10:18:39 CEST 2015


On 06Aug2015 11:03, ALAN GAULD <alan.gauld at btinternet.com> wrote:
>On 06/08/15 04:40, Steven D'Aprano wrote:
>>Um, the oldest standard for TABs is *eight* spaces, not 3 or 4,
>
>Yes, but that comes from the days of mechanical typewriters not any 
>study of code comprehension.
[...snip...]

I beg to differ a little. Old _teletypes_ and terminals used 8 character TAB 
spacing.

Mechanical typewriters had slidable lugs to position to totally arbitrary spots 
with a lever motion triggered by a key labelled "Tab", which was very useful 
for typing tabular information, hence the name. There's no "8" in there!

My personal habit is to have my terminals, editors such as vi, pagers like less 
etc interpret the TAB byte code to mean align to the next 8 column position.  
That is the common default meaning.

However, when _editing_ I tell vi that when I press TAB it is to insert enough 
SPACE characters to get to the next 4 column position. In this way I have the 
convenience of a TAB key to advance rapidly when needed, and my code comes out 
composed entirely with spaces so that my spacing in not mispresented to others.

In short, I use the TAB _key_ to aid typing. But I avoid embedded TAB 
characters into my text, because they are subject to arbitrary interpreation by 
others.

Cheers,
Cameron Simpson <cs at zip.com.au>

I had a *bad* day. I had to subvert my principles and kowtow to an idiot.
Television makes these daily sacrifices possible. It deadens the inner core
of my being.    - Martin Donovan, _Trust_


More information about the Tutor mailing list