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

Andy Sy andy at neotitans.com
Wed May 17 14:06:00 EDT 2006


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')


... if you change the tabsize then the 3rd line will no longer
properly align with the start of the quote in the 2nd line.
The 3rd line makes use of _arbitrary_, not semantic indentation.


Because you cannot count on indentation to be semantics-driven on every
single line, you _will_ end up mixing semantic and arbitrary indentation
and thus the whole notion of being able to use tabs as 'semantic
indentation' is *still untenable*.

There is JUST NO PRACTICAL USE FOR TABS.




-- 
It's called DOM+XHR and it's *NOT* a detergent!




More information about the Python-list mailing list