[issue13592] repr(regex) doesn't include actual regex
Ezio Melotti
report at bugs.python.org
Thu Dec 15 15:31:39 CET 2011
Ezio Melotti <ezio.melotti at gmail.com> added the comment:
If an eval-able re.Regex is used, the flags can be showed as second arg, like:
re.Regex('a', re.I|re.S)
instead of being added to the pattern as in
re.Regex('(?is)a')
The repr can be generated with something like
're.Regex({r.pattern!r}, {r.flags})'.format(r=r)
that currently prints
re.Regex('abc', 50)
but if #11957 is fixed, the result will look like
re.Regex('abc', re.I|re.S)
for a regex created with
r = re.compile('abc', re.I|re.S)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13592>
_______________________________________
More information about the Python-bugs-list
mailing list