[issue21728] Confusing error message when initialising type inheriting object.__init__

Gerrit Holl report at bugs.python.org
Thu Jun 12 00:06:57 CEST 2014


New submission from Gerrit Holl:

When I initialise a class that doesn't define its own __init__, but I still pass arguments, the error message is confusing:

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

Although it is correct that object() takes no parameters, it would be more correct to state that A() does not take any parameters.

----------
components: Interpreter Core
messages: 220313
nosy: Gerrit.Holl
priority: normal
severity: normal
status: open
title: Confusing error message when initialising type inheriting object.__init__
type: behavior
versions: Python 3.4

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


More information about the Python-bugs-list mailing list