Proposal: === and !=== operators

Johannes Bauer dfnsonfsduifb at gmx.de
Sat Jul 12 13:54:07 CEST 2014


On 09.07.2014 11:17, Steven D'Aprano wrote:

> People are already having problems, just listen to Anders. He's 
> (apparently) not doing NAN-aware computations on his data, he just wants 
> to be able to do something like
> 
> this_list_of_floats == that_list_of_floats

This is a horrible example.

There's no pretty way of saying this: Comparing floats using equals
operators has always and will always be an incredibly dumb idea. The
same applies obviously to containers containing floats.

I also agree with Chris that I think an additional operator will make
things worse than better. It'll add confusion with no tangible benefit.
The current operators might have the deficiency that they're not
relexive, but then again: Why should == be always reflexive while the
other operators aren't? Why should I be able to assume that

x == x -> True

but not

when x < x -> False

If you're arguing from a mathematical/logical standpoint then if you
want the former you'll also have to want the latter.

Cheers,
Johannes

-- 
>> Wo hattest Du das Beben nochmal GENAU vorhergesagt?
> Zumindest nicht öffentlich!
Ah, der neueste und bis heute genialste Streich unsere großen
Kosmologen: Die Geheim-Vorhersage.
 - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1 at speranza.aioe.org>



More information about the Python-list mailing list