On Mar 13, 9:31 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Tue, 13 Mar 2007 17:19:53 -0300, Arnaud Delobelle  
> <[EMAIL PROTECTED]> escribió:
>
> > On Mar 13, 7:36 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote:
>
> >> The re library caches the compiled regexp, I think.
>
> > That would surprise me.
> > How can re.search know that string.lower(search) is the same each
> > time?  Or else there is something that I misunderstand.
>
> It does.
>
> py> import re
> py> x = re.compile("ijk")
> py> y = re.compile("ijk")
> py> x is y
> True
>
> Both, separate calls, returned identical results. You can show the cache:

OK I didn't realise this.  But even so each time there is the cost of
looking up the regexp string in the cache dictionary.

--
Arnaud

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to