This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Date 2003-09-01.16:32:49
SpamBayes Score
Marked as misclassified
Current Ref Man 5.3.4 Calls says after grammar:
"A trailing comma may be present after an argument 
list but does not affect the semantics. "
But this is not true if arg list ends with *expr or **expr:

>>> dict(*l,) # any function will do since not called
  File "<stdin>", line 1
            ^ # points at ')'
SyntaxError: invalid syntax
>>> dict(**d,)
  File "<stdin>", line 1
            ^ # points at ','
SyntaxError: invalid syntax

Suggestion: "If an argument list does *not* end with 
*expr or **expr, a trailing comma may be added 
without affecting the semantics."

The same exception applies to function defs as well as 
calls, but 7.5 Function definitions does not have a 
statement such as above.  However, the production for 
parameter_list does end with 'defparameter [","]'.  I 
suggest that this be the first of the parenthesized 
alternatives, as it logically should be, rather than the 
last, so it flows better and so that no one (ignorant 
that '[]' binds tighter than '|') could possible think that 
the '[,]' applies to the * and ** parts.  IE: change 

parameter_list  ::=  (defparameter ",")* 
    ("*" identifier [, "**" identifier] 
    | "**" identifier | defparameter [","]) 


parameter_list  ::=  (defparameter ",")* 
    (defparameter [","]
    |'*' identifier [, "**" identifier] 
    | "**" identifier)

Squeezing out a line is a suboptimazation.
Date User Action Args
2007-08-23 14:16:35adminlinkissue798652 messages
2007-08-23 14:16:35admincreate