On 2020-02-07 6:05 p.m., Ram Rachum wrote:
Hi Soni,

I think that your suggestion is identical to Shai's. It would be good, but unfortunately it has the 3 problems I raised in my email from an hour ago.
of which 2 and 3 are personal opinions.

(for 2: you can just use a function. I'd consider that "explicit syntax" tbh.)

my point is tho: if your code implicitly raises during exception handling, that's likely a bug in your code. if it explicitly raises instead, that's likely intended instead. having the language reflect that would be useful IMO regardless of backwards compatibility concerns.

    I'm gonna make a wild suggestion:

    An explicit "raise" in an "except" body gets rewritten as "raise
    from"
    the parent exception.

    Hopefully this doesn't break anything, but, who knows. This means
    you get:

    except Foo as e:
       raise Bar
    # raises Bar, because of Foo, as if by "raise Bar from e"

    except Foo as e:
       my_raise(Bar)
    # raises Bar while handling Foo, as it currently stands.
    _______________________________________________
    Python-ideas mailing list -- python-ideas@python.org
    <mailto:python-ideas@python.org>
    To unsubscribe send an email to python-ideas-le...@python.org
    <mailto: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/XN7B2ZSHKXAYN2G3OV2UVZD7JMIZ2PXV/
    Code of Conduct: http://python.org/psf/codeofconduct/


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

Reply via email to