<div dir="ltr">"Nothing looks quite right" is a common phenomenon when you're constrained by backward compatibility. The perfect solution would throw away compatibility, but that has its own downsides. So just go for what looks the least wrong.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 16, 2014 at 3:28 PM, Matthieu Bec <span dir="ltr"><<a href="mailto:mbec@gmto.org" target="_blank">mbec@gmto.org</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Maybe what I meant with `nothing looks quite right':<br>
seconds as float, microseconds as float, nanosecond as 0..999, nanoseconds as 0..999999999 with mandatory keyword that precludes microseconds - all can be made to work, none seems completely satisfying.<br>
<br>
In fact, I don't really have a use for it from python - but something would be needed in C for the implementation of datetime.from_timespec and time.from_timespec that calls the constructor PyObjectCall_CallFunction(<u></u>clas,"...",...) - can this happen and remain hidden from the python layer?<br>
<br>
Regards,<br>
Matthieu<span class=""><br>
<br>
<br>
<br>
On 12/16/14 12:45 PM, Alexander Belopolsky wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
On Tue, Dec 16, 2014 at 12:10 PM, matthieu bec <<a href="mailto:mbec@gmto.org" target="_blank">mbec@gmto.org</a><br></span><div><div class="h5">
<mailto:<a href="mailto:mbec@gmto.org" target="_blank">mbec@gmto.org</a>>> wrote:<br>
<br>
I wonder if the datetime module is really the right location, that<br>
has constructor(year, month, day, ..., second, microsecond) - with<br>
0<ms<999999, no millis. adding 0<ns<999 would seem quite ugly, in<br>
fact nothing looks quite right.<br>
<br>
<br>
We can make nanosecond a keyword-only argument, so that<br>
<br>
time(1, 2, 3, nanosecond=123456789) -> 01:02:03.123456789<br>
<br>
and<br>
<br>
time(1, 2, 3, 4, nanosecond=123456789) -> error<br>
<br>
Users will probably be encouraged to avoid positional form when<br>
specifying time to subsecond precision. I would say time(1, 2, 3,<br>
microsecond=4) is clearer than time(1, 2, 3, 4) anyways.<br>
<br>
Another option is to allow float for the "second" argument:<br>
<br>
time(1, 2, <a href="tel:3.123456789" value="+13123456789" target="_blank">3.123456789</a>) -> 01:02:03.123456789<br>
<br>
<br>
<br></div></div><span class="">
______________________________<u></u>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/<u></u>mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/mdcb808%40gmail.com" target="_blank">https://mail.python.org/<u></u>mailman/options/python-dev/<u></u>mdcb808%40gmail.com</a><br>
<br>
</span></blockquote><span class="">
<br>
-- <br>
Matthieu Bec GMTO Corp<br>
cell : <a href="tel:%2B1%20626%20425%207923" value="+16264257923" target="_blank">+1 626 425 7923</a> 251 S Lake Ave, Suite 300<br>
phone: <a href="tel:%2B1%20626%20204%200527" value="+16262040527" target="_blank">+1 626 204 0527</a> Pasadena, CA 91101<br>
______________________________<u></u>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/<u></u>mailman/listinfo/python-dev</a><br></span>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/guido%40python.org" target="_blank">https://mail.python.org/<u></u>mailman/options/python-dev/<u></u>guido%40python.org</a><br>
</blockquote></div><br clear="all"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)</div>
</div>