Tabs for indentation & Spaces for alignment in Python 3?

Cameron Simpson cs at zip.com.au
Fri Dec 5 18:47:45 EST 2014


On 06Dec2014 09:29, Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
>Cameron Simpson wrote:
>> I have spent too much time reading files indented
>> with TABs by people using a different tabwidth to my own, and thus looking
>> aweful on my screen. The original author didn't choose to make it awful,
>> but their tabs rendered in my tab scheme look awful. And doubtless vice
>> versa. The root cause of this is that when we, as humans, indent with
>> tabs, we do it to achieve a certain visual effect; as though a certain
>> number of spaces were in play.
>
>How is this different from people who achieve a certain visual effect by
>indenting with actual spaces?
>
>I've seen people indent with 8 spaces. I've seen people indent with 2
>spaces. I've even seen people indent with a single space per level. I
>haven't seen anyone indent with 17 spaces, but I suppose it's only a matter
>of time...
>
>I don't see how reading code indented with tabs configured for 8/4/2/1
>spaces is *worse* than reading tab indented with 8/4/2/1 spaces.

Because the author will have chosen a scheme not too insane. But when I pull up 
their indented-with-2-or-4-tab files in my tab==8 editor, it looks terrible.  
When I pull up their indented-with-spaces in whatever scheme, it looks as good 
or bad as their judgement, which even when tasteless is usually better than 
overwide tabs.

I would rather not have to readjust my editor's tab spacing every time I load 
up a file from someone-who-is-not-me. If they use spaces, I don't have to. If 
they use tabs and do not indent like I do, I have to to keep things readable.

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

They shouldn't get any new nuclear weapons until they've used the ones
they've got.    - Murff



More information about the Python-list mailing list