← Back to context

Comment by msgodel

6 months ago

>tabs make much more sense. python should fix this mistake. I guess my IDE fixes it for me?

I think tabs make sense when you're by yourself and spaces make sense when you're working with others.

It varies so much by language. In C, Go, C++, etc. I'm inclining, these days, towards tabs. You can always adjust the tab width for display, but you generally end up with a clear block structure since they're statement and block-oriented languages (syntactically):

  func foo(...) ... {
      if bar > 10 {
          if baz < 100 {
              ...
          }
      }
  }

But then I go back to Lisp and would absolutely hate it, without a formatter to help, because for readability you sometimes want the equivalent of the above but other times not:

  (defun greet (name)
    (format t "Hello ~S~%" name))

Two spaces, could be a tab and a small width, but you also see this a lot (imagine a, b, and c being long enough to justify the line breaks):

  (+ a
     (truncate b
               c))

You want a variable amount of whitespace on each of these lines for alignment. Tabs won't do since you can't guarantee the tab width. Once you've chosen to use spaces for some lines, you're forced to do it for the rest or you mandate that tab widths are specifically equivalent to N spaces, which defeats the purpose of using them in the first place.

So it ultimately comes down to the language and what makes it more or less readable.