-
Notifications
You must be signed in to change notification settings - Fork 751
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
E127: "continuation line over-indented" when comprehension is an argument #680
Comments
I think the fundamental construct here is the conditional. The proposed indentation doesn't work outside of comprehensions either:
I don't think PEP 8 mentions anything about this, but I haven't looked either. |
The conditional in |
That is correct. I was just thinking that inline |
I'm getting a related problem with the following code: import pandas as pd
data = pd.DataFrame({'A': [1, 2, 3, 4, 5], 'B': [0, 0, 0, 0, 0], 'C': [4, 5, 6, 7, 8]})
nonzero = (data != 0)
print(nonzero) I get E128 continuation line underindented on the print(col) line. Looks like the parenthesis around |
@flutefreak7 I cannot reproduce, please create a new issue with more information (version, etc.) |
Consider
I would consider that this is a reasonable, and perhaps even the correct way to indent such expressions, assuming you adhere to the "binary operators after linebreak" school and also assuming that the expressions are too long to fit in a single line.
Interestingly, pycodestyle is happy with the indenting of the first two expressions, but complains about the last one
(Note that it is able to recognize the correct amount of indenting needed in the first two expressions -- adding or removing a space before "and" results in the same warning as for the third expression.)
Edit: note to self or whoever will work on this: the first two cases actually work "accidentally" because the indent of the last line is 4 characters, which is always accepted -- prepending the thing e.g. with
the_list = [...
and indenting the rest to align makes the thing fail again.)The text was updated successfully, but these errors were encountered: