Re: [Datetime-SIG] strategy for the C part of ISO 8601 datetime parsing

As I mentioned at the bug tracker, I would prefer to start with the C implementation falling back to Python. This is what we do for strptime and I don't see why fromisoformat should be different. Let's focus of finalizing the desired behavior and getting the Python implementation checked in. We don't want to maintain two implementations while the features are still subject to revision. Once Python code is mature enough, we can implement the C acceleration.
On Wed, May 31, 2017 at 3:27 PM, Mathieu Dupuy deronnax@gmail.com wrote:
Hi datetime mates
I would like to resume soon the C implementation of datetime iso format parsing in CPython I started days ago (http://bugs.python.org/issue15873). Currently I have 2 solutions and would like to know which one do you prefer:
- iterating on the string the string, stopping when something is wrong
(might process almost all of the string and finally give up because last part is wrong, EG incorrect microseconds or time zone. Penalize invalid strings, best case when most of the strings to process are valid)
- first checking the string is correct, then iterating over it and
handling each part. Early detection of incorrect strings, useless overhead for valid string. Penalize valid strings, best case when most of the strings to process are invalid).
I have a preference for solution #1. I first thought of using sscanf but it's impossible for many reasons, the first of them is scanf is unsuitable for variable numbers of match (you can't express optional match in scanf format).
Waiting for your input. _______________________________________________ Datetime-SIG mailing list Datetime-SIG@python.org https://mail.python.org/mailman/listinfo/datetime-sig The PSF Code of Conduct applies to this mailing list: https://www.python.org/psf/codeofconduct/
participants (1)
-
Alexander Belopolsky