[Python-ideas] datetime.timedelta literals

Pål Grønås Drange paal.drange at gmail.com
Sun Jun 3 17:03:43 EDT 2018


> They are more general than your proposal but they still cover pitfalls
that
> may affect yours. It would be better if you could expand your proposal to
the
> concerns raised on those threads.

After reading that thread (this summary should be taken with a grain of
salt),
the first half is concerned with dimensional analysis not (satisfactorily)
performed.  The second half of the discussion is dedicated to the major
issue
with 1E1 meaning 1 and not 1 exa, and it's also pointed out that it is
somewhat
confusing that 1m means 0.001 and not 1 meter.

There is an alternative proposal from that thread, namely that we write
2_m, 2_k
etc to mean milli and kilo, respectively.  That could also be used in my
case.

However, the suggested idea with _all the SI units_ is a completely new
construct over any programming language in existence; and quite frankly a
much
bigger change than mine.  My suggestion, which is not mine at all, really,
has
an implementation in C++, with experiences we can learn from.  The
"timedelta
literals" idea has _six_ new literals, whereas Ken Kundert's idea has I
don't
know how many.

I want to highlight one comment I found enlightening, and that is one from
Paul
Moore:

[Python-ideas] SI scale factors in Python
Paul Moore p.f.moore at gmail.com
Thu Aug 25 16:03:32 EDT 2016

> Python has a track record of being open to adding syntactic support if
> it demonstrably helps 3rd party tools (for example, the matrix
> multiplication operator was added specifically to help the numeric
> Python folks address a long-standing issue they had), so this is a
> genuine possibility - but such proposals need support from the groups
> they are intended to help.


I can understand that a lack of support from people using timedelta will be
a
blocker.


Now, please don't take this as a dismissal of your suggestion that I can
learn
from the referenced discussion; I did learn a great deal, but I also felt
that
much of the discussion was around subjects that are less relevant for the
"timedelta literals" suggestion.


Best regards,
Pål Grønås Drange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180603/06d9fede/attachment.html>


More information about the Python-ideas mailing list