WIP: bpo-1100942: Add datetime.time.strptime and datetime.date.strptime by matrixise · Pull Request #5578 · python/cpython
Here and below, you have nonzero instead of non-zero. If we keep this wording, the hyphen needs to be added.
However, this PR does not parse to a timetuple or something and check if certain components were zero, it checks to see if the format string contains time components, and fails in that case (Edit: I was looking at just the pure python implementation - I now realize that this is precisely what the C implementation is doing, but I think it's the wrong thing to do anyway). The way the docs are currently worded, you would expect this to work:
from datetime import date date.strptime("2018-01-01 00:00", "%Y-%m-%d %H:%M")
But it will fail (rightly so, I think).
I believe you can change the last part of the last sentence as such:
- parsed by `time.strptime`, or if it returns a value where the time part is - nonzero. + parsed by `time.strptime`, or if time components are present in the format string.
Also, I think it needs to be