[Python-ideas] Please reconsider the Boolean evaluation of midnight

Donald Stufft donald at stufft.io
Thu Mar 6 18:10:23 CET 2014


On Mar 6, 2014, at 12:01 PM, Tim Peters <tim.peters at gmail.com> wrote:

> [TIm]
>>> ...
>>> Do you claim you still don't understand when bool(time) returns True
>>> and False?  Those are user docs.  I don't claim that reading them will
>>> make anyone feel good ;-), but I do believe the computation is
>>> described clearly enough to enable a reasonable user to predict the
>>> result in all cases.
> 
> [Donald Stufft <donald at stufft.io>]
>> I don't think a reasonable user would predict that midnight UTC in a timezone
>> with a UTC offset of +5 would be false, while midnight UTC in a timezone with
>> a UTC offset of -5 would not be false.
> 
> As I said, I didn't claim a reasonable user would feel good about it,
> and all you're saying here is that they wouldn't feel good about it.
> I'm not arguing that they should feel good about it.
> 
> I said that the docs explained the computation clearly enough that a
> reasonable user - who read the docs and earnestly tried to apply them
> - _could_ predict the results.  And you just showed that you, for
> example, can predict them.  Since you're the very definition of
> "reasonable", I close my case for that ;-)

Actually I wasn’t able to predict it :) Someone else posted a number
of times offsets and their boolean values. I was really confused
when it turned out that 01:00:00+01:00 (1AM France/Midnight UTC)
was False but 19:00:00-05:00 (7PM Boston/Midnight UTC) wasn’t. I
only realized that the cause was the specific formula that was
used when I reversed it and tried to figure out what time in Boston
would be False and realized it was -05:00.

I don’t think it’s reasonable by any definition of the word that in order
to predict the results a user would have to turn it into an algebraic
formula and solve for X to determine that the only way for Boston
to have a False time is if time was negative.


-----------------
Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140306/ab100030/attachment.sig>


More information about the Python-ideas mailing list