From: Georg Brandl Date: Fri, 22 May 2009 07:23:32 +0000 (+0000) Subject: Use raise X(y). X-Git-Tag: v2.7a1~1135 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a8d7eb7f1a8b9cff09004a4234d8488c6bcd318;p=thirdparty%2FPython%2Fcpython.git Use raise X(y). --- diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst index e1d988ccd6f0..ebec952648a2 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!'