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

misstatement in example explanation using raise #51128

Closed
bluebloodpole mannequin opened this issue Sep 11, 2009 · 4 comments
Closed

misstatement in example explanation using raise #51128

bluebloodpole mannequin opened this issue Sep 11, 2009 · 4 comments
Assignees
Labels
docs Documentation in the Doc dir

Comments

@bluebloodpole
Copy link
Mannequin

bluebloodpole mannequin commented Sep 11, 2009

BPO 6879
Nosy @birkenfeld, @ezio-melotti

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/ezio-melotti'
closed_at = <Date 2009-09-16.13:33:34.136>
created_at = <Date 2009-09-11.01:35:44.434>
labels = ['docs']
title = 'misstatement in example explanation using raise'
updated_at = <Date 2009-09-16.13:33:34.134>
user = 'https://bugs.python.org/bluebloodpole'

bugs.python.org fields:

activity = <Date 2009-09-16.13:33:34.134>
actor = 'ezio.melotti'
assignee = 'ezio.melotti'
closed = True
closed_date = <Date 2009-09-16.13:33:34.136>
closer = 'ezio.melotti'
components = ['Documentation']
creation = <Date 2009-09-11.01:35:44.434>
creator = 'bluebloodpole'
dependencies = []
files = []
hgrepos = []
issue_num = 6879
keywords = []
message_count = 4.0
messages = ['92501', '92662', '92664', '92686']
nosy_count = 3.0
nosy_names = ['georg.brandl', 'ezio.melotti', 'bluebloodpole']
pr_nums = []
priority = 'low'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue6879'
versions = ['Python 2.6']

@bluebloodpole
Copy link
Mannequin Author

bluebloodpole mannequin commented Sep 11, 2009

v2.6.2 Python Tutorial
http://docs.python.org/tutorial/errors.html#raising-exceptions
Section 8. Errors and Exceptions
8.4. Raising Exceptions

It appears that in the example, the original may have been:
raise(NameError('HiThere')) and was then changed to
raise NameError('HiThere') but the explanation was not changed
accordingly. The current state and my suggested change are found below,
respectively:

Currently:
"""
>>> raise NameError('HiThere')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: HiThere

The first argument to raise names the exception to be raised. The
optional second argument specifies the exception’s argument.
Alternatively, the above could be written as
raise NameError('HiThere'). Either form works fine, but there seems to
be a growing stylistic preference for the latter.
"""

Suggest change to:
"""
>>> raise NameError('HiThere')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: HiThere

The first argument to raise names the exception to be raised. The
optional second argument specifies the exception’s argument.
Alternatively, the above could be written as
raise(NameError('HiThere')). Either form works fine, but there seems to
be a growing stylistic preference for the former.
"""

@bluebloodpole bluebloodpole mannequin added the docs Documentation in the Doc dir label Sep 11, 2009
@ezio-melotti
Copy link
Member

The original was:
>>> raise NameError, 'HiThere'
Since now this form is deprecated, I would remove that paragraph altogether.
Instead, that paragraph should be replaced with:
"The sole argument to raise indicates the exception to be raised. This
must be either an exception instance or an exception class (a class that
derives from Exception)."
as it is now in the Py3 doc (possibly backporting r58076).

@birkenfeld
Copy link
Member

Yes, that seems a good idea.

@ezio-melotti
Copy link
Member

Fixed in r74825 (trunk) and r74827 (release26-maint), thanks!

@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