As I understand it, the python language reference is written in extended BNF format. While looking at the documentation for function definitions I noticed that the spec doesn't seem to support the usage of trailing *args or **kwargs parameters.
parameter_list ::= (defparameter ",")*
| "*" [parameter] ("," defparameter)* ["," " ** " parameter]
| "**" parameter
| defparameter [","] )
See: https://docs.python.org/3/reference/compound_stmts.html#grammar-token-defparameter
And yet when I do a function def like so:
def func(arg1, *args, **args):
The python interpreter considers it to be legal.
What am I missing? From the spec it appears that you must have the * at the beginning of the function definition before any other parameters.