On Tue, Mar 16, 2010 at 1:37 AM, samb <[email protected]> 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... > > It means that I'll do all the checks, even if the first one did match > and I know that the next will not...
Note how I split it out into a separate function and used `return m.group(1)` to avoid that exact situation. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
