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)
The Pythonic way -
(raw_data,
t_raw_data,
words_info,
t_words_info,
tags_info,
char_info,
t_char_info) = preprocess(param)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With