<p>Analysis paralysis commence. +1 for separate module using decimal. </p>
<div class="gmail_quote">On Feb 1, 2012 1:44 PM, "PJ Eby" <<a href="mailto:pje@telecommunity.com">pje@telecommunity.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote">On Tue, Jan 31, 2012 at 7:35 PM, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Such a protocol can easily be extended to any other type - the time<br>
module could provide conversion functions for integers and float<br>
objects (meaning results may have lower precision than the underlying<br>
system calls), while the existing "fromtimestamp" APIs in datetime can<br>
be updated to accept the new optional arguments (and perhaps an<br>
appropriate class method added to timedelta, too). A class method<br>
could also be added to the decimal module to construct instances from<br>
integer components (as shown above), since that method of construction<br>
isn't actually specific to timestamps.<br></blockquote><div><br></div><div>Why not just make it something like __fromfixed__() and make it a standard protocol, implemented on floats, ints, decimals, etc. Then the API is just "time.time(type)", where type is any object providing a __fromfixed__ method. ;-)</div>
<div> </div></div>
<br>_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-dev" target="_blank">http://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/anacrolix%40gmail.com" target="_blank">http://mail.python.org/mailman/options/python-dev/anacrolix%40gmail.com</a><br>
<br></blockquote></div>