[Datetime-SIG] Calendar vs timespan calculations...

Ethan Furman ethan at stoneleaf.us
Thu Jul 30 23:19:36 CEST 2015


On 07/30/2015 01:28 PM, Carl Meyer wrote:

> [...] The _implementation_ can easily be explained [...]
> I'd summarize it as "all arithmetic temporarily pretends all
> datetimes are naive, and then blindly reattaches the original
> tzinfo member") [...]

This is the heart of the matter.  The problem is not the timedelta, which is simply a number of seconds, but with how datetime uses it.

And we cannot change existing behavior, but we can add to it -- so a new option for datetime that told it to take dst switches into account so that the new datetime was in fact timedelta seconds away 
should do the trick.

(Don't ask me which trick, I don't remember any more ;)

--
~Ethan~


More information about the Datetime-SIG mailing list