0

python about PEP8, indent

if you use spaces, only use 4 per line. why not 1 space?

20th Apr 2021, 6:03 AM
issac tseng
issac tseng - avatar
2 Réponses
+ 3
Because readability matters. When you have complex code with many nested levels, it is easy to loose track which lines belong together in the same block, when the indentation does not guide your eyesight. https://realpython.com/JUMP_LINK__&&__python__&&__JUMP_LINK-pep8/
20th Apr 2021, 9:45 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Because a program that uses 4 spaces for indentation is much more readable than one that uses 1 space. In fact, a program that uses 1 space for indentation deserves to be deleted as soon as it is made.
20th Apr 2021, 7:03 AM
XXX
XXX - avatar