I'm not advocating for it (nor against it). But the OP proposes something
clear different from the example in current Python.
On Sun, Oct 11, 2020, 12:39 PM Wes Turner
> try:
> f = open('myfile.txt')
> s = f.readline()
> i = int(s.strip())
> except OSError as err:
> print("OS error: {0}".format(err))
> except ValueError:
> print("Could not convert data to an integer.")
> except:
> print("Unexpected error:", sys.exc_info()[0])
> raise
> ```
>
I.e.
try:
might_raise_OSError()
except OSError as err try:
might_raise_ValueError()
except ValueError try:
might_raise_other()
except:
oh_well()
The proposal is to more concisely catch exceptions raised within the
'except' suites themselves.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/DOCOHSYCP67MHJLW2YU7XUBEDS774FJE/
Code of Conduct: http://python.org/psf/codeofconduct/