From: Georg Brandl Date: Fri, 24 Jul 2009 20:09:46 +0000 (+0000) Subject: #6564: fix section about the two raise syntaxes. X-Git-Tag: v2.7a1~714 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e2d27040170f5cabf66e082c97b830f5371184d8;p=python #6564: fix section about the two raise syntaxes. --- diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst index ebec952648..d547ef7fcc 100644 --- a/Doc/tutorial/errors.rst +++ b/Doc/tutorial/errors.rst @@ -221,10 +221,11 @@ exception to occur. For example:: File "", 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