Hi all, I'm pretty new to Python (a little over a month). I was wondering -- is something like this:
s = re.compile('whatever') def t(whatnot): return s.search(whatnot) for i in xrange(1000): print t(something[i]) significantly faster than something like this: def t(whatnot): s = re.compile('whatever') return s.search(whatnot) for i in xrange(1000): result = t(something[i]) ? Or is Python clever enough to see that the value of s will be the same on every call, and thus only compile it once? -- 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 -- pass it on -- http://mail.python.org/mailman/listinfo/python-list