rh wrote: > I am using 2.7.3 and I put the re.compile outside the function and it > performed faster than urlparse. I don't print out the data.
I find that hard to believe. re.compile caches its results, so except for the very first time it is called, it is very fast -- basically a function call and a dict lookup. I find it implausible that a micro-optimization such as you describe could be responsible for speeding the code up by over 33%. But since you don't demonstrate any actual working code, you could be correct, or you could be timing it wrong. Without seeing your timing code, my guess is that you are doing it wrong. Timing code is tricky, which is why I always show my work. If I get it wrong, someone will hopefully tell me. Otherwise, I might as well be making up the numbers. -- Steven -- http://mail.python.org/mailman/listinfo/python-list