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

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Mar 6 16:16:44 CET 2014


On Thu, Mar 6, 2014 at 5:39 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:

> > I think proponents of bool(time(0)) == True view it as a container of
> > hours, minutes and seconds.
>
> No, they view it as an abstraction around the common concept of time.
>

OK, it looks like we are getting closer to the root of the disagreement.

We are talking about the datetime.time type here.  It is not "an
abstraction around
the common concept of time."  That role belongs to the datetime.datetime
type.

The datetime.time type is an implementation of the concept of the *time of
day*.

In other words, for a datetime instance dt, dt.time() is the fractional
part of dt
and dt.date() is the integral part.

A test for dt.time() is just as natural for datetime as a test for t %
(24*60*60)
for posix time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140306/fcdd679d/attachment.html>


More information about the Python-ideas mailing list