unittest: Proposal to add failUnlessNear

John Roth newsgroups at jhrothjr.com
Wed Jul 21 20:55:15 EDT 2004


"Tim Peters" <tim.peters at gmail.com> wrote in message
news:mailman.682.1090448229.5135.python-list at python.org...


> Nope.  abs(a - b) works for both cases, although for complex numbers
> Python uses a numerical method less prone to spurious
> overflow/underflow than the "square root of the sum of the squares"
> formula.

I didn't know that. It does make sense to do something like
that, but it seems a bit like deep magic to make abs
recognize that the operand is a subtraction.

John Roth
>





More information about the Python-list mailing list