[Python-Dev] A grammatical oddity: trailing commas in argument lists.

Mark Dickinson dickinsm at gmail.com
Fri Jul 9 16:40:13 CEST 2010


While looking at a parser module issue
(http://bugs.python.org/issue9154) I noticed that Python's grammar
doesn't permit trailing commas after keyword-only args.  That is,

    def f(a, b,):  pass

is valid syntax, while

    def f(*, a, b,): pass

is not.  I was just curious whether the latter was deliberate or an
oversight.  And if an oversight, is it worth fixing after the
moratorium expires?  (See also http://bugs.python.org/issue2009.)

Mark


More information about the Python-Dev mailing list