[Python-ideas] PEP 485: A Function for testing approximate equality
Chris Barker
chris.barker at noaa.gov
Mon Jan 26 20:26:59 CET 2015
On Mon, Jan 26, 2015 at 10:31 AM, Antoine Pitrou <solipsis at pitrou.net>
wrote:
> > But throughout all this -- I haven't thought of a single case where I
> would
> > prefer a symmetric test and it would matter.
>
> But then it begs the question: are there cases where an asymmetric test
> matters?
Yes -- see the example in the PEP and on this list. If you have a known
value, and you want to know whether the value at hand is within some error
of the known value, then you want an asymmetric test -- and if you have
errors on order of 10% -- it does make a difference. Granted, I don't
expect this use case to be common, but it was brought up on this list.
> Simplicity has its virtues.
But which is more simple? I came to the conclusion that the asymmetric was
simpler to explain and reason about in any case.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150126/be6a58fc/attachment.html>
More information about the Python-ideas
mailing list