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

Skip Montanaro skip.montanaro at gmail.com
Fri Jan 23 22:34:57 CET 2015


On Fri, Jan 23, 2015 at 3:23 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> If you have such a precise requirement (the given tick size), you have
> to roll your own function, there's no point in a stdlib function, right?

No, I think Chris's is_close_to would probably do the trick, as the
relative tolerance would be some fractional multiple of the tick size.

In any case, whether or not I would choose to use this function is
beside the point. (It's actually a real, though solved problem in my
environment, so modifying code to use it wouldn't be worth the effort
or potential sources of bugs at this point.) I was only pointing out
that there are valid reasons where such a function might be useful to
"non-math people," outside the realm of software testing.

Knowing when you need something like this is often only discovered
after mistakes are made though. Is a numerical analysis course still
commonly taught in Computer Science departments?

Skip


More information about the Python-ideas mailing list