How do I know all thrown exceptions of a function?

Delaney, Timothy tdelaney at avaya.com
Tue Jan 23 18:16:30 EST 2001


> > Sorry - all worries with backwards compatibility *except*
> > the basic one that functions would now need to declare the
> > exceptions they raise. I don't know how to get around that one.
> 
> What about the C++ approach: a function not declaring what
> exceptions it raises is deemed to be a "legacy" function,
> potentially able to raise ANY exception whatsoever (functions
> that need to express "I'll never raise any exception" have
> to do that explicitly).

I thought about this, and I think it's the way it would have to go, but I
*really* don't like it.

For a start, you shouldn't ahve to declare anything if you guarantee that
nothing happens. Lack of declaration should be "nothing happens".

Argh! From a practical viewpoint, this is the way to do it, but from an
aesthetic viewpoint ...

Tim Delaney
Avaya Australia
+61 2 9352 9079




More information about the Python-list mailing list