<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 7, 2015 at 8:09 AM, Steven D'Aprano <span dir="ltr"><<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><span style="color:rgb(34,34,34)">  import math</span><br></div></div>
  process(math.inf)<br>
<br>
or<br>
<br>
  inf = float('inf')<br>
  process(inf)<br>
<br>
is much the same effort. At worst, we might say that it is a matter of<br>
personal taste which you prefer. But frankly, the difference is trivial.<br></blockquote><div><br></div><div>exactly -- but the cost is trivial too. Note that numpy provides np.inf and np.nan for a reason, and it s a nice thing to have. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">- offering a math.inf is harmless but not especially useful;<br></blockquote><div><br></div><div>but nice. </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- offering a single math.nan is harmful and I strongly oppose it.</blockquote><div><br></div><div>defining math.nan as a singleton could be considered harmful, but I don't see any harm at all in offering it as a pre-defined constant. We NEED to have a way to create a NaN-valued float in any case (and do with float('nan')) -- this would be no different.</div><div><br></div><div>And as nan (and inf, and -inf) can result from computation, rather than python-level object creation, they are different than None anyway (they are also particular values or a float, rather than a particular type).</div><div><br></div><div>+1</div><div><br></div><div>-Chris</div></div><div><br></div>-- <br><div 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></div>