summaryrefslogtreecommitdiffstats
path: root/Doc/tutorial
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-05-22 07:23:32 (GMT)
committerGeorg Brandl <georg@python.org>2009-05-22 07:23:32 (GMT)
commit5a8d7eb7f1a8b9cff09004a4234d8488c6bcd318 (patch)
treec2c15c6abee56bf9f43c14ec230cdcaa2dfee80f /Doc/tutorial
parent739aa36818131fc4917fa2e13a3af1f23344fcb7 (diff)
downloadcpython-5a8d7eb7f1a8b9cff09004a4234d8488c6bcd318.zip
cpython-5a8d7eb7f1a8b9cff09004a4234d8488c6bcd318.tar.gz
cpython-5a8d7eb7f1a8b9cff09004a4234d8488c6bcd318.tar.bz2
Use raise X(y).
Diffstat (limited to 'Doc/tutorial')
-rw-r--r--Doc/tutorial/errors.rst6
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst
index e1d988c..ebec952 100644
--- a/Doc/tutorial/errors.rst
+++ b/Doc/tutorial/errors.rst
@@ -216,7 +216,7 @@ Raising Exceptions
The :keyword:`raise` statement allows the programmer to force a specified
exception to occur. For example::
- >>> raise NameError, 'HiThere'
+ >>> raise NameError('HiThere')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: HiThere
@@ -231,7 +231,7 @@ handle it, a simpler form of the :keyword:`raise` statement allows you to
re-raise the exception::
>>> try:
- ... raise NameError, 'HiThere'
+ ... raise NameError('HiThere')
... except NameError:
... print 'An exception flew by!'
... raise
@@ -263,7 +263,7 @@ directly or indirectly. For example::
... print 'My exception occurred, value:', e.value
...
My exception occurred, value: 4
- >>> raise MyError, 'oops!'
+ >>> raise MyError('oops!')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
__main__.MyError: 'oops!'