[Python-ideas] Please reconsider the Boolean evaluation of midnight
Alexander Belopolsky
alexander.belopolsky at gmail.com
Thu Mar 6 00:22:54 CET 2014
On Wed, Mar 5, 2014 at 6:10 PM, Donald Stufft <donald at stufft.io> wrote:
> And yet 0 is False not because it starts the positive real numbers (not
> sure
> what that has to do with a value in an integer type) but because it
> signifies
> an empty or zero magnitude object.
>
No. It is False because it equals False:
>>> 0 == False
True
Numbers are not containers. You cannot tell whether a number is empty or
not. Python interpretation of numbers in boolean context is different from
that of containers.
I think the disagreement stems from different view on what time-of-day is.
For me, it is the fraction of the day that passed or distance from
midnight and in any case fundamentally some kind of number expressed in a
Babylonian base-60 notation.
I think proponents of bool(time(0)) == True view it as a container of
hours, minutes and seconds.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140305/97f4cb74/attachment.html>
More information about the Python-ideas
mailing list