Compiling Regular Expressions in Python
I'm working through Doug Hellman's "The Python Standard Library by Example" and came across this: "1.3.2 Compiling Expressions re includes module-level functions for working with regular expressions as text strings, but it is more efficient to compile the expressions a program uses frequently." I couldn't follow his explanation for why this is the case. He says that the "module-level functions maintain a cache of compiled expressions" and that since the "size of the cache" is limited, "using compiled expressions directly avoids the cache lookup overhead." I'd greatly appreciate it if someone