Paul Ganssle <p.gans...@gmail.com> added the comment:

So I created a little patch for this, and when I was working on it I realized 
that it's actually possible to implement full `fold` support in a generic way 
in `fromutc` under the assumption that `utcoffset - dst` holds at all points 
(which is the fundamental assumption of the builtin `fromutc` function).

It adds a bit of overhead, but I think any current fold-aware operations need 
to be implemented in pure Python anyway (and involve even more overhead), so I 
think it would be a net gain.

The big downside I see here is that it cannot take advantage of any sort of 
"is_ambiguous" function and has to rely on the method of "change the fold and 
see if the answer is different" to determine ambiguity. I think this is a small 
cost to pay for a generic implementation, though. I'm pretty busy this week and 
next week will be hectic too, but towards the end of the month I can probably 
come up with a test suite for this and look at some actual performance numbers.

----------

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

Reply via email to