[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#63959: python-mode does not keep indentation in square brackets []
From: |
kobarity |
Subject: |
bug#63959: python-mode does not keep indentation in square brackets [] |
Date: |
Sat, 01 Jul 2023 22:42:55 +0900 |
User-agent: |
Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (Gojō) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
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."
- bug#63959: python-mode does not keep indentation in square brackets [],
kobarity <=