[New-bugs-announce] [issue42978] Improve error message when "self" is missing from the method definition

Pablo Galindo Salgado report at bugs.python.org
Wed Jan 20 10:40:27 EST 2021


New submission from Pablo Galindo Salgado <pablogsal at gmail.com>:

We currently say:

Traceback (most recent call last):
  File "/Users/pgalindo3/github/python/master/lel.py", line 5, in <module>
    A().foo(1,2)
TypeError: foo() takes 2 positional arguments but 3 were given

but we should say:
Traceback (most recent call last):
  File "/Users/pgalindo3/github/python/master/lel.py", line 5, in <module>
    A().foo(1,2)
TypeError: A.foo() takes 2 positional arguments but 3 were given. Did you forget 'self' in the method definition?

----------
messages: 385349
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Improve error message when "self" is missing from the method definition

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42978>
_______________________________________


More information about the New-bugs-announce mailing list