Author ncoghlan
Recipients Amber.Yust, Andreas.Pelme, Lakin.Wecker, belopolsky, cvrebert, dstufft, georg.brandl, gwrtheyrn, lemburg, merwok, ncoghlan, pitrou, r.david.murray, shai, tim.peters, yselivanov
Date 2014-03-06.12:26:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1394108801.1.0.725033736561.issue13936@psf.upfronthosting.co.za>
In-reply-to
Content
I wrote up a longer post on python-ideas regarding the problems that the current behaviour poses when it comes to inferring a correct mental model for datetime.time(): https://mail.python.org/pipermail/python-ideas/2014-March/026647.html

As part of that, it's also worth noting the current behaviour in boolean context is effectively shorthand for:

    import datetime as dt

    naivemidnight = dt.time(0, 0)
    utcmidnight = dt.time(0, 0, tzinfo=dt.timezone.utc
    if x in (naivemidnight, utcmidnight):
        ...

So if the current boolean behaviour is deprecated and removed, it is easily reproduced through equality checks.

It may also make sense to offer an API to easily calculate seconds since midnight, but that would be a separate issue.
History
Date User Action Args
2014-03-06 12:26:41ncoghlansetrecipients: + ncoghlan, lemburg, tim.peters, georg.brandl, belopolsky, pitrou, merwok, r.david.murray, cvrebert, gwrtheyrn, Lakin.Wecker, yselivanov, shai, dstufft, Andreas.Pelme, Amber.Yust
2014-03-06 12:26:41ncoghlansetmessageid: <1394108801.1.0.725033736561.issue13936@psf.upfronthosting.co.za>
2014-03-06 12:26:41ncoghlanlinkissue13936 messages
2014-03-06 12:26:40ncoghlancreate