[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Symmetric vs asymmetric symbols (was PEP 572: Do we really need a ":" in ":="?)

On Sat, Jul 07, 2018 at 01:03:06PM +1200, Greg Ewing wrote:
> Ivan Pozdeev via Python-Dev wrote:
> >(while "<>" reads "less or greater" which is mathematically not 
> >equivalent to that: not everything has a defined ordering relation.
> I think this is a silly argument against "<>".

While I agree with your conclusions, I'd just like to point out that 
given the existence of float NANs, there's a case to be made for having 
separate <> and != operators with != keeping the "not equal" meaning and 
the <> operator meaning literally "less than, or greater than".

py> NAN != 23
py> NAN < 23 or NAN > 23

(I'm not making the case for this, just pointing out that it exists...)

There would be precedent too: at least one of Apple's SANE maths 
libraries back in the 1990s had a full set of NAN-aware comparison 
operators including IIRC separate "not equal" and "less than or greater 
than" comparisons.

But I think this is a corner of IEEE-754 esoterica that probably doesn't 
need to be a builtin operator :-)


py> from __future__ import barry_as_FLUFL
py> 23 <> 42