[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Lib
getopt.py,1.7,1.8
Jack Jansen
jack@oratrix.nl
Thu, 23 Dec 1999 11:24:26 +0100
> Vladimir.Marangozov@inrialpes.fr:
>
> > Yes. Besides, I still think that string-based exceptions are just
> > convenient for quick & dirty, throw-away test scripts.
>
> They have a hard-to-understand quirk though: the id() of the string is
> used to check rather than its value, so that except "foo" doesn't
> necessarily catch raise "foo"; but due to various optimization, this
> usually works, and people get bent out of shape when it doesn't.
I sort-of use this feature when I'm debugging: if I want to know what happens
in an exception that is usually caught somewhere higher up in the call stack I
simply put quotes around the exception name and the exception will happen
uncaught. The same trick works for except: clauses.
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm