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

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Wed May 17 15:44:52 EDT 2006


Dave Hansen enlightened us with:
> Assume the code was written by someone using 4-space tabs.  To them,
> the code is:
>
>    def sqlcall():
>    --->cursor.execute('select id, item, amount, field4, <etc>
>    --->--->--->--->...'from table1 where amount>100')
>
> (where -------> represents an 4-space tab and . represents a space)

That would be stupid indeed. It would indeed fix the tabstops at every
4 characters to keep the layout.

But generally, I don't do layout like that. I'd do:

    --->cursor.execute(
    --->--->--->'select id, item, amount, field4, <etc>
    --->--->--->'from table1 where amount>100'
    --->)

Which keeps looking fine, no matter what tab size, and without mixing
tabs and spaces.

Just because people can use tabs to make things suck,
doesn't mean the tabs are evil.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa



More information about the Python-list mailing list