[issue37914] class timedelta, support the method hours and minutes in field accessors

Serhiy Storchaka report at bugs.python.org
Thu Aug 22 07:52:11 EDT 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

It was already proposed several times before.

The problem is that what do you expect to get from timedelta(hours=24).hours?

The idiomatic way to convert a timedelta object to a number of hours is:

td = timedelta(...)
number_of_hours = td // timedelta(hours=1)

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37914>
_______________________________________


More information about the Python-bugs-list mailing list