[issue36967] Eliminate unnecessary check in _strptime when determining AM/PM

Gordon P. Hemsley report at bugs.python.org
Sun May 19 17:24:06 EDT 2019


New submission from Gordon P. Hemsley <gphemsley at gphemsley.org>:

Since __calc_am_pm() explicitly limits self.am_pm to 2 values, there are only ever 3 possible values of %p: AM, PM, or blank. Since blank is treated the same as AM, there is only the need to check whether %p is PM. This eliminates an unnecessary comparison and doubly ensures that there is no unhandled case.

----------
messages: 342872
nosy: gphemsley, p-ganssle
priority: normal
severity: normal
status: open
title: Eliminate unnecessary check in _strptime when determining AM/PM
versions: Python 3.8

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


More information about the Python-bugs-list mailing list