On Wed, Mar 04, 2020 at 10:12:34AM +0000, Jonathan Fine wrote:

> I find this behaviour perfectly satisfactory. The OP's problem can be
> resolved by looking at the exception, whose type is TypeError.
> 
> For this to be completely reliable, certain aspects the exception message
> need to be stable. It may be worth stating that this will be done, at least
> for certain exception.

Error messages are not part of the function API and are not guaranteed 
to be a constant part of the language. We shouldn't expect every single 
Python interpreter (CPython, IronPython, Jython, Nuitka, MicroPython, 
PyPy, Stackless etc) to use exactly the same error messages.

It shouldn't be a *feature change* if an error message changes. We 
shouldn't have to use a deprecation period or a `__future__` import 
before we can improve error messages, fix spelling or grammatical 
errors, or add extra information to the error message.

Error messages might be localised into the native language of the user.

Parsing error messages is a fragile and error-prone technique that 
should be avoided if at all possible.



-- 
Steven
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/V3PQVEOMHVL3DAA7TKOMAWKV2Q3BEXEO/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to