This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Clarify recommendation to inherit from Exception
Type: Stage:
Components: Documentation Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: docs@python, eric.araujo, mark.dickinson, python-dev
Priority: normal Keywords:

Created on 2014-02-14 11:31 by mark.dickinson, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg211214 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2014-02-14 11:31
From http://docs.python.org/3.4/library/exceptions.html:

"... programmers are encouraged to at least derive new exceptions from the Exception class and not BaseException."

This wording had someone I've talked to recently thinking that user-defined exceptions should inherit *directly* from Exception.

Suggested rewording, dropping the "at least" qualification that as far as I can tell serves no real purpose:

"... programmers are encouraged to derive new exceptions from the Exception class or one of its subclasses, and not from BaseException."
msg211230 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-02-14 18:23
In my reading “at least” means that exceptions should derive from Exception if they don’t derive from a more specific subclass.  IOW the same meaning as your proposed wording, but less clear.  +1 to your rewording.
msg216090 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-04-14 15:20
New changeset 8dc1b45bd467 by Mark Dickinson in branch '3.4':
Issue #20624: Exception docs wording tweak - clarify that it's okay to inherit from a subclass of Exception.
http://hg.python.org/cpython/rev/8dc1b45bd467

New changeset 262204877004 by Mark Dickinson in branch 'default':
Issue #20624: Merge exception docs tweak from 3.4 branch.
http://hg.python.org/cpython/rev/262204877004
msg216096 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-04-14 15:34
New changeset f729a0e90c4f by Mark Dickinson in branch '2.7':
Issue #20624: Merge exception docs tweak from 3.4 branch.
http://hg.python.org/cpython/rev/f729a0e90c4f
msg216097 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2014-04-14 15:35
Fixed.  Closing.
History
Date User Action Args
2022-04-11 14:57:58adminsetgithub: 64823
2014-04-14 15:35:34mark.dickinsonsetstatus: open -> closed
resolution: fixed
messages: + msg216097

versions: + Python 3.5, - Python 3.3
2014-04-14 15:34:04python-devsetmessages: + msg216096
2014-04-14 15:20:59python-devsetnosy: + python-dev
messages: + msg216090
2014-04-12 13:10:19mark.dickinsonsetassignee: docs@python -> mark.dickinson
2014-02-14 18:23:28eric.araujosetnosy: + eric.araujo
messages: + msg211230
2014-02-14 11:31:29mark.dickinsoncreate