Aug-01-2019, 12:16 AM
many of my functions accept many keyword arguments like:
def callme(*args,**opts): ...they then have code to pop off the known keywords like:
def callme(*args,**opts): foo = opts.pop('foo',default_foo) bar = opts.pop('bar',default_bar) ...then they check to see if any keywords are leftover like:
def callme(*args,**opts): foo = opts.pop('foo',default_foo) bar = opts.pop('bar',default_bar) if opts: raise ValueError(f'unknown keywords: {", ".join(x for x in opts.keys())}') ...is it possible to output a multi-line message, one line for each keyword in this example, in the raised exception? i would also like to check the arguments, too, and combine messages related to this, too.