<p dir="ltr">For closure, I've added a package, timeliterals</p>
<p dir="ltr">(env) [pgdr@hostname ~]$ pip install timeliterals<br>
(env) [pgdr@hostname ~]$ python<br>
>>> from timeliterals import *<br>
>>> 3*hours<br>
datetime.timedelta(0, 10800)<br>
>>> 3*minutes<br>
datetime.timedelta(0, 180)<br>
>>> 3*seconds<br>
datetime.timedelta(0, 3)</p>
<p dir="ltr">The source code is at <a href="https://github.com/pgdr/timeliterals">https://github.com/pgdr/timeliterals</a></p>
<p dir="ltr">I'm not going to submit a patch to datetime at this time, but I will if people<br>
would be interested.</p>
<p dir="ltr">- Pål</p>
<div class="gmail_extra"><br><div class="gmail_quote">On 5 Jun 2018 13:56, "Jacco van Dorp" <<a href="mailto:j.van.dorp@deonet.nl">j.van.dorp@deonet.nl</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">i'd also be pretty simple to implement....<br>
<br>
Just list:<br>
minute = timedelta(minutes=1)<br>
hour = timedelta(hours=1)<br>
etc...<br>
<br>
and you could import and use them like that. Or if you really want to<br>
write 5*m, the just from datetime import minute as m<br>
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
</blockquote></div></div>