On Thursday, November 5, 2015 at 2:30:08 AM UTC-8, Simon King wrote:
 

> Certainly, if "A is B" then "A==B" will be True. Actually I am not sure 
> if A.__eq__ would be invoked at all if you compare to identical objects 
> (i.e., I don't know what Python does). 
>

This is famous in Python:

sage: NAN = float("NaN")
sage: NAN == NAN
False

Dictionary lookup shortcuts equality testing  on identical keys, leading to 
the surprising:

sage: D={NAN: 1}
sage: D[NAN]
1
sage: D[float("NaN")]
KeyError: nan
sage: { NAN, NAN, float("NaN")}
{nan, nan}

(i.e., even for a key that is not equal to itself, it is still possible to 
retrieve the value under that key using *exactly* that key)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to