Indenting with tabs vs spaces

Peoter Veili peoter_veliki at hotmail.com
Thu Nov 22 06:58:08 EST 2001


> >Tabs are wrong, because different editors will treat them differently.
> >
> >Spaces are right, because a space is a space is a space, everywhere you
> >go.

Indenting with tabs can be done such that it will look the same on every
editor that uses fixed-width fonts, meaning everything will line up
correctly, it least in the sense that really matters.  Here's an example of
what I mean:



    function helloThere("hello",
                                       "there"){
    }


The proper way to do this is the second line needs to be typed with one tab
followed by enough spaces to line up the "hello" and "there".  This way the
"hello" and "there" will line up correctly on any editor. If the person was
lazy and tabbed all the way out to right before "there" and then filled in
with a
few spaces, it may not line up depending on what your tabwidth is set to.

Besides this I know of no problems with using tabs.  I find them cleaner and
more efficient.  I'd rather tab 10 times than hit the space bar 40 times. I
never have to go through a whole file and manually line things up because at
one place in the file I accidentally didn't indent with the right amount of
spaces and half the file needs fixing.  Auto-indent helps, but still....








More information about the Python-list mailing list