[Python-ideas] PEP 485: A Function for testing approximate equality

Guido van Rossum guido at python.org
Sat Jan 24 21:21:22 CET 2015


On Sat, Jan 24, 2015 at 11:59 AM, Chris Barker <chris.barker at noaa.gov>
wrote:

>
> I'd much rather require people to have to think about what makes sense for
> their use case than get trapped by a default that's totally inappropriate.
>

And by the time you have thought through your use case you're probably
better off just writing abs(x-y) <= eps for some eps that you decide from
your use case.

The number of messages written to debate this one simple formula make me
think it's not so simple after all. So perhaps this is, once again,
something that's better off as a recipe?

Alternatively, maybe a useful approach to resolving this debate could be to
look for places in actual code where people have solved this for their own
use case (as in, written by someone else to solve a real problem, not made
up as an example). Then if you see a particular pattern occur repeatedly,
you might be able to use that evidence to suggest the right helper function
that does the whole thing in one call, and by looking at variations you
might get a good insight in the needed parameters and defaults.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150124/3b563568/attachment-0001.html>


More information about the Python-ideas mailing list