On Oct 1, 2017, at 22:34, Nathaniel Smith <njs at pobox.com> wrote: > > In principle re.compile() itself could be made lazy -- return a > regular exception object that just holds the string, and then compiles > and caches it the first time it's used. Might be tricky to do in a > backwards compatibility way if it moves detection of invalid regexes > from compile time to use time, but it could be an opt-in flag. I already tried that experiment. 1) there are tricky corner cases; 2) nobody liked the change in semantics when re.compile() was made lazy. https://bugs.python.org/issue31580 https://github.com/python/cpython/pull/3755 I think there are opportunities for an explicit API for lazy compilation of regular expressions, but I’m skeptical of the adoption curve making it worthwhile. But maybe I’m wrong! -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: Message signed with OpenPGP URL: <http://mail.python.org/pipermail/python-dev/attachments/20171002/43ded33d/attachment-0001.sig>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4