Please reconsider the Boolean evaluation of midnight
mail.python.org
Please reconsider the Boolean evaluation of midnight
1–10 of 218 posts
Re: Please reconsider the Boolean evaluation of midnight
#2Re: Please reconsider the Boolean evaluation of midnight
#3Re: Please reconsider the Boolean evaluation of midnight
#4Re: Please reconsider the Boolean evaluation of midnight
#5Off the top of my head I can't think of a reason to check if a date exists, but I would certainly expect midnight to be truthy if I found a reason.
Re: Please reconsider the Boolean evaluation of midnight
#6Off the top of my head I can't think of a reason to check if a date exists, but I would certainly expect midnight to be truthy if I found a reason.
Re: Please reconsider the Boolean evaluation of midnight
#7"in Boolean contexts, a time object is considered to be true if and only if, after converting it to minutes and subtracting utcoffset() (or 0 if that’s None), the result is non-zero"
Changing at this point would possibly break code that relied on documented library behavior. That's not a responsible thing to do.
Re: Please reconsider the Boolean evaluation of midnight
#8Off the top of my head I can't think of a reason to check if a date exists, but I would certainly expect midnight to be truthy if I found a reason.
In Django you might have a nullable TimeField and check if it's set via "if obj.time_field".
Re: Please reconsider the Boolean evaluation of midnight
#9Re: Please reconsider the Boolean evaluation of midnight
#10This is pretty well-known, I thought.