<div dir="ltr"><div dir="ltr">On Fri, Feb 15, 2019 at 11:58 AM Rob Cliffe via Python-Dev <<a href="mailto:python-dev@python.org">python-dev@python.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div 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></div></blockquote><div><br></div><div>it sure does, but `delta.total_seconds()` is a float, so ms accuracy is preserved.</div><div><br></div><div>However, if you DO want a "timedelta_to_microseconds" function, it really should use the microseconds field in the timedelta object. I haven't thought it through, but it makes me nervous to convert to floating point, and then back again -- for some large values of timedelta some precision may be lost.</div><div><br></div><div>Also:</div><div><br></div><div><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div>_MICROSECONDS_PER_SECOND = 1000000</div></div></div></blockquote></div><div><br></div><div>really? why in the world would you define a constant for something that simple that can never change? (and probably isn't used in more than one place anyway</div><div> </div><div>As Alexander pointed out the canonical way to spell this would be:</div><div><br></div><div>delta / timedelta(microseconds=1)</div><div><br></div><div>but I think that is less than obvious to the usual user, so I think a:</div><div><br></div><div>delta.total_microseconds()</div><div><br></div><div>would be a reasonable addition.</div><div><br></div><div>I know I use .totalseconds() quite a bit, and would not want to have to spell it:</div><div><br></div><div>delta / timedelta(seconds=1)<br></div><div><br></div><div>(and can't do that in py2 anyway)</div><div><br></div><div>-CHB</div><div><br></div></div>-- <br><div dir="ltr" class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R            (206) 526-6959   voice<br>7600 Sand Point Way NE   (206) 526-6329   fax<br>Seattle, WA  98115       (206) 526-6317   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div></div>