[Python-ideas] checking for identity before comparing built-in objects

Mike Graham mikegraham at gmail.com
Mon Oct 8 02:43:35 CEST 2012


On Sun, Oct 7, 2012 at 8:35 PM, Alexander Belopolsky
<alexander.belopolsky at gmail.com> wrote:
> Java implements IEEE 754 to some extent, but preserves reflexivity of object equality.

I don't actually know Java, but if I run

class HelloNaN {
    public static void main(String[] args) {
        double nan1 = 0.0 / 0.0;
        double nan2 = 0.0 / 0.0;
        System.out.println(nan1 == nan2);
    }
}

I get the output "false".

Mike



More information about the Python-ideas mailing list