Confusion about dictionaries - keys use value or identity?

Roy Smith roy at
Mon Jul 9 16:53:32 CEST 2001

Tim Peters < at> wrote:
> The good news is that this part isn't true:  all versions of Python have
> always maintained an internal compiled-regexp cache, mapping regexp strings
> to their compiled forms, much like the one you sketched building "by hand"
> later.  Current Python maintains a cache of 100 pairs.

Wow, that's awesome.  You might want to update the library reference
to mention this.  It would keep people like me from running off on
pointless efficiency-hack tangents :-)

> The great *advantage* to this is that you wouldn't be so reluctant to
> exploit re.VERBOSE mode if the regexps were compiled at module
> level.

I've never tried VERBOSE mode; I'll give it a shot, thanks.

> There's one huge difference:  FORMAT statements were identified by
> meaningless integers

Meaningless?  Whatcha talking about?  We used to encode all sorts of
meaning into the line numbers.  The 1100's would be one kind of input,
the 1200's would be another, and so on.  If you want meaningless line
numbers, did you ever try ratfor? :-)

More information about the Python-list mailing list