> On 2018 Jun 4 , at 9:08 a, Giampaolo Rodola' <g.rod...@gmail.com> wrote: > > > > > > IMO datetimes are not common enough to deserve their own literals. It would > make the language more complex and harder to learn for a relatively little > benefit. This would probably make more sense as a third party lib: > > >>> import datetimeutils > >>> datetimeutils.interpretstr("2.5h - 14min + 9300ms") > datetime(...) > > Both the string and the possibility to specify function arguments would give > you way more expressiveness than language literals. >
Agreed. I'll add that interpretstr probably isn't necessary; the constructor for timedelta already lets you write >>> datetime.timedelta(hours=2.5, minutes=-14, milliseconds=9300) datetime.timedelta(0, 8169, 300000) Further, I'd argue that such involved timedelta instances are rarely instantiated explicitly, resulting instead from datetime arithmetic. -- Clint _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/