[Python-Dev] Make re.compile faster

Victor Stinner victor.stinner at gmail.com
Tue Oct 3 05:18:59 EDT 2017

> * RegexFlag.__and__ and __new__ is called very often.

Yeah, when the re module was modified to use enums for flags,
re.compile() became slower:


It would be nice if internally we could use integers again to reduce
this overhead, without loosing the nice representation:

>>> re.I
<RegexFlag.IGNORECASE: 2>


More information about the Python-Dev mailing list