Exception Handling and Inheritance
Aahz Maruch
aahz at panix.com
Sat Dec 23 11:55:56 EST 2000
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