Instance Exception Oddity: Implicit and Explicit not the same?

RT Lange whiteywidow at yahoo.com
Sun Dec 7 11:18:22 EST 2003


>>> class E1(Exception): pass

>>> class E2(E1): pass

>>> i = E2('foo')
>>> raise E1(i)
Traceback (most recent call last):
   File "<pyshell#5>", line 1, in ?
     raise E1(i)
E1: foo
>>> raise E1, i
Traceback (most recent call last):
   File "<pyshell#6>", line 1, in ?
     raise E1, i
E2: foo
>>>

Is there a reason the exception type is not the same?
Is this behavior something that should be expected?


-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/




More information about the Python-list mailing list