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.

classification
Title: C argument errors and Python arguments error are different
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.4
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, Ramchandra Apte, benjamin.peterson
Priority: normal Keywords:

Created on 2012-06-27 08:59 by Ramchandra Apte, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg164129 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2012-06-27 08:59
C argument errors and Python arguments error are different.
For example:
all(4,4,4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: all() takes exactly one argument (3 given)
def func(a):pass
a(4,4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: func() takes exactly 1 positional argument (2 given)
I do not know which error message is better.
I think the second example's (func) error message is better.
Though feel free to vote by commenting on this bug.
Another example with not enough arguments given:
hasattr(4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: hasattr expected 2 arguments, got 1
func()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: func() takes exactly 1 argument (0 given)
I don't know which of this error messages are better.
You can vote on this by commenting.
msg171610 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2012-09-30 05:50
This is won't fix at least for now. The way arguments to C functions are parsed prevents them from ever really being the same. Specific improvements can be considered.
History
Date User Action Args
2022-04-11 14:57:32adminsetgithub: 59406
2012-09-30 05:50:41benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg171610

resolution: wont fix
2012-09-30 03:18:03Ramchandra Aptesetversions: + Python 3.4, - Python 3.2
2012-06-27 15:46:44Arfreversetnosy: + Arfrever
2012-06-27 08:59:22Ramchandra Aptecreate