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

Alexander Belopolsky alexander.belopolsky at gmail.com
Fri Jul 31 18:26:17 CEST 2015


On Fri, Jul 31, 2015 at 12:02 PM, Guido van Rossum <guido at python.org> wrote:
> On Fri, Jul 31, 2015 at 5:15 AM, Chris Barker <chris.barker at noaa.gov> wrote:
>>
>> On Thu, Jul 30, 2015 at 6:09 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
>>>
>>> On 07/30/2015 06:04 PM, Tim Peters wrote:
>>>
>>>> I like Alexander's new tzstrict (subclass of tzinfo) idea best so far.
>
>
> I like it too.

Thanks for the kind words, Tim, Ethan and Guido!  I've also wondered
about a possibility to delegate arithmetics to the timezone class altogether.

For example, we could have a rule like this:

def __add__(self, delta):
    if hasattr(self.tzinfo, 'add'):
         return self.tzinfo.add(self, delta)

This, in theory, is powerful enough to support leap seconds if we represent
23:59:60.x as time(23, 59, 59, x, first=False).


More information about the Datetime-SIG mailing list