Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation for compile flags #8

Open
redfave opened this issue Dec 28, 2024 · 0 comments
Open

Improve documentation for compile flags #8

redfave opened this issue Dec 28, 2024 · 0 comments

Comments

@redfave
Copy link

redfave commented Dec 28, 2024

Thank you so much for providing this library. It will help me to improve performance in an application.

It was tedious work for me to figure out, how to enable multiline mode.

import flpc
BASE_REGEX = r"foo-regex"
MULTILINE_MODE_ENABLED = 2  # stupid magic number, see source code: https://github.com/itsmeadarsh2008/flpc/blob/542fd3a313a5875e862b3210b88fa5bea59f1b66/src/lib.rs#L93
BASE_PATTERN = flpc.compile(BASE_REGEX, MULTILINE_MODE_ENABLED)

This is not beginners friendly as it requires having a look at the Rust source code and trying to understand it. You can't expect that from an average python user.
Therefore, it would be nice to document all the available flags at least in the examples.
For the long term development, it would be better to export the flags with speaking names, like the re module does (and also to allow passing multiple of them) to ensure compatibility.

from re import compile, MULTILINE
BASE_PATTERN = compile(r"foo-regex", MULTILINE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant