<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
A function with "microseconds" in the name IMO misleadingly suggests
that it has something closer to microsecond accuracy than a 1-second
granularity.<br>
Rob Cliffe<br>
<br>
<div class="moz-cite-prefix">On 14/02/2019 05:05:54, Richard
Belleville via Python-Dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAOew_sG9nG+bOGB4gt2DSwuxP8SgZW13WznwNf-Y5DhabnZZjQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">
<div>In a recent code review, the following snippet was called
out as reinventing the</div>
<div>wheel:</div>
<div><br>
</div>
<div>_MICROSECONDS_PER_SECOND = 1000000</div>
<div><br>
</div>
<div><br>
</div>
<div>def _timedelta_to_microseconds(delta):</div>
<div> return int(delta.total_seconds() *
_MICROSECONDS_PER_SECOND)</div>
<div><br>
</div>
<div><br>
</div>
<div>The reviewer thought that there must already exist a
standard library function</div>
<div>that fulfills this functionality. After we had both
satisfied ourselves that we</div>
<div>hadn't simply missed something in the documentation, we
decided that we had</div>
<div>better raise the issue with a wider audience.</div>
<div><br>
</div>
<div>Does this functionality already exist within the standard
library? If not, would</div>
<div>a datetime.timedelta.total_microseconds function be a
reasonable addition? I</div>
<div>would be happy to submit a patch for such a thing.</div>
<div><br>
</div>
<div>Richard Belleville</div>
</div>
</div>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top: 1px solid #D3D4DE;">
<tbody>
<tr>
<td style="width: 55px; padding-top: 13px;"><a
href="http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient"
target="_blank" moz-do-not-send="true"><img
src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-green-avg-v1.png"
alt="" style="width: 46px; height: 29px;"
moz-do-not-send="true" width="46" height="29"></a></td>
<td style="width: 470px; padding-top: 12px; color:
#41424e; font-size: 13px; font-family: Arial, Helvetica,
sans-serif; line-height: 18px;">Virus-free. <a
href="http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient"
target="_blank" style="color: #4453ea;"
moz-do-not-send="true">www.avg.com</a> </td>
</tr>
</tbody>
</table>
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1"
height="1" moz-do-not-send="true"> </a></div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Python-Dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Python-Dev@python.org">Python-Dev@python.org</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/python-dev">https://mail.python.org/mailman/listinfo/python-dev</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/options/python-dev/rob.cliffe%40btinternet.com">https://mail.python.org/mailman/options/python-dev/rob.cliffe%40btinternet.com</a>
</pre>
</blockquote>
<br>
</body>
</html>