[Python-ideas] Please reconsider the Boolean evaluation of midnight

Joao S. O. Bueno jsbueno at python.org.br
Wed Mar 5 14:40:45 CET 2014


I agree this change would cause far more good than harm -
I see that it implies an incompatible change, but lets
think on "Although practicality beats purity" terms here:
the only instance I see this could possibly be used by purpose
is in a code to that would increase  a "day counter" if the time.now()
would evaluate to false. Such a piece of code would be broken in many
other levels
to start with.

A critical session in any piece of code that has to check if "at this
second now we are at midnight" should be using one of the specialized
timers to take care of borderline cases, such as start and ending of
D.S.T. and such. It would have to be orders of magnitude better
written than "if not current_time: ... "

And even in the improbable case of such a piece of code exists, the
changing of behavior would make it break in the first 24 hours, and
the problem would not be that hard to find out.

In this light, I think having to wait for 3 major release cycles until
that is gone is a lot of overkill.

On 5 March 2014 10:26, Paul Moore <p.f.moore at gmail.com> 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. 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. And once they do
> find the bug they will still have to fix it by an explicit test.
>
> Again, I'm not saying the current behaviour is sensible, but I doubt
> the work to fix it will benefit anyone in practice.
>
> Paul.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/


More information about the Python-ideas mailing list