Arbitrary Argument Lists and Keyword Argument Dictionaries

Arbitrary Arguments

def foo(*args):
    for n in args:
        print(n)

Arbitrary Argument Dictionaries

To iterate, call kwargs.items()

def foo(**kwargs):
    for k,v in kwargs.items():
        print(f"{k}: {v}")

If I were to call foo(x=10, y=11, z=12), the resulting kwargs variable would be this:

{ x: 10, y: 11, z: 12}


all tags