[Python-ideas] Please reconsider the Boolean evaluation of midnight
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Mar 6 23:38:42 CET 2014
Tim Peters wrote:
> The only difference between time and timedelta is in implementation
> details.
Only if you define it that way. To my way of thinking,
a time-of-day is like a mod-24-hour datetime, not a
mod-24-hour timedelta.
It seems you're thinking of it as a mod-24-hour timedelta.
Given that, I can see why you think that it's bizarre
to attach a timezone to one. In fact, I'd say if that's
really how a time object is meant to be interpreted,
they shouldn't even be *allowed* to have a timezone,
any more than a timedelta can.
In any case, I don't see how this interpretation
justifies the truthiness behaviour with timezones.
From my reading of the docs, the *intention* seems
to be for midnight UTC to be false and all other
times to be true. I would never have suspected the
actual behaviour with negative offsets, which looks
like an outright bug to me. Or is there some reason
for it that I'm not seeing?
--
Greg
More information about the Python-ideas
mailing list