Subject: bug#24809: 25.1; Python.el improper indention after backslash-assignment-continuation

From: [email-masked]
Date: Mon, 22 May 2017 20:26:29 -0400

[Please use "Reply All" to keep [email-masked] on Cc]

Subject: Re: bug#24809: 25.1; Python.el improper indention after backslash-assignment-continuation
From: Jules Tamagnan <[email-masked]>
To: [email-masked]
Date: Mon, 22 May 2017 11:46:32 -0700

[email-masked] writes:

> Jules Tamagnan <[email-masked]> writes:
>
>> The bug is quite simple.
>>   - Open a python file.
>>   - Type:
>>     hello = \
>>   - C-m ; newline
>>
>> The point will now be directly under the backslash character. This is
>> indented incorrectly according to the pep8 style guide and the
>> pycodestyle checker, it should instead be indented
>> `python-indent-offset` further than the previous line.
>
> So the patch works (additionally the python-indent-after-backslash-4
> test would need to be updated) but I'm not sure if it's correct.
> Currently, the pep8 style guide doesn't really say anything about
> indentation following backslash, it just recommends using parens
> instead.

I can update the test. Yeah it is a sort of gray zone because the style
guide isn't explicit. I think that the goal of putting a backslash after
the equal sign would be to split a line that was too long. The current
way that emacs chooses to split a line is not really consistent that
goal or with the outcome of using an open paren. I think that the
following long line:

an_overly_long_variable_name = some_object.some_method(some_argument_to_some_method)

could be split like this:

an_overly_long_variable_name = (
    some_object.some_method(some_argument_to_some_method))

or if someone wanted to use a backslash like this:

an_overly_long_variable_name = \
    some_object.some_method(some_argument_to_some_method)

instead of like:

an_overly_long_variable_name = \
                               some_object.some_method(some_argument_to_some_method)