[Python-ideas] bool(datetime.time(0, 0))
Steven D'Aprano
steve at pearwood.info
Wed May 9 07:16:23 CEST 2012
On Tue, May 08, 2012 at 02:21:07AM -0400, 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.
I think this demonstrates the incidious nature of this design flaw in
time objects. Alexander, you caught me in a mistake earlier, when I
neglected to take tzinfo into account, and here you are doing the same
sort of thing: you can't reliably detect midnight with a simple
bool(timevalue) test.
--
Steven
More information about the Python-ideas
mailing list