[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Tabs v.s. spaces

>>>>> "H" == H S Teoh <hsteoh@quickfur.ath.cx> writes:

    H> I have a hate-hate relationship with it. I much prefer free-style
    H> syntax where the programmer is allowed to use his best judgment on
    H> how to indent the code. Of course, in less-than-ideal projects, or
    H> projects with less-then-ideal programmers, this could result in a
    H> mess, but I'm speaking of personal preference here.

I don't quite understand why people hate it so much.  Python allow
indentation to be done in any number of spaces and tabs, as long as they are
consistent.  And you can even mix them, as long as they are consistently
mixed.  I.e., it is perfectly okay if your first level indentation is a tab
and your second level indentation is 2 spaces further than the first level
indentation.  And different functions can use different indentation style.
It is only when the indentation is inconsistent within a single function
when the "8-spaces = 1 tab" rule come into play.  If you are writing such
code, it is time to change your habit (either in terms of typing or in terms
of the editor you use) anyway.

    H> That's because the terminal settings are b0rked. I personally delete
    H> all programs that cannot cut-n-paste without messing up tabs and
    H> spaces.  Unfortunately, this happens a lot on the Winbloxe desktop at
    H> work.

Which terminal do you use that do not convert all the tabs into spaces?
Personally I won't cut-and-paste from the terminal when programming.

    H> For personal pet projects, I use 2 spaces per nesting level. Some
    H> people think that's Pure Evil(tm), although I fully agree with you
    H> about wasting screen real estate in 80 columns (yes, I am one of
    H> those freaks who insist that all code must not have lines longer than
    H> 79 characters).

I believe Linus has a point here... 8 spaces per indentation level keeps you
honest, since you can't put a whole crowd of things into a single function.
On the evil side, I had seen people who insist on using 1 space per
indentation level.


Reply to: