The problem is the keywords. You are not allowed positional arguments after keyword arguments.
f(3, 5, *[1,2,3])
works great as it passes a tuple with values ββ1,2,3. Same as:
f(3, 5, *(1,2,3))
The keyword should always appear after positional arguments, therefore this declaration of your function is incorrect:
def f(*args, a, b): return (a, b, args) print(f(a=3, b=5)) print(f(*[1,2,3], a=3, b=5))
gives:
(3, 5, ()) (3, 5, (1, 2, 3))
source share