[Python-Dev] Reasons behind misleading TypeError message when passing the wrong number of arguments to a method

Giampaolo Rodolà g.rodola at gmail.com
Thu May 20 01:42:08 CEST 2010


>>> class A:
...     def echo(self, x):
...             return x
...
>>> a = A()
>>> a.echo()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: echo() takes exactly 2 arguments (1 given)
>>>

I bet my last 2 cents this has already been raised in past but I want
to give it a try and revamp the subject anyway.
Is there a reason why the error shouldn't be adjusted to state that
*1* argument is actually required instead of 2?


--- Giampaolo
http://code.google.com/p/pyftpdlib
http://code.google.com/p/psutil


More information about the Python-Dev mailing list