spock
6/11/2017 - 11:50 AM

On the magic vars *args and *kwargs.

On the magic vars *args and *kwargs.

def func3(*args, **kwargs):
    print(args)
    print(kwargs)

>>> func3(1, 2, a=3, b=4)
>>> (1, 2)  # *args gives tuple
>>> {"a": 3, "b": 4}  # **kwargs gives dictionary