[issue9943] TypeError message became less helpful in Python 2.7

Geoffrey Bache report at bugs.python.org
Sat Sep 25 12:27:52 CEST 2010


Geoffrey Bache <gjb1002 at users.sourceforge.net> added the comment:

I think the unhelpful part is mostly that it does not distinguish between argument types any more when the distinction is important in this context. In fact, it could be argued that what it said isn't even true:

f() takes exactly 0 arguments (2 given)

f() doesn't take exactly 0 arguments. It takes any number of arguments, so long as they are keyword arguments.

Surely you agree that the Python 2.6 error describes the problem more accurately?

As for your examples, the message in the first one has changed from

TypeError: f() takes exactly 1 non-keyword argument (4 given)

to 

TypeError: f() takes exactly 1 argument (5 given)

which is possibly a marginal improvement, although taken together I would say this isn't an improvement, especially as I think examples like my first one are more widespread (OK, I didn't even know this syntax was legal...)

Your second example is only legal syntax in Python 3, so I don't really get the point with respect to comparing Python 2.6 and Python 2.7.

----------

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


More information about the Python-bugs-list mailing list