[Datetime-SIG] Another round on error-checking

Tim Peters tim.peters at gmail.com
Thu Sep 3 19:18:09 CEST 2015

>> There is an alternative solution available that avoids this problem, and
>> all other inconsistencies.

> Really?

Carl means ignoring `fold` everywhere, all the time, unless a
datetime's tzinfo is of a new "strict" flavor that implements PEP 495
_and_ forces the datetime to use timeline arithmetic all the time.

> ...
> I have not seen any "alternative solution" implemented anywhere.

In a sense, pytz kinda does this already (but not all by magic).

> If you have not tried it yourself - trust me - keeping 4000+ lines of unit tests
> intact while adding features to the datetime module is not an easy task.

They would continue to pass, _until_ you used one of the new "strict"
tzinfos.  Then they'd barf all over the place.  Indeed, it would
fatally confuse Python's _implementation_ of datetime (which, as you
know, currently exploits that arithmetic on aware datetimes is classic
- which could be changed, but won't change itself by magic).

So, assuming many changes to Python itself, this is "backward
compatible" even to the extent of leaving conversions broken forever
for code that wants to use classic arithmetic.

More information about the Datetime-SIG mailing list