This may sound like a newbie question, but I really need some help with this. I don't even know how to tag it, but I assume is just a Python question. I need to use a function that receives 5 parameters and returns 5 values:
a, b, c, d, e = function (input1, input2, input3, input4, input5)
The problem is that when I use the full variables/functions names the line is just too long, and the code looks ugly, I want to use a more fancy solution here and I was thinking on using a dict or a list so I can do this:
input_dict['param1'] = input1
input_dict['param2'] = input2
input_dict['param3'] = input3
input_dict['param4'] = input4
input_dict['param5'] = input5
ret_dict = function(input_dict)
Is there a better or "pythonic" way of improving the code quality of this kind of calls?
Thanks in advance!
input_dictversion is prettier.dictliteral notation in Python so rather than many assignments, you should construct dictionaries as{x: y, w: z}.