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

Donald Stufft donald at stufft.io
Thu Mar 6 08:43:18 CET 2014


On Mar 6, 2014, at 2:40 AM, Alexander Belopolsky <alexander.belopolsky at gmail.com> wrote:

> 
> On Thu, Mar 6, 2014 at 2:30 AM, Donald Stufft <donald at stufft.io> wrote:
> It’s not reasonable to expect that midnight will evaluate
> to false, ..
> 
> Only in the world where it is not reasonable to expect programmers to read library documentation.  In my world it is reasonable to expect that the behavior that was documented in 10 major versions and for 10 years can be relied on. 
> 
>  
> especially when it doesn’t if you happen to have a tzinfo on the time (sometimes!).
> 
> As long as tzinfo specifies a fixed offset, there is no problem with the current definition.  If you are unfortunate enough to live in a place with semi-annual DST adjustment, aware time objects are problematic for reasons that have nothing to do with the discussion at hand.
> 

Nope! It essentially in an aware time would be “false if whatever time is at the same time as UTC midnight, but only if your UTC offset is positive”. If your UTC offset is negative then you end up with 1440 instead of 0.

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140306/b0044cae/attachment-0001.html>
-------------- 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/b0044cae/attachment-0001.sig>


More information about the Python-ideas mailing list