GeezerVison is showing github.com — bpo-47152: Convert the re module into a package by serhiy-storchaka · Pull Request #32177 · python/cpython
Conversation
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to drop "sre_" prefix of module moved into the re package? re.sre_xxx now sounds redundant to me.
Overall, I like the approach!
Would it make sense to put an underscore prefix to "internal" sub-modules like re.sre_compile? For example, rename it to re._compile. asyncio, email and multiprocessing packages don't attempt to hide sub-modules. I don't know what's the best approach here.
The pip project now puts its whole code into a private pip._interal package: https://github.com/pypa/pip/tree/main/src/pip People used to abuse internals which was too easy to access. Now the "pip" package is a front-end only exposing the public API. In the pyperf project, all sub-modules are prefixed by an underscore: https://github.com/psf/pyperf/tree/main/pyperf In my experience, it was a good idea it since the internal API changed many times and I wanted to make sure that people don't use the internal API but only the public and tested API.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The gevent has C extensions (sub-modules) in its gevent package namespace. It might be possible to move the _sre extension as re._sre (or a different name), but the Python build system is not really designed for that. And currently, Linux distributions separate .py files and .so files in two separated directories. I suggest to not change that. It's ok to keep _sre as it is. I don't think that moving it is worth the troubles it would create.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
It was my initial approach. Look at changes excluding 3da0b4c.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
It was my initial approach. Look at changes excluding 3da0b4c.
If a project currently uses sre_constants, it can use from re import _constants as sre_constants, no? What is the benefits of using keeping the old names?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|