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

Ethan Furman ethan at stoneleaf.us
Tue May 8 08:33:56 CEST 2012


Alexander Belopolsky wrote:
> On Tue, May 8, 2012 at 1:42 AM, Steven D'Aprano <steve at pearwood.info> wrote:
>>> In matters of opinion, the status quo reigns.
>> That's somewhat of an exaggeration. The mere existence of a single
>> dissenting opinion isn't enough to block all progress/changes.
> 
> For what it's worth, I am also against changing the status quo.
> time(0) is special: it is the smallest possible value.  If you deal
> with low resolution time values, say hourly schedules, it is not
> unreasonable to test for time(0).  For example, when estimating daily
> averages, midnight samples can be weighted by 1/2 to account for the
> uncertainty in assigning midnight to a given day.

Testing for midnight does not require midnight to be False.

And no, I don't maintain any hope of winning this argument -- that's why 
I wrote my own class.  With it it is possible to create an unspecified 
moment... and guess what?  It evaluates to False; all actual times 
evaluate as True.  (Including midnight. ;)

~Ethan~



More information about the Python-ideas mailing list