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

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Mar 5 16:10:28 CET 2014


On 05/03/2014 15:01, Paul Moore wrote:
> 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

I wouldn't agree that this has been a fruitless discussion.  I would 
agree that this is not a bug, that the code needs changing, and that at 
least one new test needs to be added to the unit test suite(s) for the 
buggy application(s).

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com




More information about the Python-ideas mailing list