Commit e2d27040 authored by Georg Brandl's avatar Georg Brandl

#6564: fix section about the two raise syntaxes.

parent 36b30b5a
...@@ -221,10 +221,11 @@ exception to occur. For example:: ...@@ -221,10 +221,11 @@ exception to occur. For example::
File "<stdin>", line 1, in ? File "<stdin>", line 1, in ?
NameError: HiThere NameError: HiThere
The first argument to :keyword:`raise` names the exception to be raised. The The argument to :keyword:`raise` is an exception class or instance to be
optional second argument specifies the exception's argument. Alternatively, the raised. There is a deprecated alternate syntax that separates class and
above could be written as ``raise NameError('HiThere')``. Either form works constructor arguments; the above could be written as ``raise NameError,
fine, but there seems to be a growing stylistic preference for the latter. '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 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 handle it, a simpler form of the :keyword:`raise` statement allows you to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment