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

2018-02-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I don't know such reason. I would not combine f-strings and regular expressions. Curly braces are syntactically meaningful in regular expressions, and regular expression which uses them for substituting look strange. -- ___

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

2018-02-11 Thread Terry J. Reedy
Terry J. Reedy added the comment: For me, on Windows, the tests for time, datetime, and _strptime have failures on the master branch, so I don't want to submit a PR just now. -- ___ Python tracker __

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

2018-02-11 Thread Terry J. Reedy
Terry J. Reedy 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

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

2018-02-10 Thread Terry J. Reedy
Terry J. Reedy added the comment: And the conditional return can be done before sorting. -- ___ Python tracker ___ ___ Python-bugs-l

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

2018-02-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Just if not any(to_convert): return '' -- nosy: +serhiy.storchaka ___ Python tracker ___ __

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

2018-02-09 Thread Terry J. Reedy
Terry J. Reedy added the comment: This looks straightforward. I believe we normally do not backport this type of change. The tests for _strptime.py are in test_strptime.py, not test__strptime.py. -- nosy: +terry.reedy stage: -> patch review type: -> performance __

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

2018-02-08 Thread Дилян Палаузов
New submission from Дилян Палаузов : 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: -