Author michaelanckaert
Recipients belopolsky, elinaldosoft, michaelanckaert, p-ganssle, serhiy.storchaka
Date 2019-08-22.15:50:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAPk0GOu1EVVc+Z4_njeeNCYTrvP=uz1=hthpn5_5D5BekJAE3A@mail.gmail.com>
In-reply-to <1566488785.38.0.805722513539.issue37914@roundup.psfhosted.org>
Content
Thank you for the clarification Paul. It makes sense to me now to not
include those accessors.

On Thu, 22 Aug 2019 at 17:46, Paul Ganssle <report@bugs.python.org> wrote:

>
> Paul Ganssle <p.ganssle@gmail.com> added the comment:
>
> > I would support this addition. The timedelta class already has accessors
> for days and seconds, why not for hours and minutes?
>
> The `timedelta.days` and `timedelta.seconds` accessors do not do what is
> being requested here. The component accessors just give you a given
> component of the timedelta in its normalized form, so:
>
>     >>> td = timedelta(hours=25, minutes=1, seconds=2)
>     >>> td.days
>     1
>     >>> td.seconds
>     3662
>     >>> td // timedelta(seconds=1)
>     90062
>
>
> The reason there is no hours or minutes is that the normalized form of
> timedelta doesn't have those components. It would be inconsistent to have
> `hours` and `minutes` give the total duration of the timedelta in the
> chosen units while `.days` and `.seconds` return just the component of the
> normalized form.
>
> What's really being asked for here are `total_hours()` and
> `total_minutes()` methods, and when that has come up in the past (including
> recently on the python-dev mailing list), we've largely decided that the
> "divide by the units you want" idiom is sufficient (and in fact better in
> that you can choose any arbitrary units rather than just the ones that have
> specific names).
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue37914>
> _______________________________________
>
History
Date User Action Args
2019-08-22 15:50:12michaelanckaertsetrecipients: + michaelanckaert, belopolsky, serhiy.storchaka, p-ganssle, elinaldosoft
2019-08-22 15:50:12michaelanckaertlinkissue37914 messages
2019-08-22 15:50:12michaelanckaertcreate