5 Jul
2020
5 Jul
'20
1:47 p.m.
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