Re: [Python-ideas] Approximately equal operator

2018-06-16 Thread Chris Angelico
On Sat, Jun 16, 2018 at 8:51 PM, Steven D'Aprano wrote: >> Python is *very* stingy with adding new operators; IIRC only 3 have >> been added over the last ~30 years (**, //, @). I don't think ~= is >> going to make it. > > Exponentiation ** goes back to Python 1.5, so I think that's only two >

Re: [Python-ideas] Approximately equal operator

2018-06-16 Thread Steven D'Aprano
On Fri, Jun 15, 2018 at 05:31:57PM -0700, Nathaniel Smith wrote: > On Fri, Jun 15, 2018 at 3:56 PM, Andre Roberge > wrote: > > * people doing heavy numerical work and wanting code as readable as possible > > IME serious numerical work doesn't use approximate equality tests at > all, except in

Re: [Python-ideas] Approximately equal operator

2018-06-15 Thread Nathaniel Smith
On Fri, Jun 15, 2018 at 3:56 PM, Andre Roberge wrote: > * people doing heavy numerical work and wanting code as readable as possible IME serious numerical work doesn't use approximate equality tests at all, except in test assertions. > * teaching mostly beginners about finite precision for

Re: [Python-ideas] Approximately equal operator

2018-06-15 Thread Richard Damon
On 6/15/18 1:38 PM, Andre Roberge wrote: > I have a suggestion to make inspired by the current discussion about > trigonometric functions in degrees, and the desire to have them show > "exact" values in some special cases. > > I suggest that it would be useful to have operators for performing >

Re: [Python-ideas] Approximately equal operator

2018-06-15 Thread Antoine Pitrou
On Fri, 15 Jun 2018 14:38:22 -0300 Andre Roberge wrote: > > Here's a sample session for demonstration purpose... > > $ python -m experimental > experimental console version 0.9.5. [Python version: 3.6.1] > > ~~> 0.1 + 0.2 > 0.30004 > ~~> 0.1 + 0.2 == 0.3 > False > ~~> from