DOS, UNIX and tabs

Paul McNett p at ulmcnett.com
Sat Dec 30 17:33:12 EST 2006


Sebastian 'lunar' Wiesner wrote:
> Paul McNett <p at ulmcnett.com> typed
> 
>> Steven D'Aprano wrote:
>>> But I think we all agree that mixing tabs and spaces is A Very Bad
>>> Thing.
>> I like mixing tabs and spaces, actually. Tabs for indentation, and
>> additional spaces to make the code "look pretty". Somebody please tell
>> me why this is bad and I'll stop.
>>
>> class Apple(object):
>> def contrived_example_function(self, argument1, argument2,
>> argument3, argument4):
>> print "hello, world"
>>
>> Apparently, emacs in python mode follows this convention, too.
> 
> That doesn't seem like a standard settings to me. I can't remember
> changing the indentation settings for python, nonetheless my gnu emacs
> uses four spaces for indentation. Placing wrapped lines into ordered
> columns is done by inserting additional spaces. This all happens
> automatically; you never need to insert spaces manually...

I never tried emacs, but somebody once told me that if you have set
indentation-by-tab, it will indent with tabs but insert additional
spaces in wrapped lines to look pretty.


>> I like it because I get the best of both worlds: the only thing
>> against using tabs-only-indentation is that wrapping long lines can be
>> quite ugly, while space-only-indentation allows for beautifying it
>> somewhat by lining up the columns to match.
> 
> Did you try to open your code files with another editor, which has a
> different length for tabulator chars? It would look quite ugly, I
> guess...

Actually, no. Everyone can choose their own number of spaces-per-tab and
it'll look right, as long as everyone uses a monospace font.

-- 
pkm ~ http://paulmcnett.com





More information about the Python-list mailing list