[Python-ideas] Please reconsider the Boolean evaluation of midnight
Stephen J. Turnbull
stephen at xemacs.org
Fri Mar 7 18:50:26 CET 2014
Guido van Rossum writes:
> It's also not something for which a deprecation warning would work
> well. (When would it be issued? Whenever bool(<time>) is called?
Yes! Yes! Yes! Just joking -- that's got to be the wrong thing to do,
because it would warn on precisely the construct (None as sentinel for
"uninitialized") that's the only reason anybody wants this.
> Or only when it's about to return False?)
That seems reasonable to me. People who are testing for this are
presumably *constructing* instances of midnight, either with a crontab
of "* * * * *" or in a simulation -- they'll hit it frequently. The
other case that seems plausible is using a zero time as a sentinel for
"uninitialized" or "unspecified", and that *must* get a warning.
> Fearing I have said nothing new,
IIRC, you're the only person to have mentioned the pragmatic issues
about the DeprecationWarning.
More information about the Python-ideas
mailing list