I am checking the data type of several arguments in a function. If one of them is the wrong type, I want an error to be raised, that says:
TypeError: Argument my_arg did not receive a string!
For instance:
def function(a, b, c, d):
for arg in [a, b, c, d]:
if not isinstance(arg, str):
raise TypeError(f'Argument {"<some arg>"} did not receive a string!')
function(a='djsoa', b='sajdjsld', c='dsaa', d=10)
How can this be done? Please note that using a dict for arguments is not possible for me.