On Mar 16, 9:53 am, Chris Rebert <c...@rebertia.com> wrote: > On Tue, Mar 16, 2010 at 1:37 AM, samb <sam.ban...@gmail.com> wrote: > > Thanks for all those suggestions. > > They are good! > <snip> > > 2) Concerning the suggestion : > > m = re.match(r'define\s+(\S+)\s*{$', line) > > if m: > > thing = m.group(1) > > > m = re.match(r'include\s+(\S+)$', line) > > if m: > > thing = m.group(1) > > > #etc... > > Note how I split it out into a separate function and used `return > m.group(1)` to avoid that exact situation.
Yes, you're right. It's an interresting approach. I'll give it a try. Cheers -- http://mail.python.org/mailman/listinfo/python-list