On Jul 18, 6:52 pm, Gordon Airporte <[EMAIL PROTECTED]> wrote: > ... > I've also been assuming that using the re functions that create match > objects is slower/heavier than dealing with the simple list returned by > findall(). I've profiled it and these matches are the biggest part of > the running time of the program, so I really would rather not use > anything slower.
My guess would be that searching for more matches after finding the first would be more expensive than creating a match object. But that would probably depend on the nature of your data and REs, so you need to test it both ways if you are concerned about performance. It would be nice if findall() had an optional parameter to limit the number of matches, similar to the maxsplit parameter of string.split(). -- http://mail.python.org/mailman/listinfo/python-list