On Fri, 7 Feb 2020 at 23:14, Steven D'Aprano <st...@pearwood.info> wrote:
> YMMV and this is just my opinion, but personally I think that exception
> chaining is rarely useful even at the best of times. For me, the only
> time I care about "raise from" is to suppress exception chaining by
> setting the cause to None.

Oddly, I had an issue this week where exception chaining would have
been ideal. However, it was on a codebase where I needed to support
Python 2, so I couldn't use it. I went with a slightly less optimal
solution that worked on Python 2. The main difference was that there
is a little more clutter in the Python 3 error message, but that's not
a big deal because so few people need the full traceback anyway ;-) If
I had been on a Python 3 only codebase, I would have used exception
chaining quite happily and naturally. Although I would *not* have been
worried about the difference between the "during" vs "direct cause"
wording.

So I'd be hesitant about calling exception chaining a failure (like
the OP, not Steven, did) for a while yet. And even then, I would't
call it a failure, just a relatively niche feature that is helpful in
some uncommon cases.

And I'm definitely -1 on the proposal here to add an *extra* way to do
exception chaining that adds nothing beyond a slightly abbreviated
form of "raise from".

Paul
_______________________________________________
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/GTS6VO465XLSLMX63BKK3N4QZS7YXHWC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to