[Python-checkins] r74194 - python/trunk/Doc/tutorial/errors.rst
georg.brandl
python-checkins at python.org
Fri Jul 24 22:09:46 CEST 2009
Author: georg.brandl
Date: Fri Jul 24 22:09:46 2009
New Revision: 74194
Log:
#6564: fix section about the two raise syntaxes.
Modified:
python/trunk/Doc/tutorial/errors.rst
Modified: python/trunk/Doc/tutorial/errors.rst
==============================================================================
--- python/trunk/Doc/tutorial/errors.rst (original)
+++ python/trunk/Doc/tutorial/errors.rst Fri Jul 24 22:09:46 2009
@@ -221,10 +221,11 @@
File "<stdin>", line 1, in ?
NameError: HiThere
-The first argument to :keyword:`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.
+The argument to :keyword:`raise` is an exception class or instance to be
+raised. There is a deprecated alternate syntax that separates class and
+constructor arguments; the above could be written as ``raise NameError,
+'HiThere'``. Since it once was the only one available, the latter form is
+prevalent in older code.
If you need to determine whether an exception was raised but don't intend to
handle it, a simpler form of the :keyword:`raise` statement allows you to
More information about the Python-checkins
mailing list