OK to memoize re objects?

Ethan Furman ethan at stoneleaf.us
Mon Sep 21 21:20:59 CEST 2009


Nobody wrote:
> On Mon, 21 Sep 2009 07:11:36 -0700, Ethan Furman wrote:
> 
> 
>>Looking in the code for re in 2.5:
> 
> 
>>_MAXCACHE = 100
> 
> 
>>On the other hand, I (a
>>re novice, to be sure) have only used between two to five in any one
>>program... it'll be a while before I hit _MAXCACHE!
> 
> 
> Do you know how many REs import-ed modules are using? The cache isn't
> reserved for __main__.
> 

As a matter of fact, I haven't got a clue.  :-)

Fortunately, I always use .compile to save my re's.  Seems simpler to me 
that way.

~Ethan~



More information about the Python-list mailing list