When calling function with long argument lists, should the closing parenthesis be on a separate line? For example:
import module1.module2
def main():
# alternative 1, closing parenthesis on separate line
x=3
y=4
my_result_name_1, my_result_name_2 = module1.module2.function3(
argument_name1, argument_name2, keyword_argument=(x,y)
)
print(my_result_name_1)
# alternative 2, closing parenthesis on same line as last argument
x=3
y=4
my_result_name_1, my_result_name_2 = module1.module2.function3(
argument_name1, argument_name2, keyword_argument=(x,y))
print(my_result_name_1)
return
if __name__ == '__main__':
main()
The examples in PEP8 are a little bit confusing to me. First they have this example:
# Hanging indents should add a level.
foo = long_function_name(
var_one, var_two,
var_three, var_four)
Then later, they have this:
my_list = [
1, 2, 3,
4, 5, 6,
]
Which style is preferred?