8000 [3.12] gh-117597: Clarify exception handling in the tutorial (GH-117681) by miss-islington · Pull Request #117700 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.12] gh-117597: Clarify exception handling in the tutorial (GH-117681) #117700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
6 changes: 3 additions & 3 deletions Doc/tutorial/errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ may name multiple exceptions as a parenthesized tuple, for example::
... except (RuntimeError, TypeError, NameError):
... pass

A class in an :keyword:`except` clause is compatible with an exception if it is
the same class or a base class thereof (but not the other way around --- an
*except clause* listing a derived class is not compatible with a base class).
A class in an :keyword:`except` clause matches exceptions which are instances of the
class itself or one of its derived classes (but not the other way around --- an
*except clause* listing a derived class does not match instances of its base classes).
For example, the following code will print B, C, D in that order::

class B(Exception):
Expand Down
0