[New-bugs-announce] [issue6879] misstatement in example explanation using raise

Gene Ratzlaff report at bugs.python.org
Fri Sep 11 03:35:46 CEST 2009


New submission from Gene Ratzlaff <generatz at gmail.com>:

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

----------
assignee: georg.brandl
components: Documentation
messages: 92501
nosy: bluebloodpole, georg.brandl
severity: normal
status: open
title: misstatement in example explanation using raise
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6879>
_______________________________________


More information about the New-bugs-announce mailing list