Instance Exception Oddity: Implicit and Explicit not the same?

Aahz aahz at pythoncraft.com
Sun Dec 7 21:03:55 CET 2003


In article <oprztjkwvjuwzglb at newgroups.bellsouth.net>,
RT Lange  <whiteywidow at yahoo.com> wrote:
>>>> 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

<scratch head>  Why are you passing an exception instance to the
constructor for a different exception?
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.




More information about the Python-list mailing list