Conclusion
- create an indentation workflow that works regardless of the indentation style
- use
[Tab]
to create indentation - use
[Ctrl + Arrow right]
to skip indentation
- use
- IDE’s make difference negligible
- it’s a project decision not a developer one
- you will have to use both
Nevertheless, people love to argue especially about highly controversial topics like this one. So despite it being mainly irrelevant, here are a few points for project decisions
Default implementation
Pressing [Tab]
in different environments has different affects.
Move to the right until…
- the current column is a multiple of 8 (Unix systems, Ecams, Vim)
- the current column is a multiple of 4 (Windows)
- the next tab stop (Microsoft Word)
Spaces
- can be entered and pasted in all environments like terminals, publishings and browsers
- consistent cursor speed when going through
Tabs
- a character specifically meant for indentation
- customize indentation visualization according to developer’s preferences without changing the code thus separating data and presentation
- seamlessly import code without half-indenting or misalignment due to different indentation sizes
- noticeable mistakes in the level of indentation
- don’t micro manage spaces
- are consistent, they are only used for indentation, unless you are commenting wrong.
- less storage size
- take less time to go through
Secondary indentation using spaces
Sources:
- 2022-06-14: Style Guide for Python Code (PEP8)
- 2022-06-14: Death to the Space Infidels!
- 2022-06-14: Tabs versus Spaces: An Eternal Holy War
- 2022-06-14: Tabs versus spaces — What is the proper indentation character?
Related:
Tags:
Discussions