views:

172

answers:

2

G'day,

I'm revisiting Python after Michael Sparks's excellent walkthrough of Peter Norvig's Python spell checker at the SO DevDay in London.

One of the points he highlighted was how clean Python is to look at. Not cluttered with braces for scopes but using white space to indicate block scope instead.

This got me thinking. I wonder if that is the reason behind the TAB indentations that are prepended to the commands needed to build a make target.

Was it the same clarity aspect? To readily distinguish between a target and the commands needed to build the target?

A: 

I think Makefiles make the mistake of insisting on precisely one tab character for indentation. What's the harm in allowing spaces? There's no loss of precision, since shell commands can't usefully begin with spaces anyway, and there's no confusion between target lines and command lines.

Ned Batchelder
@Ned, yep agree with you. I guess by making it a "Thou shalt tab!" we don't have to worry about discussions like those about being Pythonic! (-:
Rob Wells
@Ned, I thought makefiles accepted more than one space and weren't limited to one and only one TAB character.
Rob Wells
+4  A: 

From "The Art of Unix Programming" comes this quote:

Why the tab in column 1? Yacc was new, Lex was brand new. I hadn't tried either, so I figured this would be a good excuse to learn. After getting myself snarled up with my first stab at Lex, I just did something simple with the pattern newline-tab. It worked, it stayed. And then a few weeks later I had a user population of about a dozen, most of them friends, and I didn't want to screw up my embedded base. The rest, sadly, is history.
-- Stuart Feldman
PP