Gustaf Waldemarson wrote: > One noticeable caveat is that **any** parenthesis can now be additionally > indented, e.g., the follow is now also possible: > > this_is_a_tuple = (long_variable_name_here, > also_a_long_variable_name) > > Although, given that this can be cycled at will by the user, I'm not sure if it > is a bad additional feature or not. > > Ideally, I suppose that `python-indent-context` could be modified to add a > `:inside-cond-paren` symbol that signals that the parenthesis is for a > conditional expression and thus the extra indentation should be applied, and not > in any other case. That does seem a bit harder for me to fix at a cursory glance > however, so maybe this fix is enough? Hi Gustaf, I agree with you in that it's better to have a new indent context, and I tried to implement it. At first, I thought that it would be enough to add a counterpart of the user option `python-indent-def-block-scale' and corresponding `:inside-paren-newline-start-from-block' context. `python-indent-def-block-scale' can be used to customize the following code #+begin_src python if ( "VALUE" in my_unnecessarily_long_dictionary and some_other_long_condition_case ): do_something() #+end_src to be indented as follows (with a TAB at "):" line): #+begin_src python if ( "VALUE" in my_unnecessarily_long_dictionary and some_other_long_condition_case ): do_something() #+end_src This is the style used by the popular formatter "black". From the name `python-indent-def-block-scale' and its docstring, it is easy to assume that it only works for def block, but in fact it works for every blocks. As `python-indent-def-block-scale' works only when there is no item on the same line following the opening paren, I tried to add a similar user option and an indent context for the opening paren followed by some items on the same line. It could indent as follows: #+begin_src python if ("VALUE" in my_unnecessarily_long_dictionary and some_other_long_condition_case): do_something() #+end_src However, it could not handle correctly the following example: #+begin_src python elif (some_case or another_case): do_another() #+end_src The extra indentation is not needed here. So I think it is best to increase the indentation only if the calculated indentation equals to the indentation of the contents of the block ("do_something()" in the above example). This is similar to the way I fixed Bug#57262. Unlike Bug#57262, the current indentation shown below is not a violation of the latest PEP8: #+begin_src python if ("VALUE" in my_unnecessarily_long_dictionary and some_other_long_condition_case): do_something() #+end_src Although pycodestyle reports E129 "visually indented line with same indent as next logical line," PEP8 was changed to allow this. This is explained in the following issue, for example: https://github.com/PyCQA/pycodestyle/issues/474 So changing this indentation should be a user option. Attached is my implementation of this. The user option `python-indent-block-paren-deeper' is added to customize this indentation. I would be glad if you could try it.