
On Wed, 22 Dec 1999, Guido van Rossum wrote:
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. Since you have to give your exception a name, how hard is it to say
class MyError(Exception): pass
rathern than
MyError = "MyError"
?
It is very hard. My fingers do the typing for me, and they fill in strings. I'm trying to teach them otherwise, but they insist. You're also assuming that MyError gets defined. Sometimes, my little fingers like typing: try: foo except: raise "foo broke for some reason" Quick and dirty, indeed! :-) Happy Holidays, -g -- Greg Stein, http://www.lyra.org/