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 metaxm
Recipients metaxm
Date 2018-10-03.08:01:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538553672.9.0.545547206417.issue34882@psf.upfronthosting.co.za>
In-reply-to
Content
>>> def f(a, b, c):
...     pass
>>> f(a=1, 2, 3)
SyntaxError: positional argument follows keyword argument
>>> f(a=1, *(2, 3))
TypeError: f() got multiple values for argument 'a'


f(a=1, 2, 3) will cause a SyntaxError, but f(a=1, *(2, 3)) will cause a TypeError. This makes me feel confused.

As keyword arguments must follow positional arguments, I suppose a SyntaxError rather than a TypeError should be reported if a variadic argument follows keyword arguments. Would you kindly explain why the CPython takes different actions for these two cases?
History
Date User Action Args
2018-10-03 08:01:12metaxmsetrecipients: + metaxm
2018-10-03 08:01:12metaxmsetmessageid: <1538553672.9.0.545547206417.issue34882@psf.upfronthosting.co.za>
2018-10-03 08:01:12metaxmlinkissue34882 messages
2018-10-03 08:01:12metaxmcreate