Mercurial > cpython-lru_cache-weakref
comparison Doc/tutorial/errors.rst @ 55993:96b645752c33 2.6
Merged revisions 74825 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74825 | ezio.melotti | 2009-09-16 16:14:05 +0300 (Wed, 16 Sep 2009) | 1 line
#6879 - fix misstatement about exceptions
........
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Wed, 16 Sep 2009 13:31:18 +0000 |
| parents | acc07866b233 |
| children | 66de7111230a |
comparison
equal
deleted
inserted
replaced
| 55973:a6df074d2e09 | 55993:96b645752c33 |
|---|---|
| 219 >>> raise NameError('HiThere') | 219 >>> raise NameError('HiThere') |
| 220 Traceback (most recent call last): | 220 Traceback (most recent call last): |
| 221 File "<stdin>", line 1, in ? | 221 File "<stdin>", line 1, in ? |
| 222 NameError: HiThere | 222 NameError: HiThere |
| 223 | 223 |
| 224 The first argument to :keyword:`raise` names the exception to be raised. The | 224 The sole argument to :keyword:`raise` indicates the exception to be raised. |
| 225 optional second argument specifies the exception's argument. Alternatively, the | 225 This must be either an exception instance or an exception class (a class that |
| 226 above could be written as ``raise NameError('HiThere')``. Either form works | 226 derives from :class:`Exception`). |
| 227 fine, but there seems to be a growing stylistic preference for the latter. | |
| 228 | 227 |
| 229 If you need to determine whether an exception was raised but don't intend to | 228 If you need to determine whether an exception was raised but don't intend to |
| 230 handle it, a simpler form of the :keyword:`raise` statement allows you to | 229 handle it, a simpler form of the :keyword:`raise` statement allows you to |
| 231 re-raise the exception:: | 230 re-raise the exception:: |
| 232 | 231 |
