Or, How to use variable length argument lists in Python.
The special syntax, *args
and **kwargs
in function definitions is used to pass a variable number of arguments
to a function. The single asterisk form (*args
) is used to pass
a non-keyworded
, variable-length argument list, and the double asterisk form
is used to pass a keyworded
, variable-length argument list.
Here is an example of how to use the non-keyworded form. This example
passes one formal (positional) argument, and two more variable length arguments.
formal arg: 1
another arg: two
another arg: 3
Here is an example of how to use the keyworded form. Again, one formal
argument and two keyworded variable arguments are passed.