The myFunct is expected to return two values. Both returned values are captured to var_1, var_2.
As an error check I am using a lot of if/else: return statement inside of scope of the function called (myFunct in this case). Typing simple if arg<10: return returns a single None which raises TypeError: 'NoneType' object is not iterable since there are two variables: var_1, var_2 = myFunct(5) expecting two returned values but only a single value None is returned.
In order to avoid an error like this I would have to use a following syntax:
if arg<10: return None, None
which I find pretty ugly.
I wonder if there is a nicer way to do it...
def myFunct(arg):
if arg<10:
return
return 100, 200
var_1, var_2 = myFunct(5)
return None, Nonesyntax. But if there is no way around it I will take it as is.var_1andvar_2. All of the solutions posted here are good, but which one is right probably depends on the greater context of your program.