[issue9232] Allow trailing comma in any function argument list.

Martin Panter report at bugs.python.org
Tue Mar 24 01:50:48 CET 2015


Martin Panter added the comment:

See also Issue 22942 about existing problems with the language documentation.

I would like to see trailing commas supported consistently, especially in function calls. (I think the patch here only does function definitions?) I like to use them when writing arguments on multiple lines, and it is surprising that adding packed *positional arguments can trigger a syntax error.

Maybe this is stretching the scope a bit too far, but it would also be nice to allow more keyword arguments after the **keyword unpacking:

print(1, 2, end=".\n", *(3, 4))  # Supported, but confusing
print(1, 2, *(3, 4), end=".\n")  # Better; also suported
print(1, 2, **dict(sep="-"), end=".\n")  # Unsupported, but would be nice
print(end=".\n", 1, 2)  # Unsupported, for good reason

Maybe some of this is covered by Issue 2292 (generalizing * unpacking), but I haven’t been following that, so I’m not sure.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9232>
_______________________________________


More information about the Python-bugs-list mailing list