[Python-ideas] Please reconsider the Boolean evaluation of midnight
Paul Moore
p.f.moore at gmail.com
Wed Mar 5 11:23:31 CET 2014
On 5 March 2014 10:16, Shai Berger <shai at platonix.com> wrote:
> http://bugs.python.org/issue13936 is a complaint about the fact that midnight
> -- datetime.time(0,0,0) -- is evaluated as False in Boolean contexts. It was
> closed as invalid, under the claim that """It is odd, but really no odder than
> "zero values" of other types evaluating to false in Boolean contexts""".
>
> I would like to ask for this to be reconsidered; since the ticket was closed,
> two main arguments were given for this:
Why on earth would anyone check the boolean value of a time???
Before looking at whether midnight should be false or true, I'd like
to be clear on why any real life code would care one way or the other.
It seems to me that the correct answer would be to change the code to
simply not rely on the boolean value of a time.
Paul
More information about the Python-ideas
mailing list