<br><br><div><span class="gmail_quote">On 3/13/07, <b class="gmail_sendername">Guido van Rossum</b> <<a href="mailto:firstname.lastname@example.org">email@example.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
><br>> Would this apply to Python code as well? I.e. if you use<br>> a raise statement with a class, it doesn't get instantiated<br>> immediately? And if you catch it with an except clause which<br>> doesn't capture the exception, it's never instantiated?
<br>> That would be a bonus.<br><br>I *think* that's how it works now, and I don't intend to break this.</blockquote><div><br>Eh, I don't see how it can, when you do 'raise ExceptionClass(args)' (like you want everyone to use :). It certainly doesn't, now; the arguments to 'raise' are just expressions, there is no specialcasing of calling anything. I don't believe it does so with the two-argument raise either -- at least, when experimenting, the body of an exception class's __init__ method is executed before the body of a 'finally' suite.
<br></div></div><br>-- <br>Thomas Wouters <<a href="mailto:firstname.lastname@example.org">email@example.com</a>><br><br>Hi! I'm a .signature virus! copy me into your .signature file to help me spread!