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

Дилян Палаузов report at bugs.python.org
Thu Feb 8 11:09:49 EST 2018


New submission from Дилян Палаузов <dilyan.palauzov at aegee.org>:

diff --git a/Lib/_strptime.py b/Lib/_strptime.py
--- a/Lib/_strptime.py
+++ b/Lib/_strptime.py
@@ -238,10 +238,7 @@ class TimeRE(dict):
 
         """
         to_convert = sorted(to_convert, key=len, reverse=True)
-        for value in to_convert:
-            if value != '':
-                break
-        else:
+        if all(value == '' for value in to_convert):
             return ''
         regex = '|'.join(re_escape(stuff) for stuff in to_convert)
         regex = '(?P<%s>%s' % (directive, regex)

----------
components: Library (Lib)
messages: 311838
nosy: dilyan.palauzov
priority: normal
severity: normal
status: open
title: Lib/_strptime.py: utilize all()
versions: Python 3.8

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


More information about the Python-bugs-list mailing list