I have a function where, depending on another case, I change the parameters sent to the function whose result I return. I would just like to define the parameters in the middle of the method and have only one callback at the bottom of my function. Keep in mind that this is not what my code looks like, this is just an example. I use Django if it is relevant.
if x: return func(param1, param2, param3) elif y: return func(param4, param5, param6) elif z: return func(param7, param8, param9)
I wish it read
if x: parameters = (param1, param2, param3) elif y: parameters = (param4, param5, param6) elif z: parameters = (param7, param8, param9) return func(parameters)
Thanks for the help!
source share