[Datetime-SIG] Another round on error-checking

Carl Meyer carl at oddbird.net
Thu Sep 3 05:24:25 CEST 2015


[Tim]
>>> I'm still to keen to push timeline arithmetic off to a later PEP.  It
>>> doesn't have to be addressed to solve 495's problems.
[Carl]
>> I think you've convincingly demonstrated in this thread that
>> conversions, equality, comparisons, and arithmetic _are_ all
>> fundamentally linked. If you try to cut them apart and handle some with
>> a timeline model and some with a naive model, you'll have to violate a
>> reasonably-expected invariant _somewhere_.
[Tim]
> Python already did, using timeline arithmetic for cross-zone
> subtraction and comparisons, and (necessarily so) for timezone
> conversions, but classic arithmetic for all other intrazone
> computations.

I know :(

> Mucking with that old model really does belong in a
> different PEP.  We're having quite enough pain already just figuring
> out what can go wrong with a single new bit ;-)

But the point is that changing that model (in a backwards-compatible
way, by means of a tzinfo flag) to draw a clear line between
timeline-mode and naive-mode, _eliminates_ almost all of that pain. All
these puzzles about arithmetic, ordering, equality, and hashing go away
entirely (that is, they have obvious and unsurprising answers).

So doing these two things together doesn't add to the net pain; it
reduces it considerably.

Carl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150902/641e01fa/attachment-0001.sig>


More information about the Datetime-SIG mailing list