You are viewing a single thread.
View all comments
21 points

I will never understand why people are so set on spaces…

permalink
report
reply
11 points

Tabs are blasphemy.

permalink
report
parent
reply
9 points

Why?

permalink
report
parent
reply
8 points

I use spaces, but tabs use fewer characters, are easier to edit and allow for people to have custom indentation levels…

permalink
report
parent
reply
9 points
*

If you’re using monospaced fonts for writing code (please tell me you are) spaces make sure that the code will look roughly the same on everyone’s machine.

def function(paramX: str,
             paramY: str,
             paramZ: str) -> int:
  pass

If I’d used tabs, the second and third parameter might not align with the first.

Also, left-side indentation is only a small part of the overall whitespace in code. You’re adding whitespace even when you write x = y. Spaces make sure that this whitespace around the = grows in the same scale as the indentation.

permalink
report
parent
reply
6 points

Yes but it’s not your job to make sure your code looks the same for everyone else. If they’d prefer to read it with a different tab size, maybe they’re using a smaller screen, or a larger one because of vision issues there’s no reason they shouldn’t. You can use an optional editor config if you want it to be able to look the same for others.

permalink
report
parent
reply
4 points

It makes a difference when you’re working on a large project with lots of people. Even Linux mandates 1 tab = 8 spaces.

The only argument i see in favour of tabs is the “i can change the width on my own machine!” which isn’t very convincing if you are working on a team and need to follow conventions every time you commit code. The indentation will keep looking weird on your machine.

permalink
report
parent
reply
3 points

I will never understand why people are so set on spaces…

They just never really understood tabs. If they did, they wouldn’t be sitting there counting how many times they hit the space bar!

permalink
report
parent
reply
6 points

We understand tabs perfectly, we press the tab bar and our editor inserts 4 spaces like god intended

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 3.6K

    Monthly active users

  • 1.5K

    Posts

  • 35K

    Comments