8000 [3.12] gh-117597: Clarify exception handling in the tutorial (GH-1176… · python/cpython@e46fd72 · GitHub
[go: up one dir, main page]

Skip to content

Commit e46fd72

Browse files
[3.12] gh-117597: Clarify exception handling in the tutorial (GH-117681) (#117700)
(cherry picked from commit a05068d) Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
1 parent af034dd commit e46fd72

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Doc/tutorial/errors.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ may name multiple exceptions as a parenthesized tuple, for example::
119119
... except (RuntimeError, TypeError, NameError):
120120
... pass
121121

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

127127
class B(Exception):

0 commit comments

Comments
 (0)
0