Refactor - remove re._compile?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
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
- gh-122357
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Lib/re/init.py, examining re.compile and re._compile and the linked work in gh-122357. Determine whether the implementation hook can be removed without changing behavior; done means the redundant indirection is gone and the regular-expression module remains functional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100