python - *args and **kwargs? - Stack Overflow - 0 views
-
Benjamin Bandt-Horn on 14 Dec 13One case where *args and **kwargs are useful is when writing wrapper functions (such as decorators) that need to be able accept arbitrary arguments to pass through to the function being wrapped. For example, a simple decorator that prints the arguments and return value of the function being wrapped: def mydecorator( f ): @functools.wraps( f ) def wrapper( *args, **kwargs ): ...