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 cool-RR
Recipients cool-RR
Date 2014-10-16.10:33:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1413455617.21.0.000325400143663.issue22652@psf.upfronthosting.co.za>
In-reply-to
Content
When programming, I just got this exception:

    builtins.TypeError: my_func() takes 1 positional argument but 2 were given

After a couple of minutes of investigation I figured out that the problem is that the function has a `*` in its signature, so arguments must be specified as keyword arguments, not positional arguments.

It would be nice if the exception message would include some text to suggest that, like:

    builtins.TypeError: my_func() takes 1 positional argument but 2 were given. If you were trying to use the keyword-only argument foo, please specify it as foo=value.

It's a little verbose and specific, but maybe it'll help people figure out this problem, especially newbies. We can have logic to show this message only if there are keyword-only arguments.
History
Date User Action Args
2014-10-16 10:33:37cool-RRsetrecipients: + cool-RR
2014-10-16 10:33:37cool-RRsetmessageid: <1413455617.21.0.000325400143663.issue22652@psf.upfronthosting.co.za>
2014-10-16 10:33:37cool-RRlinkissue22652 messages
2014-10-16 10:33:36cool-RRcreate