New-style exceptions?

Magnus Lie Hetland mlh at vier.idi.ntnu.no
Sun Mar 31 15:18:00 EST 2002


Is there a reason why new-style objects can't be used in the raise
statement?

>>> class Error(object): pass
...
>>> raise Error
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: exceptions must be strings, classes, or instances, not type

This seems like an artificial restriction...

(Using 2.2)

--
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org



More information about the Python-list mailing list