Brett Cannon added the comment:

strptime very much follows the POSIX standard as I implemented strptime by 
reading that doc.

If you want to see how the behaviour is implemented you can look at 
https://hg.python.org/cpython/file/ac0334665459/Lib/_strptime.py#l178 . But the 
key thing here is that the OP has unused formatters. Since strptime uses 
regexes underneath the hood, the re module does its best to match the entire 
format. Since POSIX says that e.g. the leading 0 for %m is optional, the regex 
goes with the single digit version to let the %H format match _something_ (same 
goes for %d and %M). So without rewriting strptime to not use regexes to 
support unused formatters and to stop being so POSIX-compliant, I don't see how 
to change the behaviour. Plus it would be backwards-incompatible as this is how 
strptime has worked in 2002.

It's Alexander's call, but I vote to close this as "not a bug".

----------
nosy: +brett.cannon

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22840>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to