gh-57095: Add note about input splitting in datetime.*.strptime#131049
gh-57095: Add note about input splitting in datetime.*.strptime#131049StanFromIreland wants to merge 7 commits intopython:mainfrom
datetime.*.strptime#131049Conversation
|
I don't think the behaviour is guaranteed. Can you find it some standard? IMO, it would be better to expand the note about what varies across platforms -- “The full set of format codes”, “handling of unsupported format specifiers”... and also handling of ambiguous/wrong inputs. (Even if all platforms currently agree, I don't think we should commit to their behaviour. As musl shows, there can always appear a new platform that considers it fair game to reinterpret whatever's not specified in C or POSIX.) |
He can choose to do that if he wants, I think the only thing it is hurting is his inbox 😅 WRT the change, I needed a close look to understand what this meant, which makes me think that this is not a very clear statement. It seems like what you are trying to say is something about how ambiguous format specs are parsed, correct? For example, if a code can match one digit or two, and matching two digits will fail to parse but matching one digit will succeed, it chooses one? What if you use
I agree in principle. I think if we document this behavior, we should add tests and then maybe add language like, "The behavior when parsing ambiguous strings is platform dependent. On all currently supported platforms, ". We can add a comment to the test to change the documentation if the test starts failing on a supported platform because of their implementation of strptime. (Assuming that this is not already clearly specified in the POSIX standard). |
|
Maybe the wording from the GNU docs would be better?
|
|
I don't think GNU docs have a compatible license, so we should use different wording. |
📚 Documentation preview 📚: https://cpython-previews--131049.org.readthedocs.build/