For closure, I've added a package, timeliterals (env) [pgdr@hostname ~]$ pip install timeliterals (env) [pgdr@hostname ~]$ python >>> from timeliterals import * >>> 3*hours datetime.timedelta(0, 10800) >>> 3*minutes datetime.timedelta(0, 180) >>> 3*seconds datetime.timedelta(0, 3)
The source code is at https://github.com/pgdr/timeliterals I'm not going to submit a patch to datetime at this time, but I will if people would be interested. - Pål On 5 Jun 2018 13:56, "Jacco van Dorp" <j.van.d...@deonet.nl> wrote: > i'd also be pretty simple to implement.... > > Just list: > minute = timedelta(minutes=1) > hour = timedelta(hours=1) > etc... > > and you could import and use them like that. Or if you really want to > write 5*m, the just from datetime import minute as m > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/