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

E124 is incorrect #10

Open
munk opened this issue Jan 3, 2019 · 0 comments
Open

E124 is incorrect #10

munk opened this issue Jan 3, 2019 · 0 comments

Comments

@munk
Copy link

munk commented Jan 3, 2019

E124 says:

Closing brackets should match the indentation of the opening bracket.

Anti-pattern

result = function_that_takes_arguments('a', 'b', 'c',
                                       'd', 'e', 'f',
)

Best practice

result = function_that_takes_arguments('a', 'b', 'c',
                                       'd', 'e', 'f',
                                       )

But the pep8 spec says:

The closing brace/bracket/parenthesis on multiline constructs may either line up under the first non-whitespace character of the last line of list, as in:

my_list = [
    1, 2, 3,
    4, 5, 6,
    ]
result = some_function_that_takes_arguments(
    'a', 'b', 'c',
    'd', 'e', 'f',
    )

or it may be lined up under the first character of the line that starts the multiline construct, as in:

my_list = [
    1, 2, 3,
    4, 5, 6,
]
result = some_function_that_takes_arguments(
    'a', 'b', 'c',
    'd', 'e', 'f',
)

This rule should allow closing brackets to either align with the opening bracket or the first character of the multiline construct. The explanation should be updated to exclude the following example as an anti-pattern instead.

Anti-pattern

result = function_that_takes_arguments('a', 'b', 'c',
                                       'd', 'e', 'f',
                                        )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant