[Tutor] Pep 8, about indentation

Alan Gauld alan.gauld at btinternet.com
Thu Aug 6 12:03:38 CEST 2015


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. I was referring to the recommended spacing 
for comprehending code. There were a lot of studies done on this back in 
the 70's and 80's. The only one I can find a reference to right now is 
an Article from 1983, "Program Indentation and Comprehensibility" by 
Miaria et al. It showed a 20-30% improved comprehension based
on 2-4 tabs.  0-1 space tabs and larger tabs decreased the 
comprehensibility of the code.

> For interest, here's a survey done by Perl programmers in 2002:
>
> http://www.perlmonks.org/?node_id=158886

Yes, but that's a survey of what developers prefer to use. It's not a 
study of whose code is most reliably read and understood!
(Which in the case of Perl might not be very high for any style!!)
Developers are notoriously bad at choosing the most readable
standard, they tend to go by what they think looks pretty.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list