Tabs for indentation & Spaces for alignment in Python 3?

Michael Torrie torriem at gmail.com
Sat Dec 6 12:26:07 EST 2014


On 12/06/2014 09:57 AM, Marko Rauhamaa wrote:
>> And one of the OP's points is that by using tabs for indent, and
>> spaces for alignment, you can have the best of both worlds.
> 
> I certainly doesn't sound that way.

Why is that?

> 
>> Programmers can set their tab size to anything they want, and it still
>> looks good
> 
> That's anything but true. I see zigzaggy diffs all the time.

You're not reading what I'm writing, at least understanding it.  The
idea behind using tabs for indent and spaces for alignment are clear enough:
>------->-------blah (one,
>------->-------......two

So obviously your zigzaggy diffs are showing that the person who wrote
the code is *not* using tabs for indent and spaces for alignment.  Must
just be using tabs.  Since tabs and spaces are not visibly
distinguished, it's not readily apparent when one is properly using tabs
and spaces together, and not apparent that your editor is doing it
properly, so in Python most people recommend never mixing tabs and
spaces, although you *can* do that in the way I've described if you
really want to.



More information about the Python-list mailing list