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@gmail.com> wrote:
On Thu, Dec 11, 2014 at 11:58 AM, Matthieu Bec <mdcb808@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



--
--Guido van Rossum (python.org/~guido)