12 Jun
2003
12 Jun
'03
3:04 p.m.
Hello Guido,
I'm just wondering: as we are heading towards Exception being a new-style class (no old-style classes being supported currently) I can see a very theoretical problem which must already have been discussed in python-dev (has it?):
raise x
should be "raise x()" if issubclass(x, Exception) and "raise x" if isinstance(x, Exception). What if:
class exception(object): pass ... class f(type, exception): pass ... x = f('x', (exception,), {}) isinstance(x, exception) 1 issubclass(x, exception) 1
Ok that's kind of a joke :-)
Armin
I suggest only calling it if it's not already an instance of Exception. --Guido van Rossum (home page: http://www.python.org/~guido/)