[Datetime-SIG] Another round on error-checking
tim.peters at gmail.com
Fri Sep 4 02:03:02 CEST 2015
>>> And intentional or not, "classic" arithmetic may be easy to implement
>>> and fast, but it is hard to explain, surprising, and not very useful.
>> As to being hard to explain, you must be joking:
> sigh. Look at the length of this stinking thread!
I don't recall any confusions in this thread about what classic
arithmetic does. Do you?
> and how much confusion there was at the beginning about what
> the heck the current datetime implementation actually did.
Which covered a world of issues.
> Classic arithmetic may well be the best possible solution given
> the constraints,
It's impossible that this - or any other - PEP could succeed at
changing the default arithmetic.
> but it is not obvious, clear, lacking in surprises or well documented
> ( and no one reads docs until they run into a problem)
Maybe they should ;-) But, yup, the docs could be clearer.
> I know I only got it when someone explained the implementation:
> "remove the tzinfo object, do the math, tack the tzinfo back on"
> Simple elegant, and now I get it.
So, you start with "hard to explain", and end with "simple elegant,
and now I get it" after a one-sentence explanation - yet wonder why I
said "you must be joking"? I don't see how it could be all of those
simultaneously. It's easy to explain. It just took you a while to
find the simple explanation. Some people people get it instantly;
others don't. For the latter, that's a doc problem, not a "hard to
> And get why things go wonky with datetimes with two different tzinfo objects.
> By the way, something like that should be in the docs.
I agree. Patches welcome ;-)
> Anyway, clearly timeline math is an important use case for folks -- just as
> many (more?) than classic math. It would be nice to support it one way or
> Which can have nothing to do with this PEP -- so carry one.
In the meantime, use UTC - you'll be much happier with that in the end
(simpler, clearer, cleaner, faster, ...). That was the intent from
the start, and will likely always be the best way to get timeline
arithmetic (regardless of programming language too),
More information about the Datetime-SIG