[Python-ideas] Please reconsider the Boolean evaluation of midnight
Tim Peters
tim.peters at gmail.com
Thu Mar 6 06:53:19 CET 2014
[Bruce Leban <bruce at leapyear.org>]
> ...
> Just because you wrote the docs doesn't mean you know what they mean to
> other readers. The point of documentation is to explain it to someone who
> doesn't know what it does after all.
Of course. What's your point here?
>> ...
>> Before this thread, I had never heard anyone express it as "midnight
>> local time" before. Now that I have heard it, eh - I don't find it a
>> helpful way to view it.
> Well, it's not surprising that you don't find it's helpful. In fact, it's
> wrong, which to me indicates how confusing this.
Bruce, you're the one who made up the "midnight local time" business,
which has just confused you. Try again to read what the docs actually
say, without assuming it must mean something else?
> Which of the following are falsey?
It would help a lot if you explained which ones surprised _you_, and
how you read the docs in such a way that what they actually say caused
your confusion.
> 00:00:00+01:00
Convert the naive time to minutes: 0.
Get the UTC offset in minutes (these offsets are always returned
directly as minutes in the code, but there's an "extra" calculation
step needed here because you're starting from a string representation
that also uses units of hours): 1*60 + 0 = 60.
Subtract: 0-60 = -60
Is that zero?
No, so this one is true.
> 01:00:00+01:00
60 - 60 = 0. False.
> 01:00:00-01:00
60 - -60 = 120. True.
> 07:00:00+07:00
420 - 420 = 0. False.
> 23:00:00-01:00
23*60 - -60 = 24*60. True.
> I find it particularly surprising that the bug that the OP described finding
> would occur in the Russia and China, but not in the US. Obviously, not an
> accident. :-)
Indeed, it is the key to liberating both Ukraine and Tibet ;-)
More information about the Python-ideas
mailing list