[Solved] Python: How to get names of arguments in a list in a lambda?


It’s not possible. The best solution will be using a function with *args and possible **kwargs:

argsneeded = ['foo', 'bar']
def whatever(**kwargs):
    if not all(x in kwargs for x in argsneeded):
        raise ValueError('required kwarg is missing')

0

solved Python: How to get names of arguments in a list in a lambda?