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

Alexander Belopolsky report at bugs.python.org
Thu Mar 6 02:42:46 CET 2014


Alexander Belopolsky added the comment:

Nick wrote:

> any deprecation warning should explain how to convert
> a time object to "seconds since midnight".

I would like to see such an explanation regardless of the outcome here.

The best I can think of is

timedelta(hours=t.hour, minutes=t.minute, seconds=t.second, microseconds=t.microsecond).total_seconds()

which is only a marginal improvement over 

(t.hour*60 + t.minute)*60 + t.second + 1e-6*t.microsecond

See also #17267.

----------

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


More information about the Python-bugs-list mailing list