Python PEP-8:E122和E501之后的赋值



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

最新更新