Both concepts are (mostly) distinct.
On function definition side, you have named parameters which have names, and you have variadic extensions, one for positional arguments (giving a tuple) and one for keyboard arguments (giving a dict).
Example:
def f(a, b=5, *c, **d): return a, b, c, d
This function has two named parameters (a
and b
) which can be used positional or via keyword. c
and d
take all others given.
You can call this function with positional arguments as well as with keyword arguments.
f(1)
f(a=1)
both return
1, 5, (), {}
because positional and keyword arguments are assigned to the named parameters.
You can as well do
f(a=5, foo=12) or f(5, foo=12) # -> 5, 5, (), {'foo': 12}
f(1, 2, 3) # -> 1, 2, (3,), {}
In the last example, the positional arguments 1 and 2 are given to the named parameters a
and b
; the exceeding 3 is put into the tuple c
.
You cannot do
f(b=90) # no value for a
f(12, a=90) # two values for a
If there are still unclearities, please let me know.