psss...I want to move from Perl to Python

Terry Reedy tjreedy at udel.edu
Sun Jan 31 07:28:58 EST 2016


On 1/30/2016 10:22 PM, Rustom Mody wrote:
> On Sunday, January 31, 2016 at 7:27:06 AM UTC+5:30, Steven D'Aprano wrote:
>> On Sunday 31 January 2016 09:18, Gregory Ewing wrote:

>> Correct. The re module keeps a cache of the last N regexes used, for some
>> value of N (possibly 10?) so for casual use there's no real point to pre-
>> compiling other than fussiness.
>>
>> But if you have an application that makes heavy-duty use of regexes, e.g.
>> some sort of parser with dozens of distinct regexes, you might not want to
>> rely on the cache.

>>>> import re
>>>> re._MAXCACHE
> 512
>>>>
>
> Have you ever seen a program that uses 512 re's?
> I havent :-)

I do not know if the cache was always there.  It used to be smaller, 
maybe 100, then 200.

-- 
Terry Jan Reedy




More information about the Python-list mailing list