Is 3-space indentation required in the registry?

I document my Python code using Sphinx and read in the Python developer guide (and, I think, elsewhere) that reST files use an indent of 3 spaces:

All relay files use an indent of 3 spaces; no tabs are allowed.

This is an example for an example that I copied for my index file, and some other files in which my IDE took a 3-space indent and used it for the whole page. The extension sphinx-apidocalso uses 3 spaces for the file modules.rstthat it creates.

On the other hand, since Python uses 4-space indentation, all of my docstrings are indented with 4 spaces. Moreover, directives .. automodule::generated sphinx-apidoxhave 4 spaces.

The fact is that it all works! Therefore, it remains for me to wonder if the requirement of a print in 3 spaces is a mandatory requirement, or if it is good practice, but only in terms of style? (And if so, why when all Python things have 4-space indentation?)

Or are there cases where there is no 3-spatial indentation that will break my assembly?

Other places I was looking for


, Python , , , "3--4- " Sphinx Python.

+4
1

, , 2 3 . . reStructuredText.

, .

  • .
  • IDE , , docstrings Python, 4 .
  • IDE 4 , ?
  • - .
+3

Source: https://habr.com/ru/post/1692325/


All Articles