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

Guido van Rossum report at bugs.python.org
Wed Jan 20 15:55:07 EST 2021


Guido van Rossum <guido at python.org> added the comment:

> 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.

Okay, that makes sense, you could have said so in the bug or PR description. :-)

Do you also exclude class and static methods?

I still worry that this might confuse users when a library for some reason uses a different name than 'self'.

----------

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


More information about the Python-bugs-list mailing list