Search code examples
pythonpep8

How to break this line properly to match PEP 8 style guide?


training_data_all, test_data_all, feature_cols_all = divide_data('../data/feature.csv', training_ratio)
training_data_without_sports, test_data_without_sports, feature_cols_all = divide_data('../data/feature_without_sports.csv', training_ratio)

The first line can be broken on the part where the parenthesis begins, but the second line couldn't be broken in the same way.

I think it will be best to break both lines on parts where the = signs begin, but I couldn't find the way to break on = sign from the PEP8 documentation.


Solution

  • One place where redundant parentheses can help!-)

    training_data_without_sports, test_data_without_sports, feature_cols_all = (
        divide_data('../data/feature_without_sports.csv', training_ratio))
    

    (although, variable names of more sensible lengths would make your code much more readable!-)