[ python-Bugs-1531016 ] Comma not allowed at the end of argument list for **argument
SourceForge.net
noreply at sourceforge.net
Fri Mar 16 15:42:20 CET 2007
Bugs item #1531016, was opened at 2006-07-29 20:21
Message generated for change (Comment added) made by sean_gillespie
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1531016&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Parser/Compiler
Group: Python 2.4
Status: Open
Resolution: None
Priority: 2
Private: No
Submitted By: Roman Suzi (rnd0110)
Assigned to: Nobody/Anonymous (nobody)
Summary: Comma not allowed at the end of argument list for **argument
Initial Comment:
This tells it all:
>>> str('sdfd', **a,)
File "<stdin>", line 1
str('sdfd', **a,)
^
SyntaxError: invalid syntax
>>> str('sdfd', *a,)
File "<stdin>", line 1
str('sdfd', *a,)
^
SyntaxError: invalid syntax
While the docs tell otherwise:
http://docs.python.org/ref/calls.html
While having arguments after ** doesn't make sense,
comma after ANY kinds of arguments seem to be more
consistent.
----------------------------------------------------------------------
Comment By: Sean Gillespie (sean_gillespie)
Date: 2007-03-16 14:42
Message:
Logged In: YES
user_id=1744567
Originator: NO
This behavior seems as intended. According to the docs
(http://docs.python.org/ref/calls.html):
A trailing comma may be present after the positional and keyword arguments
but does not affect the semantics.
[snip]
Formal parameters using the syntax "*identifier" or "**identifier" cannot
be used as positional argument slots or as keyword argument names.
I'm having trouble with what this actually means. However, the relevant
section in the Grammar looks like this:
arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**'
test )
It looks like this logic was explicitly coded.
If this is determined to be a bug, we can just add [','] after the test in
both cases.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1531016&group_id=5470
More information about the Python-bugs-list
mailing list