Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PEP8 warning: continuation line missing indentation or outdented

I'm using pycharm where I really like the integration of PEP8 warnings which helps me to write neat python code.

usually when there are multiple return type for a function I use the return variables in multiple line like below,

raw_data,\
t_raw_data,\                      #warning in t_raw_data
words_info,\                      #warning in words_info
t_words_info,\                    #warning in t_words_info
tags_info,\                       #warning in tags_info
char_info,\                       #warning in char_info
t_char_info = preprocess(param)   #warning in t_char_info

Which gives me warning

PEP 8: continuation line missing indentation or outdented

So what is the good practice to receive multiple return values. What is the pythonic way. I came from C++ background and I'm very new to this pythonic way.

Note: If I post the following code then there is no PEP8 warning but this seems pretty odd.

raw_data,\
    t_raw_data,\
    words_info,\
    t_words_info,\
    tags_info,\
    char_info,\
    t_char_info = preprocess(param)
like image 203
Maruf Avatar asked Jun 01 '18 10:06

Maruf


1 Answers

The Pythonic way -

(raw_data,
 t_raw_data,
 words_info,
 t_words_info,
 tags_info,
 char_info,
 t_char_info) = preprocess(param)
like image 173
Rahul Goswami Avatar answered Nov 16 '22 14:11

Rahul Goswami