Issue 6879: misstatement in example explanation using raise (original) (raw)
Issue6879
Created on 2009-09-11 01:35 by bluebloodpole, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (4) | ||
---|---|---|
msg92501 - (view) | Author: Gene Ratzlaff (bluebloodpole) | Date: 2009-09-11 01:35 |
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 "", 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 "", 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. """ | ||
msg92662 - (view) | Author: Ezio Melotti (ezio.melotti) * ![]() |
Date: 2009-09-16 02:55 |
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). | ||
msg92664 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2009-09-16 07:00 |
Yes, that seems a good idea. | ||
msg92686 - (view) | Author: Ezio Melotti (ezio.melotti) * ![]() |
Date: 2009-09-16 13:33 |
Fixed in r74825 (trunk) and r74827 (release26-maint), thanks! |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:52 | admin | set | github: 51128 |
2009-09-16 13:33:34 | ezio.melotti | set | status: open -> closedresolution: fixedmessages: + stage: resolved |
2009-09-16 07:00:31 | georg.brandl | set | messages: + |
2009-09-16 02:55:32 | ezio.melotti | set | priority: lownosy: + ezio.melottimessages: + assignee: georg.brandl -> ezio.melotti |
2009-09-11 01:35:44 | bluebloodpole | create |