diff options
author | Georg Brandl <georg@python.org> | 2009-07-24 20:09:46 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-07-24 20:09:46 (GMT) |
commit | e2d27040170f5cabf66e082c97b830f5371184d8 (patch) | |
tree | f9d9f1282b6b5061290e0f5fc6201893f8fdc833 | |
parent | 36b30b5a4bd87e42c6e8a613b9753db0e9964c95 (diff) | |
download | cpython-e2d27040170f5cabf66e082c97b830f5371184d8.zip cpython-e2d27040170f5cabf66e082c97b830f5371184d8.tar.gz cpython-e2d27040170f5cabf66e082c97b830f5371184d8.tar.bz2 |
#6564: fix section about the two raise syntaxes.
-rw-r--r-- | Doc/tutorial/errors.rst | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst index ebec952..d547ef7 100644 --- a/Doc/tutorial/errors.rst +++ b/Doc/tutorial/errors.rst @@ -221,10 +221,11 @@ exception to occur. For example:: 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 |