
7 Feb
2020
7 Feb
'20
7:33 a.m.
07.02.20 16:28, Ram Rachum пише:
The idea is to add `raise as` syntax, that raises an exception while setting the currently caught exception to be the cause. It'll look like this:
try: 1/0 except ZeroDivisionError: raise as ValueError('Whatever')
What it does is a shorter version of this:
try: 1/0 except ZeroDivisionError as error: raise ValueError('Whatever') from error
How does it differ from
try: 1/0 except ZeroDivisionError: raise ValueError('Whatever')
?