[Python-ideas] Block-Scoped Exception Handlers
Kyle Lahnakoski
klahnakoski at mozilla.com
Thu May 5 11:35:58 EDT 2016
On 5/5/2016 11:23 AM, Michael Selik wrote:
>
>
> On Thu, May 5, 2016, 7:13 AM Kyle Lahnakoski <klahnakoski at mozilla.com
> <mailto:klahnakoski at mozilla.com>> wrote:
>
>
>
> On 5/4/2016 10:31 PM, Steven D'Aprano wrote:
> > On Thu, May 05, 2016 at 02:17:25AM +0000, Michael Selik wrote:
> >
> >> Unfortunately, Kyle is using Python 2.7 still, so ``raise
> from`` won't help
> >> him.
> > If Kyle is using Python 2.7, then a new feature which is only
> introduced
> > to 3.6 or 3.7 isn't going to help him either.
> >
>
> It will help me! Eventually. :)
>
>
> I thought you said the ``raise from`` syntax solved the problem. No?
I am jealous that Python 3.x has `raise from`, and I can not use it.
`raise from` does solve the exception chaining problems in 2.7, but that
can be worked around just as effectively [1]. Me being stuck in 2.7
will not last forever.
`raise from` does not solve the excessive indentation problem: I have
many `try` clauses, causing deep indentation in my code. The
block-scoped exception handlers would mitigate this deep indentation,
and make exception handling even easier to add.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160505/076f7775/attachment.html>
More information about the Python-ideas
mailing list