<div dir="ltr">I'm still confused. We're talking about a function that compares two simple values, right? Where does the sequence of values come from? Numpy users do everything by the array, but they already have an isclose(). Or perhaps you're talking about assertApproxEqual in test_statistics.py? That has so many ways to specify the relative and absolute tolerance that I give up understanding it. The docstring doesn't give any clarity -- it simply describes the behaviors, it doesn't say when you should be using both. "[...] a naive implementation of relative error testing can run into trouble around zero" (followed by a single example) doesn't really help me.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 27, 2015 at 2:14 PM, Chris Barker <span dir="ltr"><<a href="mailto:chris.barker@noaa.gov" target="_blank">chris.barker@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Tue, Jan 27, 2015 at 2:00 PM, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br><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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I really appreciate this API design approach, and in this case I started out with that idea. But I think this is likely to be used where you need to test a bunch of values with single function/set of parameters. In TestCase.assertIsCloseTo, as well as home grown loops and comprehensions.</div></div></div></div></blockquote><div><br></div></span><div>I assume you mean <a href="https://hg.python.org/cpython/file/94d8524086bd/Lib/unittest/case.py#l525" target="_blank">assertNotAlmostEqual</a>. </div></div></div></div></blockquote><div><br></div></span><div>Sorry -- I meant a Hypothetical assertIsCLoseTo -- which would wrap the proposed is_close_to(), but apply it to a entire sequence, like <a href="https://hg.python.org/cpython/file/94d8524086bd/Lib/unittest/case.py#l525" target="_blank">assertNotAlmostEqual</a>. does.</div><span class=""><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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>This is actually the same misguided two-for-one design. You *must* specify exactly one of delta or places, and the code takes a different path. Also, it looks like both are actually absolute tolerance. <br></div></div></div></div></blockquote></span></div><div class="gmail_extra"><br></div><div class="gmail_extra">Yes, both are an absolute tolerance -- which , I think makes it a slightly less misguided design -- you aren't selecting two different functionalities, just two ways to spell the tolerance.</div><span class=""><div class="gmail_extra"><br></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">So what argument are you making here?</blockquote><div><br></div></span><div>The point was that if the user applies one set of parameters to a sequence of values that may have some zeros in it, -- we need it in one function. Nathaniel has found that to be a fairly common use-case for the numpy allclose()</div><span class=""><div><br></div><div>-Chris</div><div> <br></div><div class="gmail_extra"><br></div>-- <br><div><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R <a href="tel:%28206%29%20526-6959" value="+12065266959" target="_blank">(206) 526-6959</a> voice<br>7600 Sand Point Way NE <a href="tel:%28206%29%20526-6329" value="+12065266329" target="_blank">(206) 526-6329</a> fax<br>Seattle, WA 98115 <a href="tel:%28206%29%20526-6317" value="+12065266317" target="_blank">(206) 526-6317</a> main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</span></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)</div>
</div>