Join the Stack Overflow Community
Stack Overflow is a community of 6.6 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I have some python code that I run through pylint and that I decided to also run through pycodestyle.

To avoid long lines in a with statement, I do the following:

with my_context_manager(
    argument1,
    argument2) as something:
    rest_of_my_code

But pycodestyle tells me that

E125 continuation line with same indent as next logical line

So I indent this further, as follows:

with my_context_manager(
        argument1,
        argument2) as something:
    rest_of_my_code

But now pylint tells me:

Wrong hanging indentation (remove 4 spaces).

Is there a better solution that would satisfy both code quality checkers?

share|improve this question
2  
Out of curiosity, what happens if you indent rest_of_my_code the other way (i.e. ahead of argument1 and argument2)? – Tagc 19 mins ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.