As the issue has raised in several python projects (including pylint and black) I think PEP-8 would benefit from being a bit more precise
PEP 8 – Style Guide for Python Code | peps.python.org states
Continuation lines should align wrapped elements either vertically using Python’s implicit line joining inside parentheses, brackets and braces, or using a hanging indent [7]. When using a hanging indent the following should be considered; there should be no arguments on the first line and further indentation should be used to clearly distinguish itself as a continuation line.
and then gives two examples
in yes it gives :
foo = long_function_name(
var_one, var_two,
var_three, var_four)
(with 1 indentation)
and in no it gives
# Further indentation required as indentation is not distinguishable.
def long_function_name(
var_one, var_two, var_three,
var_four):
print(var_one)
my question:
is
def long_function_name(
var_one, var_two, var_three,
var_four
): # <---- it visually make clear that print is not inside the argument list , so it is now distinguishable
print(var_one)
“possible” ?
especially if you see this other example
# Add a comment, which will provide some distinction in editors
# supporting syntax highlighting.
if (this_is_one_thing and
that_is_another_thing):
# Since both conditions are true, we can frobnicate.
do_something()
where a comment is given as possible way to have only 1 indentation
so at the very least the docstring should play the same role and allows :
def long_function_name(
var_one, var_two, var_three,
var_four
):
"""The doc string is also a comment """
print(var_one)