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

Paul Moore p.f.moore at gmail.com
Wed Mar 5 16:01:33 CET 2014


On 5 March 2014 13:53, Shai Berger <shai at platonix.com> wrote:
> then, in a few years, people can go back to writing "if event.start_time" like
> they do with dates and datetimes.

Why on earth would they do that? It's still bad practice. If you're
using None as a sentinel, you should test for it explicitly. Nobody
has yet suggested any other use case where this matters.

>> 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)?

No. Good programming practice should cover that. We don't warn in
other cases where programmers make silly coding errors. Look at Skip's
message - should we also warn on uses of bool(int) because people can
write bad code that fails to work properly with zero, as well?

> Also, the work to fix it is probably less than the work invested in this
> discussion so far...

That is not obvious (given documentation, release management, etc, costs).

> 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?

We don't. Can we agree that it's not a bug and abandon this fruitless
discussion?

Paul


More information about the Python-ideas mailing list