2.2. Whitespaces and indentation
In Python whitespace is an important thing. We divide different identifiers using spaces.Whitespace in the beginning of the line is known as indentation, but if you give wrong indentation it will throw an error. Examples are given below:
So we can have few basic rules ready for spaces and indentation.
Use 4 spaces for indentation.
Never mix tab and spaces.
One blank line between functions.
Two blank lines between classes.
There are more places where you should be following same type of rules of whitespace, they are like
Add a space after "," in dicts, lists, typles, and argument lists and after ":" in dicts.
Spaces around assignments and comparisons (except in argument list)
No spaces just inside parentheses.