Live data from Hacker News

Python Style Guide from Google

google.github.io

1–10 of 30 posts

Re: Python Style Guide from Google

#8
post #5

4 spaces? seriously? Why would anyone type out 4 spaces instead of one tab?

Personally, i use tabs of size four with expandtabs setting. That way i don't have to press four spaces and my files look the same across all editors and platforms.

Re: Python Style Guide from Google

#9
post #5

4 spaces? seriously? Why would anyone type out 4 spaces instead of one tab?

A good reason for sticking to monospace characters is that they're always displayed the same, regardless of your personal editor and editor configuration choices.

Also, you don't need to type 4 (or however many) spaces directly. Most programming editors can be configured to insert spaces when you press tab, or to replace existing tabs in a file to spaces.

Re: Python Style Guide from Google

#10
post #3

Google internally does not always follow this guide. Different project can come up with its own style.

Note that this is the public style guide (intended for contributions to Google open-source projects). The internal style guide has some differences, mainly to more-closely match the styles of internal C++ and Java (things like naming and indenting).

In my experience, any Python code in the core codebase follows the (internal) style guide. Big mostly-standalone projects like YouTube have their own style.

Post reply on HN