I am looking to save the input parameters of a function as a string. I am using Python 3.7. I want so save that string for debugging.
What I could do easily would be something like this:
def Model(par1=150, par2=100)
#some processing
return results, par1
parameters = str(par1) + str(par2)
However, I want to be able to automatically save all parameters, even if I add more parameters later. So if I add a par3 = 300 to the function, "parameters" would also contain str(par3), instead of me having to add it manually.
The behavior I would like to have is something like this:
def Model(--any number of parameters--)
#some processing
return results
parameters = --all parameters of Model--
The reason I would like to have it done automatically is that I expect that otherwise it would cause more trouble than it being worse, as I would have to remember to manually change this all the time.
Is it possible to save ALL parameters of a function as a string (or in any other way that lets me easily check later which parameters a function ran with)?