Message229521
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. |
|
Date |
User |
Action |
Args |
2014-10-16 10:33:37 | cool-RR | set | recipients:
+ cool-RR |
2014-10-16 10:33:37 | cool-RR | set | messageid: <1413455617.21.0.000325400143663.issue22652@psf.upfronthosting.co.za> |
2014-10-16 10:33:37 | cool-RR | link | issue22652 messages |
2014-10-16 10:33:36 | cool-RR | create | |
|