在以下情况下,我应该如何改进许多或长变量的分配以遵循规则 E122 和 E501:
def my_example_function():
return 1, 2, 3, 4
# How can I improve the following line:
first_variable, second_variable, third_variable, fourth_variable = my_example_function()
只需将它跨越多行..
( first_variable, second_variable,
third_variable, fourth_variable ) = my_example_function()
E122 表示该行应少于 80 个字符,E501 表示续行应缩进。 重写该行的一种常见方法是,
first_variable, second_variable, third_variable, fourth_variable = \
my_example_function()