Exception Handling and Inheritance

Franz GEIGER fgeiger at datec.at
Tue Dec 26 10:02:15 EST 2000


> No, but you could easily implement a function to do that using the
> traceback module.
>

Admitted, that's almost always a solution if other things do not work. But I
wondered..., well, you know.

> WARNING: it's generally considered a Bad Idea to catch exceptions
> willy-nilly.  For example, do you really want to trap the keyboard
> interrupt?

Well, I do not agree here. I do not want the user seeing any uncaught
exception without any message of MY program. Visual Basic gives dreaded
examples here: "Runtime error 5 in MY.EXE" or something like that.

If tests yield, that there are exceptions needing special care, I will
handle them differently. If there where a feature like exception decoration,
the language could force me to consider different exceptions differently
from the beginning. But as I understand, scripting people do not like to be
forced to anything ;-)

Best regards
Franz GEIGER

"Aahz Maruch" <aahz at panix.com> wrote in message
news:922les$bkr$1 at panix2.panix.com...
> In article <921sdr$mlq$1 at newsreaderg1.core.theplanet.net>,
> Franz GEIGER <fgeiger at datec.at> wrote:
> >
> >But what about Exceptions? They are not caught by my TException handler!
And
> >Exception does not have my Formatted method.
>
> No, but you could easily implement a function to do that using the
> traceback module.
>
> >Do I really have to catch them in a 2nd handler? Or can I add some
> >functionality somehow to Exception instead of implementing it in a
derived
> >TException?
>
> Yes, you'll need to catch other exceptions explicitly.
>
> WARNING: it's generally considered a Bad Idea to catch exceptions
> willy-nilly.  For example, do you really want to trap the keyboard
> interrupt?
> --
>                       --- Aahz (Copyright 2000 by aahz at pobox.com)
>
> Androgynous poly kinky vanilla queer het    <*>
http://www.rahul.net/aahz/
> Hugs and backrubs -- I break Rule 6
>
> '"Crisp" is a good quality for crackers; less so for pot roast.'  --pnh











More information about the Python-list mailing list