On Tue, Jun 23, 2020 at 9:08 AM Mathew Elman <mathew.el...@ocado.com> 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 <jcgob...@gmail.com> wrote: > >> On Tue, Jun 23, 2020 at 8:44 AM Mathew Elman <mathew.el...@ocado.com> >> 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 --- Ricky. "I've never met a Kentucky man who wasn't either thinking about going home or actually going home." - Happy Chandler
_______________________________________________ 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/A3EBDO4SCNKVBC4RLM7ICWC4H6HKQ5SU/ Code of Conduct: http://python.org/psf/codeofconduct/