<div class="gmail_quote">On Thu, Feb 26, 2009 at 7:28 PM, Bruce Frederiksen <span dir="ltr"><<a href="mailto:dangyogi@gmail.com">dangyogi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
How about this?</blockquote><div><br>I tried it, but it matches quite a few comments and strings.  Try putting a "print repr(match.group(0))" in the innermost loop to debug it.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On my last response, I mentioned a suggestion to add __throw__ to context managers.  But then I remembered that the __exit__ method is already given the exception information if an exception is raised.  So you can already do what I was suggesting now.<br>

<br>
I'm still curious as to how often you could share try/except cases by writing your own context managers.<br><font color="#888888">
</font></blockquote></div><br>Not particularly often.  Much of the time, the exception handler has to clean up the mess when a file is unexpectedly unreadable or SQL explodes, and the clean-up bit is tied to the immediately surrounding code. YMMV.<br>
<blockquote style="margin: 1.5em 0pt;">--<br>
Daniel Stutzbach, Ph.D.<br>
President, <a href="http://stutzbachenterprises.com">Stutzbach Enterprises, LLC</a>
</blockquote>