Mathieu Dupuy added the comment:

crap, here is the attachment.
Yeah, but I really would like to use regex in the C version (unless you 
strongly disadvise), so we will have the same logic and the same problem. And I 
never made a patch for the C interpreter itself, so the C equivalent is not 
close to be here soon. (btw if you have a starting point to recommend)

I definitely do not like this fix, it destroys the elegance and the simplicity 
of the "single-dispatch" solution. And it introduce a lot of noisy code for a 
very rare case, people subclassing datetime.* classes.

Maybe making the regex dictionary having string keys instead of class and 
passing the correct string from the calling function, like:

    def fromisoformat(string):
        _parse_isodatetime('time', string)

or maybe functools.singledispatch handle this case ?

----------
Added file: http://bugs.python.org/file41951/fromisoformat_singledispatch.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15873>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to