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

Paul Moore p.f.moore at gmail.com
Wed Mar 5 13:54:27 CET 2014


On 5 March 2014 12:34, Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:
> On 5 March 2014 10:59, Shai Berger <shai at platonix.com> wrote:
>> On Wednesday 05 March 2014 12:44:07 Paul Moore wrote:
>>>
>>> I actually find the idea of truth-testing a value that's expected to
>>> have a type that is always true *more* unintuitive than an explicit
>>> "is not None", so I'd fix the above code regardless of what the truth
>>> value of midnight is.
>>
>> I can appreciate this point of view, but I think it is not the position
>> generally taken by Python (if it were, Boolean evaluation of an object of a
>> type that is always true would have raised an exception).
>
> I think it's clear that if this were new code being added to the
> stdlib then the consensus would be that having midnight evaluate as
> False is ridiculous.
>
> The question is surely whether the issue is worth a backwards
> compatibility break not whether the current behaviour is a good idea
> (it clearly isn't).

Precisely. Sorry I wasn't clear enough.

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).
Paul


More information about the Python-ideas mailing list