New-style exceptions?

Michael Hudson mwh at python.net
Sun Mar 31 15:44:54 EST 2002


mlh at vier.idi.ntnu.no (Magnus Lie Hetland) writes:

> 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)

This has been argued about on python-dev very recently.

I didn't read the thread, though, so you'll have to wait for someone
else to summarise or hit the archives...

Cheers,
M.



More information about the Python-list mailing list