[Python-ideas] Please reconsider the Boolean evaluation of midnight
Steven D'Aprano
steve at pearwood.info
Thu Mar 6 03:19:48 CET 2014
On Thu, Mar 06, 2014 at 09:16:06AM +1100, Ben Finney wrote:
> With ‘datetime.time’ there is no equivalent: midnight is not special in
> the way “empty” or “zero magnitude” are. Midnight is an arbitrary point
> on a continuum, and is not a “not there” value. It should not be Boolean
> false any more than any other time.
It may only be a convention that an instant before midnight is the end
of the day and midnight the beginning of the next, but it is a
convention: midnight is the origin (i.e. zero point) of the day. That
makes it arguably as falsey as 0, 0.0 and 0j.
--
Steven
More information about the Python-ideas
mailing list