Keyword and Default Examples : Keyword Arguments « Function « Python Tutorial






def f(a, b, c): print a, b, c

f(1, 2, 3)
f(c=3, b=2, a=1)
f(1, c=3, b=2)

def f(a, b=2, c=3): print a, b, c
f(1)
f(a=1)
f(1, 4)
f(1, 4, 5)
f(1, c=6)








10.7.Keyword Arguments
10.7.1.Keyword and Default Examples
10.7.2.Functions can also be called using keyword arguments of the form "keyword = value". For instance, the following function: