GNU Info

Info Node: (python2.1-tut.info)Raising Exceptions

(python2.1-tut.info)Raising Exceptions


Next: User-defined Exceptions Prev: Handling Exceptions Up: Errors and Exceptions
Enter node , (file) or (file)node

Raising Exceptions
==================

The `raise' statement allows the programmer to force a specified
exception to occur.  For example:

     >>> raise NameError, 'HiThere'
     Traceback (most recent call last):
       File "<stdin>", line 1
     NameError: HiThere

The first argument to `raise' names the exception to be raised.  The
optional second argument specifies the exception's argument.


automatically generated by info2www version 1.2.2.9