On 23/06/2020 15:12, Ricky Teachey wrote:
On Tue, Jun 23, 2020 at 9:08 AM Mathew Elman <[email protected]> wrote:
Well there you go, good point.
I didn't really like it being an operator myself. But I can see having a
math.tolerance class being useful.
On Tue, 23 Jun 2020 at 13:53, Jonathan Goble <[email protected]> wrote:
On Tue, Jun 23, 2020 at 8:44 AM Mathew Elman <[email protected]>
wrote:
Perhaps a more versatile operator would be to introduce a +- operator
that would return an object with an __eq__ method that checks for equality
in the tolerance i.e
a == b +- 0.5
This is already valid syntax, because unary minus is a thing. So this is
currently parsed as "a == b + (-0.5)".
Reversing it to use -+ won't work because unary plus is also a thing.
A little bit out of the box, but what about:
a == b +/- 0.5
...or even:
a == b +or- 0.5
Is "math.isclose(a, b, abs_tol=0.5)" really so hard to use?
--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/JGOUZFELQYLIPGCOEVXNFSUUULQXQN6O/
Code of Conduct: http://python.org/psf/codeofconduct/