[Doc-SIG] a better path from error message to solution

Julien Palard julien at palard.fr
Tue Dec 24 09:17:10 EST 2019

Hi Marc,

> have a python module that behaves like perl diagnostics (https://metacpan.org/pod/distribution/perl/lib/diagnostics.pm) at least as a ipython extension.

I tried a POC around your idea, which would enable adding text (and links) to exception and to translate them.

It's here: https://pypi.org/project/teacher/ so you can test it:

$ pip install teacher
$ python3
>>> import teacher
>>> "a" * "b"
<stdin>:1: TypeError: can't multiply sequence by non-int of type 'str'
You tried to multiply 'a' by 'b'
which is not allowed, the sequence 'a' can only be multiplied by an integer.

It only handle this very specific exception, and does not try to translate it yet, it's really just a 32 lines of code POC.

If you think this is a good way to do it, what you could do now is to document, as issues here [1], the problems your child encontered, and what piece of information helped to solve the issue. Because TBH I did so much Python that exceptions *are* readable to me now, so it's really hard to take a step back and guess what's missing (I bet my POC does not even help to understand why "a" can't be multiplied by "b" ...) :]

[1]: https://github.com/JulienPalard/teacher/issues
Julien Palard

More information about the Doc-SIG mailing list