
On Tue, Jan 27, 2015 at 1:18 PM, Chris Barker <chris.barker@noaa.gov> wrote:
On Tue, Jan 27, 2015 at 10:37 AM, Guido van Rossum <guido@python.org> wrote:
I think my reasoning comes down to the same rule I often use to decide
whether we need one function or two -- if in every use case you always know whether you need version A or version B, then it's better to have two functions rather than a single one with a flag to request A or B.
And isn't it the case that whenever you are comparing to zero, you *know* that you are comparing to zero, and you *must* specify an absolute tolerance (otherwise it's not a use case at all)?
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.
I assume you mean assertNotAlmostEqual <https://hg.python.org/cpython/file/94d8524086bd/Lib/unittest/case.py#l525>. 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. So what argument are you making here? -- --Guido van Rossum (python.org/~guido)