Python: Google App Engine source uses tab depth 2

Looking through the source of the Google App Engine, I noticed that the depth of the tab is 2 spaces instead of the usual 4. Is there any kind of wisdom, or is it just a preference?

(Perhaps this is trivial, or maybe Google knows something that does not immediately become apparent.)

UPDATE I did not expect it to work differently based on tab depth. But perhaps there is a good reason for their style.

+3
source share
3 answers

The Google Python style guide is published here , and besides PEP 8 , it also differs from it in some aspects. Nevertheless, the published version of the manual makes mandatory 4-spatial indentation (for example, PEP 8 and, like everyone else).

At Google, however, the actual rule is two-dimensional indentation (and you often catch me sending 2-dimensional indented code, because (a) this is a habit by now and (b) this is how my editors are configured ;-). This has historically been derived from the Google C ++ style guide (Google used both C ++ and Python essentially from day one, but I think C ++ got its formal style guide first) which says what

Spaces vs. Tabs

▽ 2 .

googlers ++, Python , , , .

+5

. 2- . . 4 .

(Do not assume that something is good, simply because the Google source does it. If you ever spent some time looking at the Android source code, you would know that Google has the same incompetent code as it is in any other company.)

-6
source

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


All Articles