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