Message 260449 - Python tracker (original) (raw)
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.