[issue31580] Defer compiling regular expressions

Raymond Hettinger report at bugs.python.org
Mon Sep 25 22:39:48 EDT 2017


Raymond Hettinger added the comment:

ISTM, the whole point is to compile in advance.  When I worked during high frequency trading, that was essential to news trading where you *really* didn't want to pay the compilation cost at the time the regex was used.  This proposal takes away the user's only control over when the regex is compiled. 

FWIW, if a user doesn't explicitly invoke re.compile() and instead uses a straight call to re.search(pattern, s), then the pattern is compiled on first-use and cached for future use.  In other words, we already have a simple and clear way to auto-compile on first use.  I recommend against taking away the only option to specify otherwise.

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31580>
_______________________________________


More information about the Python-bugs-list mailing list