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

Bruce Leban bruce at leapyear.org
Thu Mar 6 08:02:34 CET 2014


On Wed, Mar 5, 2014 at 10:47 PM, Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:

> it is convenient to have a simple test for midnight.
>

Except this isn't it. That's only works for naive times. For aware times:

00:00:00+00:00 = midnight England = midnight UTC => False
00:00:00+01:00 = midnight France = 2300 UTC      => True
01:00:00+01:00 = 1 am France = midnight UTC      => False
19:00:00-05:00 = 1 am Boston = midnight UTC      => True

Code that relies that bool(time) is False for midnight is broken IMHO.

--- Bruce
Learn how hackers think: http://j.mp/gruyere-security
https://www.linkedin.com/in/bruceleban
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140305/9f6da53f/attachment.html>


More information about the Python-ideas mailing list