[Datetime-SIG] PEP-0500 (Alternative datetime arithmetic) Was: PEP 495 ... is ready ...

Ethan Furman ethan at stoneleaf.us
Thu Aug 20 01:08:52 CEST 2015


On 08/19/2015 03:30 PM, Alexander Belopolsky wrote:

> If we all understand that '2015-03-08T12:00:00-05:00',  '2015-03-08T13:00:00-04:00'
>  and '2015-03-09T04:00:00+11:00' are different spellings of the same time, where is
>  a bug in the following calculation?
>
> >>> print(lt)
> 2015-03-07 12:00:00-05:00
> >>> lt += timedelta(1)
> >>> print(lt)
> 2015-03-08 12:00:00-05:00

Well, let's say I live in New York, so all winter long I've been seeing things like "2015-01-17 9:37:51-05:00", etc. and then the time switches in March and I fail to notice that the "-05:00" is still 
"-05:00" and not "-04:00" -- especially since my watch, clock, smart phone, etc., don't display the offset -- well, something bad will happen: exactly what depends on what the user was expecting when 
adding a day.

--
~Ethan~


More information about the Datetime-SIG mailing list