Optimal tab size for code readability

sotangochips picture sotangochips · May 1, 2009 · Viewed 26.9k times · Source

Personal preferences aside, is there an optimal tab size (2 spaces? 3 spaces? 8 spaces?) for code readability? In the different projects I've worked on, people seem to have vastly different standards. I can't seem to read 2 space indents, but companies like Google use it as a standard.

Can anyone point to documentation, studies, or well-reasoned arguments for the optimal size of a tab?

If we want to get specific, I work mostly in python. The goal of this question is to pick a standard for the team I work on.

Answer

esm picture esm · May 1, 2009

Four spaces and no hard tabs, if you're a Pythonista.