[Python-ideas] datetime.timedelta literals

Paul Moore p.f.moore at gmail.com
Mon Jun 4 18:21:01 EDT 2018


On 4 June 2018 at 22:50, Chris Barker via Python-ideas
<python-ideas at python.org> wrote:
> So maybe you could propose adding:
>
> seconds
> minutes
> hours
> days
>
> to the datetime module, and then we could write:
>
> 60*seconds == 1*minutes
>
> Without any changes to the language at all.

This strikes me as more of a personal/team style issue, so probably
fits better as local definitions in a project's "utilities" module.
Putting it in the stdlib implies a certain level of approval of this
as a standard idiom, and I'm not sure it's common enough practice to
warrant that.

Paul


More information about the Python-ideas mailing list