Making code more efficient and effective

bearophileHUGS at bearophileHUGS at
Thu Jun 26 17:42:05 CEST 2008

Cédric Lucantis:
> PAT = re.compile('^[ ]*(public|protected|private)[ ]+([a-zA-Z0-9_]+)
> [ ]+([a-zA-Z0-9_]+)[ ]+\((.*)\).*$')
> ...
> It might be hard to read but will avoid a lot of obscure parsing code.

You can use the VERBOSE mode, to add comments and split that RE into
some lines.

I think the RE module of Python 3.0 can be modified in some way to
encourage people to write more readable REs, but I don't know how.
Maybe the VERBOSE can be on by default...


More information about the Python-list mailing list