alexander.belopolsky at gmail.com
Sun Aug 23 00:17:39 CEST 2015
On Sat, Aug 22, 2015 at 5:46 PM, Chris Barker <chris.barker at noaa.gov> wrote:
> > gaps
>> & folds don't exist in such zones, and classic arithmetic goes much
>> faster than timeline arithmetic).
> much faster? isn't it "just a "convert to UTC, do the math, convert back
> to the TZ?" and for the "simple" TZs, the convert is an addition or
> subtraction. Is it worth optimizing that out?
You under-appreciate how well-optimized datetime arithmetic is in CPython.
Adding/subtracting datetime objects is just 1.5-2x slower than
adding/subtracting integers. Compared to that, a single call to
.utcoffset() ("even if the function itself is implemented in C") is often
Note that there are many programs written already that use datetime
arithmetic extensively. We cannot possibly make them run 10x slower in the
next Python release.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Datetime-SIG