The formal syntax for parameters in function definitions is as follows:
parameter_list ::= (defparameter ",")*
| "*" [parameter] ("," defparameter)* ["," "**" parameter]
| "**" parameter
| defparameter [","] )
( #[num], added by me for clarity)
Where |, according to the designation, indicates alternatives.
I donβt see how exactly it matches the function definition:
def foo(a, *, b=10): pass
An obvious rule in which it is assumed that the definition of the form def foo(a, *, b=10)will fall under #[2], which allows you to designate *for the separation of parameters only by keyword.
But the rule for foo, from what I would think, should be a combination of #[1]and #[2]:
parameter_list ::= (defparameter ",")* "*" [parameter] ("," defparameter)* ["," "**" parameter]
#[1] #[2] , .
?