Steven D'Aprano wrote:

Another alternative is to testing for key phrases in the exception
> message:
>
>     if "too few arguments" in err.args[0]: ...
>
> but that's fragile and only works until the message gets changed to say
> "not enough arguments". (The error message is not part of the API, so it
> can change without warning.)
>

We are talking here about an exception message that is generated by core
Python. So there would be some warning of change, namely the review process
for core Python.

I agree that there is a problem to be solved here. Perhaps it is easier and
better for core Python to decide to freeze certain messages, than to add a
new exception type.
-- 
Jonathan
_______________________________________________
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/7IOPTECPYJA52T5H4C3DH6NTHQKGN3DQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to