[Python-ideas] Improve error message when missing 'self' in method definition

Lisa Roach lisaroach14 at gmail.com
Wed Oct 5 13:17:35 EDT 2016


+1

I've definitely seen a lot of new users make this error, an improved
message could go a long way.

On Tue, Oct 4, 2016 at 1:52 PM, Nathan Goldbaum <nathan12343 at gmail.com>
wrote:

> Hi all,
>
> Recently pypy received a patch that improves the error message one gets
> when 'self' is missing in a method's signature:
>
> https://mail.python.org/pipermail/pypy-dev/2016-September/014678.html
>
> Here are the commits that implement the change in pypy:
>
> https://bitbucket.org/pypy/pypy/commits/all?search=
> branch(better-error-missing-self)
>
> I'm curious whether a similar improvement would also be received well in
> CPython. In particular, this guides one to the correct solution for a
> common programming mistake made by newcomers (and even not-so-newcomers).
>
> Here is a case study that found this was a common source of errors for
> newcomers:
>
> http://dl.acm.org/citation.cfm?id=2960327
>
> -Nathan
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161005/fc945dce/attachment-0001.html>


More information about the Python-ideas mailing list