Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent indentation suggestions for Python #417

Open
terrencepreilly opened this issue Nov 23, 2018 · 4 comments
Open

Inconsistent indentation suggestions for Python #417

terrencepreilly opened this issue Nov 23, 2018 · 4 comments
Assignees
Labels
lang:python The Python language

Comments

@terrencepreilly
Copy link

The Python style guide for docstrings gives inconsistent advice for indentation. It initially says,

Sections should be indented two spaces, except for the heading

Yet all of the examples feature four spaces of indentation. Further, under the Args section, it says,

If the description is too long to fit on a single 80-character line, use a hanging indent of 2 or 4 spaces (be consistent with the rest of the file).

Probably the first quote should read "Sections should be indented two or four spaces (be consistent with the rest of the file), except for the heading."

@gpshead
Copy link
Contributor

gpshead commented Nov 26, 2018

Thanks, internally we recommend two for this as it matches our internal coding convention. But I like your suggestion of just saying use either within the docstrings so long as it is consistent within the file. There is no strong reason to require four for docstring section indentation regardless of PEP-8 code four space indentation.

@hevrard
Copy link

hevrard commented Nov 28, 2018

@gpshead as you said internally we recommend two spaces for code indentation. But this style guide recommands four. I think it should be changed to two?
See http://google.github.io/styleguide/pyguide.html#34-indentation

@gpshead
Copy link
Contributor

gpshead commented Nov 28, 2018

Nope. The world at large should not be infected with Google's internal style quirks. This guide keeps in line with PEP-8 and what the entire world's Python editor configs use: four space indentation.

@hevrard
Copy link

hevrard commented Nov 28, 2018

Ok that makes sense. Thanks for the clarification!

@vapier vapier added the lang:python The Python language label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang:python The Python language
Projects
None yet
Development

No branches or pull requests

4 participants