Dominic Davis-Foster <dom131...@googlemail.com> added the comment:

Could the sre_parse and sre_constants modules be kept with public names (i.e. 
without the leading underscore) but within the re namespace? I use them to 
tokenize and then syntax highlight regular expressions.

I did a quick search and found a few other users of the modules:

* pydoctor uses them for regex syntax highlighting[1], although it has its own 
copy of the sre_parse source rather than importing from stdlib.
* lark uses sre_parse to find minimum and maximum length of matching strings[2]
* sre_yield uses them to determine all strings that will match a regex[3]

The whole modules don't necessarily need exposing, but certainly 
sre_parse.parse, sre_parse.parse_template, and the opcodes from sre_constants 
would be the most useful.


[1] 
https://github.com/twisted/pydoctor/blob/c86273dffade5455890570142c8b7b068f5dffd1/pydoctor/epydoc/markup/_pyval_repr.py#L776
[2] 
https://github.com/lark-parser/lark/blob/85ea92ebf4e983e9997f9953a9c1463bb3d1c6cc/lark/utils.py#L120
[3] 
https://github.com/google/sre_yield/blob/3af063a0054c4646608b43b941fbfcbe4e01214a/sre_yield/__init__.py

----------
nosy: +dom1310df

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue47152>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to