alex23 <wuwe...@gmail.com> wrote: > The docs say: > The compiled versions of the most recent patterns passed to re.match > (), re.search() or re.compile() are cached, so programs that use only > a few regular expressions at a time neednt worry about compiling > regular expressions. > > (But they don't say how few is 'only a few'...)
If you're interested then it isn't all that hard to open up re.py in an editor and see that the cache holds up to 100 items. Of course that's just an implementation detail so other versions might have a different size cache. Also implementation dependant, but it might be worth knowing that when you hit that limit the cache is simply cleared: there's no gradual clearing of the oldest or least used entries. -- http://mail.python.org/mailman/listinfo/python-list