Look at the language specification :
call ::= primary "(" [argument_list [","] | expression genexpr_for] ")" argument_list ::= positional_arguments ["," keyword_arguments] ["," "*" expression] ["," keyword_arguments] ["," "**" expression] | keyword_arguments ["," "*" expression] ["," "**" expression] | "*" expression ["," "*" expression] ["," "**" expression] | "**" expression positional_arguments ::= expression ("," expression)* keyword_arguments ::= keyword_item ("," keyword_item)* keyword_item ::= identifier "=" expression
Let sift to the parts we care about:
call ::= primary "(" [argument_list [","]] ")" argument_list ::= positional_arguments ["," keyword_arguments] ["," "*" expression] ["," keyword_arguments] ["," "**" expression] positional_arguments ::= expression ("," expression)* keyword_arguments ::= keyword_item ("," keyword_item)* keyword_item ::= identifier "=" expression
So, it seems that after any arguments to the function call, we are allowed to optional,. So this seems like a bug in cpython implementation.
Something like: f(1, *(2,3,4), ) should work according to this grammar, but not in CPython.
In an earlier answer, Eric is related to the CPython grammar specification , which includes the CPython implementation of the above grammar. Here it is below:
arglist: (argument ',')* ( argument [','] | '*' test (',' argument)* [',' '**' test] | '**' test )
Please note that this grammar does not match with the language specification as such. I would consider this an implementation error.
Please note that there are additional issues with the implementation of CPython. This should also be supported: f(*(1,2,3), *(4,5,6))
Oddly enough, the specification does not allow f(*(1,2,3), *(4,5,6), *(7,8,9))
Since I look at this more, it seems to me that this part of the specification needs some fixing. This is allowed: f(x=1, *(2,3)) , but it is not: f(x=1, 2, 3) .
And perhaps a useful starting question, in CPython, you can have a trailing comma if you don't use the *args or **kwargs function. I agree that this is lame.