Python PEP-8:E122和E501之后的分配

时间:2015-11-09 17:05:56

标签: python pep

在如下情况下,如何改进许多或长变量的分配以遵循规则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()

2 个答案:

答案 0 :(得分:3)

只需跨越多行..

( first_variable, second_variable, 
  third_variable, fourth_variable ) = my_example_function()

答案 1 :(得分:1)