[Python-checkins] r72820 - python/trunk/Doc/tutorial/errors.rst

georg.brandl python-checkins at python.org
Fri May 22 09:23:32 CEST 2009


Author: georg.brandl
Date: Fri May 22 09:23:32 2009
New Revision: 72820

Log:
Use raise X(y).

Modified:
   python/trunk/Doc/tutorial/errors.rst

Modified: python/trunk/Doc/tutorial/errors.rst
==============================================================================
--- python/trunk/Doc/tutorial/errors.rst	(original)
+++ python/trunk/Doc/tutorial/errors.rst	Fri May 22 09:23:32 2009
@@ -216,7 +216,7 @@
 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 @@
 re-raise the exception::
 
    >>> try:
-   ...     raise NameError, 'HiThere'
+   ...     raise NameError('HiThere')
    ... except NameError:
    ...     print 'An exception flew by!'
    ...     raise
@@ -263,7 +263,7 @@
    ...     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!'


More information about the Python-checkins mailing list