On Sun, Jul 05, 2020 at 10:10:01AM -0300, Soni L. wrote:

> >What would be the replacement for:
> >
> >    raise ex from None
> >
> >and so forth?
> 
> no idea. just don't use that anymore?

So your plan is to make Python less useful, less powerful, and be unable 
to do things that it can do now? Sounds great! Not.

If you want a callable that raises:

    def throw(exception, *args):
        raise exception(*args)

    func = lambda x: throw(ValueError, 'bad value') if x < 0 else x+1


Problem solved. The best part of this is that this function is 100% 
backwards compatible all the way back to Python 1.0, and you don't have 
to wait until Python 3.10 or 3.11 to use it.


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

Reply via email to