Function definition
def foo(x, y):
print(x, y)
return x, y
x, y = foo(1, 2)
print(x, y)
Default parameters
def foo(bar='bar', baz='baz'):
print(bar, baz)
foo('x', 'y')
foo(bar='x')
foo(baz='y')
Variable number of arguments
def foo(*args):
print(args)
def bar(**kwargs):
print(kwargs)
foo(1, 2, 3)
foo(*[1, 2, 3])
bar(x=1, y=2)
bar(**{'x': 1, 'y': 2})