On 5 March 2014 10:59, Shai Berger
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). Oscar