[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

Nick Coghlan report at bugs.python.org
Wed Mar 5 23:36:22 CET 2014


Nick Coghlan added the comment:

Rewording the issue title and reopening based on the python-ideas thread. The rationale for making this change is that the current behaviour converts a stylistic problem in checking values against a sentinel via "bool(value)" instead of "value is not None" into a subtle data driven behavioural bug that only occurs exactly at midnight UTC.

If someone wants to write the patch to deprecate this behaviour in Python 3.5 (reporting a deprecation warning whenever midnight is interpreted as False, perhaps suggesting the use of "is" or "is not" instead), and then actually change the behaviour in 3.6, I don't believe we should actively oppose them from doing so.

----------
nosy: +ncoghlan
resolution: invalid -> 
status: closed -> open
title: datetime.time(0,0,0) evaluates to False despite being a valid time -> RFE: change bool(datetime.time(0,0,0)) to evaluate as True
type: behavior -> enhancement
versions: +Python 3.5 -Python 2.6, Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13936>
_______________________________________


More information about the Python-bugs-list mailing list