[Python-ideas] Please reconsider the Boolean evaluation of midnight
Shai Berger
shai at platonix.com
Wed Mar 5 14:53:19 CET 2014
On Wednesday 05 March 2014 15:26:38 Paul Moore wrote:
> On 5 March 2014 13:10, Shai Berger <shai at platonix.com> wrote:
> > On Wednesday 05 March 2014 14:54:27 Paul Moore wrote:
> >> And FWIW, my opinion is that the problem is not worth a compatibility
> >> break, because it's so easily solved (and the fixed code is probably
> >> an improvement in any case).
> >
> > Ah, but it is only easily solved once it is detected; the behavior causes
> > bugs that surface once in a blue moon (in production, and then they
> > cannot be reproduced by developers who, usually, do not work at
> > midnight).
>
> That's a fair point. But your deprecation suggestion doesn't seem to
> help this, unless you expect (in a realistic timescale) to be able to
> drop support for Python <3.7.
I expect to drop support for Python<3.7 sometime...
> Your users (on say 2.7 or 3.3) will
> still get bugs, and now your developers (using 3.7) won't even be able
> to reproduce the issue by staying up till midnight.
If my developers are using 3.7 to debug problems that user encounter with 3.3,
they deserve to stay up till midnight and beyond.
> And once they do
> find the bug they will still have to fix it by an explicit test.
The process I want to see is, that Boolean evaluations of time objects is
slowly, but more-or-less completely removed from code that targets Python<3.7;
then, in a few years, people can go back to writing "if event.start_time" like
they do with dates and datetimes.
> Again, I'm not saying the current behaviour is sensible, but I doubt
> the work to fix it will benefit anyone in practice.
>
So, you support my other suggestion -- a warning on every use of bool(time)?
Also, the work to fix it is probably less than the work invested in this
discussion so far...
In any case, if we all agree that http://bugs.python.org/issue13936 is a valid
problem -- can we re-open it, and then discuss how (or if) we solve it?
Thanks,
Shai.
More information about the Python-ideas
mailing list