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

Marco Sulla Marco.Sulla.Python at gmail.com
Thu Apr 14 13:43:33 EDT 2022


On Thu, 14 Apr 2022 at 19:16, MRAB <python at mrabarnett.plus.com> wrote:
>
> When you're working only with dates, timedelta not having a 'days'
> attribute would be annoying, especially when you consider that a day is
> usually 24 hours, but sometimes 23 or 25 hours (DST).

I agree. Furthermore, timedelta is, well, a time delta, not a date
with a timezone. How could a timedelta take into account DST, leap
seconds etc?

About the initial question, I think it's a good question.


More information about the Python-list mailing list