Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

Jon Ribbens jon+usenet at unequivocal.eu
Tue Apr 19 10:01:48 EDT 2022


On 2022-04-19, Loris Bennett <loris.bennett at fu-berlin.de> wrote:
> If I am merely trying to represent part a very large number of seconds
> as a number of years, 365 days per year does not seem that controversial
> to me.  Obviously there are issues if you expect all periods of an
> integer number of years which start on a given date to all end on the
> same date.
>
> In my little niche, I just need a very simple period and am anyway not
> bothered about years, since in my case the number of days is usually
> capped at 14 and only in extremely exceptional circumstances could it
> get up to anywhere near 100.
>
> However, surely there are plenty of people measuring durations of a few
> hours or less who don't want to have to deal with seconds all the time
> (I am in fact also in this other group when I record my working hours).

Well, that's my point. Everyone's all in their own slightly-different
little niches. There isn't one straightforward standard that makes all
or even most of them happy.


More information about the Python-list mailing list