[Python-Dev] datetime nanosecond support (ctd?)
Alexander Belopolsky
alexander.belopolsky at gmail.com
Tue Dec 16 21:45:02 CET 2014
On Tue, Dec 16, 2014 at 12:10 PM, matthieu bec <mbec at gmto.org> wrote:
> I wonder if the datetime module is really the right location, that has
> constructor(year, month, day, ..., second, microsecond) - with 0<ms<999999,
> no millis. adding 0<ns<999 would seem quite ugly, in fact nothing looks
> quite right.
We can make nanosecond a keyword-only argument, so that
time(1, 2, 3, nanosecond=123456789) -> 01:02:03.123456789
and
time(1, 2, 3, 4, nanosecond=123456789) -> error
Users will probably be encouraged to avoid positional form when specifying
time to subsecond precision. I would say time(1, 2, 3, microsecond=4) is
clearer than time(1, 2, 3, 4) anyways.
Another option is to allow float for the "second" argument:
time(1, 2, 3.123456789) -> 01:02:03.123456789
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20141216/a5b92dad/attachment.html>
More information about the Python-Dev
mailing list