On Jun 26, 5:42 pm, [EMAIL PROTECTED] wrote: > 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... > > Bye, > bearophile
Thank you to everyone that replied in the thread and privately, been looking into the different techniques. Presently found the RE to be readable once I put it into VERBOSE format. I had looked it at earlier but struck a dead wall, till Cédric gave such clear code! I've been doing Java code the last few weeks and it is hard to jump between them sometimes, Java has to be so organised and checked over and over, I forget Python doesn't need such defensive programming. I currently have it finding functions, constructors and classes, and looking for them within the code, which is exactly what I was hoping for! It also reads a lot clearer, which was what I was aiming for. So thanks to everyone that helped! -- http://mail.python.org/mailman/listinfo/python-list