Tabs versus Spaces in Source Code ('semantic' vs. arbitrary indentation)

Carl J. Van Arsdall cvanarsdall at mvista.com
Wed May 17 14:26:25 EDT 2006


Andy Sy wrote:
> achates wrote:
>
>   
>> Andy Sy:
>>     
>>> Code with anything other than 8-space tabs will *NEVER* display
>>> properly using everyday unix utilities such as less and cat.
>>>       
>> less -x<tabstop> does what you want.
>>
>>     
>
>
> Ok, that tip certainly counts for something.  This is
> definitely going to make viewing tabbed code suck much
> less (although you still have to guess the tab setting
> using trial and error).
>
>
> Next major objection then, how can one practically use 'tabs as
> semantic indentation' without screwing up formatting of code like
> the below??
>
>
>   def sqlcall():
>       cursor.execute('select id, item, amount, field4, field5, field6'+
>                      'from table1 where amount>100')
>
>   
Why couldn't you tab your third line over as close as possible to the 
start of the quote then use a couple spaces?  Then the tabs would work 
just fine and you could still have your pretty line.

.c

-- 

Carl J. Van Arsdall
cvanarsdall at mvista.com
Build and Release
MontaVista Software




More information about the Python-list mailing list