[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python indentation (3 spaces)

On 05/10/18 21:48, ts9564 at gmail.com wrote:
>     I am new to Python programming but have significant SQL and C experience. My simple question is,"Why not standardize Python indentations to 3 spaces instead of 4 in order to avoid potential programming errors associated with using "TAB" instead of 4 spaces?"

Thank you for the suggestion, Thomas.  Unfortunately I think it's a 
perfect example of something that was being discussed elsewhere, the 
well-intentioned name change that actually makes things worse in the 
long run.

I think the most likely outcome of switching to 3 space indentation, 
which we could do right now with no need to change a single thing, is 
that it would all seem to work perfectly well for a while.  It wouldn't 
take long for people to get irritated with actually typing three spaces 
though, and to reprogram their Tab keys to three space tab stops.  Once 
that happens, it's only a matter of time before the people who believe 
that Tabs should give you actual Tab characters do the same, and lo and 
behold you are back where you started but with 3-space tab stops as well 
as 4-space tab stops.

Why do I think that's what would happen?  Because that's how we got 
4-space tab stops in the first place.  The original de facto standard 
was for 8-space tab stops (see 
https://en.wikipedia.org/wiki/Tab_key#Tab_characters for some 
background).  8 characters on a 132-character line printer isn't that 
much.  8 characters on an 80 column monitor is quite a long way, on the 
other hand.  People started using four spaces as a more reasonable size, 
used the Tab key for convenience and eventually ended up with the unholy 
mess we know and love today.

Fortunately 2-space tabbing never attracted the attention of the 
tab-character purists, or we'd be in an even worse situation :-)

I've watched this sort of thing happen in too many different arenas over 
the years, most obviously with my father's job.  He worked with disabled 
people, and changing terms used to refer to them never once got rid of 
the associated prejudices.  This doesn't seem to be an easy thing to 
hear particularly when it's associated with something emotive like the 
master/slave debate, but changing terms buys you at best a couple of 
months free of previous associations.  Then the old associations catch 
up, and usually bring some new friends with them.

Changing indent sizes is falling into the same trap as changing 
terminology, I'm afraid.  It's an obvious, well-intentioned thought, but 
it won't actually change anything for the better.  Thank you for 
bringing it up, though.

Rhodri James *-* Kynesim Ltd