raise Exception Syntax question
Greg Ewing
greg at cosc.canterbury.ac.nz
Fri Apr 16 00:46:18 EDT 2004
chris wrote:
> >>> import exceptions
> >>> e = exceptions.Exception
There's actually no need to import exceptions, since
all the standard exception names are built-in. I
think the exceptions module is just there for
historical compatibility.
> >>> raise e("MESSAGE")
This is the preferred form. Again, the other one
only exists for historical reasons.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list