[issue32801] Lib/_strptime.py: utilize all()

Terry J. Reedy report at bugs.python.org
Sun Feb 11 18:09:45 EST 2018


Terry J. Reedy <tjreedy at udel.edu> added the comment:

Serhiy, Is there any reason to not combine last two lines in one?

-        regex = '(?P<%s>%s' % (directive, regex)
-        return '%s)' % regex
+        return '(?P<%s>%s)' % (directive, regex)

or to use f-string to then get

+        return f'(?P<{directive}>{regex})'

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32801>
_______________________________________


More information about the Python-bugs-list mailing list