<div dir="ltr"><div class="gmail_extra"><br><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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":2ht" class="" style="overflow:hidden">In any case, we're talking about an utterly trivial micro-optimization.<br>
This is Python, not Unix shell scripting. We don't use names like<br>
"umount" to save one character over "unmount", we encouraging writing<br>
for clarity and correctness over brevity.<br></div><br class="">The math module has constants pi and e because it would be truly an<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":2ht" class="" style="overflow:hidden">
inconvenience to have to create them yourself:<br>
<br>
pi = 3.14159265389793<br>
<br></div></blockquote><div>You're missing one key detail. If I see <font face="monospace, monospace">math.nan</font> or <font face="monospace, monospace">math.inf</font> in code, I know what those values are. If I see a bare <font face="monospace, monospace">nan</font> or <font face="monospace, monospace">inf</font> in the code I don't. That's an inconvenience too.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":2ht" class="" style="overflow:hidden">
Up to now, I have only discussed inf, not nan, because there is only one<br>
inf value in floats. (Two if you count -inf.) But the IEEE 754 standard<br>
provides many different NAN values, and offers a possible interpretion<br>
of them: the extra "payload" on each NAN can be used to carry diagnostic<br>
information on which numeric operation failed. </div></blockquote><div><br></div><div>This is a red herring as any future change to support this won't automatically touch code that uses float("nan") just as it won't touch code that uses float.nan.</div><div><br></div><div>There is a problem here but that's not it. The problem is that </div><div><br></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><font face="monospace, monospace" color="#ff0000">float("nan") is float("nan") => False</font></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><span style="color:rgb(255,0,0);font-family:monospace,monospace">math</span><font face="monospace, monospace" color="#ff0000">.nan is math.nan => True</font></div></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>So is this an attractive nuisance that will make people think they can should use <font face="monospace, monospace">x is math.nan</font> instead of <font face="monospace, monospace">math.isnan(x)</font>? Hopefully not but something to consider. Pylint should flag this usage.</div></div><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="arial, helvetica, sans-serif">--- Bruce<br></font><div><div><font face="arial, helvetica, sans-serif">Check out my new puzzle book: <a href="http://Ju.mp/ingToConclusions" target="_blank">http://Ju.mp/ingToConclusions</a></font><br></div></div><div><font face="arial, helvetica, sans-serif">Get it free here: <a href="http://Ju.mp/ingToConclusionsFree" target="_blank">http://Ju.mp/ingToConclusionsFree</a> (available on iOS)</font></div><div><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div></div>