<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#330033">
On 2/2/2012 3:38 PM, Nick Coghlan wrote:
<blockquote
cite="mid:CADiSq7c78RvkxofX=+_7mUsDv=2DzPi-GtTyKK7xG3KuvZ4vNA@mail.gmail.com"
type="cite">
<pre wrap="">On Fri, Feb 3, 2012 at 8:37 AM, Glenn Linderman <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:v+python@g.nevcal.com"><v+python@g.nevcal.com></a> wrote:
</pre>
<blockquote type="cite" style="color: #000000;">
<pre wrap=""><span class="moz-txt-citetags">> </span>Sorry to bring this up, but the PEP should probably consider another option:
<span class="moz-txt-citetags">> </span>Introducing a precedent following os.stat_decimal_times(). Like
<span class="moz-txt-citetags">> </span>os.stat_float_times, it would decide the return types of timestamps from
<span class="moz-txt-citetags">> </span>os.stat. Or something along that line. Having it affect the results of
<span class="moz-txt-citetags">> </span>time.time would be weird, though. And the whole design of
<span class="moz-txt-citetags">> </span>os.stat_float_times smells of something being designed wrong in the first
<span class="moz-txt-citetags">> </span>place, to need such an API to retain backward compatibility. But I'm not
<span class="moz-txt-citetags">> </span>sure it is, even yet, designed for such flexibility.
</pre>
</blockquote>
<pre wrap="">We could get away with a global switch for the int->float transition
because ints and floats interoperate pretty well. The same is not true
for binary floats and decimal.Decimal.</pre>
</blockquote>
<br>
I agree about the interoperability of the various types, but don't
see why that doesn't mean a global switch couldn't work, although
I'm not fond of global switches.<br>
<br>
Library code that calls os.stat would have to be ready to handle
either return value, but could predetermine it by checking the
switch state. Icky. But possible.<br>
<br>
In any case, mentioning it in the PEP, along with why it is a bad
idea, is probably a good idea.<br>
</body>
</html>