mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
More two-argument raise cleanup in the tutorial.
This commit is contained in:
parent
1fc035ff63
commit
c7526f5b3e
1 changed files with 3 additions and 4 deletions
|
@ -221,10 +221,9 @@ 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 sole argument to :keyword:`raise` indicates the exception to be raised.
|
||||
This must be either an exception instance or an exception class (a class that
|
||||
derives from :class:`Exception`).
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue