New submission from Hagen Fürstenau <hfuerste...@gmx.net>: I think the following error messages are inconsistent and confusing:
>>> def f(a, b): pass ... >>> f(a=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: f() takes exactly 2 non-keyword positional arguments (1 given) >>> f(b=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: f() takes exactly 2 non-keyword positional arguments (0 given) Strictly speaking, no positional arguments are given in either case, so it should say "(0 given)" in both cases. On the other hand, the given keyword arguments are filled into the positional argument slots, so stating something like "(1 missing)" or "(1 unspecified)" in both cases seems to make more sense. Any opinions? ---------- components: Interpreter Core messages: 90485 nosy: hagen severity: normal status: open title: Inconsistent TypeError message on function calls with wrong number of arguments type: behavior versions: Python 2.7, Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6474> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com