Keyword Arguments in Python 3
Keyword arguments are related to the
function calls. When you use keyword arguments in a function call, the caller identifies
the arguments by the parameter name. This allows you to skip arguments or place
them out of order because the Python interpreter is able to use the keywords
provided to match the values with parameters.
You can also make keyword calls to the
printme() function in the following ways-
#!/usr/bin/python3
# Function definition is here
def printme( str ):
"This prints a passed
string into this function"
print (str)
return
# Now you can call printme function
printme( str = "My string")
|
When the above code is executed, it
produces the following result-
My string
|
The following example gives a clearer
picture. Note that the order of parameters does not matter.
and the output is :