Python indent syntax, advantages and disadvantages, python indent
Python syntax is relatively simple-indent
Indentation has the following advantages:
One of the advantages is to force you to write formatted code, but there is no rule on whether the indentation is a few spaces or tabs. According to the Conventions, the indentation with four spaces should always be used.
The second is to force you to write code with less indentation. You will tend to split a long piece of code into several functions to get code with less indentation.
The disadvantage of indentation is that the "copy-paste" function is invalid, which is the most pitfall. When you refactor the code, the code pasted in the past must be re-checked to check whether the indentation is correct. In addition, it is difficult for IDE to format Python code like formatting Java code.
In addition, in the text editor, you need to set to automatically convert the Tab to four spaces to ensure that Tab and space are not mixed.
Reference: Liao Xuefeng's blog