What do you prefer? For my Python code, I use 4 spaces (because of pylint and pep8), but for other files - 4-width tabs.
i prefer tabs myself as i see visually where the code is grouped and not stray into other code blocks.
- I’ve always thought it was merely a matter of taste.
- I can’t figure out a good reason to use spaces—they’re harder to use, easier to break, worse to display… for no added benefit.
However, it seems that spaces managed to win the tabs vs spaces war for God knows what strange reason. In my area of expertise (PHP) most open source projects nowadays use spaces, PSR-2 requires spaces and the Stack Overflow Developer Survey 2015 clearly shows that only n00bs use tabs.
For reference, my co-workers seem to use whatever default setting their current editor has—even if it doesn’t match current file indentation.
That approach sounded pretty intrusive to me at first, but I think I like the idea of having the spaces/tabs decision determined formally like that: deviate from the default if you like, but do so explicitly or else the code won’t compile.
I prefer spaces over tabs. Files always appear the same, no matter what editor or viewer our team is using.