[issue31671] IntFlag makes re.compile slower
STINNER Victor
report at bugs.python.org
Tue Oct 3 08:27:35 EDT 2017
STINNER Victor <victor.stinner at gmail.com> added the comment:
Oh, Python already accepts floating point numbers:
haypo at selma$ ./python
Python 3.7.0a1+ (heads/master-dirty:efb560eee2, Oct 3 2017, 12:15:58)
[GCC 7.2.1 20170915 (Red Hat 7.2.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.compile("[a-z]", flags=re.I).match("A")
<_sre.SRE_Match object; span=(0, 1), match='A'>
>>> re.I
<RegexFlag.IGNORECASE: 2>
>>> re.compile("[a-z]", flags=2).match("A")
<_sre.SRE_Match object; span=(0, 1), match='A'>
# and now a float
>>> re.compile("[a-z]", flags=2.0).match("A")
<_sre.SRE_Match object; span=(0, 1), match='A'>
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31671>
_______________________________________
More information about the Python-bugs-list
mailing list