[issue42978] Improve error message when "self" is missing from the method definition

Pablo Galindo Salgado report at bugs.python.org
Wed Jan 20 14:11:52 EST 2021


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

> I don't think this makes sense. How do you know there's a missing 'self'? Surely it's just as likely that there is indeed an extra argument. Especially if A.foo is defined by a library (stdib or 3rd party).

I use the same heuristic as Pypy: the callable is a bound method, the first name in the definition is not named "self" and it was called with n+1 positional arguments

----------

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


More information about the Python-bugs-list mailing list