
On Mon, Jan 26, 2015 at 10:35 PM, Chris Barker <chris.barker@noaa.gov> wrote:
On Mon, Jan 26, 2015 at 9:30 PM, Chris Angelico <rosuav@gmail.com> wrote:
I would suggest that, as PEP author, you guide the conversation a bit by asking specific questions that you want to answer in the PEP.
I thought I did that, actually, in that email -- I guess I wasn't very clear.
Here they are -- and please express not just your preference, but a clear statement about what would be acceptable or not acceptable.
A) Which test do we use: 1) The asymmetric test 2) The "strong" test (minimum relative tolerance) 3) The "weak" test (maximum relative tolerance)
The problem with this question is that, while it's easy to come up with examples where it may matter (e.g. 95 is within 5% of 100, but 100 is not within %5 of 95), in practice the tolerance is more likely to be 1e-8, in which case it doesn't matter.
B) Do we provide a non-zero default for the absolute tolerance? If so what should the value be? Remember that this serves primarily to provide a check against zero.
It feels like absolute tolerance is a completely different test. And it is a much simpler test for which w don't need a helper function -- it's just abs(x) < tolerance. When does a program need *both* absolute and relative tolerance in a single test?
I think that's it for the technical decisions.
I would also appreciate suggestions for paramater names --at least if we go with the asymetric test: "actual" and "expected" is a bit confusing -- I like "expected", but we need something better than "actual" for the don't-know-it's-right one.
I also would really appreciate someone working out the details and contributing text for the inclusion of this in unittest.TestCase -- unittest is really not my thing.
I've pushed some changes to gitHub (sorry, forgot to push yesterday), and once the dust settles I'll incorporate as many of the suggestions in the PEP text as I can.
I still think this is better off as a recipe than as a helper function. -- --Guido van Rossum (python.org/~guido)