|
From: | Syan Tan |
Subject: | Re: [Gnumed-devel] using exceptions |
Date: | Sun, 01 Jan 2006 07:54:00 +0800 |
The IOError , as used by the standard python IO functions, is always raised as a *class exception* , followed by a tuple( errno, strerr).
What it boils down to , is that as well as reading the documentation for a method, if it raises a developer defined exception,
then the documentation for the exception would have to be read as well, in case it passes parameters, and in case parameter
passing is done by constructing a exception instance.
On Sun Jan 1 7:35 , Syan Tan sent:
For instance, the IOError example shows that standard io functions raise tion to make up a user defined exception, and raising a Exception instance with attributes used. It's fortunate that python doesn't have scoping of try: except blocks like java does ( anything declared
inside a java try: catch block isn't available to the catch block ). What about using user-defined exceptions like goto labels ?
( no parameters needed, since all is available to the except block, just the exception labelling where the exception came from inside
the try block ).
that's right, exceptions is an evil plan to reintroduce goto.
[Prev in Thread] | Current Thread | [Next in Thread] |