I am not a Python developer, but I am very interested in this topic. While I
would definitely make use of any additional fields for exceptions as discussed,
it is already possible to find most, if not all of the information discussed in
PEP 473. To give just a concrete example taken from the PEP:
```
Friendly Console version 0.3.1. [Python version: 3.8.4]
>>> a = {'foo': 1}
>>> a['fo']
Traceback (most recent call last):
File "<friendly-console:2>", line 1, in <module>
a['fo']
KeyError: 'fo'
Did you mean foo?
>>>
>>> foo = 1
>>> fo
Traceback (most recent call last):
File "<friendly-console:5>", line 1, in <module>
fo
NameError: name 'fo' is not defined
Did you mean foo?
>>>
```
The above two examples are the actual output done by a program I work on called
friendly (formerly known as friendly-traceback) and are essentially identical
to what is given in PEP 473 as a desired outcome.
Much information about IndexError, AttributeError, etc, mentioned as desirable
in PEP 473 can already be obtained by such automated tools. Using friendly as
an example, a sample of what's possible can be found at
https://aroberge.github.io/friendly-traceback-docs/docs/html/tracebacks_en_3.8.html
Of course, having information more easily available about specific exceptions
would be welcome and make it easier and likely more error-proof to write
automated tools. But since much of the information is already available (if
one looks hard enough...), the cost of adding fields to existing exceptions
should be carefully evaluated.
André Roberge
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/LQATQLUVAZ4COI5HPS4A6DKVQ6UZ5XU7/
Code of Conduct: http://python.org/psf/codeofconduct/