Hello, On Mon, 15 Jun 2020 00:30:19 +1000 Chris Angelico <[email protected]> wrote:
> On Sun, Jun 14, 2020 at 10:41 PM Sebastian M. Ernst > <[email protected]> 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. > > > > -1. I don't see that Python needs a different comparison operator, > with all the debates that will come through about "when should I use > == and when should I use the other". Especially since it'll almost > certainly refuel the argument that you should never compare floats for > equality. > > If you're doing a lot with isclose, you can always "from math import > isclose as cl" and use a shorter name. But please don't encourage > everyone to use isclose() in place of all comparisons. All that makes good sense. I'd encourage everyone who thinks "I need a very special operator just for me", instead think in terms "Python needs ability to define custom operators". Needless to say, that doesn't have anything to do with changes to a core implementation. Instead, you're looking to be able to define a custom parser/tokenizer/AST transformer for your source. And all that is possible already yesterday. Recent example: implementation of "from __future__ import braces": https://github.com/NeKitDS/braces.py . > > ChrisA [] -- Best regards, Paul mailto:[email protected] _______________________________________________ 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/NDT7TTQZH3NLQ7UTVCST3HBR6DPSPNSM/ Code of Conduct: http://python.org/psf/codeofconduct/
