Subject: Re: bug#63959: python-mode does not keep indentation in square brackets []

From: kobarity <[email-masked]>
Date: Sat, 01 Jul 2023 22:42:55 +0900

Andreas Röhler wrote:
> Thanks for your explanation, which makes me better understand your
> endeavour. A question remains: is this new feature worth that possibly
> raise of complexity? Your patch provides a higher degree of freedom
> while keeping regularity  - which is a pro.

I think it is natural for many people to indent the same as the
previous line.  In fact, it is standard behavior outside the parens.
For example, if you intentionally change the indentation of the first
line of a block, the following lines will have the same indentation:

def func():
        a = 1  # Intentionally changed.
        b = 2  # Same indent as previous line

You can even do the following, although it will result in an
IndentationError when executed:

def func():
    a = 1
        b = 2  # Intentionally changed.
        c = 3  # Same indent as previous line

If inside the parens, the following will not result in an
IndentationError:

a = (
    1,
        2,  # Intentionally changed.
        3)  # Same indent as previous line

So I rather think the rule of indenting the same as the previous line
is more useful inside parens.

I would consider making the indentation the same as the previous line
inside the parens a fix rather than a new feature.  This is why I
named the commit "Fix Python indentation of continuation lines within
parens."