[New-bugs-announce] [issue7963] Misleading error message from object(arg)

Alexander Belopolsky report at bugs.python.org
Fri Feb 19 00:14:25 CET 2010


New submission from Alexander Belopolsky <alexander.belopolsky at gmail.com>:

>>> object(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: object.__new__() takes no parameters


This is misleading because object.__new__() takes one parameter:

>>> object.__new__(object)
<object object at 0x100413980>


I suggest changing "object.__new__() takes no parameters" to "object() takes no parameters".

Some other inconsistencies that I noticed:

>>> tuple.__new__(tuple, 1, 2, 3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: tuple() takes at most 1 argument (3 given)

but

>>> list.__new__(list, 1, 2, 3)
[]

----------
components: Interpreter Core
messages: 99547
nosy: Alexander.Belopolsky
severity: normal
status: open
title: Misleading error message from object(arg)
type: behavior
versions: Python 2.7

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


More information about the New-bugs-announce mailing list