[Python-ideas] bool(datetime.time(0, 0))

Greg Ewing greg.ewing at canterbury.ac.nz
Tue May 8 02:18:20 CEST 2012


Alexander Belopolsky wrote:

> I don't find the current behavior unintuitive.  It is common to
> represent time of day as an integer (number of minutes or seconds
> since midnight) or as a float (fraction of the 24-hour day).  In these
> cases one gets bool(midnight) -> False as an artifact of the
> representation.

Relying on that artifact by using midnight as a kind of
null value seems like a bad idea to me, though. Any
code doing that almost deserves to be broken.

-- 
Greg



More information about the Python-ideas mailing list