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.

Author serhiy.storchaka
Recipients ncoghlan, serhiy.storchaka
Date 2017-09-18.12:31:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1505737876.8.0.140580824274.issue31506@psf.upfronthosting.co.za>
In-reply-to
Content
It is not so easy to make an error message conforming with error messages for similar types. This may require changing error messages in other code.

First, "takes no arguments" instead of "takes no parameters".

For normal __new__ and __init__ you never got "takes no arguments". They  take at least one argument -- a class or an instance.

>>> tuple.__new__(tuple, 1, 2, 3, 4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: tuple expected at most 1 arguments, got 4
>>> list.__init__([], 1, 2, 3, 4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: list expected at most 1 arguments, got 4
>>> class C:
...     def __new__(cls): return object.__new__(cls)
...     def __init__(self): pass
... 
>>> C.__new__(C, 1, 2, 3, 4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __new__() takes 1 positional argument but 5 were given
>>> C.__init__(C(), 1, 2, 3, 4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() takes 1 positional argument but 5 were given
History
Date User Action Args
2017-09-18 12:31:16serhiy.storchakasetrecipients: + serhiy.storchaka, ncoghlan
2017-09-18 12:31:16serhiy.storchakasetmessageid: <1505737876.8.0.140580824274.issue31506@psf.upfronthosting.co.za>
2017-09-18 12:31:16serhiy.storchakalinkissue31506 messages
2017-09-18 12:31:16serhiy.storchakacreate