From 5a8d7eb7f1a8b9cff09004a4234d8488c6bcd318 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 22 May 2009 07:23:32 +0000 Subject: Use raise X(y). --- Doc/tutorial/errors.rst | 6 +++--- 1 file 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 "", 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 "", line 1, in ? __main__.MyError: 'oops!' -- cgit v0.12