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

Donald Stufft donald at stufft.io
Wed Mar 5 23:38:12 CET 2014


On Mar 5, 2014, at 5:35 PM, M.-A. Lemburg <mal at egenix.com> wrote:

> On 05.03.2014 23:16, Ben Finney wrote:
>> "M.-A. Lemburg" <mal at egenix.com> writes:
>> 
>>> I don't know what all the fuzz is about. There are lots of types
>>> in Python that evaluate to False in certain corner cases, e.g.
>>> "", (), [], {}, 0, 0.0, 0j, None, etc.
>>> 
>>> datetime.time(0,0,0) is just another one :-)
>> 
>> The salient difference is:
>> 
>> With the former set, they all embody concepts of either “empty” or “zero
>> magnitude”. They strongly connote “not there” within their domain of
>> values, hence map well to Boolean false.
>> 
>> With ‘datetime.time’ there is no equivalent: midnight is not special in
>> the way “empty” or “zero magnitude” are. Midnight is an arbitrary point
>> on a continuum, and is not a “not there” value.
> 
> This is true in a date/time continuum, but not true if you regard
> time as "time of day". In the latter interpretation, the day starts
> at midnight, so the day is "not there" yet at midnight.

The day is absolutely here at midnight. Midnight isn’t some void where
time ceases to exist.

> 
>> It should not be Boolean false any more than any other time.
> 
> Just like with most interpretations, you can just as easily find
> one which implies the exact opposite.
> 
> It's all smoke and mirrors anyway :-)
> 
> Perhaps Tim just wanted to be able to make float(time(0,0,0)) return
> 0.0 seconds some day. That's what mxDateTime does for time values.
> 
> -- 
> Marc-Andre Lemburg
> eGenix.com
> 
> Professional Python Services directly from the Source  (#1, Mar 05 2014)
>>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
>>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
> ________________________________________________________________________
> 2014-04-09: PyCon 2014, Montreal, Canada ...               35 days to go
> 
> ::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
> 
>   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>           Registered at Amtsgericht Duesseldorf: HRB 46611
>               http://www.egenix.com/company/contact/
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/


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

-------------- 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/20140305/98b1c4db/attachment.sig>


More information about the Python-ideas mailing list