-
Notifications
You must be signed in to change notification settings - Fork 756
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
E126 hanging indent is too strict #167
Comments
Thank you for your feedback. AFAICT, the first example does not trigger any warning with the For the second example, this was a deliberate choice of the Of course each check can be ignored with |
I'm sorry about wrong first example. from os import(
path,
listdir,
) This cause "E126 continuation line over-indented for hanging indent" and |
@methane an alternate way of writing that is: from os import (path, foo, bar, bogus, #etc
listdir, unlink, #etc,
) |
@methane, you have one too many indents.
|
@myint That rule isn't applied to hanging indent. |
Well, the PEP 8 recommends "Use 4 spaces per indentation level." The purpose of these E12* rules is to conform to PEP 8 and enforce some consistency for the indentation. |
"per level" means indent for block. |
This is your interpretation of PEP 8. |
pep8 says:
I believe no one can interpret this to "hanging indent should be 1-level 4-space indent."
Yes, I already disabled it. But I think too strict default hurts new users. |
I have a similar "too strict" issue with E126.
triggers E126, but I think this should be allowed to distinguish from an actual new indent level. Pulling the last ) onto the line above makes no difference. |
@basepi, |
@myint Heh, thanks for this. I was just wondering if we wanted to try to bring it in line with PEP8. =) |
I think 4 is the most used convention in the Python code base. The following will show lines that end with
So in terms of following a convention, I think E126 is the way to go. If one prefers 8 instead 4, then I think |
Cool! Thanks for the quick reply. |
@myint Thank you. I agree E126 is not too strict for now. |
@methane said
The 4aec4d180429 revision of PEP-8, updated 2014-05-20, explicitly aligns with @methane's assertion:
pep8 needs to revise its hanging indent rules. The number of spaces within a hanging indent needs only to be consistent; 2 spaces, 4 spaces, 8 spaces – all are valid amounts of space for hanging indents. |
@gotgenes I disagree that pep8 needs a fix because in the
And the example level it uses is 4 spaces. In other words, pep8 is still correct, and the ability to turn off this check keeps with the PEP's understanding of |
This cause "E126 continuation line over-indented for hanging indent".
But below code is OK.
from ... import (
should be handled like that.The text was updated successfully, but these errors were encountered: