Skip to content
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

Clarify recommendation to inherit from Exception #64823

Closed
mdickinson opened this issue Feb 14, 2014 · 5 comments
Closed

Clarify recommendation to inherit from Exception #64823

mdickinson opened this issue Feb 14, 2014 · 5 comments
Assignees
Labels
docs Documentation in the Doc dir

Comments

@mdickinson
Copy link
Member

BPO 20624
Nosy @mdickinson, @merwok

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/mdickinson'
closed_at = <Date 2014-04-14.15:35:34.032>
created_at = <Date 2014-02-14.11:31:29.863>
labels = ['docs']
title = 'Clarify recommendation to inherit from Exception'
updated_at = <Date 2014-04-14.15:35:34.030>
user = 'https://github.com/mdickinson'

bugs.python.org fields:

activity = <Date 2014-04-14.15:35:34.030>
actor = 'mark.dickinson'
assignee = 'mark.dickinson'
closed = True
closed_date = <Date 2014-04-14.15:35:34.032>
closer = 'mark.dickinson'
components = ['Documentation']
creation = <Date 2014-02-14.11:31:29.863>
creator = 'mark.dickinson'
dependencies = []
files = []
hgrepos = []
issue_num = 20624
keywords = []
message_count = 5.0
messages = ['211214', '211230', '216090', '216096', '216097']
nosy_count = 4.0
nosy_names = ['mark.dickinson', 'eric.araujo', 'docs@python', 'python-dev']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue20624'
versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

@mdickinson
Copy link
Member Author

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."

@mdickinson mdickinson added the docs Documentation in the Doc dir label Feb 14, 2014
@merwok
Copy link
Member

merwok commented Feb 14, 2014

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.

@mdickinson mdickinson assigned mdickinson and unassigned docspython Apr 12, 2014
@python-dev
Copy link
Mannequin

python-dev mannequin commented Apr 14, 2014

New changeset 8dc1b45bd467 by Mark Dickinson in branch '3.4':
Issue bpo-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 bpo-20624: Merge exception docs tweak from 3.4 branch.
http://hg.python.org/cpython/rev/262204877004

@python-dev
Copy link
Mannequin

python-dev mannequin commented Apr 14, 2014

New changeset f729a0e90c4f by Mark Dickinson in branch '2.7':
Issue bpo-20624: Merge exception docs tweak from 3.4 branch.
http://hg.python.org/cpython/rev/f729a0e90c4f

@mdickinson
Copy link
Member Author

Fixed. Closing.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants