[issue15873] datetime: add ability to parse RFC 3339 dates and times

Martin Panter report at bugs.python.org
Thu Feb 18 06:26:13 EST 2016


Martin Panter added the comment:

Did you see my class attributes suggestion a couple messages back? That might solve your dispatch problem:

def _parse_isodatetime(cls, string):
    match = cls._iso_regex.match(...)

class time:
    _iso_regex = re.compile(...)

# or

time._iso_regex = re.compile(...)
date._iso_regex = ...

For the C module, start looking at /Modules/datetimemodule.c. Maybe if you can think of a similar function implemented in C to copy off. It looks like strptime() defers to a Python-only implementation; maybe that is another option.

----------
stage:  -> patch review

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15873>
_______________________________________


More information about the Python-bugs-list mailing list