On 5/2/2020 6:00 AM, Henk-Jaap Wagenaar wrote:
On Fri, 1 May 2020 at 10:29, Steven D'Aprano <st...@pearwood.info
<mailto:st...@pearwood.info>> wrote:
[...]
> "Is it UnpackingOverflowException or PackingUnderflowError or
> TooManyValuesUnpackException or ValueUnpackingError or ...???"
> It took me far too long to learn the difference between
> UnicodeEncodingError and UnicodeDecodingError. Or is it
> UnicodeEncodeError and UnicodeDecodeError?
>
> It is possible to have too many fine-grained errors as well as too
few.
This is thinking about exceptions and the proposal too simply. When I
read this, I (a) found out that this exception is a built-in so it
isn't hard to find out which is which (any IDE or IPython would help)
but more importantly, looking at their MRO, if you cannot understand
the difference, and you don't have to, you could instead choose to
catch UnicodeError instead (or the combination of both).
However, if you just want to catch encoding errors you can, and this
is the crux of this proposal: allowing similar catches throughout the
standard library as a first class citizen seems sensible to me and I
am +1 of this proposal.
Please show an example of where you would catch ValueUnpackingError and
how you'd handle it (recover, re-raise, whatever).
Eric
_______________________________________________
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/I26BBAZY7HP2XFH32FW3WKVPXEAEA6JY/
Code of Conduct: http://python.org/psf/codeofconduct/