python-makefun icon indicating copy to clipboard operation
python-makefun copied to clipboard

Provide a helper to create wrappers in case of varpositional wrapped

Open smarie opened this issue 6 years ago • 0 comments

The following fails because the a argument ends up in kwargs

def f(a, *args):
    pass

@wraps(f)
def foo(*args, **kwargs):
    return f(*args, **kwargs)  # TypeError: f() got multiple values for argument 'a'

foo('hello', 12)

We could wish to provide a parameter in wraps (or new_signature) so that one can receive the various pieces (maybe in a third argument ?) and do the call easily.

smarie avatar Apr 16 '19 10:04 smarie