On Sun, Jun 14, 2020 at 02:39:49PM +0200, Sebastian M. Ernst wrote: > Hi all, > > after just having typed tons of `math.isclose` (see PEP 485 [1]) and > `numpy.isclose` calls (while basically using their default tolerances > most of the time), I was wondering whether it makes sense to add a > matching operator.
I wrote the statistics module in the stdlib, and the tests for that use a lot of approximate equality tests: https://github.com/python/cpython/blob/3.8/Lib/test/test_statistics.py which includes an approx_equal function that pre-dates the math.isclose and a unittest assertApproxEqual method. So I like to think I'm a heavy user of approximate comparisons. I wouldn't use an approximate operator. Not even if it were written with the unicode ≈ ALMOST EQUAL TO symbol :-) The problem is that the operator can only have a single pre-defined tolerance (or a pair of tolerances, absolute and relative), which would not be very useful in practice. So I would have to swap from the operator to a function call, and it is highly unlikely that the operator tolerances would be what I need the majority of the time. -- Steven _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/6AWLMPZCLZCUG6BUBV6JF5XHUQYQAYC5/ Code of Conduct: http://python.org/psf/codeofconduct/