R: [Python-Dev] Deprecating string exceptions (original) (raw)
Skip Montanaro skip@pobox.com
Thu, 28 Mar 2002 10:30:26 -0600
- Previous message: R: [Python-Dev] Deprecating string exceptions
- Next message: R: [Python-Dev] Deprecating string exceptions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido> You're looking at this all wrong. In the past, we've focused on
Guido> saying "unqualified except is wrong". But IMO "except Exception"
Guido> or "except StandardError" is just as wrong! You're still
Guido> catching way more exceptions than is good for you.
Point taken.
>> * I'm not saying you can't use "except:". I'm not advocating a
>> semantic change to the meaning of "except:". (I am suggesting that
>> KeyboardInterrupt should not inherit from StandardError.) I'm
>> saying that the recommended usage for application programmers
>> should be to avoid it.
Guido> Sorry. I told you I hadn't read the thread the first time around.
So, do we agree on this point?
Guido> We should fix the "except:" examples by catching a very specific
Guido> error, like AttributeError, TypeError or KeyError. *Not* by
Guido> catching Exception or StandardError.
Correct. That's what the long-standing bug #411881 is about. It just deals with the standard library however, and doesn't delve into the stuff in Tools, Demos, etc.
Skip
- Previous message: R: [Python-Dev] Deprecating string exceptions
- Next message: R: [Python-Dev] Deprecating string exceptions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]