[Python-ideas] "try with" syntactic sugar

Daniel Stutzbach daniel at stutzbachenterprises.com
Thu Feb 26 16:33:52 CET 2009


On Thu, Feb 26, 2009 at 8:36 AM, Daniel Stutzbach <
daniel at stutzbachenterprises.com> wrote:

> re_with = re.compile(r'(try:[ \t]*)?[\r\n]+[ \t]+with ')
>

Here's an updated regular expression that does a better job of ignoring
comments and strings:

re_with = re.compile(r'(try:[ \t]*)?[\r\n]+[ \t]+with .*:')

--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090226/0b3858f0/attachment.html>


More information about the Python-ideas mailing list