https://github.com/python/cpython/commit/6d1e9ceed3e70ebc39953f5ad4f20702ffa32119 commit: 6d1e9ceed3e70ebc39953f5ad4f20702ffa32119 branch: main author: Maurizio Sambati <[email protected]> committer: nedbat <[email protected]> date: 2026-03-13T05:40:20-04:00 summary:
Docs: except with multiple exceptions parentheses not required (#145848) As of PEP 758 the except statement doesn't require parentheses anymore for exception tuples. See: https://peps.python.org/pep-0758/ files: M Doc/tutorial/errors.rst diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst index 1c20fa2f0b6ae5..ae21dfdbf0ac44 100644 --- a/Doc/tutorial/errors.rst +++ b/Doc/tutorial/errors.rst @@ -121,9 +121,9 @@ A :keyword:`try` statement may have more than one *except clause*, to specify handlers for different exceptions. At most one handler will be executed. Handlers only handle exceptions that occur in the corresponding *try clause*, not in other handlers of the same :keyword:`!try` statement. An *except clause* -may name multiple exceptions as a parenthesized tuple, for example:: +may name multiple exceptions, for example:: - ... except (RuntimeError, TypeError, NameError): + ... except RuntimeError, TypeError, NameError: ... pass A class in an :keyword:`except` clause matches exceptions which are instances of the _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
