Vedran Čačić <ved...@gmail.com> added the comment:

An important point nobody made, as far as I can see:

* the main usability improvement justifying math.isclose is that you don't know 
the order of magnitude of your correct value--it could be anything (even 
infinite), and the manner of comparison depends on it. That's why it uses a 
sensible rel_tol out of the box, but no abs_tol--obviously, since it doesn't 
want to give nonsense results for e.g. values close to zero.

* but when you write tests, you always know the exact value you should get, 
right? In almost all cases the second argument is a numeric literal. So the 
delta-approach is perfectly ok in that context, since you're in control of how 
much discrepancy you're going to tolerate, and in the moment that you're 
deciding on this, you have the exact value expected right in front of you.

----------
nosy: +veky

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue27198>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to