6.14 Arbitrary Argument Lists
- Sometimes a programmer doesn't know how many arguments a function requires
- A function definition can include a args* parameter that collects optional positional parameters into an arbitrary argument list** tuple.
- Adding a final function parameter of **kwargs creates a dictionary containing "extra" arguments not defined in the function definition
- kwargs is short for keyword arguments.
args and *kwargs rules:
- The * and characters in *args and kwargs are the important symbols.
- Using "args" and "kwargs" is standard practice, but any valid identifier is acceptable (like perhaps using *condiments in the sandwich example).
- One or both of args or *kwargs can be used.
- They must come last (and in that order if both are used) in the parameter list, otherwise an error occurs.