diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-04-09 21:06:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-09 21:06:35 (GMT) |
commit | e46fd7257a9329cf99d290b0ee50b3eb8290ee1d (patch) | |
tree | b262fedd77705d7aee46f1220f389b1e553a48a7 | |
parent | af034dd150ca788ddae107ae5a1f8357f669de9f (diff) | |
download | cpython-e46fd7257a9329cf99d290b0ee50b3eb8290ee1d.zip cpython-e46fd7257a9329cf99d290b0ee50b3eb8290ee1d.tar.gz cpython-e46fd7257a9329cf99d290b0ee50b3eb8290ee1d.tar.bz2 |
[3.12] gh-117597: Clarify exception handling in the tutorial (GH-117681) (#117700)
(cherry picked from commit a05068db0cb43337d20a936d919b9d88c35d9818)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
-rw-r--r-- | Doc/tutorial/errors.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst index 0b9acd0..981b14f 100644 --- a/Doc/tutorial/errors.rst +++ b/Doc/tutorial/errors.rst @@ -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): |