Skip to content

Commit 31c6e4f

Browse files
committed
Mention exceptions hierarchy
1 parent b36cbfe commit 31c6e4f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/doc/en/developer/coding_in_python.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,16 @@ guide you in choosing from the most relevant exceptions to Sage. Raise
493493
like) but the input is not appropriate.
494494

495495
- `ZeroDivisionError
496-
<https://docs.python.org/3/library/exceptions.html#ZeroDivisionError>`_: if the
497-
method performs division but the input is zero. Note that for non-invertible
498-
input values, ``ArithmeticError`` is more appropriate.
496+
<https://docs.python.org/3/library/exceptions.html#ZeroDivisionError>`_: if
497+
the method performs division but the input is zero. Note that for
498+
non-invertible input values, ``ArithmeticError`` is more appropriate. As
499+
derived from ``ArithmeticError``, ``ZeroDivisionError`` can be caught as
500+
``ArithmeticError``.
499501

500502
- `NotImplementedError
501503
<https://docs.python.org/3/library/exceptions.html#NotImplementedError>`_: if
502-
the input is for a feature not yet implemented by the method.
504+
the input is for a feature not yet implemented by the method. Note that
505+
``NotImplementedError`` is derived from ``RuntimeError``.
503506

504507
If no specific error seems to apply for your situation, `RuntimeError
505508
<https://docs.python.org/3/library/exceptions.html#RuntimeError>`_ can be used.

0 commit comments

Comments
 (0)