Feature or enhancement
Proposal:
Here is re.compile:
>>> import re, inspect
>>> print(inspect.getsource(re.compile))
def compile(pattern, flags=0):
"Compile a regular expression pattern, returning a Pattern object."
return _compile(pattern, flags)
It just calls re._compile with the same arguments.
When it was introduced it looked like there was some benefit to having an "implementation hook" to swap in impl from sre_compile.py.
I think the benefit doesn't really exist anymore - it seems like there should be a slight performance improvement, and simpler tracebacks, to just move the body of _compile directly into compile.
Linked PRs
Feature or enhancement
Proposal:
Here is
re.compile:It just calls
re._compilewith the same arguments.When it was introduced it looked like there was some benefit to having an "implementation hook" to swap in impl from
sre_compile.py.I think the benefit doesn't really exist anymore - it seems like there should be a slight performance improvement, and simpler tracebacks, to just move the body of
_compiledirectly intocompile.Linked PRs