Keyword Arguments Demo
# Functions can also be called using keyword arguments of the form
# "keyword = value".
def parrot(voltage, state='state', action='action', type='type'):
print "-- Action:", action,
print "Vol", voltage
print "-- type:", type
print "-- state", state
parrot(1000)
parrot(action = 'A', voltage = 1000000)
parrot('A', state = 'B')
parrot('A', 'B', 'C')
Related examples in the same category