[Python-ideas] Please reconsider the Boolean evaluation of midnight
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Mar 6 07:51:06 CET 2014
Tim Peters wrote:
> For example, modular arithmetic on time
> objects was a possibility. In that case, time(0, 0, 0) would become
> "a zero value"
That only follows if you interpret "modular arithmetic on
time objects" as meaning that you can directly add one time
object to another. But that would be confusing times with
timedeltas. The concept of a zero *timedelta* makes sense,
but not a "zero time".
> People can say that "midnight" isn't a compelling "sentinel value",
> and I agree about the "compelling" part, but in all implementation
> respects it does _act_ as "a sentinel value".
If someone is using midnight to represent an unspecified
time, I'd say they have a bug. An appointment scheduled at
midnight is not the same as an appointment that's not
scheduled at all.
--
Greg
More information about the Python-ideas
mailing list