◐ Shell
clean mode source ↗

Message 185122 - Python tracker

> The docs don't even mention that re.compile() actually uses a cache.

Actually it does:
"""
re.compile(pattern, flags=0)

Note The compiled versions of the most recent patterns passed to re.match(), re.search() or re.compile() are cached, so programs that use only a few regular expressions at a time needn’t worry about compiling regular expressions.
"""

Now, I agree that it's definitely suboptimal...