The ONE TRUE WAY to use tabs (if you must...)

Andy Sy andy at neotitans.com
Mon May 22 04:55:02 CEST 2006


Andy Sy wrote:

> Actually a couple of the responses on this newsgroup
> have settled the question for me.  I did learn something
> new by engaging in this holy war.
> 
> 
> Tabs need not be evil, but ONLY if they are used in one
> particular way:
> 
> If you really must use tabs, use them *ONLY* for 'semantic'
> indentation and use pure spaces when you need arbitrary
> indentation (e.g. arbitrary spacing).
> 
> PHP Example
> ===========
> 
> function xyz() {
> ->print  "This is a really really really long line that I'd ".
> ->       "like to extend to the one down below while preserving ".
> ->       "ease of readability by aligning the start of the string".
> ->       "lines.  I use tabs to reflect syntactical (e.g. semantic) ".
> ->       "indentation, but use spaces for arbitrary indentation.\n\n".;
> ->while (10) {
> ->->print "This code will align properly no matter what tabsize setting ".
> ->->      "the reader uses, and is the only real benefit of using tab ".
> ->->      "characters instead of pure spaces.\n\n";
> }
> 
> 
> 
> I did some basic tests, and it looks like this style should also
> work for Python code.
> 
> 
> THIS IS THE *SINGLE* CORRECT WAY TO USE TABS IN CODE!  ANYTHING
> ELSE WILL BE A PAIN FOR PEOPLE WITH TABSIZE SETTINGS DIFFERENT
> FROM YOURS!!

Also... remember that the 'ONE TRUE WAY' essentially involves *mixing*
tabs and spaces for indentation with all the objections that that
entails... (although like mentioned above, it should work with Python,
at least in the simple cases i've tried)

Frankly, the case for tab usage is not that compelling...



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




More information about the Python-list mailing list