[Python-Dev] datetime nanosecond support (ctd?) (original) (raw)

Guido van Rossum guido at python.org
Thu Dec 11 20:14:27 CET 2014


Another issue to consider here is that parsing and printing should be symmetrical. The %f format gobbles up exactly 6 digits.

Finally, strptime and strftime are not invented by Python, the same functions with (mostly) the same format characters are defined by other languages. Is there not a single other language that has added support for nanoseconds to its strftime/strptime? (I wouldn't be surprised if there wasn't -- while computer clocks have a precision in nanoseconds, that doesn't mean they are that accurate at all (even with ntpd running).

On Thu, Dec 11, 2014 at 10:33 AM, Skip Montanaro <skip.montanaro at gmail.com> wrote:

On Thu, Dec 11, 2014 at 11:58 AM, Matthieu Bec <mdcb808 at gmail.com> wrote: > ...or keep using "%f" if acceptable...

That might be a problem. While it will probably work most of the time, there are likely to be situations where the caller assumes it generates a six-digit string. I did a little poking around. It seems like "%N" isn't used. Skip


Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org

-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20141211/1b48df1a/attachment.html>



More information about the Python-Dev mailing list