[Python-Dev] Investigating time for `import requests`
barry at python.org
Mon Oct 2 11:15:35 EDT 2017
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.
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!
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 833 bytes
Desc: Message signed with OpenPGP
More information about the Python-Dev