(EDITED FOR CLARITY)
I am trying to solve this issue with passing default parameters.
I have functions creating plots with matplotlib. These functions accept parameters and some of those have default values:
def radar_with_CI(values, categories, group=0):
...
def multi_radar_with_CI(values,
categories,
fname: str,
series_names="Series",
pth="t:/Projects/dev/Plotter/"):
...
def overlay_radar_with_CI(values,
categories,
fname: str,
series_names="Series",
pth="t:/Projects/dev/Plotter/"):
...
Then there is a master function, that aggregates parameters and runs different functions based on 'mode'.
def radar(values,
categories,
fname,
series_names="Series",
pth="",
mode="all",
group=None):
if mode == "single":
radar_with_CI(values, categories, group=group)
if mode == "one-by-one" or mode == "all":
multi_radar_with_CI(values,
categories,
series_names=series_names,
fname=fname,
pth=pth)
if mode == "overlay" or mode == "all":
overlay_radar_with_CI(values,
categories,
series_names=series_names,
fname=fname,
pth=pth)
Thing is, I need a default parameter for e.g. series_names, but I need this default parameter both in the master function and in the plotting functions themselves to be able to call them both through master function and separately.
In the code above my current solution is implemented: I made the parameter default in both the master and plotting functions.
THE QUESTION:
Is this a correct solution? Or is it bad practice to stack default parameters on themselves (in other words to send a parameter with the same value as is the default one)? Is this a place for using args or kwargs?
Thanks for any advice. If there is something unclear, let me know in the comments and I will edit this post.